[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 78/86: Clean up stack after calls
From: |
Andy Wingo |
Subject: |
[Guile-commits] 78/86: Clean up stack after calls |
Date: |
Wed, 3 Apr 2019 11:39:04 -0400 (EDT) |
wingo pushed a commit to branch lightening
in repository guile.
commit 573af9c19b5e8156ca27413d6f3ed6ef462a2031
Author: Andy Wingo <address@hidden>
Date: Wed Apr 3 12:09:38 2019 +0200
Clean up stack after calls
---
jit.h | 2 +-
jit/x86.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/jit.h b/jit.h
index ba8079d..67e1074 100644
--- a/jit.h
+++ b/jit.h
@@ -170,7 +170,7 @@ JIT_API void jit_patch_here(jit_state_t*, jit_reloc_t);
JIT_API void jit_patch_there(jit_state_t*, jit_reloc_t, jit_pointer_t);
/* Note that all functions that take jit_arg_t args[] use the args as scratch
- space. */
+ space while shuffling values into position. */
JIT_API void jit_calli(jit_state_t *, jit_pointer_t f,
size_t argc, const jit_arg_abi_t abi[],
jit_arg_t args[]);
diff --git a/jit/x86.c b/jit/x86.c
index d965afe..16bb518 100644
--- a/jit/x86.c
+++ b/jit/x86.c
@@ -735,6 +735,22 @@ prepare_args(jit_state_t *_jit, size_t argc, const
jit_arg_abi_t abi[],
}
}
+static void
+cleanup_stack_after_call(jit_state_t *_jit, size_t argc,
+ const jit_arg_abi_t abi[])
+{
+ jit_arg_t scratch;
+ struct abi_arg_iterator iter;
+
+ // Compute stack arg size.
+ reset_abi_arg_iterator(&iter, argc, abi);
+ for (size_t i = 0; i < argc; i++)
+ next_abi_arg(&iter, &scratch);
+
+ if (iter.stack_size)
+ jit_addi(_jit, JIT_SP, JIT_SP, iter.stack_size);
+}
+
void
jit_calli(jit_state_t *_jit, jit_pointer_t f,
size_t argc, const jit_arg_abi_t abi[], jit_arg_t args[])
@@ -742,6 +758,8 @@ jit_calli(jit_state_t *_jit, jit_pointer_t f,
prepare_args(_jit, argc, abi, args);
calli(_jit, (jit_word_t)f);
+
+ cleanup_stack_after_call(_jit, argc, abi);
}
void
@@ -751,6 +769,8 @@ jit_callr(jit_state_t *_jit, jit_gpr_t f,
prepare_args(_jit, argc, abi, args);
callr(_jit, rn(f));
+
+ cleanup_stack_after_call(_jit, argc, abi);
}
void
- [Guile-commits] 55/86: Add .gitlab-ci.yml, (continued)
- [Guile-commits] 55/86: Add .gitlab-ci.yml, Andy Wingo, 2019/04/03
- [Guile-commits] 43/86: Rework naming of test suite files, Andy Wingo, 2019/04/03
- [Guile-commits] 48/86: Add ldi tests, Andy Wingo, 2019/04/03
- [Guile-commits] 57/86: Fix stxi_d bug, Andy Wingo, 2019/04/03
- [Guile-commits] 49/86: Add ldxr tests, Andy Wingo, 2019/04/03
- [Guile-commits] 61/86: Add int/int reg/imm compare-and-branch tests, Andy Wingo, 2019/04/03
- [Guile-commits] 63/86: Add unordered float compare-and-branch tests, Andy Wingo, 2019/04/03
- [Guile-commits] 53/86: Add stxr tests, Andy Wingo, 2019/04/03
- [Guile-commits] 56/86: Tweak test build to run faster, and adapt CI, Andy Wingo, 2019/04/03
- [Guile-commits] 40/86: Add bitops tests, Andy Wingo, 2019/04/03
- [Guile-commits] 78/86: Clean up stack after calls,
Andy Wingo <=
- [Guile-commits] 75/86: get_temp_{gpr, xpr} returns a jit_{gpr, fpr}_t, Andy Wingo, 2019/04/03
- [Guile-commits] 66/86: Add sub-and-branch-on-overflow tests, Andy Wingo, 2019/04/03
- [Guile-commits] 73/86: Add movi_[df] tests, Andy Wingo, 2019/04/03
- [Guile-commits] 64/86: Add flag-checking test-and-branch tests, Andy Wingo, 2019/04/03
- [Guile-commits] 69/86: Add abs/sqrt tests, Andy Wingo, 2019/04/03
- [Guile-commits] 67/86: Add some nop and jmp tests, and fix a hazard with jmpi/calli, Andy Wingo, 2019/04/03
- [Guile-commits] 62/86: Add anti-float comparison tests, Andy Wingo, 2019/04/03
- [Guile-commits] 51/86: Add str tests, Andy Wingo, 2019/04/03
- [Guile-commits] 58/86: Add bltr test, Andy Wingo, 2019/04/03
- [Guile-commits] 65/86: Add add-and-branch-on-overflow tests, Andy Wingo, 2019/04/03