From f91dc81bf59946e4e6491b68788d863d2389467e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 19 Jun 2012 12:09:37 +0800 Subject: [PATCH] futures: fix some CGC problems .. even though futures don't work well with CGC, due to the lack of future-local allocation. --- src/racket/src/future.c | 5 +++++ src/racket/src/jitcall.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/racket/src/future.c b/src/racket/src/future.c index fc5179d3be..b5254ebec3 100644 --- a/src/racket/src/future.c +++ b/src/racket/src/future.c @@ -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 } } diff --git a/src/racket/src/jitcall.c b/src/racket/src/jitcall.c index aabb02c9a5..581eaf3756 100644 --- a/src/racket/src/jitcall.c +++ b/src/racket/src/jitcall.c @@ -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*));