vm: separate 'current_gc_p' from 'current_gc'

The 'current_gc' handle doesn't need to be volatile, just the state of GC-ness
db4
Joe Groff 2011-11-01 21:01:40 -07:00
parent 4d39e59054
commit 73845fdad9
3 changed files with 9 additions and 1 deletions

View File

@ -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;

View File

@ -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),

View File

@ -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;