diff options
author | Mike Pall <mike> | 2011-10-24 16:02:37 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-10-24 16:11:38 +0200 |
commit | a0d782755482483c09e919a51c396322dd228bf2 (patch) | |
tree | bf599dfa722e463593f44f9f8647fb75b4618381 /src/lj_trace.c | |
parent | 84683405fbacad0938a953d9654bec27ac75d565 (diff) | |
download | luajit-a0d782755482483c09e919a51c396322dd228bf2.tar.gz luajit-a0d782755482483c09e919a51c396322dd228bf2.tar.bz2 luajit-a0d782755482483c09e919a51c396322dd228bf2.zip |
Generalize handling of stack checks indicated by highest exit + 1.
Diffstat (limited to 'src/lj_trace.c')
-rw-r--r-- | src/lj_trace.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/lj_trace.c b/src/lj_trace.c index f907a77f..9645ecba 100644 --- a/src/lj_trace.c +++ b/src/lj_trace.c | |||
@@ -727,14 +727,8 @@ static TraceNo trace_exit_find(jit_State *J, MCode *pc) | |||
727 | TraceNo traceno; | 727 | TraceNo traceno; |
728 | for (traceno = 1; traceno < J->sizetrace; traceno++) { | 728 | for (traceno = 1; traceno < J->sizetrace; traceno++) { |
729 | GCtrace *T = traceref(J, traceno); | 729 | GCtrace *T = traceref(J, traceno); |
730 | if (T && pc >= T->mcode && pc < (MCode *)((char *)T->mcode + T->szmcode)) { | 730 | if (T && pc >= T->mcode && pc < (MCode *)((char *)T->mcode + T->szmcode)) |
731 | if (J->exitno == T->nsnap) { /* Treat stack check like a parent exit. */ | ||
732 | lua_assert(T->root != 0); | ||
733 | traceno = T->ir[REF_BASE].op1; | ||
734 | J->exitno = T->ir[REF_BASE].op2; | ||
735 | } | ||
736 | return traceno; | 731 | return traceno; |
737 | } | ||
738 | } | 732 | } |
739 | lua_assert(0); | 733 | lua_assert(0); |
740 | return 0; | 734 | return 0; |
@@ -751,11 +745,20 @@ int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr) | |||
751 | int errcode; | 745 | int errcode; |
752 | const BCIns *pc; | 746 | const BCIns *pc; |
753 | void *cf; | 747 | void *cf; |
748 | GCtrace *T; | ||
754 | #ifdef EXITSTATE_PCREG | 749 | #ifdef EXITSTATE_PCREG |
755 | J->parent = trace_exit_find(J, (MCode *)(intptr_t)ex->gpr[EXITSTATE_PCREG]); | 750 | J->parent = trace_exit_find(J, (MCode *)(intptr_t)ex->gpr[EXITSTATE_PCREG]); |
756 | #endif | 751 | #endif |
757 | lua_assert(traceref(J, J->parent) != NULL && | 752 | T = traceref(J, J->parent); UNUSED(T); |
758 | J->exitno < traceref(J, J->parent)->nsnap); | 753 | #ifdef EXITSTATE_CHECKEXIT |
754 | if (J->exitno == T->nsnap) { /* Treat stack check like a parent exit. */ | ||
755 | lua_assert(T->root != 0); | ||
756 | J->exitno = T->ir[REF_BASE].op2; | ||
757 | J->parent = T->ir[REF_BASE].op1; | ||
758 | T = traceref(J, J->parent); | ||
759 | } | ||
760 | #endif | ||
761 | lua_assert(T != NULL && J->exitno < T->nsnap); | ||
759 | exd.J = J; | 762 | exd.J = J; |
760 | exd.exptr = exptr; | 763 | exd.exptr = exptr; |
761 | errcode = lj_vm_cpcall(L, NULL, &exd, trace_exit_cp); | 764 | errcode = lj_vm_cpcall(L, NULL, &exd, trace_exit_cp); |