Skip to content

Commit 71b888c

Browse files
committed
Mark MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION as requiring html output
The code for handling this setting and performing the streaming exists only in the generated html. Also error out if MINIMAL_RUNTIME_STREAMING_WASM_* are used without MINIMAL_RUNTIME.
1 parent ddff8d5 commit 71b888c

File tree

6 files changed

+24
-4
lines changed

6 files changed

+24
-4
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works.
2020

2121
4.0.13 (in development)
2222
-----------------------
23+
- The `MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION` setting is only compatible
24+
with html output. ()
2325

2426
4.0.12 - 08/01/25
2527
-----------------

site/source/docs/tools_reference/settings_reference.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2954,6 +2954,7 @@ For large .wasm modules and production environments, this should be set to 1
29542954
for faster startup speeds. However this setting is disabled by default
29552955
since it requires server side configuration and for really small pages there
29562956
is no observable difference (also has a ~100 byte impact to code size)
2957+
This setting is only compatible with html output.
29572958

29582959
Default value: false
29592960

src/settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,7 @@ var MINIMAL_RUNTIME = 0;
19381938
// for faster startup speeds. However this setting is disabled by default
19391939
// since it requires server side configuration and for really small pages there
19401940
// is no observable difference (also has a ~100 byte impact to code size)
1941+
// This setting is only compatible with html output.
19411942
// [link]
19421943
var MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION = false;
19431944

test/test_core.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8789,16 +8789,13 @@ def test_no_declare_asm_module_exports(self):
87898789
@no_modularize_instance('MODULARIZE=instance is not compatible with MINIMAL_RUNTIME')
87908790
@parameterized({
87918791
'default': ([],),
8792-
'streaming': (['-sMINIMAL_RUNTIME_STREAMING_WASM_COMPILATION'],),
87938792
'streaming_inst': (['-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION'],),
87948793
'no_export': (['-sDECLARE_ASM_MODULE_EXPORTS=0'],),
87958794
})
87968795
@requires_node # TODO: Support for non-Node.js shells under MINIMAL_RUNTIME
87978796
def test_minimal_runtime_hello_world(self, args):
8798-
self.cflags = args
8799-
self.set_setting('MINIMAL_RUNTIME')
88008797
self.maybe_closure()
8801-
self.do_runf('small_hello_world.c', 'hello!')
8798+
self.do_runf('small_hello_world.c', 'hello!', cflags=['-sMINIMAL_RUNTIME'] + args)
88028799

88038800
# Test that printf() works in MINIMAL_RUNTIME=1
88048801
@no_wasmfs('https://github.com/emscripten-core/emscripten/issues/16816')

test/test_other.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,16 @@ def test_minimal_runtime_export_all_modularize(self):
16511651
''')
16521652
self.assertContained('libf1\nlibf2\n', self.run_js('main.mjs'))
16531653

1654+
def test_minimal_runtime_errors(self):
1655+
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME_STREAMING_WASM_COMPILATION'])
1656+
self.assertContained('emcc: error: MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION requires MINIMAL_RUNTIME' , err)
1657+
1658+
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION'])
1659+
self.assertContained('emcc: error: MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION requires MINIMAL_RUNTIME' , err)
1660+
1661+
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-sMINIMAL_RUNTIME', '-sMINIMAL_RUNTIME_STREAMING_WASM_COMPILATION'])
1662+
self.assertContained('emcc: error: MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION is only compatible with html output' , err)
1663+
16541664
def test_export_all_and_exported_functions(self):
16551665
# EXPORT_ALL should not export library functions by default.
16561666
# This means that to export library function you also need to explicitly

tools/link.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,15 @@ def limit_incoming_module_api():
10571057
if settings.MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and settings.MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION:
10581058
exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION are mutually exclusive!')
10591059

1060+
if settings.MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION and not settings.MINIMAL_RUNTIME:
1061+
exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION requires MINIMAL_RUNTIME')
1062+
1063+
if settings.MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and not settings.MINIMAL_RUNTIME:
1064+
exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION requires MINIMAL_RUNTIME')
1065+
1066+
if settings.MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION and options.oformat != OFormat.HTML:
1067+
exit_with_error('MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION is only compatible with html output')
1068+
10601069
if options.use_closure_compiler:
10611070
settings.USE_CLOSURE_COMPILER = 1
10621071

0 commit comments

Comments
 (0)