summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/lightning/i386
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/i386
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/i386')
-rw-r--r--src/runtime/c/pgf/lightning/i386/core-32.h10
1 files changed, 10 insertions, 0 deletions
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))