wingo pushed a commit to branch lightning
in repository guile.
commit a3063df782c1958e2fdfd9d88a12d16b45ce1873
Author: Paulo Andrade <[email protected]>
Date: Sun May 10 18:33:05 2015 -0300
ia64: Do not use a dangling pointer for double to integer copy
* lib/jit_ia64-fpu.c, lib/jit_ia64.c: Correct movi_d_w
and movi_f_w implementation to work when not using a
data buffer. This causes the check varargs.tst to
work when passing "-d" to the lightning test tool.
---
ChangeLog | 7 +++++++
lib/jit_ia64-fpu.c | 35 ++++++++++++++++++++++++++---------
lib/jit_ia64.c | 4 ++--
3 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2e1d363..90244b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2015-06-10 Paulo Andrade <[email protected]>
+ * lib/jit_ia64-fpu.c, lib/jit_ia64.c: Correct movi_d_w
+ and movi_f_w implementation to work when not using a
+ data buffer. This causes the check varargs.tst to
+ work when passing "-d" to the lightning test tool.
+
+2015-06-10 Paulo Andrade <[email protected]>
+
* lib/jit_ia64.c: Implement inline assembly cache flush,
required on multiprocessor systems.
diff --git a/lib/jit_ia64-fpu.c b/lib/jit_ia64-fpu.c
index 8637c01..20970fb 100644
--- a/lib/jit_ia64-fpu.c
+++ b/lib/jit_ia64-fpu.c
@@ -440,9 +440,9 @@ static void _movr_f_w(jit_state_t*,jit_int32_t,jit_int32_t);
#define movr_d_w(r0,r1) _movr_d_w(_jit,r0,r1)
static void _movr_d_w(jit_state_t*,jit_int32_t,jit_int32_t);
#define movi_f_w(r0,i0) _movi_f_w(_jit,r0,i0)
-static void _movi_f_w(jit_state_t*,jit_int32_t,jit_word_t);
+static void _movi_f_w(jit_state_t*,jit_int32_t,jit_float32_t*);
#define movi_d_w(r0,i0) _movi_d_w(_jit,r0,i0)
-static void _movi_d_w(jit_state_t*,jit_int32_t,jit_word_t);
+static void _movi_d_w(jit_state_t*,jit_int32_t,jit_float64_t*);
#define absr_f(r0,r1) absr_d(r0,r1)
#define absr_d(r0,r1) FABS(r0,r1)
#define negr_f(r0,r1) negr_d(r0,r1)
@@ -1057,30 +1057,47 @@ _movr_f_w(jit_state_t *_jit, jit_int32_t r0,
jit_int32_t r1)
}
static void
-_movi_f_w(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
+_movi_f_w(jit_state_t *_jit, jit_int32_t r0, jit_float32_t *i0)
{
- /* Should actually be used only in this case (with out0 == 120) */
+ jit_data_t data;
+
+ /* Should be used only in this case (with out0 == 120) */
if (r0 >= 120)
r0 = _jitc->rout + (r0 - 120);
- ldi_i(r0, i0);
+ if (_jitc->no_data) {
+ data.f = *i0;
+ movi(r0, data.q.l);
+ }
+ else
+ ldi_i(r0, (jit_word_t)i0);
}
static void
_movr_d_w(jit_state_t *_jit, jit_int32_t r0, jit_int32_t r1)
{
- /* Should actually be used only in this case (with out0 == 120) */
+ /* Should be used only in this case (with out0 == 120) */
if (r0 >= 120)
r0 = _jitc->rout + (r0 - 120);
GETF_D(r0, r1);
}
static void
-_movi_d_w(jit_state_t *_jit, jit_int32_t r0, jit_word_t i0)
+_movi_d_w(jit_state_t *_jit, jit_int32_t r0, jit_float64_t *i0)
{
- /* Should actually be used only in this case (with out0 == 120) */
+ union {
+ jit_word_t w;
+ jit_float64_t d;
+ } data;
+
+ /* Should be used only in this case (with out0 == 120) */
if (r0 >= 120)
r0 = _jitc->rout + (r0 - 120);
- ldi_l(r0, i0);
+ if (_jitc->no_data) {
+ data.d = *i0;
+ movi(r0, data.w);
+ }
+ else
+ ldi_l(r0, (jit_word_t)i0);
}
#define fpr_opi(name, type, size) \
diff --git a/lib/jit_ia64.c b/lib/jit_ia64.c
index 172050b..a9287c4 100644
--- a/lib/jit_ia64.c
+++ b/lib/jit_ia64.c
@@ -1420,10 +1420,10 @@ _emit_code(jit_state_t *_jit)
movr_d_w(rn(node->u.w), rn(node->v.w));
break;
case jit_code_movi_f_w:
- movi_f_w(rn(node->u.w), node->v.n->u.w);
+ movi_f_w(rn(node->u.w), node->v.n->u.p);
break;
case jit_code_movi_d_w:
- movi_d_w(rn(node->u.w), node->v.n->u.w);
+ movi_d_w(rn(node->u.w), node->v.n->u.p);
break;
default:
abort();