LuaJIT - Is ffi.alloca possible?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: LuaJIT - Is ffi.alloca possible?
 
- From: "Dimiter \"malkia\" Stanev" <malkia@...>
 
- Date: 2011年3月29日 07:59:06 -0700
 
Hi Mike,
Is ffi.alloca() possible with luajit, (taking the same arguments as 
ffi.new) - e.g. instead of allocating on the heap, to allocate on the stack?
Obviously one should not return the memory allocated as return value, 
and should ffi.copy() if it wants it too.
I think this might reduce the allocations done to call ffi functions. 
The problem I guess is that this has to be done as "inline" feature, 
can't be done as library call - so it might work only for "JIT", or the 
interpreter has to detect it - kind of like intrinsic, open coding.
I already have workaround for overallocating arguments, by simply 
keeping "global" copies, either outside, or as closures.
Hopefully not distracting you much with this, the question is more like 
If I try to implement such thing for luajit (I'm trying to learn it) - 
whether my chances are close to zero, or more?
Thanks,
Dimiter "malkia" Stanev