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

Correct extra regressions found by the call.tst test case.

* lib/jit_arm.c, lib/jit_mips-cpu.c, lib/jit_mips.c: Correct
	regressions when patching jit_calli for a forward function.

	* lib/jit_ppc-cpu.c: Correct wrong arguments to ANDI opcode
	in jit_getarg_u{c,s} implementation.
This commit is contained in:
pcpa 2012-12-28 10:28:50 -02:00
parent 3ee09ecc64
commit 1287a2d448
5 changed files with 40 additions and 30 deletions

View file

@ -1,3 +1,11 @@
2012-12-27 Paulo Andrade <pcpa@gnu.org>
* lib/jit_arm.c, lib/jit_mips-cpu.c, lib/jit_mips.c: Correct
regressions when patching jit_calli for a forward function.
* lib/jit_ppc-cpu.c: Correct wrong arguments to ANDI opcode
in jit_getarg_u{c,s} implementation.
2012-12-23 Paulo Andrade <pcpa@gnu.org>
* check/call.ok, check/call.tst: New test cases to validate

View file

@ -1468,10 +1468,8 @@ _jit_emit(jit_state_t *_jit)
assert(_jit->patches.ptr[offset].kind & arm_patch_node);
node = _jit->patches.ptr[offset].node;
word = _jit->patches.ptr[offset].inst;
if (node->code == jit_code_movi) {
if (jit_thumb_p())
value = node->v.n->u.w;
else {
if (!jit_thumb_p() &&
(node->code == jit_code_movi || node->code == jit_code_calli)) {
/* calculate where to patch word */
value = *(jit_int32_t *)word;
assert((value & 0x0f700000) == ARM_LDRI);
@ -1483,11 +1481,8 @@ _jit_emit(jit_state_t *_jit)
if (value & ARM_P) value = value & 0x00000fff;
else value = -(value & 0x00000fff);
word = word + 8 + value;
value = node->v.n->u.w;
}
}
else
value = node->u.n->u.w;
value = node->code == jit_code_movi ? node->v.n->u.w : node->u.n->u.w;
patch_at(_jit->patches.ptr[offset].kind & ~arm_patch_node, word, value);
}
@ -1715,12 +1710,9 @@ _patch(jit_state_t *_jit, jit_word_t instr, jit_node_t *node)
}
else {
flag = node->u.n->flag;
#if 1
/* should work if #if 0'ed, but better to avoid the goto fallback */
if (node->code == jit_code_calli && jit_thumb_p())
if (node->code == jit_code_calli)
kind = arm_patch_word;
else
#endif
kind = arm_patch_jump;
}
assert(!(flag & jit_flag_patch));

View file

@ -654,7 +654,9 @@ static jit_word_t _bmci(jit_state_t*,jit_word_t,jit_int32_t,jit_word_t);
# define callr(r0) _callr(_jit, r0)
static void _callr(jit_state_t*,jit_int32_t);
# define calli(i0) _calli(_jit, i0)
static jit_word_t _calli(jit_state_t*,jit_word_t);
static void _calli(jit_state_t*,jit_word_t);
# define calli_p(i0) _calli_p(_jit, i0)
static jit_word_t _calli_p(jit_state_t*,jit_word_t);
# define prolog(node) _prolog(_jit, node)
static void _prolog(jit_state_t*,jit_node_t*);
# define epilog(node) _epilog(_jit, node)
@ -2681,13 +2683,21 @@ _callr(jit_state_t *_jit, jit_int32_t r0)
NOP(1);
}
static jit_word_t
static void
_calli(jit_state_t *_jit, jit_word_t i0)
{
movi(_T9_REGNO, i0);
JALR(_T9_REGNO);
NOP(1);
}
static jit_word_t
_calli_p(jit_state_t *_jit, jit_word_t i0)
{
jit_word_t word;
word = _jit->pc.w;
movi(_T9_REGNO, i0);
movi_p(_T9_REGNO, i0);
JALR(_T9_REGNO);
NOP(1);

View file

@ -1180,7 +1180,7 @@ _jit_emit(jit_state_t *_jit)
temp = node->u.n;
assert(temp->code == jit_code_label ||
temp->code == jit_code_epilog);
word = calli(temp->u.w);
word = calli_p(temp->u.w);
if (!(temp->flag & jit_flag_patch))
patch(word, node);
}

View file

@ -362,9 +362,9 @@ static jit_word_t _movi_p(jit_state_t*,jit_int32_t,jit_word_t);
# define negr(r0,r1) NEG(r0,r1)
# define comr(r0,r1) NOT(r0,r1)
# define extr_c(r0,r1) EXTSB(r0,r1)
# define extr_uc(r0,r1) ANDI_(r0,r0,0xff)
# define extr_uc(r0,r1) ANDI_(r0,r1,0xff)
# define extr_s(r0,r1) EXTSH(r0,r1)
# define extr_us(r0,r1) ANDI_(r0,r0,0xffff)
# define extr_us(r0,r1) ANDI_(r0,r1,0xffff)
# if __BYTE_ORDER == __BIG_ENDIAN
# define htonr(r0,r1) movr(r0,r1)
# else