Skip to content

[EH/SjLj] Support Wasm EH + Wasm SjLj #16072

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 5 commits into from
Jan 21, 2022

Conversation

aheejin
Copy link
Member

@aheejin aheejin commented Jan 20, 2022

Now that
llvm/llvm-project@eb675e9
has landed, we can use Wasm EH and Wasm SjLj together.

This PR

  • enables Wasm EH + Wasm SjLj combination which was previously banned
  • unifies @with_both_exception_handling and @with_both_sjlj_handling
    into @with_both_eh_sjlj. Given that we don't really have a
    plan to test Wasm EH + Emscripten SjLj combination going forward,
    which was meant to be only a temporary measure during the period we
    have only Wasm EH but not Wasm SjLj, I don't think it's worth the
    hassle of keeping three different decorators like
    @with_both_exception_handling, @with_both_sjlj_handling,
    @with_both_eh_sjlj.
  • adds @with_both_eh_sjlj to several more tests that mix EH + SjLj
  • adds one more test that mixes EH + SjLj
  • duplicates test_longjmp into test_longjmp_stadnalone. I couldn't
    find a way to attach two decorators (@with_both_eh_sjlj and
    @also_with_standalone_wasm) to a single test.

Fixes #15404.

Now that
llvm/llvm-project@eb675e9
has landed, we can use Wasm EH and Wasm SjLj together.

This PR
- enables Wasm EH + Wasm SjLj combination which was previously banned
- unifies `@with_both_exception_handling` and `@with_both_sjlj_handling`
  into `@with_both_eh_sjlj`. Given that we don't really have a
  plan to test Wasm EH + Emscripten SjLj combination going forward,
  which was meant to be only a temporary measure during the period we
  have only Wasm EH but not Wasm SjLj, I don't think it's worth the
  hassle of keeping three different decorators like
  `@with_both_exception_handling`, `@with_both_sjlj_handling`,
  `@with_both_eh_sjlj`.
- adds `@with_both_eh_sjlj` to several more tests that mix EH + SjLj
- adds one more test that mixes EH + SjLj
- duplicates `test_longjmp` into `test_longjmp_stadnalone`. I couldn't
  find a way to attach two decorators (`@with_both_eh_sjlj and
  `@also_with_standalone_wasm`) to a single test.

Fixes emscripten-core#15404.
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

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

Should we also test just wasm EH without longjmp, and longjmp without EH, somewhere? Probably not in that decorator that runs all the time, but a separate test might be good. Unless we already have one?

int main() {
int jmpval = setjmp(buf);
if (jmpval != 0) {
printf("setjmp returned for the second time\n");
Copy link
Member

Choose a reason for hiding this comment

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

Is this reached? I don't see a longjmp in the file.

Copy link
Member Author

Choose a reason for hiding this comment

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

No it's not gonna be reached; as well with printf("inner catch: caught %d\n");. These tests check if compilation of mixed setjmp and try-catch work because LLVM backend does heavy transformation on functions that has setjmp calls, so I think it's fine that this line is not reached.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, maybe add a comment then, that this just checks compilation, and it is never reached?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@aheejin
Copy link
Member Author

aheejin commented Jan 21, 2022

Should we also test just wasm EH without longjmp, and longjmp without EH, somewhere? Probably not in that decorator that runs all the time, but a separate test might be good. Unless we already have one?

Added test_longjmp_with_and_without_exceptions and test_exceptions_with_and_without_longjmp.

int main() {
int jmpval = setjmp(buf);
if (jmpval != 0) {
printf("setjmp returned for the second time\n");
Copy link
Member

Choose a reason for hiding this comment

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

Ok, maybe add a comment then, that this just checks compilation, and it is never reached?

@aheejin aheejin merged commit 33c40be into emscripten-core:main Jan 21, 2022
@aheejin aheejin deleted the wasm_eh_sjlj branch January 21, 2022 22:59
sbc100 pushed a commit that referenced this pull request Jan 22, 2022
Now that
llvm/llvm-project@eb675e9
has landed, we can use Wasm EH and Wasm SjLj together.

This PR
- enables Wasm EH + Wasm SjLj combination which was previously banned
- unifies `@with_both_exception_handling` and `@with_both_sjlj_handling`
  into `@with_both_eh_sjlj`. Given that we don't really have a
  plan to test Wasm EH + Emscripten SjLj combination going forward,
  which was meant to be only a temporary measure during the period we
  have only Wasm EH but not Wasm SjLj, I don't think it's worth the
  hassle of keeping three different decorators like
  `@with_both_exception_handling`, `@with_both_sjlj_handling`,
  `@with_both_eh_sjlj`.
- adds `@with_both_eh_sjlj` to several more tests that mix EH + SjLj
- adds one more test that mixes EH + SjLj
- duplicates `test_longjmp` into `test_longjmp_stadnalone`. I couldn't
  find a way to attach two decorators (`@with_both_eh_sjlj and
  `@also_with_standalone_wasm`) to a single test.
- adds `test_longjmp_with_and_without_exceptions` and
`test_exceptions_with_and_without_longjmp`.

Fixes #15404.
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.

Query: Wasm EH with Emscripten SjLj support
2 participants