mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 00:07:36 +02:00
Initialize mark stack
This commit is contained in:
parent
f27e4874f2
commit
d50ae96505
1 changed files with 6 additions and 2 deletions
8
gc.c
8
gc.c
|
@ -27,7 +27,7 @@ static int gc_stage = STAGE_CLEAR_OR_MARKING;
|
|||
|
||||
// Does not need sync, only used by collector thread
|
||||
static void **mark_stack = NULL;
|
||||
static int mark_stack_len = 128;
|
||||
static int mark_stack_len = 0;
|
||||
static int mark_stack_i = 0;
|
||||
|
||||
// Lock to protect the heap from concurrent modifications
|
||||
|
@ -41,7 +41,7 @@ static int Cyc_num_mutators;
|
|||
// Functions
|
||||
|
||||
// Perform one-time initialization before mutators can be executed
|
||||
void gc_init_mutators()
|
||||
void gc_initialize()
|
||||
{
|
||||
// TODO: alloca this using a vpbuffer, or maybe another type of data structure??
|
||||
// Will need this list for later use, but only by the collector thread. so it would be
|
||||
|
@ -50,6 +50,10 @@ void gc_init_mutators()
|
|||
Cyc_num_mutators = 1;
|
||||
Cyc_mutators = calloc(Cyc_num_mutators, sizeof(gc_thread_data *));
|
||||
|
||||
// Initialize collector's mark stack
|
||||
mark_stack_len = 128;
|
||||
mark_stack = vpbuffer_realloc(mark_stack, &(mark_stack_len));
|
||||
|
||||
// Here is as good a place as any to do this...
|
||||
if (pthread_mutex_init(&(heap_lock), NULL) != 0) {
|
||||
fprintf(stderr, "Unable to initialize heap_lock mutex\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue