- get rid of fpc_PushExceptAddr and fpc_PopAddrStack entirely, when compiling in

wasm native exceptions mode - these helper routines aren't necessary in this
  mode
This commit is contained in:
Nikolay Nikolov 2021-09-28 03:59:38 +03:00
parent 91f0f1a86c
commit 0c3e179652
3 changed files with 7 additions and 46 deletions

View File

@ -328,7 +328,7 @@ implementation
end
else
begin
addstatement(statements,ccallnode.createintern('fpc_popaddrstack',nil));
//addstatement(statements,ccallnode.createintern('fpc_popaddrstack',nil));
raisenode:=ccallnode.createintern('fpc_reraise',nil);
include(raisenode.callnodeflags,cnf_call_never_returns);
addstatement(statements,raisenode);

View File

@ -711,9 +711,11 @@ procedure fpc_dispatch_by_id(Result: Pointer; const Dispatch: pointer;DispDesc:
{$ifdef FPC_HAS_FEATURE_EXCEPTIONS}
{$ifndef FPC_WASM_NATIVE_EXCEPTIONS)}
Function fpc_PushExceptAddr (Ft: {$ifdef CPU16}SmallInt{$else}Longint{$endif};_buf,_newaddr : pointer): PJmp_buf ; compilerproc;
procedure fpc_Raiseexception (Obj : TObject; AnAddr : CodePointer; AFrame : Pointer); compilerproc;
Procedure fpc_PopAddrStack; compilerproc;
{$endif FPC_WASM_NATIVE_EXCEPTIONS)}
procedure fpc_Raiseexception (Obj : TObject; AnAddr : CodePointer; AFrame : Pointer); compilerproc;
function fpc_PopObjectStack : TObject; compilerproc;
function fpc_PopSecondObjectStack : TObject; compilerproc;
Procedure fpc_ReRaise; compilerproc;

View File

@ -22,7 +22,6 @@ ThreadVar
{$else FPC_HAS_FEATURE_THREADING}
Var
{$endif FPC_HAS_FEATURE_THREADING}
ExceptAddrStack : PExceptAddr;
ExceptObjectStack : PExceptObject;
ExceptTryLevel : ObjpasInt;
@ -66,23 +65,6 @@ begin
end;
Function fpc_PushExceptAddr (Ft: {$ifdef CPU16}SmallInt{$else}Longint{$endif};_buf,_newaddr : pointer): PJmp_buf ;
[Public, Alias : 'FPC_PUSHEXCEPTADDR'];compilerproc;
var
_ExceptAddrstack : ^PExceptAddr;
begin
{$ifdef excdebug}
writeln ('In PushExceptAddr');
{$endif}
_ExceptAddrstack:=@ExceptAddrstack;
PExceptAddr(_newaddr)^.Next:=_ExceptAddrstack^;
_ExceptAddrStack^:=PExceptAddr(_newaddr);
PExceptAddr(_newaddr)^.Buf:=PJmp_Buf(_buf);
PExceptAddr(_newaddr)^.FrameType:=ft;
result:=PJmp_Buf(_buf);
end;
{ This routine is called only from fpc_raiseexception, which uses ExceptTryLevel
flag to guard against repeated exceptions which can occur due to corrupted stack
or heap. }
@ -187,28 +169,6 @@ end;
{$endif FPC_SYSTEM_HAS_RAISEEXCEPTION}
Procedure fpc_PopAddrStack;[Public, Alias : 'FPC_POPADDRSTACK']; compilerproc;
var
hp : ^PExceptAddr;
begin
{$ifdef excdebug}
writeln ('In Popaddrstack');
{$endif}
hp:=@ExceptAddrStack;
If hp^=nil then
begin
{$ifdef excdebug}
writeln ('At end of ExceptionAddresStack');
{$endif}
halt (255);
end
else
begin
hp^:=hp^^.Next;
end;
end;
function fpc_PopObjectStack : TObject;[Public, Alias : 'FPC_POPOBJECTSTACK']; compilerproc;
var
hp : PExceptObject;
@ -281,9 +241,9 @@ begin
{$ifdef excdebug}
writeln ('In reraise');
{$endif}
_ExceptAddrStack:=ExceptAddrStack;
If _ExceptAddrStack=Nil then
DoUnHandledException;
// _ExceptAddrStack:=ExceptAddrStack;
// If _ExceptAddrStack=Nil then
// DoUnHandledException;
ExceptObjectStack^.refcount := 0;
longjmp(_ExceptAddrStack^.Buf^,FPC_Exception);
end;
@ -327,7 +287,6 @@ Procedure SysInitExceptions;
}
begin
ExceptObjectstack:=Nil;
ExceptAddrStack:=Nil;
end;