GM13 LuaJIT support
ColonelThirtyTwo opened this issue · 5 comments
There are a couple of incompatibilities with the debug features. 1) SF code can't be compiled due to debug hook issues, and 2) we'd have to scrap the coroutine solution because coroutines no longer get their own debug hooks.
Using jit.off()
does not fix the coroutine issue; debug hooks are global in the LuaJIT VM regardless of whether JIT compilation is enabled and that is unlikely to change. I'll look into the compilation issues with JIT on now.
That's not why the JIT is being turned off. It's being turned off because the debug hook isn't called at all in JIT-compiled code.
It looks like you're right; see for example this thread. Apparently a debug hook being called will prevent JIT compilation, so it probably wouldn't negatively affect us. At the very least we should disable JIT locally to SF script functions instead of globally. I'll look into what's actually happening in more depth.
You would have to turn off JIT for every function that could be called (directly or indirectly) from SF code. jit.off(func)
operates on the function itself then recurses to the functions the passed func defined (not the functions called).
(However, with all the people reporting slowdowns with the JIT turned on, it might not be worth it. I mailed Mike Pall about this: http://www.freelists.org/post/luajit/When-to-turn-off-JIT,5 )
Also, I'd like to point out that with the massive amounts of C functions being called in gmod, most traces can't be compiled anyway.