[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OP_HALT is really useful
- From: Sean Conner <sean@...>
- Date: Tue, 29 May 2018 18:06:50 -0400
It was thus said that the Great Sven Olsen once stated:
> >
> > elseif what == 'tail return' then
> > local now = clock()
> > data[key] = data[key] + (now - table.remove(stack))
> > end
> >
>
> Is this a bug? In Lua 5.2 <https://www.lua.org/manual/5.2/manual.html#6.10>
> at least, it looks like the 'what' value when reporting a tail call/return
> is 'tail call' not 'tail return'.
I still use Lua 5.1 (primarily). I checked, it changed from 'tail return'
to 'tail call' between 5.1 and 5.2.
> My understanding is that tail calls are a bit tricky to instrument --
> because a 'tail call' is actually one event that's simultaneously both a
> call and a return.
It's a GOTO made pretty.
> I think that, when instrumenting for inclusive call time, ignoring tail
> call events entirely is actually a sensible policy. Effectively, I think
> that's what your code is doing (as the 'tail return' case will never be
> hit).
I did not intend to ignore tail calls.
-spc