lua-users home
lua-l archive

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


It is found here:

http://lua-users.org/lists/lua-l/2008-02/msg00243.html

I was experimenting with it the other day and noticed the following code crashes inside lparser.c:

    function Func()
        running = true;  finalize running = false end
        if running then return false end
        return Idle_loop()  -- Tail call
    end

The patch doesn't look like it uses the OP_TAILCALL instruction at all, missing out on valuable savings.

Does anyone have an update or even a better way to do this?  It doesn't appear to be exactly efficient.  I'd love to find a patch that just does injection of the code in this manner:

    function Func()
        running = true;  -- finalize running = false end
        if somebadthing then
            running = false    --!!!!!!
            return false
        end
        mutex:lock();  -- finalize mutex:unlock() end
        if running then
            mutex:unlock()  --!!!!!!
            running = false   --!!!!!!
            return false
        end
        mutex:unlock()     --!!!!!!
        running = false      --!!!!!!
        return Idle_loop()  -- Tail call
    end

Thanks.

Josh