Browse Source

+ WebAssembly threads: init StackBottom (used for stack checking) more precisely
when starting a new thread. Precision is not that important for the stack
checking itself, because it uses a stack margin of 16kb, so the previous
value, set by InitThread is good enough, however it's easy to do it precisely,
since we allocate the stack and pass a pointer to it in TWasmThread, so why
not?

Nikolay Nikolov 1 year ago
parent
commit
9d771396ff
1 changed files with 1 additions and 0 deletions
  1. 1 0
      rtl/wasi/systhrd.inc

+ 1 - 0
rtl/wasi/systhrd.inc

@@ -339,6 +339,7 @@ begin
 
   start_arg^.State:=tsRunning;
   InitThread(start_arg^.StackSize);
+  StackBottom:=start_arg^.StackBlock;
   start_arg^.ExitCode:=Cardinal(start_arg^.ThreadFunction(start_arg^.ThreadFunctionArg));
   {$IFDEF DEBUGWASMTHREADS}DebugWriteln('FPCWasmThreadStartPascal: Signaling end of thread');{$ENDIF}
   WasiRTLEventSetEvent(start_arg^.DoneEvent);