Skip to content

Commit

Permalink
runtime: replace null fillers with free_word
Browse files Browse the repository at this point in the history
  • Loading branch information
dinfuehr committed Dec 28, 2023
1 parent 1a23346 commit 00c1593
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dora-runtime/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ pub fn fill_region_with(vm: &VM, start: Address, end: Address, clear: bool) {
// nothing to do
} else if end.offset_from(start) == mem::ptr_width_usize() {
unsafe {
*start.to_mut_ptr::<usize>() = 0;
*start.to_mut_ptr::<usize>() = vm.known.free_word_class_address().to_usize();
}
} else if end.offset_from(start) == Header::size() as usize {
// fill with object
Expand Down
7 changes: 1 addition & 6 deletions dora-runtime/src/gc/swiper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,7 @@ where
let object = scan.to_obj();

if object.is_filler(vm) {
let size = if object.header().raw_vtblptr().is_null() {
mem::ptr_width_usize()
} else {
object.size()
};
scan = scan.offset(size);
scan = scan.offset(object.size());
} else {
let object_size = object.size();
fct(object, scan, object_size);
Expand Down
9 changes: 1 addition & 8 deletions dora-runtime/src/gc/swiper/minor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::gc::{
fill_region, fill_region_with, iterate_weak_roots, Address, GcReason, GenerationAllocator,
Region,
};
use crate::mem;
use crate::object::{ForwardResult, Obj, VtblptrWordKind};
use crate::threads::DoraThread;
use crate::timer::Timer;
Expand Down Expand Up @@ -613,13 +612,7 @@ impl<'a> CopyTask<'a> {
let object = ptr.to_obj();

if object.is_filler(self.vm) {
let size = if object.header().raw_vtblptr().is_null() {
mem::ptr_width_usize()
} else {
object.size()
};

ptr = ptr.offset(size);
ptr = ptr.offset(object.size());
} else {
object.visit_reference_fields(|field| {
let field_ptr = field.get();
Expand Down
7 changes: 1 addition & 6 deletions dora-runtime/src/gc/swiper/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,11 @@ impl<'a> Verifier<'a> {

while curr < region.end {
let object = curr.to_obj();
let vtblptr = object.header().raw_vtblptr();

if object.is_filler(self.vm) {
assert!(!self.in_large, "large object space should not have fillers");

let size = if vtblptr.is_null() {
mem::ptr_width_usize()
} else {
object.size()
};
let size = object.size();
let object_end = curr.offset(size);

if self.in_old && on_different_cards(curr, object_end) {
Expand Down
3 changes: 1 addition & 2 deletions dora-runtime/src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,7 @@ impl Obj {
pub fn is_filler(&self, vm: &VM) -> bool {
let vtblptr = self.header().raw_vtblptr();

vtblptr.is_null()
|| vtblptr == vm.known.free_word_class_address()
vtblptr == vm.known.free_word_class_address()
|| vtblptr == vm.known.free_array_class_address()
|| vtblptr == vm.known.free_object_class_address()
}
Expand Down

0 comments on commit 00c1593

Please sign in to comment.