Unable To Execute WebAssembly Code With Incoming for Firefox 54.0a1

310 views
Skip to first unread message

awt

unread,
Mar 20, 2017, 7:29:24 AM3/20/17
to emscripten-discuss
Hi,

I am currently on incoming and tried to compile and run my code with the following compilation flags:

"-s BINARYEN=1" "-s BINARYEN_METHOD='native-wasm,asmjs'"

I ran my code on Firefox Nightly 54.0a1 (2017-02-19) (64-bit) and got the following error:

 CompileError: wasm validation error: at offset 4: too many locals

I tried with "-s WASM=1" and got the same error as well.

Does anybody know how to debug this? Thanks.

Alon Zakai

unread,
Mar 20, 2017, 2:23:36 PM3/20/17
to emscripten-discuss
That error message indicates you are hitting a limitation in the VM. Does building with -O1 or above fix it? (optimizations should reduce the number of locals dramatically)

I'm curious if the same code runs ok as asm.js (also when unoptimized)? That would indicate a different limit in wasm vs asm.js, which would surprise me (and we should report to the browser).

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

awt

unread,
Mar 21, 2017, 12:29:46 PM3/21/17
to emscripten-discuss
Thanks Alon :) Building with -Oz did the trick.

For my next step, I would like to run wasm on a web worker with the --proxy-to-worker flag. Do you have any code examples or documentation on how to go about it? Once again, thanks for your help. 

Alon Zakai

unread,
Mar 21, 2017, 3:02:36 PM3/21/17
to emscripten-discuss
That should work the same as asm.js (with the fix that landed on incoming yesterday or the day before), so the examples in test_browser.py should all work when WASM=1. If not, let me know.


To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

awt

unread,
Mar 23, 2017, 6:50:44 AM3/23/17
to emscripten-discuss
Alon,

I tried to run wasm on a webworker using proxy to worker and these are my compilation flags:

emcc -oz -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s WASM=1 --preload-file hello.wasm --proxy-to-worker helloworld.cpp

My helloworld.cpp is just a simple file that prints a simple string to console. What I noticed is that there is no xhr call on the worker side to get the wasm binary and we get the error that says the wasm binary has to be preloaded. Adding the preload flag will not help in this case.

When we generate a html, the xhr call will be on the main thread and the wasm binary is not passed to the worker as well. I worked around it by introducing a synchronous xhr get on the worker side right at the start of the worker file and it worked.

Did I miss anything here?


On Wednesday, March 22, 2017 at 3:02:36 AM UTC+8, Alon Zakai wrote:
That should work the same as asm.js (with the fix that landed on incoming yesterday or the day before), so the examples in test_browser.py should all work when WASM=1. If not, let me know.

On Tue, Mar 21, 2017 at 9:29 AM, awt <knigh...@gmail.com> wrote:
Thanks Alon :) Building with -Oz did the trick.

For my next step, I would like to run wasm on a web worker with the --proxy-to-worker flag. Do you have any code examples or documentation on how to go about it? Once again, thanks for your help. 

On Tuesday, March 21, 2017 at 2:23:36 AM UTC+8, Alon Zakai wrote:
That error message indicates you are hitting a limitation in the VM. Does building with -O1 or above fix it? (optimizations should reduce the number of locals dramatically)

I'm curious if the same code runs ok as asm.js (also when unoptimized)? That would indicate a different limit in wasm vs asm.js, which would surprise me (and we should report to the browser).
On Mon, Mar 20, 2017 at 4:29 AM, awt <knigh...@gmail.com> wrote:
Hi,

I am currently on incoming and tried to compile and run my code with the following compilation flags:

"-s BINARYEN=1" "-s BINARYEN_METHOD='native-wasm,asmjs'"

I ran my code on Firefox Nightly 54.0a1 (2017-02-19) (64-bit) and got the following error:

 CompileError: wasm validation error: at offset 4: too many locals

I tried with "-s WASM=1" and got the same error as well.

Does anybody know how to debug this? Thanks.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alon Zakai

unread,
Mar 23, 2017, 2:15:42 PM3/23/17
to emscripten-discuss
We fixed some issues with loading the wasm binary (the worker can load it directly itself). Make sure you're on latest incoming. If you are, then can you create a testcase showing the problem, it might be something we didn't fix yet?

To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

awt

unread,
Mar 25, 2017, 10:07:00 AM3/25/17
to emscripten-discuss
Thanks Alon, it was my bad. I wasn't using the latest incoming. I updated it yesterday and its working now.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages