Skip to content

Commit f968541

Browse files
authored
Remove unnecessary stack access setup (#7644)
We had a place in emscripten.py where we manually set up stackAlloc etc. This nonstandard location confused metadce, which saw that those functions had extra definitions and uses and hence did not eliminate them. Removing that extra location reveals the possible reason for it, that it handled the _ prefix difference. Adding those special functions to the list of other special functions (that don't need prefixing) appears makes things work again.
1 parent b0002bd commit f968541

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

emscripten.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,13 +2140,6 @@ def create_module_wasm(sending, receiving, invoke_funcs, jscall_sigs,
21402140
%s;
21412141
''' % (access_quote('asmGlobalArg'), access_quote('asmLibraryArg'), receiving)]
21422142

2143-
module.append('''
2144-
var stackAlloc = Module['_stackAlloc'];
2145-
var stackSave = Module['_stackSave'];
2146-
var stackRestore = Module['_stackRestore'];
2147-
var establishStackSpace = Module['establishStackSpace'];
2148-
''')
2149-
21502143
module.append(invoke_wrappers)
21512144
module.append(jscall_funcs)
21522145
return module
@@ -2222,7 +2215,7 @@ def asmjs_mangle(name):
22222215
Prepends '_' and replaces non-alphanumerics with '_'.
22232216
Used by wasm backend for JS library consistency with asm.js.
22242217
"""
2225-
library_functions_in_module = ('setThrew', 'setTempRet0', 'getTempRet0')
2218+
library_functions_in_module = ('setThrew', 'setTempRet0', 'getTempRet0', 'stackAlloc', 'stackSave', 'stackRestore', 'establishStackSpace')
22262219
if name.startswith('dynCall_'):
22272220
return name
22282221
if name in library_functions_in_module:

0 commit comments

Comments
 (0)