lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


  I still use Lua 5.1 (primarily).  I checked, it changed from 'tail return'
to 'tail call' between 5.1 and 5.2.

Ah, that makes sense.  It looks like the guts of how debug.sethook(hook,"cr") interacts with tail calls changed quite a bit between 5.1 and 5.2.  As best as I can tell, in 5.1, a tail call will actually emit two hook events: a 'call' event when we hit OP_TAILCALL, and then a matching set of "simulated returns" when we eventually hit an OP_RETURN.  In 5.2, it looks like Lua got rid of the "simulated return" idea, and instead just emits a single hook for an OP_TAILCALL, one that uses the 'tail call' name.

If I'm understanding all this right, this semantic change doesn't actually break profiling code like yours, because it effectively replaces both the 'call' and 'tail return' cases that 5.1-era code would use to trace OP_TAILCALLs with null-ops.  That was cleverly done.

-Sven