Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm] build with -fexceptions #71883

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

nornagon
Copy link
Contributor

Summary

None

Purpose of change

The emscripten build has been crashing whenever an exception is thrown, which
turns out to be actually surprisingly rarely! But #71760 started making
something throw during JSON loading. In normal builds it's caught and handled
transparently, but without -fexceptions, emscripten will translate C++
exceptions into a full halt of the program, just as if the exception wasn't
caught.

Describe the solution

Enabling -fexceptions does have a performance impact, but being unable to play
the game seems worse than being able to play it but a bit more slowly, so here
we go :D

Describe alternatives you've considered

The particular exception that was being caught was during JSON deserialization,
which seems possible to rewrite not to use exceptions. But exceptions seem
fairly widely used in the project, so let's just enable them for now and see
how far that gets us. Eventually emscripten will support asyncify +
-fwasm-exceptions for wasm-native exception handling and the perf impact will
go away.

Testing

Game loads under wasm now!

Additional context

@github-actions github-actions bot added Code: Build Issues regarding different builds and build environments json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 21, 2024
@nornagon nornagon changed the title build emscripten with -fexceptions [wasm] build emscripten with -fexceptions Feb 21, 2024
@nornagon nornagon changed the title [wasm] build emscripten with -fexceptions [wasm] build with -fexceptions Feb 21, 2024
@akrieger akrieger merged commit dd08bab into CleverRaven:master Feb 21, 2024
23 of 27 checks passed
nornagon pushed a commit to nornagon/Cataclysm-DDA that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions Code: Build Issues regarding different builds and build environments json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants