Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/ir/module-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,15 @@ struct TypeInfos {
}
}
void note(Type type) {
for (HeapType ht : type.getHeapTypeChildren()) {
note(ht);
// Handle the common case of a ref directly, to avoid a scan of children.
if (type.isRef()) {
note(type.getHeapType());
return;
}
if (type.isTuple()) {
for (HeapType ht : type.getHeapTypeChildren()) {
note(ht);
}
}
}
// Ensure a type is included without increasing its count.
Expand All @@ -374,8 +381,14 @@ struct TypeInfos {
}
}
void include(Type type) {
for (HeapType ht : type.getHeapTypeChildren()) {
include(ht);
if (type.isRef()) {
include(type.getHeapType());
return;
}
if (type.isTuple()) {
for (HeapType ht : type.getHeapTypeChildren()) {
include(ht);
}
}
}
void noteControlFlow(Signature sig) {
Expand Down
Loading