From 30fdd20f96cd4f09d368b6d8a360aadbd57f07ec Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 26 Sep 2007 00:34:37 -0400 Subject: [PATCH] Update x86 for lazy JIT --- vm/cpu-x86.32.S | 1 + vm/cpu-x86.64.S | 1 + vm/cpu-x86.S | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/vm/cpu-x86.32.S b/vm/cpu-x86.32.S index d8630ce9b3..6233b4a14f 100644 --- a/vm/cpu-x86.32.S +++ b/vm/cpu-x86.32.S @@ -9,6 +9,7 @@ and the callstack top is passed in EDX */ #define XT_REG %ecx #define STACK_REG %esp #define DS_REG %esi +#define RETURN_REG %eax #define CELL_SIZE 4 diff --git a/vm/cpu-x86.64.S b/vm/cpu-x86.64.S index 6cddb7e53b..4e8faa18de 100644 --- a/vm/cpu-x86.64.S +++ b/vm/cpu-x86.64.S @@ -5,6 +5,7 @@ #define XT_REG %rcx #define STACK_REG %rsp #define DS_REG %r14 +#define RETURN_REG %rax #define CELL_SIZE 8 diff --git a/vm/cpu-x86.S b/vm/cpu-x86.S index 3e2a97dd5c..ec5d09291e 100644 --- a/vm/cpu-x86.S +++ b/vm/cpu-x86.S @@ -51,3 +51,15 @@ DEF(FASTCALL void,primitive_execute,(void)): DEF(FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to)): mov ARG1,STACK_REG /* rewind_to */ JUMP_QUOT + +DEF(FASTCALL void,lazy_jit_compile,(CELL quot)): + mov STACK_REG,ARG1 /* Save stack pointer */ + push XT_REG /* Alignment */ + push XT_REG + push XT_REG + call MANGLE(jit_compile) + mov RETURN_REG,ARG0 /* No-op on 32-bit */ + pop XT_REG /* OK to clobber XT_REG here */ + pop XT_REG + pop XT_REG + JUMP_QUOT /* Call the quotation */