ECMAScript
ECMAScript copied to clipboard
Two issues with Worker demo
-
fib.js
default export isfib
function and not a godot class, so every time the file is loaded i get an error message "modules/ECMAScript/ecmascript.cpp:92 - JavaScript Error". Is this how it is supposed to be right now (work in progress)? So for now to avoid this message on every save one should export some empty class inheritinggodot.Object
? -
This one is less straightforward. When i press "Calculate in Worker" the playing scene just exits without any error ("Calculate in Main Thread" works fine). I tested different things and it seems like there is a stack overflow in worker thread on my machine when
N
is higher than 26. Even whenfib
is a simple function as(n) => n < 2 ? n : fib( n - 1 )
. With 26 or lower worker is fine. Any clues what this might be caused by? What is the maximum N on your machine if you use the provided simple function?
There is a bug with stack overflow in QuickJS. You can disable stack checking for this.
Haven't this ec69d883b014738bbc7e0a9acbd10349992e88b9 recent commit disabled stack checks for apple devices already (i am on mac)? (And strange thing for me is that this error appears only in worker thread, script has no problem running on main one.)
Are there any workarounds for errors about js files that do not export a godot class (like libraries)?
Maybe it is possible in the future to add an import setting for js files that says whenever or not they are godot scripts?
@vonagam Does the latest version fixed this ?
On my machine - no. Steps i used to reproduce:
git clone --depth=1 --branch=3.2 [email protected]:godotengine/godot.git
git clone [email protected]:Geequlim/ECMAScript.git
(in godot/modules
)
python3 $(which scons) platform=osx --jobs=$(sysctl -n hw.logicalcpu)
(in godot
)
git clone [email protected]:Geequlim/ECMAScriptDemos.git
(in some temp folder)
./bin/godot.osx.tools.64 --verbose --path some/temp/ECMAScriptDemos/worker res://Control.tscn
(in godot
)
I have macOS Mojave 10.14.6.
Last outputted line before a crash is Bus error: 10
when i click on "Calculate in Worker".
Notes:
I have checked if this issue is reproducible not so long ago and while there was no hard crash, when clicked to calculate in a worker nothing would happen, seemed like a silent crash, now it is back to hard one.
This line needed to be commented. I assume it got into version control by mistake.
JavaScript Error
about fib.js
not exporting a godot class is gone.
@vonagam Does alpha12 fixed this ?
No.
@vonagam I can reproduce the issue when compiled in debug mode with llvm. In release mode with llvm or compiled with gcc in both debug and release mode won't happen.