Skip to content

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Oct 16, 2025

This removes the special handling of exported immutable globals which simplifies the code in a few different ways.

For programs that export data addresses (this is relatively rare) this means codesize reduction for the generated JS (since it no longer contains the constant values) and the codesize increase for the Wasm binary (since it now contains extra exports).

The main reason for this is consistency with dynamic linking (where data exports are always needed) and a reduction in complexity.

The following (14) test expectation files were updated by running the tests with --rebaseline:

codesize/test_codesize_minimal_64.json: 2657 => 2665 [+8 bytes / +0.30%]
test/codesize/test_codesize_minimal_O0.expected.js updated
codesize/test_codesize_minimal_O0.json: 20398 => 20495 [+97 bytes / +0.48%]
codesize/test_codesize_minimal_O1.json: 3498 => 3504 [+6 bytes / +0.17%]
codesize/test_codesize_minimal_O2.json: 2622 => 2626 [+4 bytes / +0.15%]
codesize/test_codesize_minimal_O3.json: 2354 => 2362 [+8 bytes / +0.34%]
codesize/test_codesize_minimal_Os.json: 2354 => 2362 [+8 bytes / +0.34%]
codesize/test_codesize_minimal_Os_mr.json: 559 => 572 [+13 bytes / +2.33%]
codesize/test_codesize_minimal_Oz-ctors.json: 2322 => 2330 [+8 bytes / +0.34%]
codesize/test_codesize_minimal_Oz.json: 2354 => 2362 [+8 bytes / +0.34%]
codesize/test_codesize_minimal_esm.json: 2489 => 2498 [+9 bytes / +0.36%]
codesize/test_codesize_minimal_pthreads.json: 27208 => 27214 [+6 bytes / +0.02%]
codesize/test_codesize_minimal_pthreads_memgrowth.json: 27636 => 27642 [+6 bytes / +0.02%]
codesize/test_codesize_minimal_wasmfs.json: 2354 => 2362 [+8 bytes / +0.34%]

Average change: +0.43% (+0.02% - +2.33%)

@sbc100 sbc100 requested a review from kripken October 16, 2025 14:33
@sbc100 sbc100 force-pushed the data_symbol_exports branch 2 times, most recently from 1808912 to d72fca6 Compare October 16, 2025 16:16
@sbc100 sbc100 force-pushed the data_symbol_exports branch 3 times, most recently from 65a7082 to 6c1b746 Compare October 18, 2025 21:09
This removes the special handling of exported immutable globals which
simplifies the code in a few different ways.

For programs that export data addresses (this is relatively rare) this
means codesize reduction for the generated JS (since it no longer
contains the constant values) and the codesize increase for the Wasm
binary (since it now contains extra exports).

The main reason for this is consistency with dynamic linking (where data
exports are always needed) and a reduction in complexity.

The following (14) test expectation files were updated by
running the tests with `--rebaseline`:

```
codesize/test_codesize_minimal_64.json: 2657 => 2671 [+14 bytes / +0.53%]
test/codesize/test_codesize_minimal_O0.expected.js updated
codesize/test_codesize_minimal_O0.json: 20398 => 20501 [+103 bytes / +0.50%]
codesize/test_codesize_minimal_O1.json: 3498 => 3510 [+12 bytes / +0.34%]
codesize/test_codesize_minimal_O2.json: 2622 => 2632 [+10 bytes / +0.38%]
codesize/test_codesize_minimal_O3.json: 2354 => 2368 [+14 bytes / +0.59%]
codesize/test_codesize_minimal_Os.json: 2354 => 2368 [+14 bytes / +0.59%]
codesize/test_codesize_minimal_Os_mr.json: 559 => 572 [+13 bytes / +2.33%]
codesize/test_codesize_minimal_Oz-ctors.json: 2322 => 2336 [+14 bytes / +0.60%]
codesize/test_codesize_minimal_Oz.json: 2354 => 2368 [+14 bytes / +0.59%]
codesize/test_codesize_minimal_esm.json: 2489 => 2504 [+15 bytes / +0.60%]
codesize/test_codesize_minimal_pthreads.json: 27208 => 27220 [+12 bytes / +0.04%]
codesize/test_codesize_minimal_pthreads_memgrowth.json: 27636 => 27648 [+12 bytes / +0.04%]
codesize/test_codesize_minimal_wasmfs.json: 2354 => 2368 [+14 bytes / +0.59%]

Average change: +0.60% (+0.04% - +2.33%)
```
@sbc100 sbc100 force-pushed the data_symbol_exports branch from 6c1b746 to 2c3efc2 Compare October 18, 2025 21:18
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