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
@@ -1081,6 +1081,9 @@ def check(input_file):
1081
1081
ifshared.Settings.MODULARIZE_INSTANCE:
1082
1082
shared.Settings.MODULARIZE=1
1083
1083
1084
+
ifshared.Settings.MODULARIZE:
1085
+
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)'
1086
+
1084
1087
ifshared.Settings.EMULATE_FUNCTION_POINTER_CASTS:
1085
1088
shared.Settings.ALIASING_FUNCTION_POINTERS=0
1086
1089
@@ -1186,11 +1189,6 @@ def check(input_file):
1186
1189
exit_with_error('USE_PTHREADS=2 is not longer supported')
1187
1190
ifshared.Settings.ALLOW_MEMORY_GROWTH:
1188
1191
exit_with_error('Memory growth is not yet supported with pthreads')
1189
-
ifshared.Settings.MODULARIZE:
1190
-
# currently worker.js uses the global namespace, so it's setting of
1191
-
# ENVIRONMENT_IS_PTHREAD is not picked up, in addition to all the other
1192
-
# modifications it performs.
1193
-
exit_with_error('MODULARIZE is not yet supported with pthreads')
1194
1192
# 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
396
-
#endif
397
-
}
398
-
#endif
399
-
400
392
#if EMTERPRETIFY
401
393
functionabortStackOverflowEmterpreter(){
402
394
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