summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-validator.cpp
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2020-09-29 22:19:09 +0200
committerGitHub <noreply@github.com>2020-09-29 22:19:09 +0200
commit7d673ce83206349159a68fe683bc7da02dcdaf98 (patch)
treeb6be0e5842b8726406c50e9481531cf456db326f /src/wasm/wasm-validator.cpp
parent781da4c206c54e92b46358c00d079ada66cef0df (diff)
downloadbinaryen-7d673ce83206349159a68fe683bc7da02dcdaf98.tar.gz
binaryen-7d673ce83206349159a68fe683bc7da02dcdaf98.tar.bz2
binaryen-7d673ce83206349159a68fe683bc7da02dcdaf98.zip
GC: Add stubs for the remaining instructions (#3174)
NFC, except adding most of the boilerplate for the remaining GC instructions. Each implementation site is marked with a respective `TODO (gc): theInstruction` in between the typical boilerplate code.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r--src/wasm/wasm-validator.cpp88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index ff2ed7e39..96871ad8e 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -340,6 +340,18 @@ public:
void visitTupleExtract(TupleExtract* curr);
void visitI31New(I31New* curr);
void visitI31Get(I31Get* curr);
+ void visitRefTest(RefTest* curr);
+ void visitRefCast(RefCast* curr);
+ void visitBrOnCast(BrOnCast* curr);
+ void visitRttCanon(RttCanon* curr);
+ void visitRttSub(RttSub* curr);
+ void visitStructNew(StructNew* curr);
+ void visitStructGet(StructGet* curr);
+ void visitStructSet(StructSet* curr);
+ void visitArrayNew(ArrayNew* curr);
+ void visitArrayGet(ArrayGet* curr);
+ void visitArraySet(ArraySet* curr);
+ void visitArrayLen(ArrayLen* curr);
void visitFunction(Function* curr);
// helpers
@@ -2135,6 +2147,82 @@ void FunctionValidator::visitI31Get(I31Get* curr) {
"i31.get_s/u's argument should be i31ref");
}
+void FunctionValidator::visitRefTest(RefTest* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "ref.test requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): ref.test");
+}
+
+void FunctionValidator::visitRefCast(RefCast* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "ref.cast requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): ref.cast");
+}
+
+void FunctionValidator::visitBrOnCast(BrOnCast* curr) {
+ shouldBeTrue(getModule()->features.hasGC(),
+ curr,
+ "br_on_cast requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): br_on_cast");
+}
+
+void FunctionValidator::visitRttCanon(RttCanon* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "rtt.canon requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): rtt.canon");
+}
+
+void FunctionValidator::visitRttSub(RttSub* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "rtt.sub requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): rtt.sub");
+}
+
+void FunctionValidator::visitStructNew(StructNew* curr) {
+ shouldBeTrue(getModule()->features.hasGC(),
+ curr,
+ "struct.new requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): struct.new");
+}
+
+void FunctionValidator::visitStructGet(StructGet* curr) {
+ shouldBeTrue(getModule()->features.hasGC(),
+ curr,
+ "struct.get requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): struct.get");
+}
+
+void FunctionValidator::visitStructSet(StructSet* curr) {
+ shouldBeTrue(getModule()->features.hasGC(),
+ curr,
+ "struct.set requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): struct.set");
+}
+
+void FunctionValidator::visitArrayNew(ArrayNew* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "array.new requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): array.new");
+}
+
+void FunctionValidator::visitArrayGet(ArrayGet* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "array.get requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): array.get");
+}
+
+void FunctionValidator::visitArraySet(ArraySet* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "array.set requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): array.set");
+}
+
+void FunctionValidator::visitArrayLen(ArrayLen* curr) {
+ shouldBeTrue(
+ getModule()->features.hasGC(), curr, "array.len requires gc to be enabled");
+ WASM_UNREACHABLE("TODO (gc): array.len");
+}
+
void FunctionValidator::visitFunction(Function* curr) {
if (curr->sig.results.isTuple()) {
shouldBeTrue(getModule()->features.hasMultivalue(),