Skip to content

Can we do more table element stripping in RemoveUnusedModuleElements? #3029

Description

@sbc100

In RemoveUnusedModuleElements we clear the entire table if there is no usage of the table in the module:

https://github.com/WebAssembly/binaryen/blob/master/src/passes/RemoveUnusedModuleElements.cpp#L226

However, perhaps we could be more course grain:

  1. Find all the signatures used by all call_indirect instructions.
  2. Remove any table elements that don't match one of those signatures.

I guess this might make the table kind of sparse? Would it be observable? Using one of these slots would generate an "invalid signature" and now it would become "empty table slot". I guess we could add per-signature trapping functions. These would never be reached and would preserve the "invalid signature" trap.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions