summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-08-24 20:13:02 +0200
committerGitHub <noreply@github.com>2020-08-24 11:13:02 -0700
commitfa43b5070b9c46c88d725ceb76f61340324d2ea0 (patch)
tree90852037dd4fc6697b75963eb90a48bfb514d381 /src/wasm/wasm-validator.cpp
parentd2e2521e55120465549ddbccc4660ff98e929008 (diff)
downloadbinaryen-fa43b5070b9c46c88d725ceb76f61340324d2ea0.tar.gz
binaryen-fa43b5070b9c46c88d725ceb76f61340324d2ea0.tar.bz2
binaryen-fa43b5070b9c46c88d725ceb76f61340324d2ea0.zip
Add new compound Signature, Struct and Array types (#3012)
Extends the `Type` hash-consing infrastructure to handle type-parameterized and constructed types introduced in the typed function references and GC proposals. This should be a non-functional change since the new types are not used anywhere yet. Recursive type construction and canonicalization is also left as future work. Co-authored-by: Thomas Lively <tlively@google.com>
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index 6e7ef3301..8410cc0b2 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -389,7 +389,7 @@ void FunctionValidator::noteLabelName(Name name) {
void FunctionValidator::visitBlock(Block* curr) {
if (!getModule()->features.hasMultivalue()) {
- shouldBeTrue(!curr->type.isMulti(),
+ shouldBeTrue(!curr->type.isTuple(),
curr,
"Multivalue block type (multivalue is not enabled)");
}
@@ -1773,11 +1773,11 @@ void FunctionValidator::visitSelect(Select* curr) {
"select condition must be valid");
if (curr->ifTrue->type != Type::unreachable) {
shouldBeFalse(
- curr->ifTrue->type.isMulti(), curr, "select value may not be a tuple");
+ curr->ifTrue->type.isTuple(), curr, "select value may not be a tuple");
}
if (curr->ifFalse->type != Type::unreachable) {
shouldBeFalse(
- curr->ifFalse->type.isMulti(), curr, "select value may not be a tuple");
+ curr->ifFalse->type.isTuple(), curr, "select value may not be a tuple");
}
if (curr->type != Type::unreachable) {
shouldBeTrue(Type::isSubType(curr->ifTrue->type, curr->type),
@@ -1969,7 +1969,7 @@ void FunctionValidator::visitTupleExtract(TupleExtract* curr) {
}
void FunctionValidator::visitFunction(Function* curr) {
- if (curr->sig.results.isMulti()) {
+ if (curr->sig.results.isTuple()) {
shouldBeTrue(getModule()->features.hasMultivalue(),
curr->body,
"Multivalue function results (multivalue is not enabled)");
@@ -2137,7 +2137,7 @@ static void validateBinaryenIR(Module& wasm, ValidationInfo& info) {
static void validateImports(Module& module, ValidationInfo& info) {
ModuleUtils::iterImportedFunctions(module, [&](Function* curr) {
- if (curr->sig.results.isMulti()) {
+ if (curr->sig.results.isTuple()) {
info.shouldBeTrue(module.features.hasMultivalue(),
curr->name,
"Imported multivalue function "
@@ -2164,7 +2164,7 @@ static void validateImports(Module& module, ValidationInfo& info) {
curr->mutable_, curr->name, "Imported global cannot be mutable");
}
info.shouldBeFalse(
- curr->type.isMulti(), curr->name, "Imported global cannot be tuple");
+ curr->type.isTuple(), curr->name, "Imported global cannot be tuple");
});
}
@@ -2194,7 +2194,7 @@ static void validateExports(Module& module, ValidationInfo& info) {
g->mutable_, g->name, "Exported global cannot be mutable");
}
info.shouldBeFalse(
- g->type.isMulti(), g->name, "Exported global cannot be tuple");
+ g->type.isTuple(), g->name, "Exported global cannot be tuple");
}
}
}
@@ -2347,7 +2347,7 @@ static void validateEvents(Module& module, ValidationInfo& info) {
Type(Type::none),
curr->name,
"Event type's result type should be none");
- if (curr->sig.params.isMulti()) {
+ if (curr->sig.params.isTuple()) {
info.shouldBeTrue(module.features.hasMultivalue(),
curr->name,
"Multivalue event type (multivalue is not enabled)");