futures: fix some CGC problems

.. even though futures don't work well with CGC, due to
the lack of future-local allocation.
This commit is contained in:
Matthew Flatt 2012-06-19 12:09:37 +08:00
parent 61be7a9a40
commit f91dc81bf5
2 changed files with 10 additions and 1 deletions

View File

@ -1240,6 +1240,7 @@ Scheme_Object *scheme_future(int argc, Scheme_Object *argv[])
return do_make_future(argc, argv);
else {
Scheme_Object *proc = argv[0];
#ifdef MZ_PRECISE_GC
if (SAME_TYPE(SCHEME_TYPE(proc), scheme_native_closure_type)
&& scheme_native_arity_check(proc, 0)
&& (((Scheme_Native_Closure *)proc)->code->start_code != scheme_on_demand_jit_code)
@ -1272,6 +1273,10 @@ Scheme_Object *scheme_future(int argc, Scheme_Object *argv[])
} else {
return scheme_rtcall_make_future(proc);
}
#else
/* future-local allocation is not supported */
return scheme_rtcall_make_future(proc);
#endif
}
}

View File

@ -155,8 +155,12 @@ static Scheme_Object *ts__scheme_tail_apply_from_native(Scheme_Object *rator, in
{
if (scheme_use_rtcall) {
/* try thread-local allocation: */
Scheme_Object **a;
Scheme_Object **a;
#ifdef MZ_PRECISE_GC
a = MALLOC_N(Scheme_Object *, argc);
#else
a = NULL; /* future-local allocation is not supported */
#endif
if (a) {
Scheme_Thread *p = scheme_current_thread;
memcpy(a, argv, argc * sizeof(Scheme_Object*));