sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[dart2wasm] Support cross module inlining & better inlining in dart2wasm

Open mkustermann opened this issue 2 days ago • 0 comments

We should start allowing dart2wasm to inline functions across wasm modules. A function can inline a target function if the target is guaranteed to be loaded when the calling function executes.

The most important case: A deferred module calls a function that's present in the main module.

This will have several benefits:

  • deferred module code may get smaller/faster
  • main module (and others) may not have to export functions (if all uses are inlined)
  • we rely less on wasm-opt to do heavy lifting

The current inlining heuristics are very crude and could be improved (very conservative atm & based on AST node count).

mkustermann avatar Dec 09 '25 13:12 mkustermann