+ WebAssembly: allow specifying heapsize and maxheapsize larger than 2GiB

(WebAssembly has a 32-bit address space, so there's still a 4GiB limit)
This commit is contained in:
Nikolay Nikolov 2024-08-24 14:09:38 +03:00
parent 7fc6d5aaa1
commit 184c612f78
2 changed files with 11 additions and 8 deletions

View File

@ -417,7 +417,7 @@ Const
pendingstate : tpendingstate;
{ Memory sizes }
heapsize,
maxheapsize,
maxheapsize : int64;
stacksize : longint;
{$Ifdef EXTDEBUG}

View File

@ -855,9 +855,9 @@ unit scandir;
procedure dir_memory;
var
l : longint;
heapsize_limit: longint;
maxheapsize_limit: longint;
l : int64;
heapsize_limit: int64;
maxheapsize_limit: int64;
begin
{$if defined(i8086)}
if target_info.system=system_i8086_win16 then
@ -875,12 +875,15 @@ unit scandir;
heapsize_limit:=65520;
maxheapsize_limit:=65520;
end;
{$elseif defined(WASM32)}
heapsize_limit:=int64(high(uint32))+1;
maxheapsize_limit:=int64(high(uint32))+1;
{$elseif defined(cpu16bitaddr)}
heapsize_limit:=65520;
maxheapsize_limit:=65520;
{$else}
heapsize_limit:=high(heapsize);
maxheapsize_limit:=high(maxheapsize);
heapsize_limit:=high(longint);
maxheapsize_limit:=high(longint);
{$endif}
current_scanner.skipspace;
l:=current_scanner.readval;
@ -899,14 +902,14 @@ unit scandir;
begin
current_scanner.readchar;
current_scanner.skipspace;
l:=current_scanner.readval;
l:=current_scanner.readval64;
if l>=1024 then
heapsize:=min(l,heapsize_limit);
if c=',' then
begin
current_scanner.readchar;
current_scanner.skipspace;
l:=current_scanner.readval;
l:=current_scanner.readval64;
if l>=heapsize then
maxheapsize:=min(l,maxheapsize_limit)
else