Add new test case to check stack integrity on complex stack frames. - lightning.git - Portable just-in-time compiler library

index : lightning.git
Portable just-in-time compiler library
summary refs log tree commit diff
path: root/lib/jit_mips.c
diff options
context:
space:
mode:
authorpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2012年12月19日 18:07:12 -0200
committerpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2012年12月19日 18:07:12 -0200
commita74318a1d715a7f9ce9c99ae81c3038645efcc10 (patch)
tree5b13fe85aa14c298324b238c8e6140ee14f392b0 /lib/jit_mips.c
parentb43ea1f908866baaf14586e6d048bff4dbf6db1f (diff)
downloadlightning-a74318a1d715a7f9ce9c99ae81c3038645efcc10.tar.gz
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.
Diffstat (limited to 'lib/jit_mips.c')
-rw-r--r--lib/jit_mips.c 21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/jit_mips.c b/lib/jit_mips.c
index d3cca00..1773b5d 100644
--- a/lib/jit_mips.c
+++ b/lib/jit_mips.c
@@ -224,12 +224,6 @@ void
_jit_epilog(jit_state_t *_jit)
{
assert(_jit->function);
-
- _jit->function->stack = ((/* first 16 bytes must be allocated */
- (_jit->function->self.alen > 16 ?
- _jit->function->self.alen : 16) -
- /* align stack at 8 bytes */
- _jit->function->self.aoff) + 7) & -8;
assert(_jit->function->epilog->next == NULL);
jit_link(_jit->function->epilog);
_jit->function = NULL;
@@ -266,13 +260,20 @@ _jit_arg_f(jit_state_t *_jit)
assert(_jit->function);
offset = (_jit->function->self.size - stack_framesize) >> 2;
- if (offset < 4) {
+ if (offset < 3) {
if (!_jit->function->self.argi) {
offset += 4;
_jit->function->self.argf += 2;
+ assert(!(offset & 1));
}
- else
+ else {
_jit->function->self.argi += 2;
+ if (offset & 1) {
+ ++_jit->function->self.argi;
+ ++offset;
+ _jit->function->self.size += sizeof(jit_float32_t);
+ }
+ }
}
else
offset = _jit->function->self.size;
@@ -395,7 +396,7 @@ void
_jit_getarg_f(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
- jit_new_node_ww(jit_code_getarg_f, u, _A0 - (v >> 1));
+ jit_new_node_ww(jit_code_getarg_f, u, _A0 - v);
else if (v < 8)
jit_movr_f(u, _F12 - ((v - 4) >> 1));
else
@@ -406,7 +407,7 @@ void
_jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
if (v < 4)
- jit_new_node_ww(jit_code_getarg_d, u, _A0 - (v >> 1));
+ jit_new_node_ww(jit_code_getarg_d, u, _A0 - v);
else if (v < 8)
jit_movr_d(u, _F12 - ((v - 4) >> 1));
else
generated by cgit v1.2.3 (git 2.46.0) at 2025年10月03日 11:20:30 +0000

AltStyle によって変換されたページ (->オリジナル) /