summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/lightning
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-09-11 15:39:39 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-09-11 15:39:39 +0000
commit621d748bac0914a93e3d399f81616c70fd083bb5 (patch)
tree60f1f5ee5be58c9a26adb24d0a185766d9f1b20b /src/runtime/c/pgf/lightning
parent18ee232497cea462434359cdd759e20321a2b750 (diff)
a major revision of the bytecode generator and JIT compiler. the effect is that now we can compute with lambda functions and with true tail recursion
Diffstat (limited to 'src/runtime/c/pgf/lightning')
-rw-r--r--src/runtime/c/pgf/lightning/core-common.h6
-rw-r--r--src/runtime/c/pgf/lightning/i386/core-32.h10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/runtime/c/pgf/lightning/core-common.h b/src/runtime/c/pgf/lightning/core-common.h
index b60f0bf31..04dbb2c7b 100644
--- a/src/runtime/c/pgf/lightning/core-common.h
+++ b/src/runtime/c/pgf/lightning/core-common.h
@@ -474,6 +474,12 @@ typedef union jit_code {
#endif
#endif
+#ifndef jit_setarg_p
+#ifdef JIT_FP
+#define jit_setarg_p(reg, ofs) jit_stxi_p((ofs), JIT_FP, (reg));
+#endif
+#endif
+
/* Common definitions when sizeof(long) = sizeof(int) */
#ifndef jit_addi_l
diff --git a/src/runtime/c/pgf/lightning/i386/core-32.h b/src/runtime/c/pgf/lightning/i386/core-32.h
index 9b1810761..561fab5fb 100644
--- a/src/runtime/c/pgf/lightning/i386/core-32.h
+++ b/src/runtime/c/pgf/lightning/i386/core-32.h
@@ -108,6 +108,16 @@ struct jit_local_state {
#define jit_finish(sub) (_jitl.finish_ref = jit_calli((sub)), ADDLir(sizeof(long) * _jitl.argssize, JIT_SP), _jitl.argssize = 0, _jitl.finish_ref)
#define jit_finishr(reg) (jit_callr((reg)), ADDLir(sizeof(long) * _jitl.argssize, JIT_SP), _jitl.argssize = 0)
+#ifdef __APPLE__
+#define jit_tail_finishr(reg) jit_base_tail_finishr(-12, reg)
+#else
+#define jit_tail_finishr(reg) jit_base_tail_finishr(_jitl.alloca_offset, reg)
+#endif
+
+#define jit_base_tail_finishr(ofs, reg) \
+ (((ofs) < 0 ? LEAVE_() : POPLr(_EBP)), \
+ POPLr(_EDI), POPLr(_ESI), POPLr(_EBX), jit_jmpr(reg))
+
#define jit_arg_c() ((_jitl.framesize += sizeof(int)) - sizeof(int))
#define jit_arg_uc() ((_jitl.framesize += sizeof(int)) - sizeof(int))
#define jit_arg_s() ((_jitl.framesize += sizeof(int)) - sizeof(int))