wingo pushed a commit to branch lightning
in repository guile.
commit adc854f1a7fa688f4cb3882a32f087cc89b116f6
Author: pcpa <[email protected]>
Date: Sat Dec 22 16:28:02 2012 -0200
Correct regressions with --with-float={soft,softfp} in the arm backend
* lib/jit_arm.c: Correct use of wrong argument offset
variable in armv7l or float/double argument for varargs
function in armv7hl.
Correct jit_getarg* logic in software float mode to
match expected behavior in other backends, that is, if
a function is not called, it is safe to use a few lightning
calls before a next jit_getarg* call, as done in the test
case check/stack.tst. The proper solution should be to
extend the parser in lib/lightning.c to check if there is
some float operation that will call some (libgcc?) function,
but software float arm should be a very uncommon backend for
lightning, so, just load the already in place arguments
saved to stack, assuming the register argument was clobbered
(what should not be the case most times...).
---
ChangeLog | 17 +++++++++++++++++
lib/jit_arm.c | 49 ++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 59 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8e23479..299bc0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,22 @@
2012-12-22 Paulo Andrade <[email protected]>
+ * lib/jit_arm.c: Correct use of wrong argument offset
+ variable in armv7l or float/double argument for varargs
+ function in armv7hl.
+ Correct jit_getarg* logic in software float mode to
+ match expected behavior in other backends, that is, if
+ a function is not called, it is safe to use a few lightning
+ calls before a next jit_getarg* call, as done in the test
+ case check/stack.tst. The proper solution should be to
+ extend the parser in lib/lightning.c to check if there is
+ some float operation that will call some (libgcc?) function,
+ but software float arm should be a very uncommon backend for
+ lightning, so, just load the already in place arguments
+ saved to stack, assuming the register argument was clobbered
+ (what should not be the case most times...).
+
+2012-12-22 Paulo Andrade <[email protected]>
+
* check/clobber.ok, check/clobber.tst: New test case doing
extensive validation tests to ensure registers not used in
a operation are not clobbered.
diff --git a/lib/jit_arm.c b/lib/jit_arm.c
index fab42aa..0a11070 100644
--- a/lib/jit_arm.c
+++ b/lib/jit_arm.c
@@ -388,8 +388,8 @@ _jit_arg_d(jit_state_t *_jit)
if (_jit->function->self.argi < 3) {
if (_jit->function->self.argi & 1)
++_jit->function->self.argi;
- offset = _jit->function->self.argf;
- _jit->function->self.argf += 2;
+ offset = _jit->function->self.argi;
+ _jit->function->self.argi += 2;
return (offset);
}
}
@@ -409,7 +409,12 @@ _jit_arg_d_reg_p(jit_state_t *_jit, jit_int32_t offset)
void
_jit_getarg_c(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
- if (v < 4)
+ if (jit_swf_p()) {
+ if (v < 4)
+ v <<= 2;
+ jit_ldxi_c(u, JIT_FP, v);
+ }
+ else if (v < 4)
jit_extr_c(u, JIT_RA0 - v);
else
jit_ldxi_c(u, JIT_FP, v);
@@ -418,7 +423,12 @@ _jit_getarg_c(jit_state_t *_jit, jit_int32_t u,
jit_int32_t v)
void
_jit_getarg_uc(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
- if (v < 4)
+ if (jit_swf_p()) {
+ if (v < 4)
+ v <<= 2;
+ jit_ldxi_uc(u, JIT_FP, v);
+ }
+ else if (v < 4)
jit_extr_uc(u, JIT_RA0 - v);
else
jit_ldxi_uc(u, JIT_FP, v);
@@ -427,7 +437,12 @@ _jit_getarg_uc(jit_state_t *_jit, jit_int32_t u,
jit_int32_t v)
void
_jit_getarg_s(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
- if (v < 4)
+ if (jit_swf_p()) {
+ if (v < 4)
+ v <<= 2;
+ jit_ldxi_s(u, JIT_FP, v);
+ }
+ else if (v < 4)
jit_extr_s(u, JIT_RA0 - v);
else
jit_ldxi_s(u, JIT_FP, v);
@@ -436,7 +451,12 @@ _jit_getarg_s(jit_state_t *_jit, jit_int32_t u,
jit_int32_t v)
void
_jit_getarg_us(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
- if (v < 4)
+ if (jit_swf_p()) {
+ if (v < 4)
+ v <<= 2;
+ jit_ldxi_us(u, JIT_FP, v);
+ }
+ else if (v < 4)
jit_extr_us(u, JIT_RA0 - v);
else
jit_ldxi_us(u, JIT_FP, v);
@@ -445,7 +465,12 @@ _jit_getarg_us(jit_state_t *_jit, jit_int32_t u,
jit_int32_t v)
void
_jit_getarg_i(jit_state_t *_jit, jit_int32_t u, jit_int32_t v)
{
- if (v < 4)
+ if (jit_swf_p()) {
+ if (v < 4)
+ v <<= 2;
+ jit_ldxi_i(u, JIT_FP, v);
+ }
+ else if (v < 4)
jit_movr(u, JIT_RA0 - v);
else
jit_ldxi_i(u, JIT_FP, v);
@@ -460,6 +485,11 @@ _jit_getarg_f(jit_state_t *_jit, jit_int32_t u,
jit_int32_t v)
else
jit_ldxi_f(u, JIT_FP, v);
}
+ else if (jit_swf_p()) {
+ if (v < 4)
+ v <<= 2;
+ jit_ldxi_f(u, JIT_FP, v);
+ }
else {
if (v < 4)
jit_movr_f(u, JIT_RA0 - v);
@@ -477,6 +507,11 @@ _jit_getarg_d(jit_state_t *_jit, jit_int32_t u,
jit_int32_t v)
else
jit_ldxi_d(u, JIT_FP, v);
}
+ else if (jit_swf_p()) {
+ if (v < 4)
+ v <<= 2;
+ jit_ldxi_d(u, JIT_FP, v);
+ }
else {
if (v < 4)
jit_movr_d(u, JIT_RA0 - v);