Fix crash if GC runs during lazy_jit_compile

release
Slava Pestov 2007-09-26 00:34:10 -04:00
parent f400729792
commit 99a42aa089
5 changed files with 9 additions and 6 deletions

View File

@ -173,9 +173,7 @@ DEF(void,throw_impl,(CELL quot, F_STACK_FRAME *rewind_to)):
DEF(void,lazy_jit_compile,(CELL quot)): DEF(void,lazy_jit_compile,(CELL quot)):
mr r4,r1 /* save stack pointer */ mr r4,r1 /* save stack pointer */
PROLOGUE PROLOGUE
SAVE(r3,18) /* save quot */
bl MANGLE(jit_compile) bl MANGLE(jit_compile)
RESTORE(r3,18)
EPILOGUE EPILOGUE
JUMP_QUOT /* call the quotation */ JUMP_QUOT /* call the quotation */

View File

@ -20,7 +20,7 @@ and the callstack top is passed in EDX */
pop %ebp ; \ pop %ebp ; \
pop %ebx pop %ebx
#define QUOT_XT_OFFSET 5 #define QUOT_XT_OFFSET 9
#define PROFILING_OFFSET 25 #define PROFILING_OFFSET 25
#define WORD_DEF_OFFSET 13 #define WORD_DEF_OFFSET 13
#define WORD_XT_OFFSET 29 #define WORD_XT_OFFSET 29

View File

@ -20,7 +20,7 @@
pop %rbp ; \ pop %rbp ; \
pop %rbx pop %rbx
#define QUOT_XT_OFFSET 13 #define QUOT_XT_OFFSET 21
#define PROFILING_OFFSET 53 #define PROFILING_OFFSET 53
#define WORD_DEF_OFFSET 29 #define WORD_DEF_OFFSET 29
#define WORD_XT_OFFSET 61 #define WORD_XT_OFFSET 61

View File

@ -34,10 +34,12 @@ bool jit_stack_frame_p(F_ARRAY *array)
return false; return false;
} }
FASTCALL void jit_compile(CELL tagged, F_STACK_FRAME *stack) FASTCALL CELL jit_compile(CELL tagged, F_STACK_FRAME *stack)
{ {
stack_chain->callstack_top = stack; stack_chain->callstack_top = stack;
REGISTER_ROOT(tagged);
F_QUOTATION *quot = untag_quotation(tagged); F_QUOTATION *quot = untag_quotation(tagged);
F_ARRAY *array = untag_object(quot->array); F_ARRAY *array = untag_object(quot->array);
@ -154,6 +156,9 @@ FASTCALL void jit_compile(CELL tagged, F_STACK_FRAME *stack)
UNREGISTER_UNTAGGED(quot); UNREGISTER_UNTAGGED(quot);
quot->xt = xt; quot->xt = xt;
quot->compiled = T; quot->compiled = T;
UNREGISTER_ROOT(tagged);
return tagged;
} }
XT quot_offset_to_pc(F_QUOTATION *quot, F_FIXNUM offset) XT quot_offset_to_pc(F_QUOTATION *quot, F_FIXNUM offset)

View File

@ -1,2 +1,2 @@
DLLEXPORT FASTCALL void jit_compile(CELL tagged, F_STACK_FRAME *stack); DLLEXPORT FASTCALL CELL jit_compile(CELL tagged, F_STACK_FRAME *stack);
XT quot_offset_to_pc(F_QUOTATION *quot, F_FIXNUM offset); XT quot_offset_to_pc(F_QUOTATION *quot, F_FIXNUM offset);