1. It's not clear how much code size will be saved. Hopefully some. But the main effect will be on performance, and code size will still be higher than without exceptions since the compiler has to insert unwinding code all around (due to how C++ exceptions work, RAII destructors must be called, etc.). I'd hope the increase is much less than the current bloat, but no way to be sure.
2. (b) That testcase works for me (it prints SUCCESS with the whitelist). That's on emscripten incoming. If you're on an older version maybe updating would help. Also it might help to take a look at the examples in the test suite, they show it in action. On Mon, Jul 25, 2016 at 4:24 AM, Gaurav Dewan <[email protected]> wrote: > Currently enabling exception handling support lead to increase in size of > optimized build (asm.js as well as wasm) by about 33% in our codebase. > > (1) Will the planned Zero cost exception support in wasm shave off a > significant size from the wasm file ? > > (2) With regard to asm.js, are there ways to decrease the codesize bloat > with regard to exception handling - > > (a) One way could be to replace try, throw and catch in construct C++ code > with equivalent sequential error handling construct. But then > emscripten/clang toolchain would already be optimized to do the same in > automated manner. > > (b) Identifying the errors in applications which are gracefully handled > and enable exception handling only for those workflows. This is generally > error-prone and not maintainable way since sometimes fatal error like > out_of_memory could be potentially handled (by freeing C++ memory or not > performing a specific task). > I looked at EXCEPTION_CATCHING_WHITELIST with disable exception catching > = 2 option but it appeared to be not working (throwing in try block) > em++ whitelist.cpp -O1 -s DISABLE_EXCEPTION_CATCHING=2 -s > EXCEPTION_CATCHING_WHITELIST='["_main"]' -o whitelist.js > >> #include <stdio.h> >> int main(void) { >> try { >> throw 5; >> } >> catch (...) { >> printf("SUCCESS\n"); //not printed >> } >> return 0; >> } >> >> I guess, even if it worked - it would not catch exceptions from nested > function (or function pointer) calls. So it may not be that useful. > > (c) Any other way to solve "this" size bloat ? > > -- > 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 [email protected]. > 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
