mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-04 03:00:20 +02:00
* include/lightning.h, lib/jit_arm.c, lib/jit_mips.c, lib/jit_ppc.c, lib/jit_x86.c, lib/lightning.c: Change jit_prepare to no longer receive an argument. If receiving an argument, it should be an ABI specifier, not a boolean if varargs or not, and add the new jit_ellipsis call, to specify where the ellipsis is in the C prototype of the function being called. Note that currently it is not supported to define varargs functions and it will be ignored if calling jit_ellipsis not in a prepare/finish* block, but this should be addressed. * check/allocai.tst, check/alu_add.tst, check/alu_and.tst, check/alu_com.tst, check/alu_div.tst, check/alu_lsh.tst, check/alu_mul.tst, check/alu_neg.tst, check/alu_or.tst, check/alu_rem.tst, check/alu_rsh.tst, check/alu_sub.tst, check/alu_xor.tst, check/alux_add.tst, check/alux_sub.tst, check/bp.tst, check/branch.tst, check/cvt.tst, check/divi.tst, check/fib.tst, check/ldsti.tst, check/ldstr-c.tst, check/ldstr.tst, check/ldstxi-c.tst, check/ldstxi.tst, check/ldstxr-c.tst, check/ldstxr.tst, check/rpn.tst, check/lightning.c: Update for the change to jit_prepare and addition of jit_ellipsis.
96 lines
1.4 KiB
Scilab
96 lines
1.4 KiB
Scilab
.data 128
|
|
idfmt:
|
|
.c "received %d\n"
|
|
failure_message:
|
|
.c "numbers don't add up to zero\n"
|
|
report_message:
|
|
.c "failed: got %i instead of %i\n"
|
|
succeeded_message:
|
|
.c "succeeded\n"
|
|
|
|
.code
|
|
jmpi main
|
|
|
|
/*
|
|
static int
|
|
identity (int arg)
|
|
{
|
|
printf ("received %i\n", arg);
|
|
return arg;
|
|
}
|
|
*/
|
|
identify:
|
|
prolog
|
|
arg $i
|
|
getarg %v0 $i
|
|
prepare
|
|
pushargi idfmt
|
|
ellipsis
|
|
pushargr %v0
|
|
finishi @printf
|
|
retr %v0
|
|
epilog
|
|
|
|
identity_func:
|
|
prolog
|
|
arg $i
|
|
getarg %r1 $i
|
|
|
|
/* Store the argument on the stack. */
|
|
allocai $(__WORDSIZE >> 3) $off
|
|
stxi $off %fp %r1
|
|
|
|
/* Store the negative of the argument on the stack. */
|
|
allocai $(__WORDSIZE >> 3) $neg
|
|
negr %r2 %r1
|
|
stxi $neg %fp %r2
|
|
|
|
/* Invoke FUNC. */
|
|
prepare
|
|
pushargr %r1
|
|
finishi identify
|
|
|
|
/* Ignore the result. */
|
|
|
|
/* Restore the negative and the argument from the stack. */
|
|
ldxi %r2 %fp $neg
|
|
ldxi %v1 %fp $off
|
|
|
|
/* Make sure they still add to zero. */
|
|
addr %r0 %v1 %r2
|
|
bnei branch %r0 0
|
|
|
|
/* Return it. */
|
|
retr %v1
|
|
|
|
/* Display a failure message. */
|
|
branch:
|
|
prepare
|
|
pushargi failure_message
|
|
ellipsis
|
|
finishi @printf
|
|
|
|
/* Leave. */
|
|
retr %v1
|
|
epilog
|
|
|
|
main:
|
|
prolog
|
|
prepare
|
|
pushargi 7777
|
|
finishi identity_func
|
|
beqi succeeded %ret 7777
|
|
prepare
|
|
pushargi report_message
|
|
ellipsis
|
|
pushargr %ret
|
|
pushargi 7777
|
|
finishi @printf
|
|
reti 1
|
|
succeeded:
|
|
prepare
|
|
pushargi succeeded_message
|
|
ellipsis
|
|
finishi @printf
|
|
reti 0
|
|
epilog
|