Skip to content

Commit 7f2c9bf

Browse files
authored
[MODULARIZE=instance] Mark -sDYNCALLS as not supported. NFC (#24340)
Also enable a bunch more tests
1 parent d71d76e commit 7f2c9bf

15 files changed

+64
-40
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,9 +813,15 @@ jobs:
813813
instance.test_fannkuch
814814
instance.test_fasta
815815
instance.test_EXPORTED_RUNTIME_METHODS
816+
instance.test_abort_on_exceptions*
816817
instance.test_ccall
817818
instance.test_dylink_basics*
818819
instance.test_Module_dynamicLibraries*
820+
instance.test_dylink_argv_argc
821+
instance.test_dlmalloc*
822+
instance.test_dyncall*
823+
instance.test_em_asm*
824+
instance.test_embind*
819825
esm_integration.test_fs_js_api*
820826
esm_integration.test_inlinejs3
821827
esm_integration.test_embind_val_basics

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,19 @@ Limitations
115115
Some major features still do not work in this mode. Many of these we hope to
116116
fix in future releses. Current limitations include:
117117

118-
* Internal usage (e.g. usage within EM_JS / JS libary code) of the `Module`
119-
object does not work. This is because symbols are exported directly using
120-
ES6 module syntax rathar than using a global `Module` object.
118+
* Internal usage (e.g. usage within EM_JS / JS libary code) of the ``Module``
119+
global does not work. This is because symbols are exported directly using
120+
ES6 module syntax rathar than using the ``Module`` global.
121121

122-
* `ccall`/`cwrap` are not supported (these depend on the internal `Module`
123-
object).
122+
* `ccall`/`cwrap` are not supported (depends on the ``Module`` global).
124123

125124
* :ref:`abort_on_wasm_exceptions` is not supported (requires wrapping wasm
126125
exports).
127126

127+
* :ref:`dyncalls` is not supported (depends on the ``Module`` global)
128+
129+
* :ref:`asyncify` is not supported (depends on :ref:`dyncalls`)
130+
128131
* The output of file_packager is not compatible so :ref:`emcc-preload-file` and
129132
:ref:`emcc-embed-file` do not work.
130133

src/lib/libccall.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
addToLibrary({
88
// Returns the C function with a specified identifier (for C++, you need to do manual name mangling)
9+
#if MODULARIZE == 'instance'
10+
$getCFunc__deps: [() => error('ccall is not yet compatible with MODULARIZE=instance')],
11+
#endif
12+
$getCFunc__internal: true,
913
$getCFunc: (ident) => {
1014
var func = Module['_' + ident]; // closure exported function
1115
#if ASSERTIONS

src/lib/libcore.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,9 @@ addToLibrary({
17361736
$dynCallLegacy__deps: [
17371737
#if MINIMAL_RUNTIME
17381738
'$dynCalls',
1739+
#endif
1740+
#if MODULARIZE == 'instance'
1741+
() => error('dynCallLegacy is not yet compatible with MODULARIZE=instance'),
17391742
#endif
17401743
],
17411744
$dynCallLegacy: (sig, ptr, args) => {

src/postamble.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ export default async function init(moduleArg = {}) {
322322
run();
323323
}
324324

325-
#if PTHREADS
326-
// When run as a pthread we run `init` immediately.
327-
if (ENVIRONMENT_IS_PTHREAD) await init()
325+
#if PTHREADS || WASM_WORKERS
326+
// When run as a worker thread run `init` immediately.
327+
if ({{{ ENVIRONMENT_IS_WORKER_THREAD() }}}) await init()
328328
#endif
329329

330330
#if ENVIRONMENT_MAY_BE_NODE

src/wasm_worker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ if (ENVIRONMENT_IS_NODE) {
4040
// Weak map of handle functions to their wrapper. Used to implement
4141
// addEventListener/removeEventListener.
4242
var wrappedHandlers = new WeakMap();
43+
/** @suppress {checkTypes} */
44+
globalThis.onmessage = null;
4345
function wrapMsgHandler(h) {
4446
var f = wrappedHandlers.get(h)
4547
if (!f) {

test/embind/test_unsigned.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ int main()
3636
// Module['set_bind_u64'](2147483648); // todo: embind does not currently support 64-bit integers.
3737
Module['set_bind_u32'](2147483648);
3838
// Module['_set_c_u64'](2147483648); // todo: embind does not currently support 64-bit integers.
39-
Module['_set_c_u32'](2147483648);
39+
_set_c_u32(2147483648);
4040
);
4141
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8312
1+
8307
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22242
1+
22233
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6617
1+
6613

0 commit comments

Comments
 (0)