浏览代码

* record in the flowcontrol flags whether we are currently in a block whose
exceptions are caught in the current routine (fc_catching_exceptions),
so that for LLVM we will be able to use "invoke" instead of "call" in that
case

git-svn-id: trunk@35158 -

Jonas Maebe 8 年之前
父节点
当前提交
b14c037533
共有 3 个文件被更改,包括 10 次插入6 次删除
  1. 5 4
      compiler/ncgflw.pas
  2. 3 0
      compiler/pass_2.pas
  3. 2 2
      compiler/x86_64/nx64flw.pas

+ 5 - 4
compiler/ncgflw.pas

@@ -584,7 +584,6 @@ implementation
       begin
         current_asmdata.getjumplabel(exceptstate.exceptionlabel);
         exceptstate.oldflowcontrol:=flowcontrol;
-        flowcontrol:=[fc_inflowcontrol];
 
         paraloc1.init;
         paraloc2.init;
@@ -642,6 +641,8 @@ implementation
           longjmp'd back here }
         hlcg.a_cmp_const_reg_label(list,setjmpres.def,OC_NE,0,tmpresloc.register,exceptstate.exceptionlabel);
         setjmpres.resetiftemp;
+
+        flowcontrol:=[fc_inflowcontrol,fc_catching_exceptions];
      end;
 
 
@@ -924,7 +925,7 @@ implementation
 
          { return all used control flow statements }
          flowcontrol:=trystate.oldflowcontrol+(doobjectdestroyandreraisestate.newflowcontrol +
-           trystate.newflowcontrol - [fc_inflowcontrol]);
+           trystate.newflowcontrol - [fc_inflowcontrol,fc_catching_exceptions]);
       end;
 
 
@@ -1062,7 +1063,7 @@ implementation
 
          cexceptionstatehandler.unget_exception_temps(current_asmdata.CurrAsmList,excepttemps);
          hlcg.a_label(current_asmdata.CurrAsmList,nextonlabel);
-         flowcontrol:=doobjectdestroyandreraisestate.oldflowcontrol+(doobjectdestroyandreraisestate.newflowcontrol-[fc_inflowcontrol]);
+         flowcontrol:=doobjectdestroyandreraisestate.oldflowcontrol+(doobjectdestroyandreraisestate.newflowcontrol-[fc_inflowcontrol,fc_catching_exceptions]);
          paraloc1.done;
          current_asmdata.CurrAsmList.concat(tai_marker.create(mark_NoLineInfoEnd));
 
@@ -1252,7 +1253,7 @@ implementation
             current_procinfo.CurrContinueLabel:=oldContinueLabel;
             current_procinfo.CurrBreakLabel:=oldBreakLabel;
           end;
-         flowcontrol:=finallyexceptionstate.oldflowcontrol+(finallyexceptionstate.newflowcontrol-[fc_inflowcontrol]);
+         flowcontrol:=finallyexceptionstate.oldflowcontrol+(finallyexceptionstate.newflowcontrol-[fc_inflowcontrol,fc_catching_exceptions]);
       end;
 
 

+ 3 - 0
compiler/pass_2.pas

@@ -35,6 +35,9 @@ uses
          fc_continue,
          fc_inflowcontrol,
          fc_gotolabel,
+         { in block that has an exception handler associated with it
+           (try..except, try..finally, exception block of try..except, ... }
+         fc_catching_exceptions,
          { in try block of try..finally and target uses specific unwinding }
          fc_unwind_exit,
          fc_unwind_loop,

+ 2 - 2
compiler/x86_64/nx64flw.pas

@@ -293,9 +293,9 @@ procedure tx64tryfinallynode.pass_generate_code;
         { fc_unwind_xx tells exit/continue/break statements to emit special
           unwind code instead of just JMP }
         if not implicitframe then
-          flowcontrol:=flowcontrol+[fc_unwind_exit,fc_unwind_loop];
+          flowcontrol:=flowcontrol+[fc_catching_exceptions,fc_unwind_exit,fc_unwind_loop];
         secondpass(left);
-        flowcontrol:=flowcontrol-[fc_unwind_exit,fc_unwind_loop];
+        flowcontrol:=flowcontrol-[fc_catching_exceptions,fc_unwind_exit,fc_unwind_loop];
         if codegenerror then
           exit;
       end;