Przeglądaj źródła

* get rid of WebAssembly constant DefaultMaxMemoryForThreads, because it was
repeated twice. Instead, set maxheapsize correctly with the default value in
init_parser.

Nikolay Nikolov 11 miesięcy temu
rodzic
commit
44f58c702f
3 zmienionych plików z 7 dodań i 7 usunięć
  1. 0 4
      compiler/ogwasm.pas
  2. 7 0
      compiler/parser.pas
  3. 0 3
      compiler/systems/t_wasi.pas

+ 0 - 4
compiler/ogwasm.pas

@@ -4928,15 +4928,11 @@ implementation
             end;
             end;
         end;
         end;
 
 
-      const
-        DefaultMaxMemoryForThreads = 33554432;
       var
       var
         cust_sec: TWasmCustomSectionType;
         cust_sec: TWasmCustomSectionType;
       begin
       begin
         result:=false;
         result:=false;
         FMaxMemoryPages:=align(maxheapsize,WasmPageSize) div WasmPageSize;
         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 }
         { each custom sections starts with its name }
         for cust_sec in TWasmCustomSectionType do
         for cust_sec in TWasmCustomSectionType do

+ 7 - 0
compiler/parser.pas

@@ -199,6 +199,13 @@ implementation
                if heapsize=0 then
                if heapsize=0 then
                  heapsize:=65536;
                  heapsize:=65536;
              end;
              end;
+           system_wasm32_wasi:
+             begin
+               if ts_wasm_threads in init_settings.targetswitches then
+                 maxheapsize:=33554432
+               else
+                 maxheapsize:=0;
+             end;
 {$ifdef i8086}
 {$ifdef i8086}
            system_i8086_embedded:
            system_i8086_embedded:
              begin
              begin

+ 0 - 3
compiler/systems/t_wasi.pas

@@ -129,7 +129,6 @@ end;
 function tlinkerwasi.MakeExecutable:boolean;
 function tlinkerwasi.MakeExecutable:boolean;
 const
 const
   PageSize = 65536;
   PageSize = 65536;
-  DefaultMaxMemoryForThreads = 33554432;
 var
 var
   GCSectionsStr  : ansistring;
   GCSectionsStr  : ansistring;
   binstr, cmdstr : Tcmdstr;
   binstr, cmdstr : Tcmdstr;
@@ -179,8 +178,6 @@ begin
   if ts_wasm_threads in current_settings.targetswitches then
   if ts_wasm_threads in current_settings.targetswitches then
     begin
     begin
       cmdstr := cmdstr + ' --import-memory --shared-memory --global-base=1024';
       cmdstr := cmdstr + ' --import-memory --shared-memory --global-base=1024';
-      if maxmem<=0 then
-        maxmem:=align(DefaultMaxMemoryForThreads,PageSize);
     end;
     end;
 
 
   if initialmem>0 then
   if initialmem>0 then