diff options
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 7147f2c3d..bc707890c 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -1360,9 +1360,21 @@ void StringSliceIter::finalize() { } } -void ContBind::finalize() { type = Type(contTypeAfter, NonNullable); } +void ContBind::finalize() { + if (cont->type == Type::unreachable) { + type = Type::unreachable; + } else if (!handleUnreachableOperands(this)) { + type = Type(contTypeAfter, NonNullable); + } +} -void ContNew::finalize() { type = Type(contType, NonNullable); } +void ContNew::finalize() { + if (func->type == Type::unreachable) { + type = Type::unreachable; + } else { + type = Type(contType, NonNullable); + } +} static void populateResumeSentTypes(Resume* curr, Module* wasm) { if (!wasm) { @@ -1406,13 +1418,24 @@ static void populateResumeSentTypes(Resume* curr, Module* wasm) { } void Resume::finalize(Module* wasm) { - const Signature& contSig = - this->contType.getContinuation().type.getSignature(); - type = contSig.results; + if (cont->type == Type::unreachable) { + type = Type::unreachable; + } else if (!handleUnreachableOperands(this)) { + const Signature& contSig = + this->contType.getContinuation().type.getSignature(); + type = contSig.results; + } populateResumeSentTypes(this, wasm); } +void Suspend::finalize(Module* wasm) { + if (!handleUnreachableOperands(this) && wasm) { + auto tag = wasm->getTag(this->tag); + type = tag->sig.results; + } +} + size_t Function::getNumParams() { return getParams().size(); } size_t Function::getNumVars() { return vars.size(); } |