Skip to content

Commit 58938a3

Browse files
authored
Remove ASYNCIFY_LAZY_LOAD_CODE (#25236)
This was marked a deprecated in #24383 and nobody has chimed in that they are using it. Fixes: #16828
1 parent fc36712 commit 58938a3

File tree

15 files changed

+7
-268
lines changed

15 files changed

+7
-268
lines changed

ChangeLog.md

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

2424
4.0.14 - 09/02/25
2525
-----------------
26+
- The `-sASYNCIFY_LAZY_LOAD_CODE` setting and the corresponding C function
27+
`emscripten_lazy_load_code` were removed. (#25236)
2628
- The `addRunDependency` and `removeRunDependency` API are now optional and need
2729
to be included and/or exported using, for example,
2830
`DEFAULT_LIBRARY_FUNCS_TO_INCLUDE` or `EXPORTED_RUNTIME_METHODS`. (#24974)

site/source/docs/api_reference/emscripten.h.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,22 +1434,6 @@ Functions
14341434
local state all the way up the stack. As a result, it will add overhead
14351435
to your program.
14361436
1437-
.. c:function:: void emscripten_lazy_load_code()
1438-
1439-
This creates two Wasm files at compile time: the first Wasm which is
1440-
downloaded and run normally, and a second that is lazy-loaded. When an
1441-
``emscripten_lazy_load_code()`` call is reached, we load the second Wasm
1442-
and resume execution using it.
1443-
1444-
The idea here is that the initial download can be quite small, if you
1445-
place enough ``emscripten_lazy_load_code()`` calls in your codebase, as
1446-
the optimizer can remove code from the first Wasm if it sees it can't
1447-
be reached. The second downloaded Wasm can contain your full codebase,
1448-
including rarely-used functions, in which case the lazy-loading may
1449-
not happen at all.
1450-
1451-
.. note:: This requires building with ``-sASYNCIFY_LAZY_LOAD_CODE``.
1452-
14531437
ABI functions
14541438
=============
14551439

site/source/docs/compiling/Modularized-Output.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ fix in future releses. Current limitations include:
123123

124124
* `ccall`/`cwrap` are not supported (depends on the ``Module`` global).
125125

126-
* :ref:`asyncify_lazy_load_code` is not supported (depends on ``wasmExports``
127-
global)
128-
129126
* :ref:`minimal_runtime` is not supported.
130127

131128
* The output of file_packager is not compatible so :ref:`emcc-preload-file` and

site/source/docs/tools_reference/settings_reference.rst

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,18 +1348,6 @@ If enabled will output which functions have been instrumented and why.
13481348

13491349
Default value: false
13501350

1351-
.. _asyncify_lazy_load_code:
1352-
1353-
ASYNCIFY_LAZY_LOAD_CODE
1354-
=======================
1355-
1356-
Allows lazy code loading: where emscripten_lazy_load_code() is written, we
1357-
will pause execution, load the rest of the code, and then resume.
1358-
1359-
.. note:: This setting is deprecated
1360-
1361-
Default value: false
1362-
13631351
.. _asyncify_debug:
13641352

13651353
ASYNCIFY_DEBUG

src/lib/libasync.js

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ addToLibrary({
141141
#if ASYNCIFY == 1
142142
Asyncify.funcWrappers.set(original, wrapper);
143143
#endif
144-
#if MAIN_MODULE || ASYNCIFY_LAZY_LOAD_CODE
144+
#if MAIN_MODULE
145145
wrapper.orig = original;
146146
#endif
147147
return wrapper;
@@ -171,18 +171,12 @@ addToLibrary({
171171
}
172172
#endif
173173
var wrapper = Asyncify.instrumentFunction(original);
174-
#if ASYNCIFY_LAZY_LOAD_CODE
175-
original.exportName = x;
176-
#endif
177174
ret[x] = wrapper;
178175

179176
} else {
180177
ret[x] = original;
181178
}
182179
}
183-
#if ASYNCIFY_LAZY_LOAD_CODE
184-
Asyncify.updateFunctionMapping(ret);
185-
#endif
186180
return ret;
187181
},
188182

@@ -217,34 +211,6 @@ addToLibrary({
217211
asyncPromiseHandlers: null, // { resolve, reject } pair for when *all* asynchronicity is done
218212
sleepCallbacks: [], // functions to call every time we sleep
219213

220-
#if ASYNCIFY_LAZY_LOAD_CODE
221-
updateFunctionMapping(newExports) {
222-
#if ASYNCIFY_DEBUG
223-
dbg('updateFunctionMapping', Asyncify.callStackIdToFunc);
224-
#endif
225-
#if ASSERTIONS
226-
assert(!Asyncify.exportCallStack.length);
227-
#endif
228-
Asyncify.callStackIdToFunc.forEach((func, id) => {
229-
#if ASSERTIONS
230-
assert(func.exportName);
231-
assert(newExports[func.exportName]);
232-
assert(newExports[func.exportName].orig);
233-
#endif
234-
var newFunc = newExports[func.exportName].orig;
235-
Asyncify.callStackIdToFunc.set(id, newFunc)
236-
Asyncify.callstackFuncToId.set(newFunc, id);
237-
#if MEMORY64
238-
var args = Asyncify.rewindArguments.get(func);
239-
if (args) {
240-
Asyncify.rewindArguments.set(newFunc, args);
241-
Asyncify.rewindArguments.delete(func);
242-
}
243-
#endif
244-
});
245-
},
246-
#endif
247-
248214
getCallStackId(func) {
249215
#if ASSERTIONS
250216
assert(func);
@@ -546,16 +512,6 @@ addToLibrary({
546512
});
547513
},
548514

549-
#if ASYNCIFY_LAZY_LOAD_CODE
550-
emscripten_lazy_load_code__async: true,
551-
emscripten_lazy_load_code: () => Asyncify.handleSleep((wakeUp) => {
552-
// Update the expected wasm binary file to be the lazy one.
553-
wasmBinaryFile += '.lazy.wasm';
554-
// Load the new wasm. The resulting Promise will resolve once the async loading is done.
555-
createWasm().then(() => wakeUp());
556-
}),
557-
#endif
558-
559515
_load_secondary_module__sig: 'v',
560516
_load_secondary_module__async: true,
561517
_load_secondary_module: async function() {

src/lib/libsigs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ sigs = {
678678
emscripten_idb_store__sig: 'vpppip',
679679
emscripten_idb_store_blob__sig: 'vpppip',
680680
emscripten_is_webgl_context_lost__sig: 'ip',
681-
emscripten_lazy_load_code__sig: 'v',
682681
emscripten_lock_async_acquire__sig: 'vpppd',
683682
emscripten_lock_orientation__sig: 'ii',
684683
emscripten_math_acos__sig: 'dd',

src/preamble.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ function getWasmImports() {
642642
// instrumenting imports is used in asyncify in two ways: to add assertions
643643
// that check for proper import use, and for ASYNCIFY=2 we use them to set up
644644
// the Promise API on the import side.
645-
#if PTHREADS || ASYNCIFY_LAZY_LOAD_CODE
645+
#if PTHREADS
646646
// In pthreads builds getWasmImports is called more than once but we only
647647
// and the instrument the imports once.
648648
if (!wasmImports.__instrumented) {

src/settings.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,6 @@ var ASYNCIFY_ONLY = [];
915915
// [link]
916916
var ASYNCIFY_ADVISE = false;
917917

918-
// Allows lazy code loading: where emscripten_lazy_load_code() is written, we
919-
// will pause execution, load the rest of the code, and then resume.
920-
// [link]
921-
// [deprecated]
922-
var ASYNCIFY_LAZY_LOAD_CODE = false;
923-
924918
// Runtime debug logging from asyncify internals.
925919
//
926920
// - 1: Minimal logging.
@@ -2275,4 +2269,5 @@ var LEGACY_SETTINGS = [
22752269
['MAYBE_WASM2JS', [0], 'No longer supported (use -sWASM=2)'],
22762270
['HEADLESS', [0], 'No longer supported, use headless browsers or Node.js with JSDOM'],
22772271
['USE_OFFSET_COVERTER', [0], 'No longer supported, not needed with modern v8 versions'],
2272+
['ASYNCIFY_LAZY_LOAD_CODE', [0], 'No longer supported'],
22782273
];

system/include/emscripten/emscripten.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ int emscripten_run_preload_plugins(const char* file, em_str_callback_func onload
117117
typedef void (*em_run_preload_plugins_data_onload_func)(void*, const char*);
118118
void emscripten_run_preload_plugins_data(char* data, int size, const char *suffix, void *arg, em_run_preload_plugins_data_onload_func onload, em_arg_callback_func onerror);
119119

120-
void emscripten_lazy_load_code(void);
121-
122120
// show an error on some renamed methods
123121
#define emscripten_async_prepare(...) _Pragma("GCC error(\"emscripten_async_prepare has been replaced by emscripten_run_preload_plugins\")")
124122
#define emscripten_async_prepare_data(...) _Pragma("GCC error(\"emscripten_async_prepare_data has been replaced by emscripten_run_preload_plugins_data\")")

test/core/emscripten_lazy_load_code.c

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)