Skip to content
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

Root table items; reverse table/elem edge directions #153

Merged
merged 4 commits into from
Sep 8, 2018

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Sep 6, 2018

Muuuuch less reported in twiggy garbage now :)

And tables are showing up as expected in the dominator trees now!

The function table contains functions that can be dynamically indirectly called,
and since we can't statically understand indirect calls (and nor can the linker
or wasm-gc) we treat the table as roots (effectively rooting anything that the
table is holding).

Fixes #5
It was the other way around because at the binary level the element references
which table it is populating, but logically it is the table that owns its
elements. It gives us much more useful data this way: we can see when the table
is heavy in the dominators tree, because a bunch of dynamic indirect calls that
the linker couldn't remove got entrenched in the binary.
@fitzgen fitzgen requested a review from data-pup September 6, 2018 23:16
@@ -559,7 +559,7 @@ impl<'a> Parse<'a> for elements::ElementSection {
let elem_id = Id::entry(idx, i);
if let Some(table_section_idx) = table_section_idx {
let entry_id = Id::entry(table_section_idx, elem.index() as usize);
items.add_edge(elem_id, entry_id);
items.add_edge(entry_id, elem_id);
Copy link
Member

Choose a reason for hiding this comment

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

logically it is the table that owns its
elements. It gives us much more useful data this way: we can see when the table
is heavy in the dominators tree, because a bunch of dynamic indirect calls that
the linker couldn't remove got entrenched in the binary.

It took a second for me to understand this, but ❗ omg! ❗

Would not have thought of this, ! This is so cool :)

Copy link
Member

@data-pup data-pup left a comment

Choose a reason for hiding this comment

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

This is wonderful. I really love the additional work to add a way to update the test expectations separately. Thanks for doing this!

@data-pup data-pup merged commit fcc3d56 into master Sep 8, 2018
@fitzgen fitzgen deleted the table-elem-edges branch September 8, 2018 00:13
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