[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT FFI callbacks
- From: Florian Weimer <fw@...>
- Date: Thu, 17 Nov 2011 22:23:26 +0100
* Mike Pall:
> tl;dr: Just pass a Lua function to a C function taking a callback
> argument and the FFI will do all the magic in the background.
I'm trying to figure out what made this feat suddenly possible. I was
under the impression that it wouldn't be possible introduce, say,
allocations into traces which were deemed allocation-free before.
By the way, you could probably use stubs of the form
CALL vm_ffi_callback
RET
and derive the slot and the address of the state pointer from the
return address on the stack within vm_ffi_callback. This would allow
you to squeeze a few more stubs into that memory area.