aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lj_record.c31
-rw-r--r--src/lj_traceerr.h1
2 files changed, 24 insertions, 8 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index 3f7c2bde..42f9a8ae 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1734,22 +1734,40 @@ static void check_call_unroll(jit_State *J)
1734 } 1734 }
1735} 1735}
1736 1736
1737static void rec_func_lua(jit_State *J) 1737/* Record Lua function setup. */
1738static void rec_func_setup(jit_State *J)
1738{ 1739{
1739 GCproto *pt = J->pt; 1740 GCproto *pt = J->pt;
1741 BCReg s, numparams = pt->numparams;
1740 if ((pt->flags & PROTO_NO_JIT)) 1742 if ((pt->flags & PROTO_NO_JIT))
1741 lj_trace_err(J, LJ_TRERR_CJITOFF); 1743 lj_trace_err(J, LJ_TRERR_CJITOFF);
1742 lua_assert(!(pt->flags & PROTO_IS_VARARG)); 1744 lua_assert(!(pt->flags & PROTO_IS_VARARG));
1743 if (J->baseslot + pt->framesize >= LJ_MAX_JSLOTS) 1745 if (J->baseslot + pt->framesize >= LJ_MAX_JSLOTS)
1744 lj_trace_err(J, LJ_TRERR_STACKOV); 1746 lj_trace_err(J, LJ_TRERR_STACKOV);
1745 /* Fill up missing args with nil. */ 1747 /* Fill up missing parameters with nil. */
1746 while (J->maxslot < pt->numparams) 1748 for (s = J->maxslot; s < numparams; s++)
1747 J->base[J->maxslot++] = TREF_NIL; 1749 J->base[s] = TREF_NIL;
1748 /* The remaining slots should never be read before they are written. */ 1750 /* The remaining slots should never be read before they are written. */
1749 J->maxslot = pt->numparams; 1751 J->maxslot = numparams;
1752}
1753
1754/* Record entry to a Lua function. */
1755static void rec_func_lua(jit_State *J)
1756{
1757 rec_func_setup(J);
1750 check_call_unroll(J); 1758 check_call_unroll(J);
1751} 1759}
1752 1760
1761/* Record entry to an already compiled function. */
1762static void rec_func_jit(jit_State *J, TraceNo lnk)
1763{
1764 rec_func_setup(J);
1765 J->instunroll = 0; /* Cannot continue across a compiled function. */
1766 if (J->pc == J->startpc && J->framedepth + J->retdepth == 0)
1767 lnk = J->curtrace; /* Can form an extra tail-recursive loop. */
1768 rec_stop(J, lnk); /* Link to the function. */
1769}
1770
1753/* -- Record allocations -------------------------------------------------- */ 1771/* -- Record allocations -------------------------------------------------- */
1754 1772
1755static TRef rec_tnew(jit_State *J, uint32_t ah) 1773static TRef rec_tnew(jit_State *J, uint32_t ah)
@@ -2127,9 +2145,8 @@ void lj_record_ins(jit_State *J)
2127 case BC_FUNCF: 2145 case BC_FUNCF:
2128 rec_func_lua(J); 2146 rec_func_lua(J);
2129 break; 2147 break;
2130
2131 case BC_JFUNCF: 2148 case BC_JFUNCF:
2132 lj_trace_err(J, LJ_TRERR_NYILNKF); 2149 rec_func_jit(J, rc);
2133 break; 2150 break;
2134 2151
2135 case BC_FUNCV: 2152 case BC_FUNCV:
diff --git a/src/lj_traceerr.h b/src/lj_traceerr.h
index 6e02a053..89ab04d1 100644
--- a/src/lj_traceerr.h
+++ b/src/lj_traceerr.h
@@ -23,7 +23,6 @@ TREDEF(BADTYPE, "bad argument type")
23TREDEF(CJITOFF, "call to JIT-disabled function") 23TREDEF(CJITOFF, "call to JIT-disabled function")
24TREDEF(CUNROLL, "call unroll limit reached") 24TREDEF(CUNROLL, "call unroll limit reached")
25TREDEF(NYIRECU, "NYI: recursive calls") 25TREDEF(NYIRECU, "NYI: recursive calls")
26TREDEF(NYILNKF, "NYI: linking/patching function calls")
27TREDEF(NYIVF, "NYI: vararg function") 26TREDEF(NYIVF, "NYI: vararg function")
28TREDEF(NYICF, "NYI: C function %p") 27TREDEF(NYICF, "NYI: C function %p")
29TREDEF(NYIFF, "NYI: FastFunc %s") 28TREDEF(NYIFF, "NYI: FastFunc %s")