Skip to content

Commit 0ba2fc2

Browse files
authored
Remove internal USE_READY_PROMISE (#24874)
This was only used in one very specific case which required all the following to be enabled: - MINIMAL_RUNTIME - MODULARIZE - SINGLE_FILE - !PTHREADS - html output This combination rare because most folks don't have use the emscripten generated html output. So that rules out most of our users, then they would also have to choose `MODULARIZE` but not actually want to create multiple instances or pass in any arguments. This is because in order to support this very special use case the generated HTML was setup to stamp out a singleton instance of the module with no arguments passed in. While it *is* sometimes useful to stamp out a single instance of the module we don't do this in any other circumstances. If a user wants to do this its easy enough to do with a `--post-js` file. In fact we do this in our test code when we want to test the `-sMODULARIZE` setting. See `test/modularize_post_js.js`. So think this change is really an improvment and I think its very unlikely that many folks will be using this specific combination of settings.
1 parent 9152fca commit 0ba2fc2

11 files changed

+26
-40
lines changed

ChangeLog.md

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

2121
4.0.13 (in development)
2222
-----------------------
23+
- The `-sMODULARIZE` setting generates a factory function that must be called
24+
before the program is instantiated that run. However, emscripten previously
25+
had very special case where this instantiation would happen automatically
26+
(with no parameterization) under certain specific circumstances: When
27+
`-sMINIMAL_RUNTIME`, `-sSINGLE_FILE` and `-sMODULARIZE` were used in
28+
combination with default html output. This special case was removed. If you
29+
want to instantiate the module on startup you can still do so by adding a call
30+
the factory function in `--extern-post-js`. (#24874)
2331
- emcc will now error if `MINIMAL_RUNTIME_STREAMING_WASM_COMPILATION` is used
2432
when not generating html output. This was always incompatible but previously
2533
ignored. (#24849)

src/postamble_modularize.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// We assign to the `moduleRtn` global here and configure closure to see
55
// this as and extern so it won't get minified.
66

7-
#if USE_READY_PROMISE
87
if (runtimeInitialized) {
98
moduleRtn = Module;
109
} else {
@@ -14,9 +13,6 @@ if (runtimeInitialized) {
1413
readyPromiseReject = reject;
1514
});
1615
}
17-
#else
18-
moduleRtn = {};
19-
#endif
2016

2117
#if ASSERTIONS
2218
// Assertion for attempting to access module properties on the incoming

src/runtime_common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "runtime_asan.js"
2121
#endif
2222

23-
#if MODULARIZE && USE_READY_PROMISE
23+
#if MODULARIZE
2424
var readyPromiseResolve, readyPromiseReject;
2525
#endif
2626

src/settings_internal.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,6 @@ var WASM_EXCEPTIONS = false;
191191
// EXPORTED_FUNCTIONS then this gets set to 0.
192192
var EXPECT_MAIN = true;
193193

194-
// Return a "ready" Promise from the MODULARIZE factory function.
195-
// We disable this under some circumstance if we know its not needed.
196-
var USE_READY_PROMISE = true;
197-
198194
// If true, building against Emscripten's wasm heap memory profiler.
199195
var MEMORYPROFILER = false;
200196

src/shell_minimal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ var err = (...args) => console.error(...args);
116116
// compilation is ready. In that callback, call the function run() to start
117117
// the program.
118118
function ready() {
119-
#if MODULARIZE && USE_READY_PROMISE
119+
#if MODULARIZE
120120
readyPromiseResolve?.(Module);
121121
#endif // MODULARIZE
122122
#if INVOKE_RUN && HAS_MAIN

src/shell_minimal_runtime.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
#if SINGLE_FILE
2020
// If we are doing a SINGLE_FILE=1 build, inlined JS runtime code follows here:
2121
{{{ JS_CONTENTS_IN_SINGLE_FILE_BUILD }}}
22-
23-
#if MODULARIZE
24-
// Launch the MODULARIZEd build.
25-
{{{ EXPORT_NAME }}}({});
26-
#endif
27-
2822
#endif
2923

3024
</script>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 454,
33
"a.html.gz": 321,
4-
"a.js": 4386,
5-
"a.js.gz": 2247,
4+
"a.js": 4437,
5+
"a.js.gz": 2281,
66
"a.wasm": 8290,
77
"a.wasm.gz": 5639,
8-
"total": 13130,
9-
"total_gz": 8207
8+
"total": 13181,
9+
"total_gz": 8241
1010
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"a.html": 346,
33
"a.html.gz": 255,
4-
"a.js": 18135,
5-
"a.js.gz": 9784,
6-
"total": 18481,
7-
"total_gz": 10039
4+
"a.js": 18198,
5+
"a.js.gz": 9822,
6+
"total": 18544,
7+
"total_gz": 10077
88
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.html": 454,
33
"a.html.gz": 321,
4-
"a.js": 3924,
5-
"a.js.gz": 2087,
4+
"a.js": 3975,
5+
"a.js.gz": 2123,
66
"a.wasm": 8290,
77
"a.wasm.gz": 5639,
8-
"total": 12668,
9-
"total_gz": 8047
8+
"total": 12719,
9+
"total_gz": 8083
1010
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"a.html": 346,
33
"a.html.gz": 255,
4-
"a.js": 17662,
5-
"a.js.gz": 9616,
6-
"total": 18008,
7-
"total_gz": 9871
4+
"a.js": 17725,
5+
"a.js.gz": 9659,
6+
"total": 18071,
7+
"total_gz": 9914
88
}

0 commit comments

Comments
 (0)