throw_impl now forwards the vm ptr

db4
Phil Dawes 2009-08-19 19:40:09 +01:00
parent 4afc16e95b
commit 465f06ebc2
7 changed files with 29 additions and 16 deletions

View File

@ -79,6 +79,19 @@ DEF(void,set_x87_env,(const void*)):
fldcw 2(%eax) fldcw 2(%eax)
ret ret
DEF(F_FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to, void *vm)):
mov CELL_SIZE(STACK_REG),NV_TEMP_REG /* stash vm ptr */
/* clear x87 stack, but preserve rounding mode and exception flags */
sub $2,STACK_REG
fnstcw (STACK_REG)
fninit
fldcw (STACK_REG)
/* rewind_to */
mov ARG1,STACK_REG
mov NV_TEMP_REG,ARG1
jmp *QUOT_XT_OFFSET(ARG0)
#include "cpu-x86.S" #include "cpu-x86.S"
#ifdef WINDOWS #ifdef WINDOWS

View File

@ -88,6 +88,7 @@ DEF(void,primitive_inline_cache_miss_tail,(void)):
add $STACK_PADDING,%rsp add $STACK_PADDING,%rsp
jmp *%rax jmp *%rax
<<<<<<< HEAD
DEF(void,get_sse_env,(void*)): DEF(void,get_sse_env,(void*)):
stmxcsr (%rdi) stmxcsr (%rdi)
ret ret
@ -106,4 +107,14 @@ DEF(void,set_x87_env,(const void*)):
fldcw 2(%rdi) fldcw 2(%rdi)
ret ret
DEF(F_FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to, void *vm)):
/* clear x87 stack, but preserve rounding mode and exception flags */
sub $2,STACK_REG
fnstcw (STACK_REG)
fninit
fldcw (STACK_REG)
/* rewind_to */
mov ARG1,STACK_REG
jmp *QUOT_XT_OFFSET(ARG0)
#include "cpu-x86.S" #include "cpu-x86.S"

View File

@ -37,7 +37,6 @@ multiply_overflow:
DEF(F_FASTCALL void,c_to_factor,(CELL quot, void *vm)): DEF(F_FASTCALL void,c_to_factor,(CELL quot, void *vm)):
PUSH_NONVOLATILE PUSH_NONVOLATILE
mov ARG0,NV_TEMP_REG mov ARG0,NV_TEMP_REG
//mov $35,ARG1
/* Create register shadow area for Win64 */ /* Create register shadow area for Win64 */
sub $32,STACK_REG sub $32,STACK_REG
@ -57,16 +56,6 @@ DEF(F_FASTCALL void,c_to_factor,(CELL quot, void *vm)):
POP_NONVOLATILE POP_NONVOLATILE
ret ret
DEF(F_FASTCALL void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to)):
/* clear x87 stack, but preserve rounding mode and exception flags */
sub $2,STACK_REG
fnstcw (STACK_REG)
fninit
fldcw (STACK_REG)
/* rewind_to */
mov ARG1,STACK_REG
jmp *QUOT_XT_OFFSET(ARG0)
DEF(F_FASTCALL void,lazy_jit_compile,(CELL quot, void *vm)): DEF(F_FASTCALL void,lazy_jit_compile,(CELL quot, void *vm)):
mov ARG1,NV_TEMP_REG /* stash vm ptr */ mov ARG1,NV_TEMP_REG /* stash vm ptr */
mov STACK_REG,ARG1 /* Save stack pointer */ mov STACK_REG,ARG1 /* Save stack pointer */

View File

@ -70,7 +70,7 @@ inline static unsigned int fpu_status(unsigned int status)
/* Defined in assembly */ /* Defined in assembly */
VM_ASM_API void c_to_factor(cell quot,void *vm); VM_ASM_API void c_to_factor(cell quot,void *vm);
VM_ASM_API void throw_impl(cell quot, stack_frame *rewind_to); VM_ASM_API void throw_impl(cell quot, stack_frame *rewind_to, void *vm);
VM_ASM_API void lazy_jit_compile(cell quot, void *vm); VM_ASM_API void lazy_jit_compile(cell quot, void *vm);
VM_C_API void set_callstack(stack_frame *to, VM_C_API void set_callstack(stack_frame *to,

View File

@ -78,7 +78,7 @@ void factorvm::throw_error(cell error, stack_frame *callstack_top)
else else
callstack_top = stack_chain->callstack_top; callstack_top = stack_chain->callstack_top;
throw_impl(userenv[BREAK_ENV],callstack_top); throw_impl(userenv[BREAK_ENV],callstack_top,this);
} }
/* Error was thrown in early startup before error handler is set, just /* Error was thrown in early startup before error handler is set, just
crash. */ crash. */
@ -167,7 +167,7 @@ void factorvm::fp_trap_error(unsigned int fpu_status, stack_frame *signal_callst
inline void factorvm::vmprim_call_clear() inline void factorvm::vmprim_call_clear()
{ {
throw_impl(dpop(),stack_chain->callstack_bottom); throw_impl(dpop(),stack_chain->callstack_bottom,this);
} }
PRIMITIVE(call_clear) PRIMITIVE(call_clear)

View File

@ -370,7 +370,7 @@ cell factorvm::lazy_jit_compile_impl(cell quot_, stack_frame *stack)
VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack, factorvm *myvm) VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack, factorvm *myvm)
{ {
return vm->lazy_jit_compile_impl(quot_,stack); return VM_PTR->lazy_jit_compile_impl(quot_,stack);
} }
inline void factorvm::vmprim_quot_compiled_p() inline void factorvm::vmprim_quot_compiled_p()