On Wed, Sep 4, 2019 at 2:10 PM Beuc <b...@beuc.net> wrote: > Hi, > > Trying to test my Emscripten project with Asyncify, I recompiled it with > tot-upstream, with the same whitelist, but this is failing: > > Part 1) Handling function names that change (work-around) > > I read that using function prefixes worked as limited wildcard but that > doesn't seem to be the case - did I do something wrong? >
Wildcards like "__py*" should work (with "*"). But the "*" can only be at the end currently, I believe. -s ASYNCIFY_WHITELIST='["__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_"...' > warning: Asyncify whitelist contained a non-existing function name: > __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_ ($__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_) > > Also llvm-nm doesn't seem to support listing WASM. > Correct, llvm-nm is only aware of LLVM IR. Wasm object files contain wasm. To see the names in them, build with something like -g or --profiling (so names are kept) and use binaryen's wasm-dis. You can also inspect the binary directly. I managed to find the function through emcc ... -o fat.llvm && llvm-nm > fat.llvm : > 003832c5 t __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_screen > > LLVM IR may encode the name differently than in wasm, as LLVM IR will use standard name mangling while wasm names will be "human-readable" (contain things like parentheses, types, ::, etc. - the output of c++filt). > Part 2) Run-time failure > > With the updated WHITELIST, I got the dreaded: > > RuntimeError: unreachable executed index.wasm:386701:1 > An unreachable can be several things. If it in the binaryen API, it could be the asyncify stack is too small. But here it looks like it's in a user function - it could be that an import was called that started a sleep, but asyncify was not aware of it, and control flow ends up in the wrong place. Adding some debug logging in your sleep function, and making sure ASYNCIFY_IMPORTS is correct, might help. Note that in ASSERTIONS mode we improved debug errors for that pretty recently, not sure if in the last version or since then. > __pyx_pw_11pygame_sdl2_7display_21flip > http://localhost:8000/index.wasm:386701 > emu$__pyx_pw_11pygame_sdl2_7display_21flip > http://localhost:8000/index.wasm:8749855 > 15 http://localhost:8000/index.wasm:2587748 > __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_screen > http://localhost:8000/index.wasm:2845914 > __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_screen > http://localhost:8000/index.wasm:2813529 > emu$__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_screen > http://localhost:8000/index.wasm:8760622 > PyCFunction_Call http://localhost:8000/index.wasm:5272869 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5750951 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > function_call http://localhost:8000/index.wasm:5167287 > emu$function_call http://localhost:8000/index.wasm:8793327 > PyObject_Call http://localhost:8000/index.wasm:5030529 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5754056 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > function_call http://localhost:8000/index.wasm:5167287 > emu$function_call http://localhost:8000/index.wasm:8793327 > PyObject_Call http://localhost:8000/index.wasm:5030529 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5754056 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5734704 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5734704 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > fast_function http://localhost:8000/index.wasm:5767904 > PyEval_EvalFrameEx http://localhost:8000/index.wasm:5751409 > PyEval_EvalCodeEx http://localhost:8000/index.wasm:5714071 > PyEval_EvalCode http://localhost:8000/index.wasm:5710418 > PyRun_FileExFlags http://localhost:8000/index.wasm:5955369 > PyRun_SimpleFileExFlags http://localhost:8000/index.wasm:5954716 > pyapp_runmain http://localhost:8000/index.wasm:58353 > x http://localhost:8000/index.js:17649 > handleSleep http://localhost:8000/index.js:17712 > safeSetTimeout http://localhost:8000/index.js:9068 > > My whitelist: > -s ASYNCIFY_WHITELIST='["main", "pyapp_runmain", "SDL_WaitEvent", > "SDL_WaitEventTimeout", "SDL_Delay", "SDL_RenderPresent", > "GLES2_RenderPresent", "SDL_GL_SwapWindow", "Emscripten_GLES_SwapWindow", > "PyRun_SimpleFileExFlags", "PyRun_FileExFlags", "PyEval_EvalCode", > "PyEval_EvalCodeEx", "PyEval_EvalFrameEx", "PyCFunction_Call", > "PyObject_Call", "fast_function", "function_call", "instancemethod_call", > "slot_tp_call", "__pyx_pw_11pygame_sdl2_5event_7wait", > "__pyx_pw_11pygame_sdl2_7display_21flip", > "__pyx_pw_11pygame_sdl2_7display_6Window_13flip", > "__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_screen", > "__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_screen", > "__Pyx_PyObject_CallNoArg", "__pyx_pf_10emscripten_6sleep", > "__pyx_pw_10emscripten_7sleep", "__pyx_pf_10emscripten_8sleep_with_yield", > "__pyx_pw_10emscripten_9sleep_with_yield", "gen_send", "gen_send_ex", > "gen_iternext", "type_call", "slot_tp_init", "builtin_eval"]' > > Not sure if all the "emu$" and "fastfunction" are properly handled :/ > > Any clue? > > Cheers! > Beuc > > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/20190904211035.7a3v7rgwmiwser4n%40mail.beuc.net > . > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpQKacWC2vgFV%2BcOq2k70nV0bYjCjL0Sd7K86YZ-%3D4Kdaw%40mail.gmail.com.