1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-21 03:00:19 +02:00

Add new test case to check stack integrity on complex stack frames.

* check/stack.ok, check/stack.tst: New files to test data
	integrity on a deep chain of stack frames.

	* lib/jit_arm.c, lib/jit_arm-cpu.c, lib/jit_mips.c,
	lib/jit_mips-cpu.c, lib/jit_ppc.c, lib/jit_ppc-cpu.c,
	lib/jit_x86.c, lib/jit_x86-cpu.c: Calculate _jit->function->stack
	in the emit stage, otherwise it will calculate it wrong if
	need to jit_allocai space to spill registers.

	* lib/lightning.c: Correct wrong offset when updating the
	"current" jit function pointer in the code that may need to
	allocate stack space to spill registers.

	* check/lightning.c: Correct off by one data space check.

	* check/Makefile.am: Update for new test case.
This commit is contained in:
pcpa 2012-12-19 18:07:12 -02:00
parent b43ea1f908
commit a74318a1d7
14 changed files with 387 additions and 29 deletions

View file

@ -20,8 +20,6 @@
#if PROTO
# if __WORDSIZE == 32
# define stack_alignment 4
# define stack_framesize 20
# define ldi(u, v) ldi_i(u, v)
# define ldxi(u, v, w) ldxi_i(u, v, w)
# define sti(u, v) sti_i(u, v)
@ -32,8 +30,6 @@
# define reg8_p(rn) \
((rn) >= _RAX_REGNO && (rn) <= _RBX_REGNO)
# else
# define stack_alignment 8
# define stack_framesize 56
# define ldi(u, v) ldi_l(u, v)
# define ldxi(u, v, w) ldxi_l(u, v, w)
# define sti(u, v) sti_l(u, v)
@ -3070,6 +3066,14 @@ _jmpi(jit_state_t *_jit, jit_word_t i0)
static void
_prolog(jit_state_t *_jit, jit_node_t *node)
{
#if __WORDSIZE == 32
_jit->function->stack = (((_jit->function->self.alen -
_jit->function->self.aoff) + 15) & -16) + 12;
#else
_jit->function->stack = (((_jit->function->self.alen -
_jit->function->self.aoff) + 15) & -16) + 8;
#endif
/* callee save registers */
subi(_RSP_REGNO, _RSP_REGNO, stack_framesize - sizeof(jit_word_t));
#if __WORDSIZE == 32