MAIN_THREAD_EM_ASM is running on worker in a USE_PTHREADS=1 build

263 views
Skip to first unread message

Hostile Fork

unread,
Sep 6, 2019, 2:33:20 AM9/6/19
to emscripten-discuss
I wanted to try out `upstream-latest`, to absorb the impact of "Asyncify"...looks like a superior answer to our emterpreter build, and so far seems fine!  Nice work!

But this latest version seems to be causing problems with the USE_PTHREADS=1 build.  As far as I can tell, it's ignoring the `MAIN_THREAD_` part of MAIN_THREAD_EM_ASM().  If the request is submitted from a worker, it still runs on the worker.  (The same code works as expected in an older emsdk version, for instance with `emcc --version` of 1.38.28.)

I dug a little into what might have changed in the code, and it looks like things have definitely become more nuanced, with "proxied function invokers":


I'm a bit worried about this line in particular:

    @no_wasm_backend('Proxying EM_ASM calls is not yet implemented in Wasm backend')

Discussed some here as well:


I'm not clear on what backend it would work on if not WASM, as there doesn't seem to be pthreads support for the JS backend.  (?)

Is MAIN_THREAD_EM_ASM() supposed to work?  I didn't cook up a minimal example to test it, due to seeing these comments (and my usage seems pretty straightforward).  But if it's believed to be an error in my usage I can look deeper into it, just wanted to check on the meaning of these "not implemented" remarks first.

Thanks,
--Brian

Thomas Lively

unread,
Sep 6, 2019, 3:12:04 AM9/6/19
to emscripte...@googlegroups.com
“'Proxying EM_ASM calls is not yet implemented in Wasm backend” is certainly a little vague, but it means the upstream LLVM wasm backend, as opposed to the older Fastcomp backend which also compiles to WebAssembly but does so indirectly via asm.js.  It sounds like this feature is not yet available in upstream-latest, unfortunately. 

--
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-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/c97732a3-9626-48dc-8c47-0ec83caca0ac%40googlegroups.com.

Alon Zakai

unread,
Sep 6, 2019, 7:03:50 PM9/6/19
to emscripte...@googlegroups.com
I opened


now to track this. It does look like we should figure it out before switching to the new backend.


Reply all
Reply to author
Forward
0 new messages