diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-10-11 00:30:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 00:30:06 -0700 |
commit | c6cd444496c4c1b684dbc69b10fc2f5cbfdd8e47 (patch) | |
tree | 0e921050a69d9942c3fdbc62ad87e6b0d7aa9398 | |
parent | 4507ee5767b62095b29ca3b9c775475400f5423a (diff) | |
download | binaryen-c6cd444496c4c1b684dbc69b10fc2f5cbfdd8e47.tar.gz binaryen-c6cd444496c4c1b684dbc69b10fc2f5cbfdd8e47.tar.bz2 binaryen-c6cd444496c4c1b684dbc69b10fc2f5cbfdd8e47.zip |
Enable exnref instrumentation when EH is enabled (#2379)
`exnref` is enabled by not reference type feature but exception handling
feature. Sorry that I missed this in #2377.
-rw-r--r-- | src/passes/InstrumentLocals.cpp | 4 | ||||
-rw-r--r-- | test/passes/instrument-locals_all-features.txt | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp index 8c8cc2c9c..6e12b0f3a 100644 --- a/src/passes/InstrumentLocals.cpp +++ b/src/passes/InstrumentLocals.cpp @@ -159,8 +159,10 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> { if (curr->features.hasReferenceTypes()) { addImport(curr, get_anyref, "aiia"); - addImport(curr, get_exnref, "eiie"); addImport(curr, set_anyref, "aiia"); + } + if (curr->features.hasExceptionHandling()) { + addImport(curr, get_exnref, "eiie"); addImport(curr, set_exnref, "eiie"); } } diff --git a/test/passes/instrument-locals_all-features.txt b/test/passes/instrument-locals_all-features.txt index 57d3d919e..3d6aa4d05 100644 --- a/test/passes/instrument-locals_all-features.txt +++ b/test/passes/instrument-locals_all-features.txt @@ -15,8 +15,8 @@ (import "env" "set_f32" (func $set_f32 (param i32 i32 f32) (result f32))) (import "env" "set_f64" (func $set_f64 (param i32 i32 f64) (result f64))) (import "env" "get_anyref" (func $get_anyref (param i32 i32 anyref) (result anyref))) - (import "env" "get_exnref" (func $get_exnref (param i32 i32 exnref) (result exnref))) (import "env" "set_anyref" (func $set_anyref (param i32 i32 anyref) (result anyref))) + (import "env" "get_exnref" (func $get_exnref (param i32 i32 exnref) (result exnref))) (import "env" "set_exnref" (func $set_exnref (param i32 i32 exnref) (result exnref))) (func $A (; 12 ;) (type $FUNCSIG$v) (local $x i32) |