|
104 | 104 | 'emscripten_idb_store', 'emscripten_idb_delete', 'emscripten_idb_exists',
|
105 | 105 | 'emscripten_idb_load_blob', 'emscripten_idb_store_blob', 'SDL_Delay',
|
106 | 106 | 'emscripten_scan_registers', 'emscripten_lazy_load_code',
|
107 |
| - 'emscripten_fiber_swap', |
| 107 | + 'emscripten_fiber_swap', '__load_secondary_module', |
108 | 108 | 'wasi_snapshot_preview1.fd_sync', '__wasi_fd_sync', '_emval_await',
|
109 | 109 | '_dlopen_js', '__asyncjs__*'
|
110 | 110 | ]
|
@@ -706,6 +706,9 @@ def check_human_readable_list(items):
|
706 | 706 | passes += ['--jspi']
|
707 | 707 | passes += ['--pass-arg=jspi-imports@%s' % ','.join(settings.ASYNCIFY_IMPORTS)]
|
708 | 708 | passes += ['--pass-arg=jspi-exports@%s' % ','.join(settings.ASYNCIFY_EXPORTS)]
|
| 709 | + if settings.SPLIT_MODULE: |
| 710 | + passes += ['--pass-arg=jspi-split-module'] |
| 711 | + |
709 | 712 | if settings.BINARYEN_IGNORE_IMPLICIT_TRAPS:
|
710 | 713 | passes += ['--ignore-implicit-traps']
|
711 | 714 | # normally we can assume the memory, if imported, has not been modified
|
@@ -751,9 +754,12 @@ def make_js_executable(script):
|
751 | 754 | pass # can fail if e.g. writing the executable to /dev/null
|
752 | 755 |
|
753 | 756 |
|
754 |
| -def do_split_module(wasm_file): |
| 757 | +def do_split_module(wasm_file, options): |
755 | 758 | os.rename(wasm_file, wasm_file + '.orig')
|
756 | 759 | args = ['--instrument']
|
| 760 | + if options.requested_debug: |
| 761 | + # Tell wasm-split to preserve function names. |
| 762 | + args += ['-g'] |
757 | 763 | building.run_binaryen_command('wasm-split', wasm_file + '.orig', outfile=wasm_file, args=args)
|
758 | 764 |
|
759 | 765 |
|
@@ -2527,6 +2533,9 @@ def check_memory_setting(setting):
|
2527 | 2533 | if settings.LEGALIZE_JS_FFI:
|
2528 | 2534 | settings.REQUIRED_EXPORTS += ['__get_temp_ret', '__set_temp_ret']
|
2529 | 2535 |
|
| 2536 | + if settings.SPLIT_MODULE and settings.ASYNCIFY == 2: |
| 2537 | + settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE += ['_load_secondary_module'] |
| 2538 | + |
2530 | 2539 | # wasm side modules have suffix .wasm
|
2531 | 2540 | if settings.SIDE_MODULE and shared.suffix(target) == '.js':
|
2532 | 2541 | diagnostics.warning('emcc', 'output suffix .js requested, but wasm side modules are just wasm files; emitting only a .wasm, no .js')
|
@@ -3192,7 +3201,7 @@ def phase_final_emitting(options, state, target, wasm_target, memfile):
|
3192 | 3201 |
|
3193 | 3202 | if settings.SPLIT_MODULE:
|
3194 | 3203 | diagnostics.warning('experimental', 'The SPLIT_MODULE setting is experimental and subject to change')
|
3195 |
| - do_split_module(wasm_target) |
| 3204 | + do_split_module(wasm_target, options) |
3196 | 3205 |
|
3197 | 3206 | for f in generated_text_files_with_native_eols:
|
3198 | 3207 | tools.line_endings.convert_line_endings_in_file(f, os.linesep, options.output_eol)
|
|
0 commit comments