Sfoglia il codice sorgente

+ WebAssembly: allow specifying heapsize and maxheapsize larger than 2GiB
(WebAssembly has a 32-bit address space, so there's still a 4GiB limit)

Nikolay Nikolov 11 mesi fa
parent
commit
184c612f78
2 ha cambiato i file con 11 aggiunte e 8 eliminazioni
  1. 1 1
      compiler/globals.pas
  2. 10 7
      compiler/scandir.pas

+ 1 - 1
compiler/globals.pas

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

+ 10 - 7
compiler/scandir.pas

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