Skip to content

Stop renaming longjmp in wasm-emscripten-finalize #3111

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

Merged
merged 3 commits into from
Sep 11, 2020
Merged

Stop renaming longjmp in wasm-emscripten-finalize #3111

merged 3 commits into from
Sep 11, 2020

Conversation

kripken
Copy link
Member

@kripken kripken commented Sep 10, 2020

Instead of finalize renaming emscripten_longjmp_jmpbuf to emscripten_longjmp,
do nothing in finalize. But in the optional --post-emscripten pass, rename it there if
both exist, so that we don't end up using two imports (other optimization passes
can then remove an unneeded import).

Depends on emscripten-core/emscripten#12157 to land first.

@kripken kripken requested a review from sbc100 September 10, 2020 17:34
Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Copy link
Member

@aheejin aheejin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason we generate two different names in LLVM. This is basically the same issue with #3081, meaning in an LLVM IR pass, we don't have wasm final types yet. This change LGTM, and I think we can merge these two names in a separate LLVM backend pass that we planned to make in #3081.

@sbc100
Copy link
Member

sbc100 commented Sep 11, 2020

This is the reason we generate two different names in LLVM.

If there was some way would we could merge these symbols in LLVM at some layer that would be great but it sounds like its just not possible? I guess its OK to continue to maintain them both in emscripten as aliases of each other.

@aheejin
Copy link
Member

aheejin commented Sep 11, 2020

No it is possible in LLVM, and that's what we decided in #3081. The reason for this and all __invoke renaming was because WebAssemblyLowerEmscriptenEHSjLj is an IR-level pass, which is before isel; if we make a separate MIR level pass that occurs after isel it can resolve all these in LLVM. I first did all these in Binaryen in 2016 or something (when I was an intern ;) ) just because that looked simpler and didn't need a new pass.

@kripken kripken merged commit dbff242 into master Sep 11, 2020
@kripken kripken deleted the longjmp branch September 11, 2020 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants