* get rid of WebAssembly constant DefaultMaxMemoryForThreads, because it was

repeated twice. Instead, set maxheapsize correctly with the default value in
  init_parser.
This commit is contained in:
Nikolay Nikolov 2024-08-18 10:51:32 +03:00
parent 2dd610c140
commit 44f58c702f
3 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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