From c2924c3e1d17ffe469a654233481d7be1248d7e0 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 28 Apr 2015 20:46:59 +0200 Subject: Disable trace stitching (for now) due to a design mistake. Thanks to Elias Hogstvedt for finding a test case for a well known, but hard to track down issue with trace stitching. --- src/lj_ffrecord.c | 32 ++++++++++++++++++++++++++++++++ src/lj_traceerr.h | 2 ++ 2 files changed, 34 insertions(+) (limited to 'src') diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index e17f6818..318329d0 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c @@ -96,6 +96,13 @@ static ptrdiff_t results_wanted(jit_State *J) return -1; } +#ifdef LUAJIT_TRACE_STITCHING +/* This feature is disabled for now due to a design mistake. Sorry. +** +** It causes unpredictable behavior and crashes when a full trace flush +** happens with a stitching continuation still in the stack somewhere. +*/ + /* Trace stitching: add continuation below frame to start a new trace. */ static void recff_stitch(jit_State *J) { @@ -174,6 +181,31 @@ static void LJ_FASTCALL recff_nyi(jit_State *J, RecordFFData *rd) /* Must stop the trace for classic C functions with arbitrary side-effects. */ #define recff_c recff_nyi +#else +/* Fallback handler for fast functions that are not recorded (yet). */ +LJ_NORET static void recff_nyi(jit_State *J, RecordFFData *rd) +{ + setfuncV(J->L, &J->errinfo, J->fn); + lj_trace_err_info(J, LJ_TRERR_NYIFF); + UNUSED(rd); +} + +/* Throw error for unsupported variant of fast function. */ +LJ_NORET static void recff_nyiu(jit_State *J, RecordFFData *rd) +{ + setfuncV(J->L, &J->errinfo, J->fn); + lj_trace_err_info(J, LJ_TRERR_NYIFFU); + UNUSED(rd); +} + +/* Must abort the trace for classic C functions with arbitrary side-effects. */ +LJ_NORET static void recff_c(jit_State *J, RecordFFData *rd) +{ + setfuncV(J->L, &J->errinfo, J->fn); + lj_trace_err_info(J, LJ_TRERR_NYICF); + UNUSED(rd); +} +#endif /* Emit BUFHDR for the global temporary buffer. */ static TRef recff_bufhdr(jit_State *J) diff --git a/src/lj_traceerr.h b/src/lj_traceerr.h index 6b377cb0..5a2fe8bb 100644 --- a/src/lj_traceerr.h +++ b/src/lj_traceerr.h @@ -24,6 +24,8 @@ TREDEF(BADTYPE, "bad argument type") TREDEF(CJITOFF, "JIT compilation disabled for function") TREDEF(CUNROLL, "call unroll limit reached") TREDEF(DOWNREC, "down-recursion, restarting") +TREDEF(NYICF, "NYI: C function %p") +TREDEF(NYIFF, "NYI: FastFunc %s") TREDEF(NYIFFU, "NYI: unsupported variant of FastFunc %s") TREDEF(NYIRETL, "NYI: return to lower frame") -- cgit v1.2.3-55-g6feb