Re: Implementing another language on luajit - function arguments

  • From: lex pops <lexpops12@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 4 Nov 2013 15:06:36 -0800

>> Instead of tables, did you try using ffi objects in a custom memory manager?
>
> No. To the best of my knowledge, there is no way of putting references
> to lua objects in FFI objects, and I had no intention of using only
> FFI objects everywhere.

If I understand correctly, the issue isn't putting the lua object
references in FFI objects, it's making sure the lua objects are not
GCed since the FFI references are not traversed by the GC.

> That said, functional patterns - combinators - won't be optimized. The
> problem in the end is that LuaJIT is not necessarily a good target for
> functional languages, when you collude this with the GC and the fact
> closures are not (or were not at least when i worked on this project)
> JIT compiled. This might change in the future though.

I just did some experiments with both 2.0.2 and 2.1. Creating closures
is indeed not JIT compiled (calling closures is). However, I when I
replaced the closure with a setmetatable() with a __call() method then
it did get JIT compiled.

Thanks for the tips.

lp

Other related posts: