diff options
Diffstat (limited to 'src/ir')
-rw-r--r-- | src/ir/eh-utils.cpp | 5 | ||||
-rw-r--r-- | src/ir/eh-utils.h | 10 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/ir/eh-utils.cpp b/src/ir/eh-utils.cpp index 70b5452a6..6d65de4ad 100644 --- a/src/ir/eh-utils.cpp +++ b/src/ir/eh-utils.cpp @@ -148,8 +148,9 @@ void handleBlockNestedPop(Try* try_, Function* func, Module& wasm) { } } -void handleBlockNestedPops(Function* func, Module& wasm) { - if (!wasm.features.hasExceptionHandling()) { +void handleBlockNestedPops(Function* func, Module& wasm, FeaturePolicy policy) { + if (policy == FeaturePolicy::SkipIfNoEH && + !wasm.features.hasExceptionHandling()) { return; } FindAll<Try> trys(func->body); diff --git a/src/ir/eh-utils.h b/src/ir/eh-utils.h index 79ccbc507..ee5ad661d 100644 --- a/src/ir/eh-utils.h +++ b/src/ir/eh-utils.h @@ -38,8 +38,14 @@ bool containsValidDanglingPop(Expression* catchBody); // '(local.get $new)' where the 'pop' used to be. void handleBlockNestedPop(Try* try_, Function* func, Module& wasm); -// Calls handleBlockNestedPop for each 'Try's in a given function. -void handleBlockNestedPops(Function* func, Module& wasm); +enum class FeaturePolicy { SkipIfNoEH, RunIfNoEH }; + +// Calls handleBlockNestedPop for each 'Try's in a given function. By default, +// does no work if EH is not enabled, but this can be overridden with the +// RunIfNoEH policy. +void handleBlockNestedPops(Function* func, + Module& wasm, + FeaturePolicy policy = FeaturePolicy::SkipIfNoEH); // Given a catch body, find the pop corresponding to the catch. There might be // pops nested inside a try inside this catch, and we must ignore them, like |