lua-users home
lua-l archive

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


Hi,
My script (https://hastebin.com/adaqajufeb.makefile) is declaring an
object with a rather complex structure ; it is rejected with the
following error message with latest
lua :
[string "settings = {..."]:639: function or expression needs too many
registers '0.51041179895401'.
I didn't find any information on the issue beside
http://lua-users.org/lists/lua-l/2015-04/msg00372.html which I suspect
is different from mine : running lua in debug mode I found that the
crash is happening in
luaK_reserveregs (the luaK_checkstack call fails) hence the issue is
related to registers count in the lua vm rather than stack size.
I reproduced the bug on https://repl.it/languages/lua
I suspect that I hit a cornercase of some sort : since several
constructors are nested they allocate some register space but don't
release it on time so that constructors in the deepest level in the
structure are able to do their own allocation ; however I'm not 100%
sure I properly diagnosed the issue. I don't know if it's possible to
fix, tweaking the defines in lua.h or luaconf.h (LUAI_MAXSTACK...)
didn't help.

I discovered that modifying LFIELDS_PER_FLUSH in lopcodes.h helps :
changing it from 50 to 10 makes my code work, however customisation of
this define seems unsupported (it's neither in lua.h nor in luaconf.h)
and I fear that it may bring regression in other part of the code.

Is there a proper fix available for this issue that doesn't require
changing the LUA code ?

Regards,
Vincent