#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;
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);
free_list_allocator<Block>::free_list_allocator(cell size_, cell start_) :
size(size_), start(start_), end(start_ + size_), state(mark_bits<Block>(size_,start_))
{
- clear_free_list();
+ initial_free_list(0);
}
template<typename Block> void free_list_allocator<Block>::clear_free_list()
/* 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<typename Block> void free_list_allocator<Block>::build_free_list(cell size)
+template<typename Block> void free_list_allocator<Block>::initial_free_list(cell size)
{
clear_free_list();
if(size != this->size)
/* 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<typename Block>
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)
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? */);
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)
}
}
- 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)
{
factor_vm *parent;
- void push() { parent->check_tagged_pointer(tagged<Type>::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<Type>(value_),parent(vm) { push(); }
explicit gc_root(Type *value_, factor_vm *vm) : tagged<Type>(value_),parent(vm) { push(); }
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;
+ }
}
}
#endif
}
- inline void check_tagged_pointer(cell tagged)
- {
- #ifdef FACTOR_DEBUG
- if(!immediate_p(tagged))
- {
- object *obj = untag<object>(tagged);
- check_data_pointer(obj);
- obj->h.hi_tag();
- }
- #endif
- }
-
// generic arrays
template<typename Array> Array *allot_uninitialized_array(cell capacity);
template<typename Array> bool reallot_array_in_place_p(Array *array, cell capacity);