Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented Dec 10, 2024

Co-locate the declaration and implementation of TypeGraphWalkerBase and
its subtypes in wasm-type.cpp and simplify the implementation. Remove
the preVisit and postVisit tasks for both Types and HeapTypes since
overriding scanType and scanHeapType is sufficient for all users. Stop
scanning the HeapTypes in reference types because a follow-on change
(#7142) will make that much more complicated, and it turns out that it
is not necessary.

Co-locate the declaration and implementation of TypeGraphWalkerBase and
its subtypes in wasm-type.cpp and simplify the implementation. Remove
the preVisit and postVisit tasks for both Types and HeapTypes since
overriding scanType and scanHeapType is sufficient for all users. Stop
scanning the HeapTypes in reference types because a follow-on change
(#7142) will make that much more complicated, and it turns out that it
is not necessary.
@tlively tlively requested a review from kripken December 10, 2024 01:19
assert(taskList.empty());
taskList.push_back(Task::scan(type));
doWalk();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we don't walk heap types, it seems like this will only ever walk the type itself, or the tuple elements if it is a tuple. And the tuple elements are not themselves tuples. So can this function not just be a simple loop over *type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could, but I think it's simpler to keep the method of traversal consistent between types and heap types.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, though it might be a tad faster the other way. But up to you.


private:
bool isTopLevel = true;
std::unordered_set<HeapType> seen;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be used?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, indeed.

@tlively tlively merged commit 725f76d into main Dec 10, 2024
13 checks passed
@tlively tlively deleted the simplify-type-graph-walker branch December 10, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants