Skip to content

Commit 63ec8e2

Browse files
authored
Centralize internal pthread exports. NFC (#16853)
The change moves from special case handling in `src/modules.js` to `emcc.py` where other similar symbols are handled already.
1 parent f49a9d3 commit 63ec8e2

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

emcc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1536,9 +1536,10 @@ def include_and_export(name):
15361536

15371537
include_and_export('establishStackSpace')
15381538
include_and_export('invokeEntryPoint')
1539+
include_and_export('PThread')
15391540
if not settings.MINIMAL_RUNTIME:
15401541
# keepRuntimeAlive does not apply to MINIMAL_RUNTIME.
1541-
settings.EXPORTED_RUNTIME_METHODS += ['keepRuntimeAlive']
1542+
settings.EXPORTED_RUNTIME_METHODS += ['keepRuntimeAlive', 'ExitStatus', 'wasmMemory']
15421543

15431544
if settings.MODULARIZE:
15441545
if not settings.EXPORT_ES6 and settings.EXPORT_NAME == 'Module':

src/modules.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,7 @@ function exportRuntime() {
432432
'callMain',
433433
'abort',
434434
'keepRuntimeAlive',
435+
'wasmMemory',
435436
];
436437

437438
if (USE_PTHREADS && ALLOW_MEMORY_GROWTH) {
@@ -479,6 +480,7 @@ function exportRuntime() {
479480
'lengthBytesUTF32',
480481
'allocateUTF8',
481482
'allocateUTF8OnStack',
483+
'ExitStatus',
482484
]);
483485
}
484486

@@ -487,21 +489,6 @@ function exportRuntime() {
487489
runtimeElements.push('checkStackCookie');
488490
}
489491

490-
if (USE_PTHREADS) {
491-
// In pthreads mode, the following functions always need to be exported to
492-
// Module for closure compiler, and also for MODULARIZE (so worker.js can
493-
// access them).
494-
const threadExports = ['PThread', 'wasmMemory'];
495-
if (!MINIMAL_RUNTIME) {
496-
threadExports.push('ExitStatus');
497-
}
498-
499-
threadExports.forEach((x) => {
500-
EXPORTED_RUNTIME_METHODS_SET.add(x);
501-
runtimeElements.push(x);
502-
});
503-
}
504-
505492
if (SUPPORT_BASE64_EMBEDDING) {
506493
runtimeElements.push('intArrayFromBase64');
507494
runtimeElements.push('tryParseAsDataURI');

0 commit comments

Comments
 (0)