mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-22 12:59:05 +02:00
* Do not cache memory, it may grow
This commit is contained in:
parent
3aa6c7cf07
commit
6e630afa75
@ -250,6 +250,8 @@ Const
|
|||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
EWasiError = Class(Exception);
|
||||||
|
|
||||||
// The imports as expected by WASI
|
// The imports as expected by WASI
|
||||||
IWASI = interface ['{A03AC61B-3C68-4DA8-AC4F-53ED01814673}']
|
IWASI = interface ['{A03AC61B-3C68-4DA8-AC4F-53ED01814673}']
|
||||||
// Please keep these sorted !!
|
// Please keep these sorted !!
|
||||||
@ -696,6 +698,8 @@ begin
|
|||||||
FPreparedStartDescriptor.RunExceptionMessage:=TJSJSON.Stringify(OE);
|
FPreparedStartDescriptor.RunExceptionMessage:=TJSJSON.Stringify(OE);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
if FPreparedStartDescriptor.RunExceptionClass<>'' then
|
||||||
|
Console.log('Running Webassembly resulted in exception. Exception class: ',FPreparedStartDescriptor.RunExceptionClass,', message:',FPreparedStartDescriptor.RunExceptionMessage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWASIHost.DoStdWrite(Sender: TObject; const aOutput: String);
|
procedure TWASIHost.DoStdWrite(Sender: TObject; const aOutput: String);
|
||||||
@ -794,6 +798,7 @@ function TWASIHost.RunWebAssemblyInstance(aDescr: TWebAssemblyStartDescriptor;
|
|||||||
aAfterStart: TAfterStartCallback): Boolean;
|
aAfterStart: TAfterStartCallback): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
FPreparedStartDescriptor:=aDescr;
|
||||||
Result:=RunWebAssemblyInstance(aBeforeStart,aAfterStart,Nil);
|
Result:=RunWebAssemblyInstance(aBeforeStart,aAfterStart,Nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -809,6 +814,8 @@ Var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=True;
|
Result:=True;
|
||||||
|
if not (jsTypeOf(aValue)='object') then
|
||||||
|
Raise EWasiError.Create('Did not get a instantiated webassembly');
|
||||||
WASD.Instance:=InstResult.Instance;
|
WASD.Instance:=InstResult.Instance;
|
||||||
WASD.Module:=InstResult.Module;
|
WASD.Module:=InstResult.Module;
|
||||||
WASD.Exported:=TWASIExports(TJSObject(WASD.Instance.exports_));
|
WASD.Exported:=TWASIExports(TJSObject(WASD.Instance.exports_));
|
||||||
@ -1089,9 +1096,9 @@ end;
|
|||||||
|
|
||||||
function TPas2JSWASIEnvironment.GetMemory: TJSWebassemblyMemory;
|
function TPas2JSWASIEnvironment.GetMemory: TJSWebassemblyMemory;
|
||||||
begin
|
begin
|
||||||
if Assigned(FMemory) then
|
{ if Assigned(FMemory) then
|
||||||
Result:=FMemory
|
Result:=FMemory
|
||||||
else
|
else }
|
||||||
Result:= FModuleInstanceExports.Memory;
|
Result:= FModuleInstanceExports.Memory;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user