New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deterministic bytecode generation #1008
Comments
The iteration order of tables in Lua is non-deterministic. In LuaJIT it's even non-deterministic for different VM invocations (on purpose). The bytecode for a table constructor with initializers ( The solution sketched out in #993 for bytecode generation options could be extended with another flag. Which would then serialize the template table to the bytecode in a deterministic (sorted) order ( That said: any progress on implementing #993? I thought it was important for you. |
Ah, I understand, I should have realised. I wrongly assumed the iteration order was a runtime thing as opposed to compile time. Re the #993 ticket: As it seems to work to disable the Possibly, our client wishes to have the determinism, in which case I would propose your suggestion as the way forward. |
I suspect that this is the reason, why openSUSE's cd bcc-0.28.0/build/src/lua && for i in $(seq 1000) ; do
luajit -bg bcc.lua bcc.o && md5sum bcc.o
done | sort -u |wc -l
1000 |
Now implemented, thanks to Peter Cawley. Add the
|
I'm wondering if it would be possible to make it so that the output of a luajit compilation (same input, same architecture) would produce the same output.
I think it's a good trait to have if possible (e.g. for debugging what has changed and for buildsystems in general).
I have a small repro case here which produces different output in 95% of the cases:
test.lua
Then I run luajit (
v2.1
-51fb2f2
)which in turn produces output like this:
My first guess would be that there is some padding somewhere that isn't zeroed out, but perhaps there is something more complex that makes it behave like this?
The text was updated successfully, but these errors were encountered: