vm: fix high_fragmentation_p assertion

db4
Slava Pestov 2011-09-05 23:30:13 -07:00
parent 0c0906c2d8
commit 0f5e0eada5
3 changed files with 9 additions and 8 deletions

View File

@ -341,11 +341,11 @@ void factor_vm::collect_compact(bool trace_contexts_p)
code->flush_icache(); code->flush_icache();
} }
void factor_vm::collect_growing_heap(cell requested_bytes, bool trace_contexts_p) void factor_vm::collect_growing_heap(cell requested_size, bool trace_contexts_p)
{ {
/* Grow the data heap and copy all live objects to the new heap. */ /* Grow the data heap and copy all live objects to the new heap. */
data_heap *old = data; data_heap *old = data;
set_data_heap(data->grow(requested_bytes)); set_data_heap(data->grow(requested_size));
collect_mark_impl(trace_contexts_p); collect_mark_impl(trace_contexts_p);
collect_compact_code_impl(trace_contexts_p); collect_compact_code_impl(trace_contexts_p);
code->flush_icache(); code->flush_icache();

View File

@ -143,7 +143,7 @@ void factor_vm::set_current_gc_op(gc_op op)
if(gc_events) current_gc->event->op = op; if(gc_events) current_gc->event->op = op;
} }
void factor_vm::gc(gc_op op, cell requested_bytes, bool trace_contexts_p) void factor_vm::gc(gc_op op, cell requested_size, bool trace_contexts_p)
{ {
assert(!gc_off); assert(!gc_off);
assert(!current_gc); assert(!current_gc);
@ -198,7 +198,7 @@ void factor_vm::gc(gc_op op, cell requested_bytes, bool trace_contexts_p)
collect_compact(trace_contexts_p); collect_compact(trace_contexts_p);
break; break;
case collect_growing_heap_op: case collect_growing_heap_op:
collect_growing_heap(requested_bytes,trace_contexts_p); collect_growing_heap(requested_size,trace_contexts_p);
break; break;
default: default:
critical_error("Bad GC op",current_gc->op); critical_error("Bad GC op",current_gc->op);
@ -298,12 +298,13 @@ void factor_vm::primitive_compact_gc()
object *factor_vm::allot_large_object(cell type, cell size) object *factor_vm::allot_large_object(cell type, cell size)
{ {
/* If tenured space does not have enough room, collect and compact */ /* If tenured space does not have enough room, collect and compact */
if(!data->tenured->can_allot_p(size + data->high_water_mark())) cell requested_size = size + data->high_water_mark();
if(!data->tenured->can_allot_p(requested_size))
{ {
primitive_compact_gc(); primitive_compact_gc();
/* If it still won't fit, grow the heap */ /* If it still won't fit, grow the heap */
if(!data->tenured->can_allot_p(size)) if(!data->tenured->can_allot_p(requested_size))
{ {
gc(collect_growing_heap_op, gc(collect_growing_heap_op,
size, /* requested size */ size, /* requested size */

View File

@ -314,8 +314,8 @@ struct factor_vm
void collect_compact_impl(bool trace_contexts_p); void collect_compact_impl(bool trace_contexts_p);
void collect_compact_code_impl(bool trace_contexts_p); void collect_compact_code_impl(bool trace_contexts_p);
void collect_compact(bool trace_contexts_p); void collect_compact(bool trace_contexts_p);
void collect_growing_heap(cell requested_bytes, bool trace_contexts_p); void collect_growing_heap(cell requested_size, bool trace_contexts_p);
void gc(gc_op op, cell requested_bytes, bool trace_contexts_p); void gc(gc_op op, cell requested_size, bool trace_contexts_p);
void scrub_context(context *ctx); void scrub_context(context *ctx);
void scrub_contexts(); void scrub_contexts();
void primitive_minor_gc(); void primitive_minor_gc();