confused about root-trace link in LuaJIT

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

confused about root-trace link in LuaJIT

twey seo

I was confused about the behavior of root-trace link, what's the different between link "return" and link self(loop or recursion):

local function f1(v) if v == 0 then return end f1(v - 1) end f1(109)

with log:

[TRACE 1 t1.lua:1 return]

and

local function f1(v) if v == 0 then return end f1(v - 1) end f1(112)

with log:

[TRACE 1 t1.lua:1 up-recursion]

And what does link in root-trace actually do?

In trace_abort(), the condition of calling penalty_pc():

if (J->parent == 0 && !bc_isret(bc_op(J->cur.startins)))

means first root trace and not in tail-recursion? and the inner condition:

if (J->exitno == 0)

what does this condition actually mean?