From af92c5adfe9be1f4c253f41d01f12178c795de81 Mon Sep 17 00:00:00 2001 From: pcpa Date: Tue, 18 Jun 2013 22:54:29 -0300 Subject: [PATCH] Correct build and pass all tests on Solaris Sparc. * lib/jit_sparc-cpu.c: Correct compiler warning of value used before assignment. The usage is bogus as the api requires always patching jumps, but the random value used could cause an assertion due to invalid displacement. * lib/jit_sparc.c: Always load and store double arguments in stack as 2 float loads or stores, for safety, as unaligned access is not allowed in Sparc Solaris. --- ChangeLog | 11 +++++++++++ check/lightning.c | 4 ++-- lib/jit_sparc-cpu.c | 2 +- lib/jit_sparc.c | 16 ++++++++++++---- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60402a4b2..e357774a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2013-06-18 Paulo Andrade + + * lib/jit_sparc-cpu.c: Correct compiler warning of value + used before assignment. The usage is bogus as the api + requires always patching jumps, but the random value used + could cause an assertion due to invalid displacement. + + * lib/jit_sparc.c: Always load and store double arguments + in stack as 2 float loads or stores, for safety, as unaligned + access is not allowed in Sparc Solaris. + 2013-06-14 Paulo Andrade * configure.ac: Force -mlp64 to CFLAGS on HP-UX ia64 port. diff --git a/check/lightning.c b/check/lightning.c index 3f785a31d..aa29e38a0 100644 --- a/check/lightning.c +++ b/check/lightning.c @@ -33,8 +33,8 @@ # include #endif -/* The label_t identifier clashes with a definition in sys/types.h */ -#if defined(_AIX) +/* The label_t identifier clashes with a system definitions */ +#if defined(_AIX) || defined(__sun__) # define label_t l_label_t #endif diff --git a/lib/jit_sparc-cpu.c b/lib/jit_sparc-cpu.c index 3ddbfd9b6..956840ac1 100644 --- a/lib/jit_sparc-cpu.c +++ b/lib/jit_sparc-cpu.c @@ -1562,7 +1562,7 @@ _jmpi(jit_state_t *_jit, jit_word_t i0) { jit_word_t w; jit_int32_t reg; - w = (i0 - w) >> 2; + w = (i0 - _jit->pc.w) >> 2; if (s22_p(w)) { BA(w); NOP(); diff --git a/lib/jit_sparc.c b/lib/jit_sparc.c index 5142c8c41..0915192f5 100644 --- a/lib/jit_sparc.c +++ b/lib/jit_sparc.c @@ -372,8 +372,10 @@ _jit_getarg_d(jit_state_t *_jit, jit_int32_t u, jit_node_t *v) jit_ldxi_f(u, JIT_FP, -8); jit_ldxi_f(u + 1, JIT_FP, stack_framesize); } - else - jit_ldxi_d(u, JIT_FP, v->u.w); + else { + jit_ldxi_f(u, JIT_FP, v->u.w); + jit_ldxi_f(u + 1, JIT_FP, v->u.w + 4); + } } void @@ -455,7 +457,10 @@ _jit_pushargr_d(jit_state_t *_jit, jit_int32_t u) _jitc->function->call.size += sizeof(jit_float32_t); } else { - jit_stxi_d(_jitc->function->call.size + stack_framesize, JIT_SP, u); + jit_stxi_f(_jitc->function->call.size + stack_framesize, + JIT_SP, u); + jit_stxi_f(_jitc->function->call.size + stack_framesize + 4, + JIT_SP, u + 1); _jitc->function->call.size += sizeof(jit_float64_t); } } @@ -480,7 +485,10 @@ _jit_pushargi_d(jit_state_t *_jit, jit_float64_t u) _jitc->function->call.size += sizeof(jit_float32_t); } else { - jit_stxi_d(_jitc->function->call.size + stack_framesize, JIT_SP, regno); + jit_stxi_f(_jitc->function->call.size + stack_framesize, + JIT_SP, regno); + jit_stxi_f(_jitc->function->call.size + stack_framesize + 4, + JIT_SP, regno + 1); _jitc->function->call.size += sizeof(jit_float64_t); } jit_unget_reg(regno);