|
@@ -253,6 +253,7 @@ interface
|
|
|
'.rodata',
|
|
|
'.data',
|
|
|
'fpc.resources');
|
|
|
+ WasmPageSize = 65536;
|
|
|
private
|
|
|
FImports: TFPHashObjectList;
|
|
|
FFuncTypes: TWasmFuncTypeTable;
|
|
@@ -4928,15 +4929,14 @@ implementation
|
|
|
end;
|
|
|
|
|
|
const
|
|
|
- PageSize = 65536;
|
|
|
DefaultMaxMemoryForThreads = 33554432;
|
|
|
var
|
|
|
cust_sec: TWasmCustomSectionType;
|
|
|
begin
|
|
|
result:=false;
|
|
|
- FMaxMemoryPages:=align(maxheapsize,PageSize) div PageSize;
|
|
|
+ FMaxMemoryPages:=align(maxheapsize,WasmPageSize) div WasmPageSize;
|
|
|
if (ts_wasm_threads in current_settings.targetswitches) and (FMaxMemoryPages<=0) then
|
|
|
- FMaxMemoryPages:=align(DefaultMaxMemoryForThreads,PageSize) div PageSize;
|
|
|
+ FMaxMemoryPages:=align(DefaultMaxMemoryForThreads,WasmPageSize) div WasmPageSize;
|
|
|
|
|
|
{ each custom sections starts with its name }
|
|
|
for cust_sec in TWasmCustomSectionType do
|
|
@@ -5499,8 +5499,6 @@ implementation
|
|
|
end;
|
|
|
|
|
|
procedure TWasmExeOutput.SetStackPointer;
|
|
|
- const
|
|
|
- PageSize = 65536;
|
|
|
var
|
|
|
BssSec: TExeSection;
|
|
|
StackStart, InitialStackPtrAddr: QWord;
|
|
@@ -5508,8 +5506,8 @@ implementation
|
|
|
BssSec:=FindExeSection('.bss');
|
|
|
InitialStackPtrAddr := (BssSec.MemPos+BssSec.Size+stacksize+15) and (not 15);
|
|
|
FMinMemoryPages := Max(
|
|
|
- QWord(Align(QWord(InitialStackPtrAddr),QWord(PageSize)) div PageSize),
|
|
|
- QWord(Align(QWord(heapsize),QWord(PageSize)) div PageSize));
|
|
|
+ QWord(Align(QWord(InitialStackPtrAddr),QWord(WasmPageSize)) div WasmPageSize),
|
|
|
+ QWord(Align(QWord(heapsize),QWord(WasmPageSize)) div WasmPageSize));
|
|
|
FStackPointerSym.LinkingData.GlobalInitializer.init_i32:=Int32(InitialStackPtrAddr);
|
|
|
end;
|
|
|
|