summaryrefslogtreecommitdiff
path: root/compiler/ncgflw.pas
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-02-17 20:12:51 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2019-02-17 20:12:51 +0000
commita02f48baf728b1f293f4f1b1e513307f3fc0865a (patch)
treeb66f584467dcf552ec1f7be21c8b6f34316f76e7 /compiler/ncgflw.pas
parent32c4ba689c180471dc4d40149093765af27e65ee (diff)
downloadfpc-a02f48baf728b1f293f4f1b1e513307f3fc0865a.tar.gz
* small fixes for pseabieh
+ raise node support for pseabieh git-svn-id: https://svn.freepascal.org/svn/fpc/branches/debug_eh@41355 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncgflw.pas')
-rw-r--r--compiler/ncgflw.pas60
1 files changed, 56 insertions, 4 deletions
diff --git a/compiler/ncgflw.pas b/compiler/ncgflw.pas
index 1873436aa4..fe0f8147f0 100644
--- a/compiler/ncgflw.pas
+++ b/compiler/ncgflw.pas
@@ -29,7 +29,8 @@ interface
uses
globtype,
symtype,symdef,
- aasmbase,aasmdata,nflw,
+ aasmbase,aasmdata,
+ node,nflw,
pass_2,cgbase,cgutils,ncgutil;
type
@@ -73,6 +74,8 @@ interface
end;
tcgraisenode = class(traisenode)
+ function pass_1: tnode;override;
+ procedure pass_generate_code;override;
end;
{ Utility class for exception handling state management that is used
@@ -297,9 +300,8 @@ implementation
action: TPSABIEHAction;
begin
cgpara1.init;
- if exceptframekind<>tek_except
- { not(fc_catching_exceptions in flowcontrol) and
- use_cleanup(exceptframekind) } then
+ if not(fc_catching_exceptions in flowcontrol) and
+ use_cleanup(exceptframekind) then
begin
pd:=search_system_proc('fpc_resume');
paramanager.getintparaloc(list,pd,1,cgpara1);
@@ -1651,6 +1653,56 @@ implementation
end;
+ function tcgraisenode.pass_1: tnode;
+ begin
+ if not(tf_use_psabieh in target_info.flags) or assigned(left) then
+ result:=inherited
+ else
+ begin
+ expectloc:=LOC_VOID;
+ result:=nil;
+ end;
+ end;
+
+
+ procedure tcgraisenode.pass_generate_code;
+ var
+ CurrentLandingPad, CurrentAction, ReRaiseLandingPad: TPSABIEHAction;
+ begin
+ if not(tf_use_psabieh in target_info.flags) then
+ Internalerror(2019021701);
+
+ location_reset(location,LOC_VOID,OS_NO);
+ CurrentLandingPad:=nil;
+ { a reraise must raise the exception to the parent exception frame }
+ if fc_catching_exceptions in flowcontrol then
+ begin
+ current_procinfo.CreateNewPSABIEHCallsite;
+ CurrentLandingPad:=current_procinfo.CurrentLandingPad;
+ if current_procinfo.PopLandingPad(CurrentLandingPad) then
+ exclude(flowcontrol,fc_catching_exceptions);
+ CurrentAction:=current_procinfo.CurrentAction;
+ current_procinfo.PopAction(CurrentAction);
+
+ ReRaiseLandingPad:=TPSABIEHAction.Create(nil);
+ current_procinfo.PushAction(ReRaiseLandingPad);
+ current_procinfo.PushLandingPad(ReRaiseLandingPad);
+ end;
+ hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_reraise',[],nil).resetiftemp;
+ if assigned(CurrentLandingPad) then
+ begin
+ current_procinfo.CreateNewPSABIEHCallsite;
+ current_procinfo.PopLandingPad(current_procinfo.CurrentLandingPad);
+ current_procinfo.PopAction(ReRaiseLandingPad);
+
+ current_procinfo.PushAction(CurrentAction);
+ current_procinfo.PushLandingPad(CurrentLandingPad);
+ include(flowcontrol,fc_catching_exceptions);
+ end;
+ end;
+
+
+
begin
cwhilerepeatnode:=tcgwhilerepeatnode;
cifnode:=tcgifnode;