Skip to content

Commit 33bbfa5

Browse files
committed
Avoid calling writeStackCookie to early in worker.js
When running a worker we don't want to write the stack cookie until the worker is actually running a pthread. This is done in `establishStackSpace`. For this reason we don't want to run `writeStackCookie` during `run` (which is used only to initiialize the worker, before its running a thread).
1 parent 1bb6a3a commit 33bbfa5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/postamble.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,6 @@ function run(args) {
239239
return;
240240
}
241241

242-
#if STACK_OVERFLOW_CHECK
243-
stackCheckInit();
244-
#endif
245-
246242
#if RELOCATABLE
247243
if (!dylibsLoaded) {
248244
// Loading of dynamic libraries needs to happen on each thread, so we can't
@@ -287,6 +283,10 @@ function run(args) {
287283
}
288284
#endif
289285

286+
#if STACK_OVERFLOW_CHECK
287+
stackCheckInit();
288+
#endif
289+
290290
preRun();
291291

292292
// a preRun added a dependency, run will be called later

src/preamble.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,6 @@ function preRun() {
375375
}
376376

377377
function initRuntime() {
378-
#if STACK_OVERFLOW_CHECK
379-
checkStackCookie();
380-
#endif
381378
#if ASSERTIONS
382379
assert(!runtimeInitialized);
383380
#endif
@@ -396,6 +393,9 @@ function initRuntime() {
396393
err('__set_stack_limits: ' + _emscripten_stack_get_base() + ', ' + _emscripten_stack_get_end());
397394
#endif
398395
___set_stack_limits(_emscripten_stack_get_base(), _emscripten_stack_get_end());
396+
#endif
397+
#if STACK_OVERFLOW_CHECK
398+
checkStackCookie();
399399
#endif
400400
<<< ATINITS >>>
401401
callRuntimeCallbacks(__ATINIT__);

0 commit comments

Comments
 (0)