mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Use minor GC code to move GC coop result to heap
This allows the code to move any object to the heap, instead of the previous hack. There may be more overhead calling the full minor GC code, however, most objects should already have been moved and by definition this would only happen after a function has blocked for a length of time. So, both should minimize the additional overhead.
This commit is contained in:
parent
a2ba71f965
commit
72eda149c5
1 changed files with 3 additions and 17 deletions
20
gc.c
20
gc.c
|
@ -1270,27 +1270,13 @@ void gc_mutator_thread_runnable(gc_thread_data *thd, object result)
|
|||
while(!ck_pr_cas_int((int *)&(thd->thread_state),
|
||||
CYC_THREAD_STATE_BLOCKED_COOPERATING,
|
||||
CYC_THREAD_STATE_RUNNABLE)){}
|
||||
// transport result to heap, if necessary
|
||||
if (is_object_type(result)) {
|
||||
switch(type_of(result)) {
|
||||
case eof_tag:
|
||||
case primitive_tag:
|
||||
case symbol_tag:
|
||||
case boolean_tag:
|
||||
// these are not heap allocated
|
||||
break;
|
||||
default:
|
||||
// TODO: need to move object to heap
|
||||
// TODO: also, then need to gc_mark_gray heap obj
|
||||
fprintf(stderr, "Unhandled object type result, TODO: implement\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
// Setup value to send to continuation
|
||||
thd->gc_args[0] = result;
|
||||
thd->gc_num_args = 1;
|
||||
// Whoa.
|
||||
// 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);
|
||||
//printf("DEBUG - Call into gc_cont after collector coop\n");
|
||||
// Whoa.
|
||||
longjmp(*(thd->jmp_start), 1);
|
||||
} else {
|
||||
// Collector didn't do anything; make a normal continuation call
|
||||
|
|
Loading…
Add table
Reference in a new issue