You are not logged in.
The SyNode sample "03-HelloSpiderMonkey52-cross" works for both `Delphi & win32` and `FPC & Linux64`.
However, the same sample does not work for `FPC & win32` (compiled on windows, or cross-compiled from linux).
The same synsm.dll used for `Delphi & win32` is used.
The error is access violation at `InitSelfHostedCode`.
For some compiling occasions, the error is `Invalid floating point operation` instead.
As shown by the figures, the operations for `Delphi & win32` and `FPC & win32` seem to be identical.
I could not figure out the cause or the workaround.
Could you help to suggest what could be the cause and how to fix ? Many thanks !
Offline
It turns out that if I put the SetExceptionMask line
// https://forum.lazarus.freepascal.org/index.php?topic=70135.15
SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow,exPrecision]);
try
JS_Init();
cx := JSContext.CreateNew(8 * 1024 * 1024);
...
at the very beginning of "HelloSpiderMonkey52.dpr", the sample works fine for FPC & win32.
Nevertheless, it is still confusing for me because the line
TSynFPUException.ForLibraryCode
is already called at the very beginning of `JSContext.CreateNew`.
SyNode/SpiderMonkey.pas:4190:class function JSContext.CreateNew(maxbytes: uint32; maxNurseryBytes: uint32; parentContext: PJSContext): PJSContext;
SyNode/SpiderMonkey.pas-4191-begin
SyNode/SpiderMonkey.pas-4192- with TSynFPUException.ForLibraryCode do begin
SyNode/SpiderMonkey.pas-4193- Result := JS_NewContext(maxbytes, maxNurseryBytes, parentContext);
SyNode/SpiderMonkey.pas-4194- InitSelfHostedCode(Result);
SyNode/SpiderMonkey.pas-4195- end;
Could you help to suggest why would there be "Invalid floating point operation" at "JSContext.CreateNew" when "TSynFPUException.ForLibraryCode" is already called at "JSContext.CreateNew" ? Many thanks !
Last edited by ComingNine (Yesterday 20:31:14)
Offline