Implement jit_frame and jit_tramp interfaces - lightning.git - Portable just-in-time compiler library

index : lightning.git
Portable just-in-time compiler library
summary refs log tree commit diff
path: root/lib/jit_arm-cpu.c
diff options
context:
space:
mode:
authorpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2014年10月14日 17:04:40 -0300
committerpcpa <paulo.cesar.pereira.de.andrade@gmail.com>2014年10月14日 17:04:40 -0300
commit839341a498b7b2077d715c2ca66d3debcddc0c30 (patch)
treec4fa2ea3b8cf6efb33e2fccc2b9bd8e2c750ff58 /lib/jit_arm-cpu.c
parent20a2f1f9c539c6b7509f9a32ef926b9b9dd98cc9 (diff)
downloadlightning-839341a498b7b2077d715c2ca66d3debcddc0c30.tar.gz
Implement jit_frame and jit_tramp interfaces
* include/lightning.h, include/lightning/jit_private.h, lib/jit_aarch64-cpu.c, lib/jit_alpha-cpu.c, lib/jit_arm-cpu.c, lib/jit_hppa-cpu.c, lib/jit_ia64-cpu.c, lib/jit_mips-cpu.c, lib/jit_ppc-cpu.c, lib/jit_s390x-cpu.c, lib/jit_sparc-cpu.c, lib/jit_x86-cpu.c, lib/lightning.c: Implement the new jit_frame and jit_tramp interfaces, that allow writing trampoline like calls, where a single dispatcher jit buffer is written, and later other jit buffers are created, with the same stack frame layout as the dispatcher. This is the logic that GNU Smalltalk used in lightning 1.x, and is required to make a sane port for lighting 2.x. * jit_ia64-cpu.c: Implement support for jit_frame and jit_tramp, and also correct wrong encoding for B4 instructions, that implement jmpr, as well as correct reverse logic in _jmpr, that was moving the branch register to the jump register, and not vice-versa. Also, if a stack frame is to be assumed, always assume it may call a function with up to 8 arguments, regardless of the hint frame argument. * lib/jit_arm.c: Add a new must_align_p() interface to ensure function prologs are always aligned. This condition was previously always true, somewhat by accident, but with jit_tramp it is not guaranteed. * jit_ia64-cpu.c: lib/jit_ppc.c: Add minor special handling required to implement jit_tramp, where a function descriptor should not be added before a prolog, as jit_tramp means omit prolog. * check/lightning.c: Update test driver for the new interfaces. * check/Makefile.am, check/tramp.tst, check/tramp.ok: Add a simple test and example of the jit_frame and jit_tramp usage implementing a simple Fibonacci function using a simulation of an interpreter stack and how it would handle state in language specific variables. * doc/body.texi: Add documentation for jit_frame and jit_tramp.
Diffstat (limited to 'lib/jit_arm-cpu.c')
-rw-r--r--lib/jit_arm-cpu.c 12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/jit_arm-cpu.c b/lib/jit_arm-cpu.c
index 1be40b5..02edeed 100644
--- a/lib/jit_arm-cpu.c
+++ b/lib/jit_arm-cpu.c
@@ -3694,6 +3694,16 @@ _calli_p(jit_state_t *_jit, jit_word_t i0)
static void
_prolog(jit_state_t *_jit, jit_node_t *node)
{
+ if (_jitc->function->define_frame || _jitc->function->assume_frame) {
+ jit_int32_t frame = -_jitc->function->frame;
+ assert(_jitc->function->self.aoff >= frame);
+ if (_jitc->function->assume_frame) {
+ if (jit_thumb_p() && !_jitc->thumb)
+ _jitc->thumb = _jit->pc.w;
+ return;
+ }
+ _jitc->function->self.aoff = frame;
+ }
_jitc->function->stack = ((_jitc->function->self.alen -
/* align stack at 8 bytes */
_jitc->function->self.aoff) + 7) & -8;
@@ -3732,6 +3742,8 @@ _prolog(jit_state_t *_jit, jit_node_t *node)
static void
_epilog(jit_state_t *_jit, jit_node_t *node)
{
+ if (_jitc->function->assume_frame)
+ return;
addi(_SP_REGNO, _FP_REGNO, 16);
if (jit_cpu.abi)
VPOP_F64(_D8_REGNO, 8);
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月13日 11:58:26 +0000

AltStyle によって変換されたページ (->オリジナル) /