]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: fix high_fragmentation_p assertion
authorSlava Pestov <slava@factorcode.org>
Tue, 6 Sep 2011 06:30:13 +0000 (23:30 -0700)
committerSlava Pestov <slava@factorcode.org>
Tue, 6 Sep 2011 06:30:28 +0000 (23:30 -0700)
vm/compaction.cpp
vm/gc.cpp
vm/vm.hpp

index b7d9b611a326b9197e42aaa57cf2c3ec3bac6b41..3d1ed89a4777f3129ac49bb17c3044a17d3072aa 100644 (file)
@@ -341,11 +341,11 @@ void factor_vm::collect_compact(bool trace_contexts_p)
        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. */
        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_compact_code_impl(trace_contexts_p);
        code->flush_icache();
index ba4753d4006846bda0aed7a03e4e936a20cab7eb..b1cdaa52afec837120c49531d902ba2b1d44797c 100755 (executable)
--- a/vm/gc.cpp
+++ b/vm/gc.cpp
@@ -143,7 +143,7 @@ void factor_vm::set_current_gc_op(gc_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(!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);
                                break;
                        case collect_growing_heap_op:
-                               collect_growing_heap(requested_bytes,trace_contexts_p);
+                               collect_growing_heap(requested_size,trace_contexts_p);
                                break;
                        default:
                                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)
 {
        /* 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();
 
                /* 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,
                                size, /* requested size */
index 9539ba04e16bd63104c857f7aae9bb5de76c6feb..28e9c8c1aae5d473c04031d01a20cbe5870ecb82 100755 (executable)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -314,8 +314,8 @@ struct factor_vm
        void collect_compact_impl(bool trace_contexts_p);
        void collect_compact_code_impl(bool trace_contexts_p);
        void collect_compact(bool trace_contexts_p);
-       void collect_growing_heap(cell requested_bytes, bool trace_contexts_p);
-       void gc(gc_op op, 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_size, bool trace_contexts_p);
        void scrub_context(context *ctx);
        void scrub_contexts();
        void primitive_minor_gc();