summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-07-11 08:12:59 -0700
committerGitHub <noreply@github.com>2019-07-11 08:12:59 -0700
commit1a9b0e166a747fefbf0502318e6c2cc27669f3a1 (patch)
tree9677843f332083ad3c8663973ec5a57498cda662
parent9838b396d72e96741348b6c11c6fd02500b54171 (diff)
downloadbinaryen-1a9b0e166a747fefbf0502318e6c2cc27669f3a1.tar.gz
binaryen-1a9b0e166a747fefbf0502318e6c2cc27669f3a1.tar.bz2
binaryen-1a9b0e166a747fefbf0502318e6c2cc27669f3a1.zip
Don't minify __stack_pointer import (#2219)
This is core import like __memory_base and __table_base.
-rw-r--r--src/passes/MinifyImportsAndExports.cpp2
-rw-r--r--src/shared-constants.h1
-rw-r--r--src/wasm/wasm-emscripten.cpp2
-rw-r--r--src/wasm/wasm.cpp1
4 files changed, 4 insertions, 2 deletions
diff --git a/src/passes/MinifyImportsAndExports.cpp b/src/passes/MinifyImportsAndExports.cpp
index 043cfb588..d625f7543 100644
--- a/src/passes/MinifyImportsAndExports.cpp
+++ b/src/passes/MinifyImportsAndExports.cpp
@@ -145,7 +145,7 @@ private:
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) {
return;
}
auto newName = names.getName(soFar++);
diff --git a/src/shared-constants.h b/src/shared-constants.h
index 9fb84dbf8..4f64f1cf6 100644
--- a/src/shared-constants.h
+++ b/src/shared-constants.h
@@ -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;
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index 8463354e8..65f877d92 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -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)) {
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index e4c9813b3..d0a916072 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -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");