diff --git a/library/compiler/ppc/alien.factor b/library/compiler/ppc/alien.factor index e675d6a048..0de33c722a 100644 --- a/library/compiler/ppc/alien.factor +++ b/library/compiler/ppc/alien.factor @@ -22,6 +22,8 @@ M: float-regs stack>freg >r 1 rot stack@ r> LF ; M: stack-params stack>freg drop >r 0 1 rot stack@ LWZ 0 1 r> stack@ STW ; +M: stack-params freg>stack swapd stack>freg ; + M: %unbox generate-node ( vop -- ) drop ! Call the unboxer diff --git a/library/test/compiler/callbacks.factor b/library/test/compiler/callbacks.factor index a94399a84e..018af6e24f 100644 --- a/library/test/compiler/callbacks.factor +++ b/library/test/compiler/callbacks.factor @@ -70,11 +70,24 @@ compiled "void" { "int" "double" "int" } [ + * "x" set ] alien-callback ; compiled -FUNCTION: void callback_test_3 void* callback int x double y int z ; -compiled +FUNCTION: void callback_test_3 void* callback int x double y int z ; compiled [ 27.0 ] [ [ "x" off callback-9 3 4 5 callback_test_3 "x" get ] with-scope ] unit-test + +: callback-10 + "void" + { "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" } + [ datastack "stack" set ] alien-callback ; compiled + +FUNCTION: void callback_test_4 void* callback int a1 int a2 int a3 int a4 int a5 int a6 int a7 int a8 int a9 int a10 ; compiled + +[ V{ 1 2 3 4 5 6 7 8 9 10 } ] [ + [ + callback-10 1 2 3 4 5 6 7 8 9 10 callback_test_4 + "stack" get + ] with-scope +] unit-test diff --git a/native/ffi_test.c b/native/ffi_test.c index ab0c92abc9..613cd93da6 100644 --- a/native/ffi_test.c +++ b/native/ffi_test.c @@ -110,3 +110,12 @@ void callback_test_3(void (*callback)(int x, double y, int z), printf("callback_test_3 leaving\n"); fflush(stdout); } + +void callback_test_4(void (*callback)(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10), int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10) +{ + printf("callback_test_4 entry\n"); + fflush(stdout); + callback(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); + printf("callback_test_4 leaving\n"); + fflush(stdout); +} diff --git a/native/run.c b/native/run.c index ab170c8759..df701b8b6b 100644 --- a/native/run.c +++ b/native/run.c @@ -88,7 +88,7 @@ void run_nullary_callback(CELL quot) } /* Called by compiled callbacks after nest_stacks() and boxing registers */ -CELL run_unary_callback(CELL quot) +void run_unary_callback(CELL quot) { CELL retval; @@ -96,7 +96,7 @@ CELL run_unary_callback(CELL quot) run(false); retval = dpeek(); unnest_stacks(); - return retval; + dpush(retval); } /* XT of deferred words */