You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CompileError: WebAssembly.instantiate(): size 8279546 > maximum function size 7654321 #16690
I guess lto might manage to reduce that function below the maximum size browsers allow.
In general, you can disable inlining on functions that end up huge like this, or build that file with -Os etc. Or if the function is machine-generated, not generate a single big function but split it up, etc.
Thanks for your reply. I did use -Os during compilation already (but used -O3 during link) and still encountered the issue. It would be great if Emscripten would handle splitting up large function automatically or give a warning at compile/link time along with more information on which function causes this problem. Not sure if that would be possible / feasible though...
There have been some thoughts about function splitting and outlining, although for other purposes, but it could help here too. I think it's definitely feasible, if someone has the time, but it may not be easy (when splitting you need to pass around all relevant locals, and in such a huge function I worry you'd hit browser limits on the # of parameters/returns. Spilling to memory might help, but that could be extremely slow).
Activity
donalffons commentedon Apr 10, 2022
What seems to resolve this for me is to enable
-fltoduring compile and link.kripken commentedon Apr 11, 2022
I guess lto might manage to reduce that function below the maximum size browsers allow.
In general, you can disable inlining on functions that end up huge like this, or build that file with
-Osetc. Or if the function is machine-generated, not generate a single big function but split it up, etc.donalffons commentedon Apr 11, 2022
Thanks for your reply. I did use
-Osduring compilation already (but used-O3during link) and still encountered the issue. It would be great if Emscripten would handle splitting up large function automatically or give a warning at compile/link time along with more information on which function causes this problem. Not sure if that would be possible / feasible though...kripken commentedon Apr 12, 2022
There have been some thoughts about function splitting and outlining, although for other purposes, but it could help here too. I think it's definitely feasible, if someone has the time, but it may not be easy (when splitting you need to pass around all relevant locals, and in such a huge function I worry you'd hit browser limits on the # of parameters/returns. Spilling to memory might help, but that could be extremely slow).
donalffons commentedon Apr 12, 2022
Great to hear that you have this on the radar already / still. Since this is not urgent for me any more, I will close this issue.