You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[wasm-split] Move exclusive items to secondary modules (#8441)
When splitting a module, if non-function items (memories, tables,
globals, tags) are exclusively used by a single secondary module, this
moves them directly to that secondary module rather than exporting them
from the primary module.
When a global is moved, its initializer can contain `global.get` or
`ref.func`s, creating dependences on other globals and functions. For
now, this PR just exports all the dependences from the primary module to
the secondary module. This will be improved by follow-up PRs.
This PR reduces the size of the primary module for acx_gallery by 12.5%.
Follow-up PRs will reduce it further.
This also sadly increases wasm-split's running time on acx_gallery from
16.5s -> 24.7s, by 49%, due to more computations in
`shareImportableItems`.
---
The below is `wasm-objdump -h` result of the primary modules:
- Before
```
Type start=0x0000000c end=0x00035e09 (size=0x00035dfd) count: 11192
Import start=0x00035e0e end=0x004bd669 (size=0x0048785b) count: 65720
Function start=0x004bd66d end=0x004d0519 (size=0x00012eac) count: 62890
Table start=0x004d051c end=0x004d4059 (size=0x00003b3d) count: 2921
Tag start=0x004d405b end=0x004d405f (size=0x00000004) count: 1
Global start=0x004d4063 end=0x00689ff8 (size=0x001b5f95) count: 80766
Export start=0x00689ffc end=0x0071b16c (size=0x00091170) count: 60877
Start start=0x0071b16e end=0x0071b170 (size=0x00000002) start: 828
Elem start=0x0071b174 end=0x00784fb9 (size=0x00069e45) count: 12303
DataCount start=0x00784fbb end=0x00784fbc (size=0x00000001) count: 1
Code start=0x00784fc1 end=0x009b4958 (size=0x0022f997) count: 62890
Data start=0x009b495c end=0x009d44e9 (size=0x0001fb8d) count: 1
```
- After (This PR)
```
Type start=0x0000000c end=0x00035d44 (size=0x00035d38) count: 11185
Import start=0x00035d49 end=0x003faf6f (size=0x003c5226) count: 56805
Function start=0x003faf73 end=0x0040de1f (size=0x00012eac) count: 62890
Table start=0x0040de22 end=0x0041195d (size=0x00003b3b) count: 2921
Tag start=0x0041195f end=0x00411963 (size=0x00000004) count: 1
Global start=0x00411967 end=0x005541c5 (size=0x0014285e) count: 47771
Export start=0x005541c9 end=0x005dfc2c (size=0x0008ba63) count: 59077
Start start=0x005dfc2e end=0x005dfc30 (size=0x00000002) start: 828
Elem start=0x005dfc34 end=0x00649a77 (size=0x00069e43) count: 12303
DataCount start=0x00649a79 end=0x00649a7a (size=0x00000001) count: 1
Code start=0x00649a7f end=0x00879385 (size=0x0022f906) count: 62890
Data start=0x00879389 end=0x00898f16 (size=0x0001fb8d) count: 1
```
Follow-ups: #8442 and #8443
0 commit comments