lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


That makes total sense. Yes, it finally compiles the loop when
removing ipairs. Thanks for your help. I am just in the process of
understanding (at least in a high level first) how to write efficient
code with luaJIT.
Thanks again!
Ben


On Sun, May 1, 2011 at 3:09 PM, Mike Pall <mikelu-1105@mike.de> wrote:
> Benjamin Segovia wrote:
>> Also, I just saw that "pairs" seems to abort the trace also but in
>> this case, the error message given by the trace dump is pretty clear
>> "NYI: FastFunc pairs".
>
> pairs() (or rather next()) is going to be slow, no matter what I do.
> Use a linear array and a plain 'for' loop for iterating over the
> squares.
>
>> "symbol not in cache" remains however a bit obscure :)
>
> C library symbols are resolved and stored in a cache after their
> first use. This happens only once, so it's usually the interpreter
> which adds the symbol to the cache. The JIT compiler doesn't
> handle this case, as it would not be profitable to do so. But the
> compiler should kick in much later for the same code path and by
> then the symbol ought to be in the cache already.
>
> This error indicates the JIT compiler hit some code the
> interpreter hasn't run yet. This is rare and may be a coincidence.
> The JIT compiler will retry and compile it on the next recording
> attempt for that path (but then it hits the abort for pairs()).
>
> --Mike
>
>