+ 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; pendingstate : tpendingstate;
{ Memory sizes } { Memory sizes }
heapsize, heapsize,
maxheapsize, maxheapsize : int64;
stacksize : longint; stacksize : longint;
{$Ifdef EXTDEBUG} {$Ifdef EXTDEBUG}

View File

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