Added (presently failing) test for spilled arg callback

darcs
slava 2006-02-14 22:27:28 +00:00
parent b3a3124566
commit 827df2d5d2
4 changed files with 28 additions and 4 deletions

View File

@ -22,6 +22,8 @@ M: float-regs stack>freg >r 1 rot stack@ r> LF ;
M: stack-params stack>freg M: stack-params stack>freg
drop >r 0 1 rot stack@ LWZ 0 1 r> stack@ STW ; 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 -- ) M: %unbox generate-node ( vop -- )
drop drop
! Call the unboxer ! Call the unboxer

View File

@ -70,11 +70,24 @@ compiled
"void" { "int" "double" "int" } "void" { "int" "double" "int" }
[ + * "x" set ] alien-callback ; compiled [ + * "x" set ] alien-callback ; compiled
FUNCTION: void callback_test_3 void* callback int x double y int z ; FUNCTION: void callback_test_3 void* callback int x double y int z ; compiled
compiled
[ 27.0 ] [ [ 27.0 ] [
[ [
"x" off callback-9 3 4 5 callback_test_3 "x" get "x" off callback-9 3 4 5 callback_test_3 "x" get
] with-scope ] with-scope
] unit-test ] 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

View File

@ -110,3 +110,12 @@ void callback_test_3(void (*callback)(int x, double y, int z),
printf("callback_test_3 leaving\n"); printf("callback_test_3 leaving\n");
fflush(stdout); 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);
}

View File

@ -88,7 +88,7 @@ void run_nullary_callback(CELL quot)
} }
/* Called by compiled callbacks after nest_stacks() and boxing registers */ /* Called by compiled callbacks after nest_stacks() and boxing registers */
CELL run_unary_callback(CELL quot) void run_unary_callback(CELL quot)
{ {
CELL retval; CELL retval;
@ -96,7 +96,7 @@ CELL run_unary_callback(CELL quot)
run(false); run(false);
retval = dpeek(); retval = dpeek();
unnest_stacks(); unnest_stacks();
return retval; dpush(retval);
} }
/* XT of deferred words */ /* XT of deferred words */