Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/passes/MinifyImportsAndExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct MinifyImportsAndExports : public Pass {
std::map<Name, Name> oldToNew;
auto process = [&](Name& name) {
// do not minifiy special imports, they must always exist
if (name == MEMORY_BASE || name == TABLE_BASE) {
if (name == MEMORY_BASE || name == TABLE_BASE || name == STACK_POINTER) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

are these "ABI imports" documented in tool-conventions? if so a link to there might be nice.

for the first two I think the dynamic linking doc there mentions them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't know .. all i know is that if I allow minification of __stack_pointer I get a test failure. To be honest I'm not sure why these can't be minified too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh you are correct this should be documented in https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md but isn't yet.

return;
}
auto newName = names.getName(soFar++);
Expand Down
1 change: 1 addition & 0 deletions src/shared-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ extern Name GROW_WASM_MEMORY;
extern Name WASM_CALL_CTORS;
extern Name MEMORY_BASE;
extern Name TABLE_BASE;
extern Name STACK_POINTER;
extern Name GET_TEMP_RET0;
extern Name SET_TEMP_RET0;
extern Name NEW_SIZE;
Expand Down
2 changes: 1 addition & 1 deletion src/wasm/wasm-emscripten.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Global* EmscriptenGlueGenerator::getStackPointerGlobal() {
// linker could export it by name?
for (auto& g : wasm.globals) {
if (g->imported()) {
if (g->base == "__stack_pointer") {
if (g->base == STACK_POINTER) {
return g.get();
}
} else if (!isExported(wasm, g->name)) {
Expand Down
1 change: 1 addition & 0 deletions src/wasm/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Name GROW_WASM_MEMORY("__growWasmMemory");
Name WASM_CALL_CTORS("__wasm_call_ctors");
Name MEMORY_BASE("__memory_base");
Name TABLE_BASE("__table_base");
Name STACK_POINTER("__stack_pointer");
Name GET_TEMP_RET0("getTempRet0");
Name SET_TEMP_RET0("setTempRet0");
Name NEW_SIZE("newSize");
Expand Down