mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 04:18:31 +02:00
* Allow wasm guest & host to be notified of wasm memory growth
This commit is contained in:
parent
62236ec2bb
commit
736fc12e55
@ -27,6 +27,8 @@ begin
|
||||
P.SourcePath.Add('src');
|
||||
// Logger
|
||||
T:=P.Targets.AddUnit('wasm.logger.api.pas');
|
||||
// Memutils
|
||||
T:=P.Targets.AddUnit('wasm.memutils.pas');
|
||||
|
||||
// Timer
|
||||
T:=P.Targets.AddUnit('wasm.timer.shared.pas');
|
||||
|
@ -71,6 +71,8 @@ begin
|
||||
end
|
||||
else
|
||||
SysOSAlloc:=nil;
|
||||
if assigned(WasmGrowMemoryCallback) then
|
||||
WasmGrowMemoryCallback(grow_pages);
|
||||
end;
|
||||
{$ifdef FPC_WASM_THREADS}
|
||||
if InitialHeapCriticalSectionInitialized then
|
||||
|
@ -66,17 +66,23 @@ const
|
||||
sLineBreak = LineEnding;
|
||||
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsLF;
|
||||
|
||||
type
|
||||
TWasmGrowMemoryCallBack = procedure(aGrowPages: longint);
|
||||
|
||||
var
|
||||
argc: longint;
|
||||
argv: PPAnsiChar;
|
||||
envp: PPAnsiChar;
|
||||
___fpc_wasm_suspender: WasmExternRef; section 'WebAssembly.Global';
|
||||
|
||||
WasmGrowMemoryCallback : TWasmGrowMemoryCallBack;
|
||||
|
||||
function __fpc_get_wasm_suspender: WasmExternRef;
|
||||
procedure __fpc_set_wasm_suspender(v: WasmExternRef);
|
||||
|
||||
property __fpc_wasm_suspender: WasmExternRef read __fpc_get_wasm_suspender write __fpc_set_wasm_suspender;
|
||||
|
||||
|
||||
|
||||
Procedure DebugWriteln(aString : ShortString);
|
||||
|
||||
implementation
|
||||
|
Loading…
Reference in New Issue
Block a user