You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: emcc.py
+21-7Lines changed: 21 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1082,6 +1082,9 @@ def check(input_file):
1082
1082
ifshared.Settings.MODULARIZE_INSTANCE:
1083
1083
shared.Settings.MODULARIZE=1
1084
1084
1085
+
ifshared.Settings.MODULARIZE:
1086
+
assertnotoptions.proxy_to_worker, '-s MODULARIZE=1 and -s MODULARIZE_INSTANCE=1 are not compatible with --proxy-to-worker (if you want to run in a worker with -s MODULARIZE=1, you likely want to do the worker side setup manually)'
1087
+
1085
1088
ifshared.Settings.EMULATE_FUNCTION_POINTER_CASTS:
1086
1089
shared.Settings.ALIASING_FUNCTION_POINTERS=0
1087
1090
@@ -1187,11 +1190,6 @@ def check(input_file):
1187
1190
exit_with_error('USE_PTHREADS=2 is not longer supported')
1188
1191
ifshared.Settings.ALLOW_MEMORY_GROWTH:
1189
1192
exit_with_error('Memory growth is not yet supported with pthreads')
1190
-
ifshared.Settings.MODULARIZE:
1191
-
# currently worker.js uses the global namespace, so it's setting of
1192
-
# ENVIRONMENT_IS_PTHREAD is not picked up, in addition to all the other
1193
-
# modifications it performs.
1194
-
exit_with_error('MODULARIZE is not yet supported with pthreads')
1195
1193
# UTF8Decoder.decode doesn't work with a view of a SharedArrayBuffer
// Generates access to module exports variable in pthreads worker.js
1481
+
functionmakeAsmExportAccessInPthread(variable){
1482
+
if(MODULARIZE){
1483
+
return"Module['"+variable+"']"// 'Module' is defined in worker.js local scope, so not EXPORT_NAME in this case.
1484
+
}else{
1485
+
returnEXPORT_NAME+"['"+variable+"']"
1486
+
}
1487
+
}
1488
+
1489
+
// Generates access to a global scope variable in pthreads worker.js
1490
+
functionmakeAsmGlobalAccessInPthread(variable){
1491
+
if(MODULARIZE){
1492
+
return"Module['"+variable+"']"// 'Module' is defined in worker.js local scope, so not EXPORT_NAME in this case.
1493
+
}else{
1494
+
returnvariable
1495
+
}
1496
+
}
1497
+
1498
+
// Generates access to both global scope variable and exported Module variable, e.g. "Module['foo'] = foo" or just plain "foo" depending on if we are MODULARIZEing.
1499
+
// Used the be able to initialize both variables at the same time.
importScripts('{{{ SEPARATE_ASM }}}');// load the separated-out asm.js
365
-
#endif
366
-
}
367
-
#endif
368
-
369
361
#if EMTERPRETIFY
370
362
functionabortStackOverflowEmterpreter(){
371
363
abort("Emterpreter stack overflow! Decrease the recursion level or increase EMT_STACK_MAX in tools/emterpretify.py (current value "+EMT_STACK_MAX+").");
Copy file name to clipboardExpand all lines: src/shell.js
+28-5Lines changed: 28 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -81,11 +81,34 @@ if (Module['ENVIRONMENT']) {
81
81
// 2) We could be the application main() thread proxied to worker. (with Emscripten -s PROXY_TO_WORKER=1) (ENVIRONMENT_IS_WORKER == true, ENVIRONMENT_IS_PTHREAD == false)
82
82
// 3) We could be an application pthread running in a worker. (ENVIRONMENT_IS_WORKER == true and ENVIRONMENT_IS_PTHREAD == true)
83
83
#if USE_PTHREADS
84
-
varENVIRONMENT_IS_PTHREAD;
85
-
if(!ENVIRONMENT_IS_PTHREAD)ENVIRONMENT_IS_PTHREAD=false;// ENVIRONMENT_IS_PTHREAD=true will have been preset in worker.js. Make it false in the main runtime thread.
86
-
varPthreadWorkerInit;// Collects together variables that are needed at initialization time for the web workers that host pthreads.
// ENVIRONMENT_IS_PTHREAD=true will have been preset in worker.js. Make it false in the main runtime thread.
87
+
// N.B. this line needs to appear without 'var' keyword to avoid 'var hoisting' from occurring. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var)
88
+
ENVIRONMENT_IS_PTHREAD=false;
89
+
varPthreadWorkerInit={};// Collects together variables that are needed at initialization time for the web workers that host pthreads.
// Note that not all runtime fields are imported above. Values for STACK_BASE, STACKTOP and STACK_MAX are not yet known at worker.js load time.
102
+
// These will be filled in at pthread startup time (the 'run' message for a pthread - pthread start establishes the stack frame)
103
+
}
104
+
#endif
105
+
106
+
#if !MODULARIZE
107
+
// In MODULARIZE mode _scriptDir needs to be captured already at the very top of the page immediately when the page is parsed, so it is generated there
108
+
// before the page load. In non-MODULARIZE modes generate it here.
0 commit comments