Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Sep 1, 2020

We were careful not to minify those, as well as the stack pointer, which
makes sense in dynamic linking. But we don't run this pass in dynamic linking
anyhow - we need the proper names of symbols in that case. So this was
not helping us, and was just a leftover from an early state.

This both a useful optimization and also important for #3043,
as the wasm backend exports the table as __indirect_function_table - a much
longer name than emscripten's table. So just changing to that would regress
code size on small projects. Once we land this, the name won't matter as it will
be minified anyhow.

This will break some tests on the roller as it improves code size beyond
current expectations, so it will require a double-roll or a temporary test
disabling.

@kripken kripken requested a review from sbc100 September 1, 2020 13:41
kripken added a commit to emscripten-core/emscripten that referenced this pull request Sep 1, 2020
}
if (module->table.exists) {
processImport(&module->table);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just use iterImportedMemories and iterImportedTables?

Or better still add an iterImports and just use that?

Copy link
Member Author

@kripken kripken Sep 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good idea for iterImports, that's much nicer. Added now.

(edit: and yes, I forgot about iterImportedMemories and iterImportedTables)

Copy link
Member

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@kripken kripken merged commit 7438b6c into master Sep 2, 2020
@kripken kripken deleted the table1 branch September 2, 2020 18:54
kripken added a commit to emscripten-core/emscripten that referenced this pull request Sep 2, 2020
Code size improvements + stack improvements are inbound,

WebAssembly/binaryen#3089
WebAssembly/binaryen#3091
kripken added a commit to emscripten-core/emscripten that referenced this pull request Sep 3, 2020
Code size improvements are from WebAssembly/binaryen#3089 which lets us now
minify the name of the memory and the table among the wasm imports and exports.

Reverts the disablings in #12099, #12100 (except for the safe stack one, which
requires more fixes in a subsequent PR).
std::map<Name, Name> newToOld;
auto process = [&](Name& name) {
// do not minifiy special imports, they must always exist
if (name == MEMORY_BASE || name == TABLE_BASE || name == STACK_POINTER) {

This comment was marked as outdated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the special stack pointer import is relevant only for dynamic linking, but as mentioned earlier, we don't run this pass in that case anyhow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I see

sbc100 added a commit that referenced this pull request Sep 22, 2022
TABLE_BASE usage was removed in #3211.
MEMORY_BASE usage was removed in #3089.
NEW_SIZE usage was removed in #3180.
sbc100 added a commit that referenced this pull request Sep 22, 2022
TABLE_BASE usage was removed in #3211.
MEMORY_BASE usage was removed in #3089.
NEW_SIZE usage was removed in #3180.
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.

4 participants