summaryrefslogtreecommitdiff
path: root/src/wasm-validator.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-09-21 19:33:11 -0700
committerGitHub <noreply@github.com>2016-09-21 19:33:11 -0700
commit8be82627c6a8cbded0dab67ad1f31906a54ba78c (patch)
treeb7b14f1899ffe39a7562007474a58948685146c8 /src/wasm-validator.h
parent7292ef9c863a0766c697cc0a77516447ff652820 (diff)
parent740e36eab98d679387fea60cd642591a69ce809f (diff)
downloadbinaryen-8be82627c6a8cbded0dab67ad1f31906a54ba78c.tar.gz
binaryen-8be82627c6a8cbded0dab67ad1f31906a54ba78c.tar.bz2
binaryen-8be82627c6a8cbded0dab67ad1f31906a54ba78c.zip
Merge pull request #703 from WebAssembly/spec-update
Spec update - get us passing the 0xc spec tests (minus stacky stuff)
Diffstat (limited to 'src/wasm-validator.h')
-rw-r--r--src/wasm-validator.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/wasm-validator.h b/src/wasm-validator.h
index e23221337..988d1104d 100644
--- a/src/wasm-validator.h
+++ b/src/wasm-validator.h
@@ -179,7 +179,6 @@ public:
}
}
void visitCallIndirect(CallIndirect *curr) {
- shouldBeTrue(getModule()->table.segments.size() > 0, curr, "no table");
auto* type = getModule()->checkFunctionType(curr->fullType);
if (!shouldBeTrue(!!type, curr, "call_indirect type must exist")) return;
shouldBeEqualOrFirstIsUnreachable(curr->target->type, i32, curr, "indirect call target must be an i32");
@@ -335,7 +334,7 @@ public:
}
void visitGlobal(Global* curr) {
- shouldBeTrue(curr->init->is<Const>(), curr->name, "global init must be valid");
+ shouldBeTrue(curr->init->is<Const>() || curr->init->is<GetGlobal>(), curr->name, "global init must be valid");
shouldBeEqual(curr->type, curr->init->type, nullptr, "global init must have correct type");
}
@@ -394,7 +393,15 @@ public:
break;
}
}
- shouldBeTrue(found, name, "module exports must be found");
+ shouldBeTrue(found, name, "module function exports must be found");
+ } else if (exp->kind == Export::Global) {
+ shouldBeTrue(curr->checkGlobal(name), name, "module global exports must be found");
+ } else if (exp->kind == Export::Table) {
+ shouldBeTrue(name == Name("0") || name == curr->table.name, name, "module table exports must be found");
+ } else if (exp->kind == Export::Memory) {
+ shouldBeTrue(name == Name("0") || name == curr->memory.name, name, "module memory exports must be found");
+ } else {
+ WASM_UNREACHABLE();
}
Name exportName = exp->name;
shouldBeFalse(exportNames.count(exportName) > 0, exportName, "module exports must be unique");