diff --git a/vm/arrays.hpp b/vm/arrays.hpp index 48be881230..6063269e7f 100755 --- a/vm/arrays.hpp +++ b/vm/arrays.hpp @@ -15,7 +15,6 @@ inline void factor_vm::set_array_nth(array *array, cell slot, cell value) #ifdef FACTOR_DEBUG assert(slot < array_capacity(array)); assert(array->h.hi_tag() == ARRAY_TYPE); - check_tagged_pointer(value); #endif cell *slot_ptr = &array->data()[slot]; *slot_ptr = value; diff --git a/vm/free_list_allocator.hpp b/vm/free_list_allocator.hpp index efdad508cb..8332399279 100644 --- a/vm/free_list_allocator.hpp +++ b/vm/free_list_allocator.hpp @@ -22,7 +22,7 @@ template struct free_list_allocator { Block *next_block_after(Block *block); void clear_free_list(); void add_to_free_list(free_heap_block *block); - void build_free_list(cell size); + void initial_free_list(cell size); void assert_free_block(free_heap_block *block); free_heap_block *find_free_block(cell size); free_heap_block *split_free_block(free_heap_block *block, cell size); @@ -40,7 +40,7 @@ template free_list_allocator::free_list_allocator(cell size_, cell start_) : size(size_), start(start_), end(start_ + size_), state(mark_bits(size_,start_)) { - clear_free_list(); + initial_free_list(0); } template void free_list_allocator::clear_free_list() @@ -85,7 +85,7 @@ template void free_list_allocator::add_to_free_list(free_ /* Called after reading the heap from the image file, and after heap compaction. Makes a free list consisting of one free block, at the very end. */ -template void free_list_allocator::build_free_list(cell size) +template void free_list_allocator::initial_free_list(cell size) { clear_free_list(); if(size != this->size) @@ -345,7 +345,7 @@ void free_list_allocator::compact(Iterator &iter) /* Now update the free list; there will be a single free block at the end */ - this->build_free_list((cell)compactor.address - this->start); + this->initial_free_list((cell)compactor.address - this->start); } template diff --git a/vm/gc.cpp b/vm/gc.cpp index 706831136b..6b3ec80481 100755 --- a/vm/gc.cpp +++ b/vm/gc.cpp @@ -60,12 +60,12 @@ void factor_vm::gc(gc_op op, current_gc->op = collect_growing_heap_op; break; default: - critical_error("Bad GC op\n",op); + critical_error("Bad GC op",current_gc->op); break; } if(verbosegc) - std::cout << "GC rewind, op=" << op << std::endl; + std::cout << "GC rewind, op=" << current_gc->op << std::endl; } switch(current_gc->op) @@ -91,20 +91,20 @@ void factor_vm::gc(gc_op op, record_gc_stats(&gc_stats.full_stats); break; default: - critical_error("Bad GC op\n",op); + critical_error("Bad GC op\n",current_gc->op); break; } + if(verbosegc) + std::cout << "GC done, op=" << current_gc->op << std::endl; + delete current_gc; current_gc = NULL; - - if(verbosegc) - std::cout << "GC done, op=" << op << std::endl; } void factor_vm::primitive_minor_gc() { - gc(collect_full_op, + gc(collect_nursery_op, 0, /* requested size */ true, /* trace contexts? */ false /* compact code heap? */); diff --git a/vm/image.cpp b/vm/image.cpp index 845ca6c1bc..f5879e7a32 100755 --- a/vm/image.cpp +++ b/vm/image.cpp @@ -36,7 +36,7 @@ void factor_vm::load_data_heap(FILE *file, image_header *h, vm_parameters *p) fatal_error("load_data_heap failed",0); } - data->tenured->build_free_list(h->data_size); + data->tenured->initial_free_list(h->data_size); } void factor_vm::load_code_heap(FILE *file, image_header *h, vm_parameters *p) @@ -57,7 +57,7 @@ void factor_vm::load_code_heap(FILE *file, image_header *h, vm_parameters *p) } } - code->allocator->build_free_list(h->code_size); + code->allocator->initial_free_list(h->code_size); } void factor_vm::data_fixup(cell *handle, cell data_relocation_base) diff --git a/vm/local_roots.hpp b/vm/local_roots.hpp index 6ae059f4c4..58142be8f2 100644 --- a/vm/local_roots.hpp +++ b/vm/local_roots.hpp @@ -6,7 +6,7 @@ struct gc_root : public tagged { factor_vm *parent; - void push() { parent->check_tagged_pointer(tagged::value()); parent->gc_locals.push_back((cell)this); } + void push() { parent->gc_locals.push_back((cell)this); } explicit gc_root(cell value_,factor_vm *vm) : tagged(value_),parent(vm) { push(); } explicit gc_root(Type *value_, factor_vm *vm) : tagged(value_),parent(vm) { push(); } diff --git a/vm/mark_bits.hpp b/vm/mark_bits.hpp index 161a7fd755..279c04a23a 100644 --- a/vm/mark_bits.hpp +++ b/vm/mark_bits.hpp @@ -81,12 +81,21 @@ template struct mark_bits { bits[start.first] |= start_mask ^ end_mask; else { +#ifdef FACTOR_DEBUG + assert(start.first < bits_size); +#endif bits[start.first] |= ~start_mask; for(cell index = start.first + 1; index < end.first; index++) bits[index] = (u64)-1; - bits[end.first] |= end_mask; + if(end_mask != 0) + { +#ifdef FACTOR_DEBUG + assert(end.first < bits_size); +#endif + bits[end.first] |= end_mask; + } } } diff --git a/vm/vm.hpp b/vm/vm.hpp index 86ed092ff7..40dcb4f3bc 100755 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -280,18 +280,6 @@ struct factor_vm #endif } - inline void check_tagged_pointer(cell tagged) - { - #ifdef FACTOR_DEBUG - if(!immediate_p(tagged)) - { - object *obj = untag(tagged); - check_data_pointer(obj); - obj->h.hi_tag(); - } - #endif - } - // generic arrays template Array *allot_uninitialized_array(cell capacity); template bool reallot_array_in_place_p(Array *array, cell capacity);