-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[WebAssembly] Handle block and polymorphic stack in AsmTypeCheck #110770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -498,7 +498,9 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser { | |
|
||
void addBlockTypeOperand(OperandVector &Operands, SMLoc NameLoc, | ||
WebAssembly::BlockType BT) { | ||
if (BT != WebAssembly::BlockType::Void) { | ||
if (BT == WebAssembly::BlockType::Void) { | ||
TC.setLastSig(wasm::WasmSignature{}); | ||
} else { | ||
wasm::WasmSignature Sig({static_cast<wasm::ValType>(BT)}, {}); | ||
TC.setLastSig(Sig); | ||
NestingStack.back().Sig = Sig; | ||
|
@@ -1002,7 +1004,8 @@ class WebAssemblyAsmParser final : public MCTargetAsmParser { | |
auto *Signature = Ctx.createWasmSignature(); | ||
if (parseSignature(Signature)) | ||
return ParseStatus::Failure; | ||
TC.funcDecl(*Signature); | ||
if (CurrentState == FunctionStart) | ||
TC.funcDecl(*Signature); | ||
Comment on lines
+1007
to
+1008
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
WasmSym->setSignature(Signature); | ||
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION); | ||
TOut.emitFunctionType(WasmSym); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before, when we have a non-void block we set the signature in the type checker, but not when we have a void block. So if we have a non-void block and then a void block, the type checker incorrectly thought void block's signature was the same as the previous (non-void ) one.