File tree Expand file tree Collapse file tree 4 files changed +9
-7
lines changed
Expand file tree Collapse file tree 4 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1685,7 +1685,7 @@ def include_and_export(name):
16851685 # wasm. This allows us to set up memory, preload files, etc. even before
16861686 # the wasm module is created.
16871687 if shared .Settings .MINIMAL_RUNTIME or shared .Settings .STANDALONE_WASM :
1688- shared .Settings .EXPORT_MEMORY_TO_WASM = 0
1688+ shared .Settings .MEMORY_DEFINED_IN_WASM = 1
16891689
16901690 if shared .Settings .WASM_BIGINT :
16911691 shared .Settings .LEGALIZE_JS_FFI = 0
Original file line number Diff line number Diff line change @@ -623,7 +623,7 @@ def add_standard_wasm_imports(send_items_map):
623623 # Normally we import these into the wasm (so that JS could use them even
624624 # before the wasm loads), while in standalone mode we do not depend
625625 # on JS to create them, but create them in the wasm and export them.
626- if shared .Settings .EXPORT_MEMORY_TO_WASM :
626+ if not shared .Settings .MEMORY_DEFINED_IN_WASM :
627627 memory_import = 'wasmMemory'
628628 if shared .Settings .MODULARIZE and shared .Settings .USE_PTHREADS :
629629 # Pthreads assign wasmMemory in their worker startup. In MODULARIZE mode, they cannot assign inside the
Original file line number Diff line number Diff line change @@ -196,6 +196,8 @@ var STRUCT_INFO = '';
196196// If true, building against Emscripten's asm.js/wasm heap memory profiler.
197197var MEMORYPROFILER = 0 ;
198198
199- // Set to 1 by default for certain cases such as STANDALONE_WASM and
200- // MINIMAL_RUNTIME
201- var EXPORT_MEMORY_TO_WASM = 1 ;
199+ // By default we set this to 0 meaning the wasm file does not defined its own
200+ // memory and instead the memory is defined in JavaScript.
201+ // This is set 1 in STANDALONE_WASM or MINIMAL_RUNTIME mode in which case
202+ // the wasm module exports its memory to JavaScript.
203+ var MEMORY_DEFINED_IN_WASM = 0 ;
Original file line number Diff line number Diff line change @@ -477,8 +477,8 @@ def lld_flags_for_executable(external_symbol_list):
477477 else :
478478 cmd .append ('--allow-undefined' )
479479
480- if Settings .EXPORT_MEMORY_TO_WASM :
481- cmd .append ('--import -memory' )
480+ if not Settings .MEMORY_DEFINED_IN_WASM :
481+ cmd .append ('--importt -memory' )
482482
483483 if Settings .USE_PTHREADS :
484484 cmd .append ('--shared-memory' )
You can’t perform that action at this time.
0 commit comments