1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-09 07:00:23 +02:00

Implement jit_allocar for dynamic stack allocation

* include/lightning.h, include/lightning/jit_private.h,
	lib/jit_aarch64-cpu.c, lib/jit_aarch64.c,
	lib/jit_alpha-cpu.c, lib/jit_alpha.c,
	lib/jit_arm-cpu.c, lib/jit_arm.c,
	lib/jit_hppa-cpu.c, lib/jit_hppa.c,
	lib/jit_ia64-cpu.c, lib/jit_ia64.c,
	lib/jit_mips-cpu.c, lib/jit_mips.c,
	lib/jit_ppc-cpu.c, lib/jit_ppc.c,
	lib/jit_s390-cpu.c, lib/jit_s390.c,
	lib/jit_sparc-cpu.c, lib/jit_sparc.c,
	lib/jit_x86-cpu.c, lib/jit_x86.c: Implement the new
	jit_allocar(offs, size) interface, that receives
	two integer registers arguments, allocates space
	dynamically in the stack, returns the offset in
	the first argument, and uses the second argument
	for the size in bytes of the memory to be allocated.

	* check/allocar.ok, check/allocar.tst: New files
	implementing test cases for the new jit_allocar
	interface.

	* check/Makefile.am, check/lightning.c: Update for
	the new test case and interface.

	* doc/body.texi: Add documentation of the new
	interface.
This commit is contained in:
pcpa 2015-02-17 14:37:57 -02:00
parent 9f72e66116
commit ad589fbb0a
28 changed files with 801 additions and 28 deletions

View file

@ -3437,6 +3437,7 @@ _jmpi(jit_state_t *_jit, jit_word_t i0)
static void
_prolog(jit_state_t *_jit, jit_node_t *node)
{
jit_int32_t reg;
if (_jitc->function->define_frame || _jitc->function->assume_frame) {
jit_int32_t frame = -_jitc->function->frame;
assert(_jitc->function->self.aoff >= frame);
@ -3444,6 +3445,8 @@ _prolog(jit_state_t *_jit, jit_node_t *node)
return;
_jitc->function->self.aoff = frame;
}
if (_jitc->function->allocar)
_jitc->function->self.aoff &= -16;
#if __X64 && __CYGWIN__
_jitc->function->stack = (((/* first 32 bytes must be allocated */
(_jitc->function->self.alen > 32 ?
@ -3519,6 +3522,12 @@ _prolog(jit_state_t *_jit, jit_node_t *node)
/* alloca */
subi(_RSP_REGNO, _RSP_REGNO, _jitc->function->stack);
if (_jitc->function->allocar) {
reg = jit_get_reg(jit_class_gpr);
movi(rn(reg), _jitc->function->self.aoff);
stxi_i(_jitc->function->aoffoff, _RBP_REGNO, rn(reg));
jit_unget_reg(reg);
}
}
static void