[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 116/437: Change jit_finish to work with varargs function
From: |
Andy Wingo |
Subject: |
[Guile-commits] 116/437: Change jit_finish to work with varargs functions in x86_64. |
Date: |
Mon, 2 Jul 2018 05:13:56 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit d04cfb05ac08f7cef8a920dfabe65ed6991c8719
Author: PCPA <address@hidden>
Date: Wed Aug 25 06:55:50 2010 -0300
Change jit_finish to work with varargs functions in x86_64.
It is required to set %al to 0-8 inclusive, telling the number of
xmm registers used to pass arguments.
This also corrects the calculation of _jitl.nextarg_putfp, that
would be incorrect if calling a function with both, float and double
arguments.
---
lightning/i386/core-64.h | 16 ++++++++++++----
lightning/i386/fp-64.h | 8 ++++----
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/lightning/i386/core-64.h b/lightning/i386/core-64.h
index b10fb5b..fb11896 100644
--- a/lightning/i386/core-64.h
+++ b/lightning/i386/core-64.h
@@ -55,6 +55,7 @@ struct jit_local_state {
int nextarg_putfp;
int nextarg_geti;
int argssize;
+ int fprssize;
int alloca_offset;
int alloca_slack;
};
@@ -145,11 +146,18 @@ struct jit_local_state {
#define jit_pusharg_i(rs) (--_jitl.argssize, MOVQrr(rs,
jit_arg_reg_order[_jitl.argssize]))
-#define jit_finish(sub) (MOVQir((long) (sub), JIT_REXTMP), \
- CALLsr(JIT_REXTMP))
+#define jit_finish(sub) (MOVBir(_jitl.fprssize < JIT_FP_ARG_MAX
\
+ ? _jitl.fprssize \
+ : JIT_FP_ARG_MAX, _AL), \
+ jit_calli(sub))
#define jit_reg_is_arg(reg) ((reg) == _ECX || (reg) == _EDX)
-#define jit_finishr(reg) ((jit_reg_is_arg((reg)) ? MOVQrr(reg,
JIT_REXTMP) : (void)0), \
- CALLsr(jit_reg_is_arg((reg)) ? JIT_REXTMP :
(reg)))
+#define jit_finishr(reg) (MOVBir(_jitl.fprssize < JIT_FP_ARG_MAX \
+ ? _jitl.fprssize \
+ : JIT_FP_ARG_MAX, _AL), \
+ (jit_reg_is_arg((reg)) \
+ ? (MOVQrr(reg, JIT_REXTMP), \
+ jit_callr(JIT_REXTMP)) \
+ : jit_callr(reg)))
#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/fp-64.h b/lightning/i386/fp-64.h
index 77312e7..d775474 100644
--- a/lightning/i386/fp-64.h
+++ b/lightning/i386/fp-64.h
@@ -291,11 +291,11 @@ union jit_double_imm {
#define jit_unordr_d(d, s1, s2) (XORLrr ((d), (d)), UCOMISDrr ((s1),
(s2)), SETPr (jit_reg8((d))))
#if !defined(_ASM_SAFETY)
-#define jit_prepare_f(num) (_jitl.nextarg_putfp = _XMM0 + (num))
-#define jit_prepare_d(num) (_jitl.nextarg_putfp = _XMM0 + (num))
+#define jit_prepare_f(num) (_jitl.fprssize += (num),
_jitl.nextarg_putfp = _XMM0 + _jitl.fprssize)
+#define jit_prepare_d(num) (_jitl.fprssize += (num),
_jitl.nextarg_putfp = _XMM0 + _jitl.fprssize)
#else
-#define jit_prepare_f(num) ((num) <= JIT_FP_ARG_MAX ?
(_jitl.nextarg_putfp = _XMM0 + (num)) : JITFAIL("too many float arguments"))
-#define jit_prepare_d(num) ((num) <= JIT_FP_ARG_MAX ?
(_jitl.nextarg_putfp = _XMM0 + (num)) : JITFAIL("too many float arguments"))
+#define jit_prepare_f(num) (_jitl.fprssize += (num) <=
JIT_FP_ARG_MAX ? (_jitl.nextarg_putfp = _XMM0 + _jitl.fprssize) : JITFAIL("too
many float arguments"))
+#define jit_prepare_d(num) (_jitl.fprssize += (num) <=
JIT_FP_ARG_MAX ? (_jitl.nextarg_putfp = _XMM0 + _jitl.fprssize) : JITFAIL("too
many float arguments"))
#endif
#define jit_arg_f() (_XMM0 + _jitl.nextarg_getfp++)
- [Guile-commits] 117/437: Implement x86_64 support for multiple integer and float arguments., (continued)
- [Guile-commits] 117/437: Implement x86_64 support for multiple integer and float arguments., Andy Wingo, 2018/07/02
- [Guile-commits] 105/437: fix 64-bit load with sign extension, Andy Wingo, 2018/07/02
- [Guile-commits] 70/437: add _s32P, Andy Wingo, 2018/07/02
- [Guile-commits] 121/437: Define some extra fp-common macros when sizeof(long) == sizeof(int)., Andy Wingo, 2018/07/02
- [Guile-commits] 77/437: add .gitattributes file, Andy Wingo, 2018/07/02
- [Guile-commits] 44/437: merge some bugfixes, give right meaning to jit_retval_[fd], Andy Wingo, 2018/07/02
- [Guile-commits] 106/437: ldst test update, Andy Wingo, 2018/07/02
- [Guile-commits] 114/437: Change JIT_REXTMP to not clobber 6th argument., Andy Wingo, 2018/07/02
- [Guile-commits] 88/437: move JIT_R1/JIT_R2 to R10/R11 for the x86_64 backend, Andy Wingo, 2018/07/02
- [Guile-commits] 133/437: Correct integer multiplication and add extra test case., Andy Wingo, 2018/07/02
- [Guile-commits] 116/437: Change jit_finish to work with varargs functions in x86_64.,
Andy Wingo <=
- [Guile-commits] 85/437: add (void) casts for C++ compatibility, Andy Wingo, 2018/07/02
- [Guile-commits] 127/437: Extra cleanup before update to new codebase., Andy Wingo, 2018/07/02
- [Guile-commits] 130/437: Add make rule to build test case dependencies., Andy Wingo, 2018/07/02
- [Guile-commits] 125/437: fix multiplication on x86_64, Andy Wingo, 2018/07/02
- [Guile-commits] 102/437: add ldst test, Andy Wingo, 2018/07/02
- [Guile-commits] 131/437: Add proper make clean rule to the check subdir., Andy Wingo, 2018/07/02
- [Guile-commits] 109/437: more fixes to fp branches, Andy Wingo, 2018/07/02
- [Guile-commits] 136/437: Update code to build and pass test cases in the arm port., Andy Wingo, 2018/07/02
- [Guile-commits] 124/437: Also reset alloca_slack after jit_prolog in i386., Andy Wingo, 2018/07/02
- [Guile-commits] 154/437: Correct test cases to work with x87 in ix86., Andy Wingo, 2018/07/02