diff --git a/ffi.c b/ffi.c index fa356331..7ae707dd 100644 --- a/ffi.c +++ b/ffi.c @@ -20,8 +20,10 @@ void *Cyc_init_thread(object thread_and_thunk, int argc, object *args); * for the call and perform a minor GC to ensure any returned object * is on the heap and safe to use. */ -static void Cyc_return_from_scm_call(gc_thread_data *thd, int argc, object k, object result) +static void Cyc_return_from_scm_call(void *data, object _, int argc, object *args) { + gc_thread_data *thd = data; + object result = args[0]; // Cleaup thread object per Cyc_exit_thread gc_remove_mutator(thd); ck_pr_cas_int((int *)&(thd->thread_state), CYC_THREAD_STATE_RUNNABLE, @@ -39,8 +41,10 @@ static void Cyc_return_from_scm_call(gc_thread_data *thd, int argc, object k, ob * We store results and longjmp back to where we started, at the * bottom of the trampoline (we only jump once). */ -static void Cyc_after_scm_call(gc_thread_data *thd, int argc, object k, object result) +static void Cyc_after_scm_call(void *data, object _, int argc, object *args) { + gc_thread_data *thd = data; + object result = args[0]; mclosure0(clo, Cyc_return_from_scm_call); object buf[1]; buf[0] = result; GC(thd, &clo, buf, 1); diff --git a/mstreams.c b/mstreams.c index 13474195..16b5d7d1 100644 --- a/mstreams.c +++ b/mstreams.c @@ -13,20 +13,21 @@ #include /* These macros are hardcoded here to support functions in this module. */ -#define closcall1(td, clo, a1) \ +#define closcall1(td, clo, buf) \ if (obj_is_not_closure(clo)) { \ - Cyc_apply(td, 0, (closure)(a1), clo); \ + Cyc_apply(td, clo, 1, buf ); \ } else { \ - ((clo)->fn)(td, 1, clo, a1);\ + ((clo)->fn)(td, clo, 1, buf); \ +;\ } -#define return_closcall1(td, clo, a1) { \ +#define return_closcall1(td, clo,a1) { \ char top; \ + object buf[1]; buf[0] = a1;\ if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \ - object buf[1]; buf[0] = a1;\ GC(td, clo, buf, 1); \ return; \ } else {\ - closcall1(td, (closure) (clo), a1); \ + closcall1(td, (closure) (clo), buf); \ return;\ } \ }