Created
November 5, 2012 15:50
-
-
Save ColonelThirtyTwo/4017921 to your computer and use it in GitHub Desktop.
Proof that LuaJIT cannot compile C functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "test" | |
local add = test.test_add | |
local x = 0 | |
for i=1,100000 do | |
x = add(x,i) | |
end | |
print(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define LUA_LIB | |
#include "lua.h" | |
#include "lauxlib.h" | |
static int test_add(lua_State* L) | |
{ | |
lua_pushnumber(L, luaL_checknumber(L,1) + luaL_checknumber(L,2)); | |
return 1; | |
} | |
static const luaL_reg testlib[] = { | |
{"test_add", test_add}, | |
{NULL, NULL} | |
}; | |
LUALIB_API int luaopen_test(lua_State* L) | |
{ | |
luaL_register(L, "test", testlib); | |
return 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
---- TRACE 1 start ctest.lua:6 | |
0011 MOV 6 0 | |
0012 MOV 7 1 | |
0013 MOV 8 5 | |
0014 CALL 6 2 3 | |
0000 . FUNCC ; C:6bec1254 | |
---- TRACE 1 abort ctest.lua:7 -- NYI: C function 0x0032ecd0 | |
5000050000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment