* WebAssembly threads: fix threadvars with the new WASI-threads implementation

This commit is contained in:
Nikolay Nikolov 2024-08-04 05:50:06 +03:00
parent aaf536ae10
commit 801f902efe

View File

@ -336,6 +336,8 @@ procedure WasiAllocateThreadVars; forward;
procedure FPCWasmThreadStartPascal(tid: longint; start_arg: PWasmThread);
begin
{$IFDEF DEBUGWASMTHREADS}DebugWriteln('FPCWasmThreadStartPascal(...)');{$ENDIF}
fpc_wasm32_init_tls(start_arg^.InitTLSBase);
start_arg^.ID:=tid;
GlobalCurrentThread:=@start_arg;
GlobalIsMainThread:=0;
@ -359,12 +361,6 @@ asm
i32.load
global.set $__stack_pointer
local.get 1
i32.const 4
i32.add
i32.load
global.set $__tls_base
local.get 0
local.get 1
call $FPCWasmThreadStartPascal