4 ms·
Can someone ELI5 what exactly happens when the external method call is "JIT"ed in a language like LuaJIT -- what does that mean? I understand calling dlopen()
by gavinray 5y ago
Can someone ELI5 what exactly happens when the external method call is "JIT"ed in a language like LuaJIT -- what does that mean?
I understand calling dlopen() and dlsym()
And I understand this idea of a PLT and it's indirection
But this idea of something external to the JIT'ed program being JIT'ed I do not understand.
Does it mean it inlined the instructions of the external function into the JIT'ed code?
- deleted 5y ago[deleted]
- deathanatos 5y agoNo, I don't think Lua (or the author) is inlining the external function. What's being JIT'd is the Lua code into machine code, and where Lua would need to call a C function, it (apparently) is just emitting a `call the_external_fn` into the JIT's resulting assembly. That's a direct function call, so it's about as fast as you're going to get, but somewhat counter-intuitively, it'll be faster than C, as we don't do anything with the PLT or indirection. Just call the function.