1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00
guile/check/allocai.tst
pcpa 9e86ef12cf Add the new jit_name call to mark function boundaries
* check/3to2.tst, check/add.tst, check/allocai.tst, check/bp.tst,
	check/call.tst, check/ccall.c, check/clobber.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/lightning.c, check/rpn.tst, check/stack.tst,
	check/varargs.tst, include/lightning.h,
	include/lightning/jit_private.h, lib/jit_arm.c, lib/jit_disasm.c,
	lib/jit_mips.c, lib/jit_note.c, lib/jit_ppc.c, lib/jit_print.c,
	lib/jit_x86.c, lib/lightning.c:	Extend the "jit_note" abstraction
	with the new "jit_name" call, that receives a string argument, and
	should usually be called to mark boundaries of functions of code
	generating jit (that is, it is not expected that the language
	generating jit map its functions to jit functions).
2013-01-18 18:05:57 -02:00

100 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;
}
*/
name identify
identify:
prolog
arg $i
getarg %v0 $i
prepare
pushargi idfmt
ellipsis
pushargr %v0
finishi @printf
retr %v0
epilog
name identity_func
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
name main
main:
prolog
prepare
pushargi 7777
finishi identity_func
retval %r0
beqi succeeded %r0 7777
prepare
pushargi report_message
ellipsis
pushargr %r0
pushargi 7777
finishi @printf
reti 1
succeeded:
prepare
pushargi succeeded_message
ellipsis
finishi @printf
reti 0
epilog