mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-25 13:05:05 +02:00
Handle block/runnable with a primitive as the cont
This commit is contained in:
parent
51748fb957
commit
22814ffc52
1 changed files with 9 additions and 1 deletions
8
gc.c
8
gc.c
|
@ -1303,6 +1303,8 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Cyc_apply_from_buf(void *data, int argc, object prim, object *buf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called explicitly from a mutator thread to let the collector know
|
* Called explicitly from a mutator thread to let the collector know
|
||||||
* that it has finished blocking. In addition, if the collector
|
* that it has finished blocking. In addition, if the collector
|
||||||
|
@ -1336,9 +1338,15 @@ void gc_mutator_thread_runnable(gc_thread_data *thd, object result)
|
||||||
longjmp(*(thd->jmp_start), 1);
|
longjmp(*(thd->jmp_start), 1);
|
||||||
} else {
|
} else {
|
||||||
// Collector didn't do anything; make a normal continuation call
|
// Collector didn't do anything; make a normal continuation call
|
||||||
|
if (type_of(thd->gc_cont) == cons_tag || prim(thd->gc_cont)) {
|
||||||
|
object buf[1];
|
||||||
|
buf[0] = result;
|
||||||
|
Cyc_apply_from_buf(thd, 1, thd->gc_cont, buf);
|
||||||
|
} else {
|
||||||
(((closure)(thd->gc_cont))->fn)(thd, 1, thd->gc_cont, result);
|
(((closure)(thd->gc_cont))->fn)(thd, 1, thd->gc_cont, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//// Unit testing:
|
//// Unit testing:
|
||||||
//int main(int argc, char **argv) {
|
//int main(int argc, char **argv) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue