diff --git a/compiler/ogwasm.pas b/compiler/ogwasm.pas index 85bf16a1a9..0ba05145a6 100644 --- a/compiler/ogwasm.pas +++ b/compiler/ogwasm.pas @@ -4928,15 +4928,11 @@ implementation end; end; - const - DefaultMaxMemoryForThreads = 33554432; var cust_sec: TWasmCustomSectionType; begin result:=false; FMaxMemoryPages:=align(maxheapsize,WasmPageSize) div WasmPageSize; - if (ts_wasm_threads in current_settings.targetswitches) and (FMaxMemoryPages<=0) then - FMaxMemoryPages:=align(DefaultMaxMemoryForThreads,WasmPageSize) div WasmPageSize; { each custom sections starts with its name } for cust_sec in TWasmCustomSectionType do diff --git a/compiler/parser.pas b/compiler/parser.pas index a517fa4336..eee5fd7e75 100644 --- a/compiler/parser.pas +++ b/compiler/parser.pas @@ -199,6 +199,13 @@ implementation if heapsize=0 then heapsize:=65536; end; + system_wasm32_wasi: + begin + if ts_wasm_threads in init_settings.targetswitches then + maxheapsize:=33554432 + else + maxheapsize:=0; + end; {$ifdef i8086} system_i8086_embedded: begin diff --git a/compiler/systems/t_wasi.pas b/compiler/systems/t_wasi.pas index 2ea216d186..61f15399d5 100644 --- a/compiler/systems/t_wasi.pas +++ b/compiler/systems/t_wasi.pas @@ -129,7 +129,6 @@ end; function tlinkerwasi.MakeExecutable:boolean; const PageSize = 65536; - DefaultMaxMemoryForThreads = 33554432; var GCSectionsStr : ansistring; binstr, cmdstr : Tcmdstr; @@ -179,8 +178,6 @@ begin if ts_wasm_threads in current_settings.targetswitches then begin cmdstr := cmdstr + ' --import-memory --shared-memory --global-base=1024'; - if maxmem<=0 then - maxmem:=align(DefaultMaxMemoryForThreads,PageSize); end; if initialmem>0 then