Skip to content

Simplify and fix heap type counting #5110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 5, 2022
Merged

Simplify and fix heap type counting #5110

merged 2 commits into from
Oct 5, 2022

Conversation

tlively
Copy link
Member

@tlively tlively commented Oct 4, 2022

Annotations on array.get and array.set were not being counted and the code could
generally be simplified since count already ignores types that don't need to
be counted.

Annotations on array.get and array.set were not being counted and the code could
generally be simplified since `count` already ignores types that don't need to
be counted.
@tlively tlively requested a review from kripken October 4, 2022 23:46
@tlively
Copy link
Member Author

tlively commented Oct 4, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@@ -54,17 +54,15 @@ struct CodeScanner
if (auto* call = curr->dynCast<CallIndirect>()) {
counts.note(call->heapType);
} else if (auto* call = curr->dynCast<CallRef>()) {
if (call->isReturn && call->target->type.isFunction()) {
Copy link
Member

Choose a reason for hiding this comment

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

The isReturn change makes us count in the way that is correct in the spec but we haven't yet moved to, I think? But the idea is that there's no harm to doing that for now, and eventually this code will become right in binaryen as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

We emit a type annotation for non-return call_ref as well since #5079, so this is necessary for correctness.

@tlively tlively mentioned this pull request Oct 5, 2022
@tlively tlively merged commit 5b0977d into main Oct 5, 2022
@tlively tlively deleted the fix-type-counts branch October 5, 2022 02:51
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.

2 participants