]> gitweb.factorcode.org Git - factor.git/commitdiff
vm: separate 'current_gc_p' from 'current_gc'
authorJoe Groff <arcata@gmail.com>
Wed, 2 Nov 2011 04:01:40 +0000 (21:01 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 2 Nov 2011 20:23:19 +0000 (13:23 -0700)
The 'current_gc' handle doesn't need to be volatile, just the state of GC-ness

vm/gc.cpp
vm/vm.cpp
vm/vm.hpp

index b1cdaa52afec837120c49531d902ba2b1d44797c..5ea23dce3bb96dd647e652c4bb8a18b4e1aaae32 100755 (executable)
--- a/vm/gc.cpp
+++ b/vm/gc.cpp
@@ -155,6 +155,7 @@ void factor_vm::gc(gc_op op, cell requested_size, bool trace_contexts_p)
        assert(!data->high_fragmentation_p());
 
        current_gc = new gc_state(op,this);
+       atomic::store(&current_gc_p, true);
 
        /* Keep trying to GC higher and higher generations until we don't run
        out of space in the target generation. */
@@ -217,6 +218,7 @@ void factor_vm::gc(gc_op op, cell requested_size, bool trace_contexts_p)
 
        end_gc();
 
+       atomic::store(&current_gc_p, false);
        delete current_gc;
        current_gc = NULL;
 
index d7cdf99e85f8edf1dcedb94cb67c3324170cafee..ecc3359e0cebe23193ea5ae7f6ebd642c9bac11d 100755 (executable)
--- a/vm/vm.cpp
+++ b/vm/vm.cpp
@@ -12,6 +12,8 @@ factor_vm::factor_vm() :
        safepoint_fep_p(false),
        gc_off(false),
        current_gc(NULL),
+       current_gc_p(false),
+       current_jit_p(false),
        gc_events(NULL),
        fep_p(false),
        fep_help_was_shown(false),
index b58cdcb99a42e467249765bb2f63b9c267610f75..b62ac3f9c969dff850c221de0121ea8572ca09b1 100755 (executable)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -91,7 +91,11 @@ struct factor_vm
        callback_heap *callbacks;
 
        /* Only set if we're performing a GC */
-       volatile gc_state *current_gc;
+       gc_state *current_gc;
+       volatile cell current_gc_p;
+
+       /* Set if we're in the jit */
+       volatile cell current_jit_p;
 
        /* Mark stack */
        std::vector<cell> mark_stack;