[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [LuaJIT FFI] Tailcalling string.byte() in a callback causes LuaJIT to crash
- From: Duncan Cross <duncan.cross@...>
- Date: Sat, 14 Jan 2012 21:28:44 +0000
Just discovered this (running on Windows 7):
LuaJIT 2.0.0-beta9 -- 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
> ffi = require 'ffi'
> func = ffi.cast('int(*)()', function() return string.byte 'a'; end)
> =func()
(...CRASH!!)
Forcing a non-tailcall fixes it:
LuaJIT 2.0.0-beta9 -- 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
> ffi = require 'ffi'
> func = ffi.cast('int(*)()', function() return (string.byte 'a'); end)
> =func()
97
-Duncan