Closed yurivict closed 4 years ago
The function is simply too big for MuJS to handle. It would take more than 64k instructions, which exceeds the limit of our bytecode format.
This isn't urgent, but in the long run you could make instructions count based on the compile-time option. There is no reason why it shoudn't be able to handle large JS scripts, especially when there are so many of them floating around.
I tried this change:
-typedef unsigned short js_Instruction;
+typedef unsigned int js_Instruction;
mujs
mostly works, but this code
var i = -1
print("i="+i)
prints
i=4294967295
Did you see this compiler warning that you get with that typedef?
/jscompile.c:78:12: warning: comparison of integers of different signs: 'int' and 'js_Instruction' (aka 'unsigned int')
You should be fine with
typedef int js_Instruction;
Could you please make 32-bit addresses a build option?
32-bit addresses and instructions can be specified at build time with -DJS_INSTRUCTION=int (or any other SIGNED integer type).
I tried to use SQLite translated into JavaScript: https://raw.githubusercontent.com/kripken/sql.js/master/js/sql.js but it fails:
This might be also a bug in
sql.js
itself.Please also note how the third line lacks line/column information, and the first two lines lack column information.