mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 04:25:06 +02:00
Bug fixes, comments
This commit is contained in:
parent
2992eb02b7
commit
4d2b59966c
2 changed files with 13 additions and 2 deletions
13
gc.c
13
gc.c
|
@ -1242,6 +1242,10 @@ void gc_thread_data_free(gc_thread_data *thd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called explicitly from a mutator thread to let the collector know
|
||||||
|
* it (may) block for an unknown period of time.
|
||||||
|
*/
|
||||||
void gc_mutator_thread_blocked(gc_thread_data *thd, object cont)
|
void gc_mutator_thread_blocked(gc_thread_data *thd, object cont)
|
||||||
{
|
{
|
||||||
if(!ck_pr_cas_int((int *)&(thd->thread_state),
|
if(!ck_pr_cas_int((int *)&(thd->thread_state),
|
||||||
|
@ -1254,8 +1258,15 @@ void gc_mutator_thread_blocked(gc_thread_data *thd, object cont)
|
||||||
thd->gc_num_args = 0; // Will be set later, after collection
|
thd->gc_num_args = 0; // Will be set later, after collection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called explicitly from a mutator thread to let the collector know
|
||||||
|
* that it has finished blocking. In addition, if the collector
|
||||||
|
* cooperated on behalf of the mutator while it was blocking, the mutator
|
||||||
|
* will move any remaining stack objects to the heap and longjmp.
|
||||||
|
*/
|
||||||
void gc_mutator_thread_runnable(gc_thread_data *thd, object result)
|
void gc_mutator_thread_runnable(gc_thread_data *thd, object result)
|
||||||
{
|
{
|
||||||
|
char stack_limit;
|
||||||
// Transition from blocked back to runnable using CAS.
|
// Transition from blocked back to runnable using CAS.
|
||||||
// If we are unable to transition back, assume collector
|
// If we are unable to transition back, assume collector
|
||||||
// has cooperated on behalf of this mutator thread.
|
// has cooperated on behalf of this mutator thread.
|
||||||
|
@ -1274,7 +1285,7 @@ void gc_mutator_thread_runnable(gc_thread_data *thd, object result)
|
||||||
thd->gc_args[0] = result;
|
thd->gc_args[0] = result;
|
||||||
thd->gc_num_args = 1;
|
thd->gc_num_args = 1;
|
||||||
// Move any remaining stack objects (should only be the result?) to heap
|
// Move any remaining stack objects (should only be the result?) to heap
|
||||||
gc_minor(thd, thd->stack_limit, thd->stack_start, thd->gc_cont, thd->gc_args, thd->gc_num_args);
|
gc_minor(thd, &stack_limit, thd->stack_start, thd->gc_cont, thd->gc_args, thd->gc_num_args);
|
||||||
//printf("DEBUG - Call into gc_cont after collector coop\n");
|
//printf("DEBUG - Call into gc_cont after collector coop\n");
|
||||||
// Whoa.
|
// Whoa.
|
||||||
longjmp(*(thd->jmp_start), 1);
|
longjmp(*(thd->jmp_start), 1);
|
||||||
|
|
|
@ -2337,7 +2337,7 @@ char *gc_move(char *obj, gc_thread_data *thd, int *alloci, int *heap_grown) {
|
||||||
|
|
||||||
object Cyc_trigger_minor_gc(void *data, object cont) {
|
object Cyc_trigger_minor_gc(void *data, object cont) {
|
||||||
gc_thread_data* thd = (gc_thread_data *)data;
|
gc_thread_data* thd = (gc_thread_data *)data;
|
||||||
thd->gc_args = boolean_t;
|
thd->gc_args[0] = boolean_t;
|
||||||
GC(data, cont, thd->gc_args, 1);
|
GC(data, cont, thd->gc_args, 1);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue