mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 03:36:34 +02:00
Convert function calls
This commit is contained in:
parent
93310be845
commit
fd35f2e53e
2 changed files with 13 additions and 8 deletions
8
ffi.c
8
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);
|
||||
|
|
11
mstreams.c
11
mstreams.c
|
@ -13,20 +13,21 @@
|
|||
#include <errno.h>
|
||||
|
||||
/* 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) { \
|
||||
char top; \
|
||||
if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
|
||||
object buf[1]; buf[0] = a1;\
|
||||
if (stack_overflow(&top, (((gc_thread_data *)data)->stack_limit))) { \
|
||||
GC(td, clo, buf, 1); \
|
||||
return; \
|
||||
} else {\
|
||||
closcall1(td, (closure) (clo), a1); \
|
||||
closcall1(td, (closure) (clo), buf); \
|
||||
return;\
|
||||
} \
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue