lua-users home
lua-l archive

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


2011/6/23 Mike Pall <mikelu-1106@mike.de>:
> This is the 8th beta release of LuaJIT 2.0.0.
>

Hello Mike,

This is so cool, I've been waiting eagerly for this! My hat off to
you, and my thanks to your sponsors.
I have an issue though:

I have a build of Lanes where LOG_FUNC_INFO @ tools.c is defined to 1.

With Lua 5.1.4 I get this:

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require "lanes"
NAME: C:\Program Files (x86)\Lua\5.1\lua\lanes.lua @ 406
NAME: C:\Program Files (x86)\Lua\5.1\lua\lanes.lua @ 347
NAME: [C] function 001D3CC0
NAME: [C] function 100149A0
NAME: [C] function 100148D0
NAME: [C] function 10015010
NAME: C:\Program Files (x86)\Lua\5.1\lua\lanes.lua @ 291

But with LuaJIT2 I get instead:

LuaJIT 2.0.0-beta8 -- Copyright (C) 2005-2011 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc fuse
> require "lanes"
NAME: C:\Program Files (x86)\Lua\5.1\lua\lanes.lua @ 406
NAME: C:\Program Files (x86)\Lua\5.1\lua\lanes.lua @ 347
NAME: [C] function 00263CC0
NAME: [C] @ -1
C:\Program Files (x86)\Lua\5.1\lua\lanes.lua:429: ASSERT failed:
d:\boulot\lualanes\lanes\src\tools.c:939 'tmp==0'
stack traceback:
        [C]: ?
        C:\Program Files (x86)\Lua\5.1\lua\lanes.lua:429: in main chunk
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: ?


This is an error generated by the Lanes module when copying the
function. It would seem that this is caused by the line tool.c:905

    lua_CFunction cfunc= lua_tocfunction( L,i );

because with LuaJIT, cfunc is NULL even when I receive what Lua 5.1.4
has decided is a C function. This causes the Lanes code to try to
handle the function as a Lua function, which fails.

Assuming that the upvalues are scanned in the order the parser
encountered them, this function is pairs(), cached at lanes.lua:73.

I suppose then that lua_tocfunction() returns NULL this is because
pairs() gets some special handling that turns it in a non-C function:

 LuaJIT 2.0.0-beta8 -- Copyright (C) 2005-2011 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc fuse
> =pairs
function: fast#16

But if it is not a C function, and it is not a Lua function, what is
it, and how can I copy it from one state to another?


Regards,

-- 
Benoit.