diff options
Diffstat (limited to 'src/ir/possible-contents.cpp')
-rw-r--r-- | src/ir/possible-contents.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp index 9c132fd0c..0c4e28568 100644 --- a/src/ir/possible-contents.cpp +++ b/src/ir/possible-contents.cpp @@ -896,6 +896,26 @@ struct InfoCollector } addRoot(curr, PossibleContents::exactType(curr->type)); } + void visitArrayNewSeg(ArrayNewSeg* curr) { + if (curr->type == Type::unreachable) { + return; + } + auto heapType = curr->type.getHeapType(); + switch (curr->op) { + case NewData: { + Type elemType = heapType.getArray().element.type; + addRoot(DataLocation{heapType, 0}, + PossibleContents::fromType(elemType)); + return; + } + case NewElem: { + Type segType = getModule()->elementSegments[curr->segment]->type; + addRoot(DataLocation{heapType, 0}, PossibleContents::fromType(segType)); + return; + } + } + WASM_UNREACHABLE("unexpected op"); + } void visitArrayInit(ArrayInit* curr) { if (curr->type == Type::unreachable) { return; |