summaryrefslogtreecommitdiff
path: root/src/ir/effects.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-12-10 15:25:23 -0800
committerGitHub <noreply@github.com>2020-12-10 15:25:23 -0800
commitc93da3de39a4592abc6cddbed30b5c7074069a24 (patch)
tree265bcd421a97a21d58493f65eb29f252bf3a6001 /src/ir/effects.h
parent57a9e77add02dc1d874fdbfee2c61cae8c0eefa1 (diff)
downloadbinaryen-c93da3de39a4592abc6cddbed30b5c7074069a24.tar.gz
binaryen-c93da3de39a4592abc6cddbed30b5c7074069a24.tar.bz2
binaryen-c93da3de39a4592abc6cddbed30b5c7074069a24.zip
[GC] Add Array operations (#3436)
array.new/get/set/len - pretty straightforward after structs and all the infrastructure for them. Also fixes validation of the unnecessary heapType param in the text and binary formats in structs as well as arrays. Fixes printing of packed types in type names, which emitted i32 for them. That broke when we emitted the same name for an array of i8 and i32 as in the new testing here. Also fix a bug in Field::operator< which was wrong for packed types; again, this was easy to notice with the new testing.
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r--src/ir/effects.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h
index e4907b082..94387c2cf 100644
--- a/src/ir/effects.h
+++ b/src/ir/effects.h
@@ -556,8 +556,7 @@ private:
}
void visitRttCanon(RttCanon* curr) {}
void visitRttSub(RttSub* curr) {}
- void visitStructNew(StructNew* curr) {
- }
+ void visitStructNew(StructNew* curr) {}
void visitStructGet(StructGet* curr) {
// traps when the arg is null
if (curr->ref->type.isNullable()) {
@@ -570,17 +569,20 @@ private:
parent.implicitTrap = true;
}
}
- void visitArrayNew(ArrayNew* curr) {
- WASM_UNREACHABLE("TODO (gc): array.new");
- }
+ void visitArrayNew(ArrayNew* curr) {}
void visitArrayGet(ArrayGet* curr) {
- WASM_UNREACHABLE("TODO (gc): array.get");
+ // traps when the arg is null or the index out of bounds
+ parent.implicitTrap = true;
}
void visitArraySet(ArraySet* curr) {
- WASM_UNREACHABLE("TODO (gc): array.set");
+ // traps when the arg is null or the index out of bounds
+ parent.implicitTrap = true;
}
void visitArrayLen(ArrayLen* curr) {
- WASM_UNREACHABLE("TODO (gc): array.len");
+ // traps when the arg is null
+ if (curr->ref->type.isNullable()) {
+ parent.implicitTrap = true;
+ }
}
};