fix --enable-jitframe for platforms that use libunwind
This commit is contained in:
parent
0d870fb11c
commit
5c641919a6
|
@ -246,7 +246,7 @@ Scheme_Object *scheme_jit_continuation_apply_install(Apply_LWC_Args *args) XFORM
|
|||
next_new_fp = NULL;
|
||||
}
|
||||
|
||||
/* fixups of local variables in the fraame */
|
||||
/* fixups of local variables in the frame */
|
||||
#if defined(JIT_X86_64) || defined(JIT_X86_PLAIN)
|
||||
new_fp[-4] = (void *)((intptr_t)new_fp[-4] + cm_delta); /* LOCAL1 */
|
||||
#endif
|
||||
|
|
|
@ -975,7 +975,7 @@ void scheme_jit_prolog_again(mz_jit_state *jitter, int n, int ret_addr_reg)
|
|||
# endif
|
||||
# ifdef MZ_PROLOG_CREATE_FULL_STACK_FRAME
|
||||
/* Make the internal ABI the same as the main call ABI */
|
||||
# define MZ_LOCAL_FRAME_SIZE 8
|
||||
# define MZ_LOCAL_FRAME_SIZE (LOCAL_FRAME_SIZE+3)
|
||||
# define mz_prolog(x) (PUSHQr(_EBP), \
|
||||
mz_get_local_p((x), JIT_LOCAL3), \
|
||||
MOVQrr(_ESP, _EBP), \
|
||||
|
|
|
@ -159,6 +159,33 @@ static void set_cache(void *p, Scheme_Object *last)
|
|||
((void **)p)[RETURN_ADDRESS_OFFSET] = sjc.stack_cache_pop_code;
|
||||
}
|
||||
|
||||
#ifdef MZ_USE_DWARF_LIBUNWIND
|
||||
static int manual_unw_step(unw_cursor_t *c, uintptr_t stack_start, uintptr_t stack_end) {
|
||||
void **pp;
|
||||
unw_word_t stack_addr;
|
||||
|
||||
pp = (void **)unw_get_frame_pointer(c);
|
||||
if (!(STK_COMP((uintptr_t)pp, stack_end)
|
||||
&& STK_COMP(stack_start, (uintptr_t)pp)))
|
||||
return 0;
|
||||
|
||||
# ifdef MZ_USE_JIT_ARM
|
||||
stack_addr = (unw_word_t)&(pp[JIT_NEXT_FP_OFFSET+2]);
|
||||
unw_manual_step(c,
|
||||
&pp[RETURN_ADDRESS_OFFSET], &stack_addr,
|
||||
&pp[0], &pp[1], &pp[2], &pp[3],
|
||||
&pp[4], &pp[5], &pp[6], &pp[7],
|
||||
&pp[NEXT_FRAME_OFFSET]);
|
||||
# else
|
||||
stack_addr = (unw_word_t)&(pp[RETURN_ADDRESS_OFFSET+1]);
|
||||
unw_manual_step(c, &pp[RETURN_ADDRESS_OFFSET], &pp[0],
|
||||
&stack_addr, &pp[-1], &pp[-2], &pp[-3]);
|
||||
# endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
Scheme_Object *scheme_native_stack_trace(void)
|
||||
{
|
||||
void *p, *q, *cache_frame_p, *set_cache_sp = NULL;
|
||||
|
@ -169,7 +196,6 @@ Scheme_Object *scheme_native_stack_trace(void)
|
|||
unw_context_t cx;
|
||||
unw_cursor_t c;
|
||||
int manual_unw = 0;
|
||||
unw_word_t stack_addr;
|
||||
#else
|
||||
Get_Stack_Proc gs;
|
||||
#endif
|
||||
|
@ -388,6 +414,10 @@ Scheme_Object *scheme_native_stack_trace(void)
|
|||
/* np is the actual stack frame */
|
||||
p = np;
|
||||
q = ((void **)p)[RETURN_ADDRESS_OFFSET];
|
||||
# ifdef MZ_USE_DWARF_LIBUNWIND
|
||||
if (!manual_unw_step(&c, stack_start, stack_end))
|
||||
q = NULL;
|
||||
# endif
|
||||
#else
|
||||
# ifdef MZ_USE_JIT_I386
|
||||
/* Push after local stack of return-address proc
|
||||
|
@ -484,24 +514,9 @@ Scheme_Object *scheme_native_stack_trace(void)
|
|||
if (use_unw) {
|
||||
if (manual_unw) {
|
||||
/* A JIT-generated function, so we unwind ourselves... */
|
||||
void **pp;
|
||||
pp = (void **)unw_get_frame_pointer(&c);
|
||||
if (!(STK_COMP((uintptr_t)pp, stack_end)
|
||||
&& STK_COMP(stack_start, (uintptr_t)pp)))
|
||||
break;
|
||||
# ifdef MZ_USE_JIT_ARM
|
||||
stack_addr = (unw_word_t)&(pp[JIT_NEXT_FP_OFFSET+2]);
|
||||
unw_manual_step(&c,
|
||||
&pp[RETURN_ADDRESS_OFFSET], &stack_addr,
|
||||
&pp[0], &pp[1], &pp[2], &pp[3],
|
||||
&pp[4], &pp[5], &pp[6], &pp[7],
|
||||
&pp[NEXT_FRAME_OFFSET]);
|
||||
# else
|
||||
stack_addr = (unw_word_t)&(pp[RETURN_ADDRESS_OFFSET+1]);
|
||||
unw_manual_step(&c, &pp[RETURN_ADDRESS_OFFSET], &pp[0],
|
||||
&stack_addr, &pp[-1], &pp[-2], &pp[-3]);
|
||||
# endif
|
||||
manual_unw = 0;
|
||||
if (!manual_unw_step(&c, stack_start, stack_end))
|
||||
break;
|
||||
manual_unw = 0;
|
||||
} else {
|
||||
unw_step(&c);
|
||||
q = (void *)unw_get_ip(&c);
|
||||
|
|
Loading…
Reference in New Issue
Block a user