summaryrefslogtreecommitdiff
path: root/src/ir/effects.h
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-04-06 13:35:12 -0700
committerGitHub <noreply@github.com>2023-04-06 20:35:12 +0000
commit4f91c6a569614275d906a825d3f495541aa8802d (patch)
tree26b438a2aeec65e93a219da792b928b7c9c0eece /src/ir/effects.h
parent6afbc200b57acd1b9111de7729d47fea1d04c5f6 (diff)
downloadbinaryen-4f91c6a569614275d906a825d3f495541aa8802d.tar.gz
binaryen-4f91c6a569614275d906a825d3f495541aa8802d.tar.bz2
binaryen-4f91c6a569614275d906a825d3f495541aa8802d.zip
Implement array.fill, array.init_data, and array.init_elem (#5637)
These complement array.copy, which we already supported, as an initial complete set of bulk array operations. Replace the WIP spec tests with the upstream spec tests, lightly edited for compatibility with Binaryen.
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r--src/ir/effects.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h
index 59ef8bace..c5251ae64 100644
--- a/src/ir/effects.h
+++ b/src/ir/effects.h
@@ -799,6 +799,25 @@ private:
// traps when a ref is null, or when out of bounds.
parent.implicitTrap = true;
}
+ void visitArrayFill(ArrayFill* curr) {
+ if (curr->ref->type.isNull()) {
+ parent.trap = true;
+ return;
+ }
+ parent.writesArray = true;
+ // Traps when the destination is null or when out of bounds.
+ parent.implicitTrap = true;
+ }
+ void visitArrayInit(ArrayInit* curr) {
+ if (curr->ref->type.isNull()) {
+ parent.trap = true;
+ return;
+ }
+ parent.writesArray = true;
+ // Traps when the destination is null, when out of bounds in source or
+ // destination, or when the source segment has been dropped.
+ parent.implicitTrap = true;
+ }
void visitRefAs(RefAs* curr) {
if (curr->op == ExternInternalize || curr->op == ExternExternalize) {
// These conversions are infallible.