Major rewrite of error handling to allow external/internal unwinding.

Make external unwinding the default on x64.
It's mandatory on WIN64 due to the abundance of callee-saved regs.
Allow piecewise internal frame unwinding and optional cleanup.
Store ERRMEM, ERRERR and ERRCPP early and copy down later.
Use FRAME_CP for lj_vm_resume.
Add lj_vm_unwind_*_eh variants as landing pads for external unwinder.
Use fastcall for lj_vm_unwind_*.
Can drop r12/r13 saves in POSIX/x64 interpreter now.
This commit is contained in:
Mike Pall
2010-01-02 17:42:11 +01:00
parent 8fc9430d06
commit 93ee10642e
6 changed files with 1149 additions and 1009 deletions

View File

@@ -15,8 +15,10 @@ typedef TValue *(*lua_CPFunction)(lua_State *L, lua_CFunction func, void *ud);
LJ_ASMF int lj_vm_cpcall(lua_State *L, lua_CFunction func, void *ud,
lua_CPFunction cp);
LJ_ASMF int lj_vm_resume(lua_State *L, TValue *base, int nres1, ptrdiff_t ef);
LJ_ASMF_NORET void lj_vm_unwind_c(void *cframe, int errcode);
LJ_ASMF_NORET void lj_vm_unwind_ff(void *cframe);
LJ_ASMF_NORET void LJ_FASTCALL lj_vm_unwind_c(void *cframe, int errcode);
LJ_ASMF_NORET void LJ_FASTCALL lj_vm_unwind_ff(void *cframe);
LJ_ASMF void lj_vm_unwind_c_eh(void);
LJ_ASMF void lj_vm_unwind_ff_eh(void);
/* Miscellaneous functions. */
#if LJ_TARGET_X86ORX64