summaryrefslogtreecommitdiff
path: root/src/passes
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes')
-rw-r--r--src/passes/GenerateDynCalls.cpp3
-rw-r--r--src/passes/PostEmscripten.cpp18
2 files changed, 2 insertions, 19 deletions
diff --git a/src/passes/GenerateDynCalls.cpp b/src/passes/GenerateDynCalls.cpp
index 8269f6f78..08c8c0ac7 100644
--- a/src/passes/GenerateDynCalls.cpp
+++ b/src/passes/GenerateDynCalls.cpp
@@ -55,7 +55,8 @@ struct GenerateDynCalls : public WalkerPass<PostWalker<GenerateDynCalls>> {
void visitFunction(Function* func) {
// Generate dynCalls for invokes
- if (func->imported() && func->base.startsWith("invoke_")) {
+ if (func->imported() && func->module == ENV &&
+ func->base.startsWith("invoke_")) {
Signature sig = func->sig;
// The first parameter is a pointer to the original function that's called
// by the invoke, so skip it
diff --git a/src/passes/PostEmscripten.cpp b/src/passes/PostEmscripten.cpp
index 0c7521afc..eea7a1a34 100644
--- a/src/passes/PostEmscripten.cpp
+++ b/src/passes/PostEmscripten.cpp
@@ -78,9 +78,6 @@ struct OptimizeCalls : public WalkerPass<PostWalker<OptimizeCalls>> {
struct PostEmscripten : public Pass {
void run(PassRunner* runner, Module* module) override {
- // Optimize imports
- optimizeImports(runner, module);
-
// Optimize calls
OptimizeCalls().run(runner, module);
@@ -88,21 +85,6 @@ struct PostEmscripten : public Pass {
optimizeExceptions(runner, module);
}
- void optimizeImports(PassRunner* runner, Module* module) {
- // Calling emscripten_longjmp_jmpbuf is the same as emscripten_longjmp.
- Name EMSCRIPTEN_LONGJMP("emscripten_longjmp");
- Name EMSCRIPTEN_LONGJMP_JMPBUF("emscripten_longjmp_jmpbuf");
- ImportInfo info(*module);
- auto* emscripten_longjmp =
- info.getImportedFunction(ENV, EMSCRIPTEN_LONGJMP);
- auto* emscripten_longjmp_jmpbuf =
- info.getImportedFunction(ENV, EMSCRIPTEN_LONGJMP_JMPBUF);
- if (emscripten_longjmp && emscripten_longjmp_jmpbuf) {
- // Both exist, so it is worth renaming so that we have only one.
- emscripten_longjmp_jmpbuf->base = EMSCRIPTEN_LONGJMP;
- }
- }
-
// Optimize exceptions (and setjmp) by removing unnecessary invoke* calls.
// An invoke is a call to JS with a function pointer; JS does a try-catch
// and calls the pointer, catching and reporting any error. If we know no