Skip to content

[Wasm Exceptions] Scan catch events in RemoveUnusedModuleElements#3582

Merged
kripken merged 2 commits intomainfrom
scanevent
Feb 18, 2021
Merged

[Wasm Exceptions] Scan catch events in RemoveUnusedModuleElements#3582
kripken merged 2 commits intomainfrom
scanevent

Conversation

@kripken
Copy link
Member

@kripken kripken commented Feb 18, 2021

There was an existing test for this, it turns out.

Also refactor away some annoying repeated code in that pass. visitTry is
the only actual change.

Noticed by the exceptions fuzzer emscripten-core/emscripten#13485, e.g. on wasm-opt -O1 on

#include <stdio.h> // avoid iostream C++ code, just test libc++abi, not libc++
#include <stdint.h>

extern void refuel();
extern void checkRecursion();
extern bool getBoolean();

struct Class {
  Class();
  ~Class();
};

void func_0() {
  while (getBoolean()) {
  }
}

int main() {
  // func_0
  puts("calling func_0");
  refuel();
  try {
    func_0();
  } catch(...) {
    puts("main caught from func_0");
  }
  return 0;
}```

@kripken kripken requested review from aheejin and tlively February 18, 2021 21:27
@kripken kripken changed the title [Wasm GC] Scan events in RemoveUnusedModuleElements [Wasm Exceptions] Scan events in RemoveUnusedModuleElements Feb 18, 2021
@kripken kripken changed the title [Wasm Exceptions] Scan events in RemoveUnusedModuleElements [Wasm Exceptions] Scan catch events in RemoveUnusedModuleElements Feb 18, 2021
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.

Thanks! I forgot to do this...

@kripken kripken merged commit ec2aa7e into main Feb 18, 2021
@kripken kripken deleted the scanevent branch February 18, 2021 22:02
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