[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/20: Account for saved return address when locating ar
From: |
Andy Wingo |
Subject: |
[Guile-commits] 02/20: Account for saved return address when locating args |
Date: |
Sun, 28 Apr 2019 07:54:18 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit 89fd69fc00873f4ef4408fc829fcc659491f5b7f
Author: Andy Wingo <address@hidden>
Date: Fri Apr 26 14:38:29 2019 +0200
Account for saved return address when locating args
Also, fix alignment to be in bytes rather than bits. Oops!
---
lightening/lightening.c | 20 +++++++++++++++++---
lightening/x86.c | 6 +++++-
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/lightening/lightening.c b/lightening/lightening.c
index 4d7888c..365bdb6 100644
--- a/lightening/lightening.c
+++ b/lightening/lightening.c
@@ -68,12 +68,26 @@ struct jit_state
# define UNLIKELY(exprn) exprn
#endif
+enum stack_state
+{
+ BEFORE_CALL,
+ AFTER_CALL
+};
+
static jit_bool_t jit_get_cpu(void);
static jit_bool_t jit_init(jit_state_t *);
static void jit_flush(void *fptr, void *tptr);
static void jit_try_shorten(jit_state_t *_jit, jit_reloc_t reloc,
jit_pointer_t addr);
+struct abi_arg_iterator;
+
+static void reset_abi_arg_iterator(struct abi_arg_iterator *iter, size_t argc,
+ const jit_operand_t *args,
+ enum stack_state state);
+static void next_abi_arg(struct abi_arg_iterator *iter,
+ jit_operand_t *arg);
+
jit_bool_t
init_jit(void)
{
@@ -830,7 +844,7 @@ jit_align_stack(jit_state_t *_jit, size_t expand)
size_t new_size = _jit->frame_size + expand;
// Align stack to double-word boundaries. This isn't really a
// principle but it does work for Aarch32, AArch64 and x86-64.
- size_t alignment = __WORDSIZE * 2;
+ size_t alignment = __WORDSIZE / 8 * 2;
size_t aligned_size = (new_size + alignment - 1) & ~(alignment - 1);
size_t diff = aligned_size - _jit->frame_size;
if (diff)
@@ -855,7 +869,7 @@ prepare_call_args(jit_state_t *_jit, size_t argc,
jit_operand_t args[])
struct abi_arg_iterator iter;
// Compute shuffle destinations and space for spilled arguments.
- reset_abi_arg_iterator(&iter, argc, args);
+ reset_abi_arg_iterator(&iter, argc, args, BEFORE_CALL);
for (size_t i = 0; i < argc; i++)
next_abi_arg(&iter, &dst[i]);
@@ -908,7 +922,7 @@ jit_locate_args(jit_state_t *_jit, size_t argc,
jit_operand_t args[])
{
struct abi_arg_iterator iter;
- reset_abi_arg_iterator(&iter, argc, args);
+ reset_abi_arg_iterator(&iter, argc, args, AFTER_CALL);
for (size_t i = 0; i < argc; i++)
next_abi_arg(&iter, &args[i]);
}
diff --git a/lightening/x86.c b/lightening/x86.c
index 4031bb1..79f9824 100644
--- a/lightening/x86.c
+++ b/lightening/x86.c
@@ -315,11 +315,15 @@ round_size_up_to_words(size_t bytes)
static void
reset_abi_arg_iterator(struct abi_arg_iterator *iter, size_t argc,
- const jit_operand_t *args)
+ const jit_operand_t *args, enum stack_state state)
{
memset(iter, 0, sizeof *iter);
iter->argc = argc;
iter->args = args;
+ if (state == AFTER_CALL)
+ iter->stack_size = __WORDSIZE / 8; // Saved return address.
+ else
+ ASSERT(state == BEFORE_CALL);
}
static void
- [Guile-commits] 14/20: Add {enter,leave}_jit_abi calls in tests, (continued)
- [Guile-commits] 14/20: Add {enter,leave}_jit_abi calls in tests, Andy Wingo, 2019/04/28
- [Guile-commits] 09/20: Remove most __X64_32 code, Andy Wingo, 2019/04/28
- [Guile-commits] 10/20: Add facility to enter and leave JIT ABI, Andy Wingo, 2019/04/28
- [Guile-commits] 03/20: Fix lightening to compile on 32-bit x86, Andy Wingo, 2019/04/28
- [Guile-commits] 13/20: Fix ABI of arg to extr_d_f test, Andy Wingo, 2019/04/28
- [Guile-commits] 12/20: Fix jit_leave_jit_abi to pop correct registers, Andy Wingo, 2019/04/28
- [Guile-commits] 08/20: Simplify 64/32 concerns in x86-cpu.c, Andy Wingo, 2019/04/28
- [Guile-commits] 07/20: Make jit_cpu private, Andy Wingo, 2019/04/28
- [Guile-commits] 11/20: Small bug fixes for ia32, Andy Wingo, 2019/04/28
- [Guile-commits] 01/20: Inline some internal definitions into backend-specific files, Andy Wingo, 2019/04/28
- [Guile-commits] 02/20: Account for saved return address when locating args,
Andy Wingo <=
- [Guile-commits] 05/20: Fix compile warnings for 32-bit tests, Andy Wingo, 2019/04/28
- [Guile-commits] 06/20: Fix 32-bit movi_d, Andy Wingo, 2019/04/28