Skip to content

Commit

Permalink
Do not mark as used elements with export tables
Browse files Browse the repository at this point in the history
Export tables are used anyway
  • Loading branch information
zetanumbers committed May 6, 2024
1 parent 839c297 commit 4751bd9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/passes/used.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,14 @@ impl Used {
for elem in module.elements.iter() {
match elem.kind {
// Active segments are rooted because they initialize imported
// or exported tables. Declared segments can probably get gc'd
// but for now we're conservative and we root them.
// tables.
ElementKind::Active { table, .. } => {
if module.exports.get_exported_table(table).is_some()
|| module.tables.get(table).import.is_some()
{
if module.tables.get(table).import.is_some() {
stack.push_element(elem.id());
}
}
// Declared segments can probably get gc'd but for now we're
// conservative and we root them
ElementKind::Declared => {
stack.push_element(elem.id());
}
Expand Down

0 comments on commit 4751bd9

Please sign in to comment.