[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Lightning] Re: Bug in x86_64
From: |
Paolo Bonzini |
Subject: |
[Lightning] Re: Bug in x86_64 |
Date: |
Thu, 12 Jun 2008 22:45:11 -0700 |
User-agent: |
Thunderbird 2.0.0.14 (Macintosh/20080421) |
What are your thoughts?
What about the attached patch? It just relocates V1 and V2 to R12 and R13.
Paolo
diff --git a/lightning/i386/core-32.h b/lightning/i386/core-32.h
index d93967f..9775fc8 100644
--- a/lightning/i386/core-32.h
+++ b/lightning/i386/core-32.h
@@ -36,6 +36,8 @@
#define JIT_CAN_16 1
#define JIT_AP _EBP
+#define JIT_V_NUM 3
+#define JIT_V(i) ((i) == 0 ? _EBX : _ESI + (i) - 1)
struct jit_local_state {
int framesize;
diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h
index d2ab96a..da391ae 100644
--- a/lightning/i386/core-64.h
+++ b/lightning/i386/core-64.h
@@ -39,6 +39,9 @@
#define JIT_CALLTMPSTART 0x48
#define JIT_REXTMP 0x4B
+#define JIT_V_NUM 3
+#define JIT_V(i) ((i) == 0 ? _EBX : _R11D + (i))
+
struct jit_local_state {
int long_jumps;
int nextarg_getfp;
@@ -127,17 +130,13 @@ struct jit_local_state {
#define jit_pusharg_i(rs) (_jitl.argssize++, MOVQrr(rs, JIT_CALLTMPSTART
+ _jitl.argssize - 1))
#define jit_finish(sub) (MOVQir((long) (sub), JIT_REXTMP), \
jit_shift_args(), \
- CALLsr(JIT_REXTMP), \
- jit_restore_locals())
+ CALLsr(JIT_REXTMP))
#define jit_reg_is_arg(reg) ((reg == _EDI) || (reg ==_ESI) || (reg ==
_EDX))
#define jit_finishr(reg) ((jit_reg_is_arg((reg)) ? MOVQrr(reg,
JIT_REXTMP) : (void)0), \
jit_shift_args(), \
- CALLsr(jit_reg_is_arg((reg)) ? JIT_REXTMP :
(reg)), \
- jit_restore_locals())
+ CALLsr(jit_reg_is_arg((reg)) ? JIT_REXTMP :
(reg)))
-/* R12 and R13 are callee-save, instead of EDI and ESI. Can be improved. */
#define jit_shift_args() \
- (MOVQrr(_ESI, _R12), MOVQrr(_EDI, _R13), \
(_jitl.argssize-- \
? (MOVQrr(JIT_CALLTMPSTART + _jitl.argssize, jit_arg_reg_order[0]), \
(_jitl.argssize-- \
@@ -146,10 +145,7 @@ struct jit_local_state {
? MOVQrr(JIT_CALLTMPSTART, jit_arg_reg_order[2]) \
: (void)0)) \
: (void)0)) \
- : (void)0))
-
-#define jit_restore_locals() \
- (MOVQrr(_R12, _ESI), MOVQrr(_R13, _EDI))
+ : (void)0)
#define jit_retval_l(rd) ((void)jit_movr_l ((rd), _EAX))
#define jit_arg_c()
(jit_arg_reg_order[_jitl.nextarg_geti++])
diff --git a/lightning/i386/core.h b/lightning/i386/core.h
index 3ed6730..ad99d4d 100644
--- a/lightning/i386/core.h
+++ b/lightning/i386/core.h
@@ -39,9 +39,7 @@
#define JIT_RET _EAX
#define JIT_R_NUM 3
-#define JIT_V_NUM 3
#define JIT_R(i) (_EAX + (i))
-#define JIT_V(i) ((i) == 0 ? _EBX : _ESI + (i) - 1)
/* 3-parameter operation */