[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 244/437: HPPA: Correct bogus logic when calling function
From: |
Andy Wingo |
Subject: |
[Guile-commits] 244/437: HPPA: Correct bogus logic when calling function pointers. |
Date: |
Mon, 2 Jul 2018 05:14:29 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 455237673b5ed71a9637f4e4d6e83ef261d5e6c2
Author: pcpa <address@hidden>
Date: Tue Sep 10 21:23:25 2013 -0300
HPPA: Correct bogus logic when calling function pointers.
* lib/jit_hppa-cpu.c: Correct code to call a function stored
in a register or a patched function address.
---
ChangeLog | 5 +++++
lib/jit_hppa-cpu.c | 17 ++++++++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2065308..4667e99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-09-10 Paulo Andrade <address@hidden>
+ * lib/jit_hppa-cpu.c: Correct code to call a function stored
+ in a register or a patched function address.
+
+2013-09-10 Paulo Andrade <address@hidden>
+
* lib/jit_ia64-cpu.c: Correct incorrect logic when restoring
the value of the "r2" callee save register.
diff --git a/lib/jit_hppa-cpu.c b/lib/jit_hppa-cpu.c
index f80cb1c..2a88f9f 100644
--- a/lib/jit_hppa-cpu.c
+++ b/lib/jit_hppa-cpu.c
@@ -318,6 +318,7 @@ static void _f38(jit_state_t*,jit_int32_t,
#define BBI_N_GE(r,p,i) BBI_N_(BB_CC_GE,r,p,i)
#define BE(i,s,b) f19(0x38,b,s,i,0)
#define BE_L(i,s,b) f19(0x39,b,s,i,0)
+#define BE_L_N(i,s,b) f19(0x39,b,s,i,1)
#define BLR(x,t) f21(0x3a,t,x,2,0)
#define BLR_N(x,t) f21(0x3a,t,x,2,1)
#define BREAK(i,j) f27(0,j,i)
@@ -326,6 +327,7 @@ static void _f38(jit_state_t*,jit_int32_t,
#define BVE(b) f22(0x3a,b,6,0,0,0)
#define BVE_N(b) f22(0x3a,b,6,0,1,0)
#define BVE_L(b) f22(0x3a,b,7,0,0,0)
+#define BVE_L_N(b) f22(0x3a,b,7,0,0,1)
#define II_C_NONE 0
#define II_C_M (1<<5)
#define II_C_S (1<<13)
@@ -2548,16 +2550,25 @@ _jmpi_p(jit_state_t *_jit, jit_word_t i0)
static void
_callr(jit_state_t *_jit, jit_int32_t r0)
{
+ jit_word_t dyn;
+ jit_word_t imm;
if (r0 != _R1_REGNO)
COPY(r0, _R1_REGNO);
/* inline $$dyncall */
- BBI_N_GE(_R1_REGNO, 30, 4); /* if (r1 & 2) {
*/
+ imm = _jit->pc.w;
+ BBI_N_GE(_R1_REGNO, 30, 0); /* if (r1 & 2) {
*/
DEPWRI(0, 31, 2, _R1_REGNO); /* r1 &= ~2; */
LDWI(4, _R1_REGNO, _R19_REGNO); /* r19 = r1[1]; */
LDWI(0, _R1_REGNO, _R1_REGNO); /* r1 = r1[0]; */
/* } */
BVE_L(_R1_REGNO);
STWL(_RP_REGNO, -24, _SP_REGNO);
+ dyn = _jit->pc.w;
+ jmpi(_jit->pc.w);
+ patch_at(imm, _jit->pc.w);
+ BVE_L_N(_R1_REGNO);
+ NOP();
+ patch_at(dyn, _jit->pc.w);
}
static void
@@ -2577,8 +2588,8 @@ _calli(jit_state_t *_jit, jit_word_t i0)
if (w >= -32768 && w <= 32767)
B_L_N(w);
else {
- movi(_R1_REGNO, w);
- BLR_N(_R1_REGNO, _RP_REGNO);
+ movi(_R1_REGNO, i0);
+ BVE_L_N(_R1_REGNO);
}
NOP();
}
- [Guile-commits] 332/437: Add test case to check possible issues with 2 contexts, (continued)
- [Guile-commits] 332/437: Add test case to check possible issues with 2 contexts, Andy Wingo, 2018/07/02
- [Guile-commits] 189/437: Pass all but the (not yet implemented) qmul and qdiv tests in sparc, Andy Wingo, 2018/07/02
- [Guile-commits] 217/437: Adjust lightning to work on ppc AIX., Andy Wingo, 2018/07/02
- [Guile-commits] 223/437: Build and pass all tests on big endian Irix mips using the n32 abi., Andy Wingo, 2018/07/02
- [Guile-commits] 205/437: Properly split instruction groups for predicate registers., Andy Wingo, 2018/07/02
- [Guile-commits] 391/437: aarch64: Correct va_list offsets and double load., Andy Wingo, 2018/07/02
- [Guile-commits] 304/437: Correct typo in documentation., Andy Wingo, 2018/07/02
- [Guile-commits] 409/437: Correct binutils version detection, Andy Wingo, 2018/07/02
- [Guile-commits] 310/437: Allow jit_jmpi on an immediate constant address., Andy Wingo, 2018/07/02
- [Guile-commits] 264/437: ARM: Do not use ldrt/strt by default, Andy Wingo, 2018/07/02
- [Guile-commits] 244/437: HPPA: Correct bogus logic when calling function pointers.,
Andy Wingo <=
- [Guile-commits] 273/437: x86: Ensure the x87 stack is empty when calling a function., Andy Wingo, 2018/07/02
- [Guile-commits] 126/437: Cleanup on preparation for lightning rework., Andy Wingo, 2018/07/02
- [Guile-commits] 364/437: GNU lightning 2.1.0 release, Andy Wingo, 2018/07/02
- [Guile-commits] 242/437: Add missing jit_clear_state to documentation sample., Andy Wingo, 2018/07/02
- [Guile-commits] 417/437: HPPA: Correct wrong regarg_p check, Andy Wingo, 2018/07/02
- [Guile-commits] 333/437: Implement jit_flush, Andy Wingo, 2018/07/02
- [Guile-commits] 316/437: Implement the jit_rsb* interface., Andy Wingo, 2018/07/02
- [Guile-commits] 358/437: Add new --enable-devel-disassembler configure option, Andy Wingo, 2018/07/02
- [Guile-commits] 262/437: Rerun tests on supported backends after bogus self test correction, Andy Wingo, 2018/07/02
- [Guile-commits] 399/437: mips: Pass tests for variadic jit functions on new abi, Andy Wingo, 2018/07/02