Forráskód Böngészése

* fix exception handling code generator memory leaks

git-svn-id: branches/debug_eh@40734 -
Jonas Maebe 6 éve
szülő
commit
9f928b2805
2 módosított fájl, 9 hozzáadás és 8 törlés
  1. 5 4
      compiler/llvm/nllvmflw.pas
  2. 4 4
      compiler/ncgflw.pas

+ 5 - 4
compiler/llvm/nllvmflw.pas

@@ -164,7 +164,7 @@ implementation
           We cheat for now by adding an invoke to a dummy routine at the start and at
           We cheat for now by adding an invoke to a dummy routine at the start and at
           the end of the try-block. That will not magically fix the state
           the end of the try-block. That will not magically fix the state
           of all variables when the exception gets caught though. }
           of all variables when the exception gets caught though. }
-        hlcg.g_call_system_proc(list,'FPC_DUMMYPOTENTIALRAISE',[],nil);
+        hlcg.g_call_system_proc(list,'FPC_DUMMYPOTENTIALRAISE',[],nil).resetiftemp;
       end;
       end;
 
 
 
 
@@ -212,7 +212,7 @@ implementation
           be combined with marking stores inside try blocks as volatile and the
           be combined with marking stores inside try blocks as volatile and the
           loads afterwards as well in order to guarantee correct optimizations
           loads afterwards as well in order to guarantee correct optimizations
           in case an exception gets triggered inside a try-block though }
           in case an exception gets triggered inside a try-block though }
-        hlcg.g_call_system_proc(list,'FPC_DUMMYPOTENTIALRAISE',[],nil);
+        hlcg.g_call_system_proc(list,'FPC_DUMMYPOTENTIALRAISE',[],nil).resetiftemp;
 
 
         { record that no exception happened in the reason buf }
         { record that no exception happened in the reason buf }
         reg:=hlcg.getintregister(list,ossinttype);
         reg:=hlcg.getintregister(list,ossinttype);
@@ -284,7 +284,7 @@ implementation
 
 
     class procedure tllvmexceptionstatehandler.end_catch(list: TAsmList);
     class procedure tllvmexceptionstatehandler.end_catch(list: TAsmList);
       begin
       begin
-        hlcg.g_call_system_proc(list,'fpc_psabi_end_catch',[],nil);
+        hlcg.g_call_system_proc(list,'fpc_psabi_end_catch',[],nil).resetiftemp;
         inherited;
         inherited;
       end;
       end;
 
 
@@ -297,7 +297,7 @@ implementation
 
 
     class procedure tllvmexceptionstatehandler.catch_all_end(list: TAsmList);
     class procedure tllvmexceptionstatehandler.catch_all_end(list: TAsmList);
       begin
       begin
-        hlcg.g_call_system_proc(list,'fpc_psabi_end_catch',[],nil);
+        hlcg.g_call_system_proc(list,'fpc_psabi_end_catch',[],nil).resetiftemp;
       end;
       end;
 
 
 
 
@@ -367,6 +367,7 @@ implementation
             hlcg.a_cmp_reg_loc_label(list,typeidres.Def,OC_EQ,exceptiontypeidreg,exceptloc,catchstartlab);
             hlcg.a_cmp_reg_loc_label(list,typeidres.Def,OC_EQ,exceptiontypeidreg,exceptloc,catchstartlab);
             hlcg.a_jmp_always(list,nextonlabel);
             hlcg.a_jmp_always(list,nextonlabel);
             hlcg.a_label(list,catchstartlab);
             hlcg.a_label(list,catchstartlab);
+            typeidres.resetiftemp;
           end;
           end;
 
 
         wrappedexception:=hlcg.getaddressregister(list,voidpointertype);
         wrappedexception:=hlcg.getaddressregister(list,voidpointertype);

+ 4 - 4
compiler/ncgflw.pas

@@ -697,7 +697,7 @@ implementation
     { in the except block                                    }
     { in the except block                                    }
     class procedure tcgexceptionstatehandler.cleanupobjectstack(list: TAsmList);
     class procedure tcgexceptionstatehandler.cleanupobjectstack(list: TAsmList);
       begin
       begin
-         hlcg.g_call_system_proc(list,'fpc_doneexception',[],nil);
+         hlcg.g_call_system_proc(list,'fpc_doneexception',[],nil).resetiftemp;
       end;
       end;
 
 
 
 
@@ -715,7 +715,7 @@ implementation
          free_exception(list,t,entrystate,0,exitlabel,false);
          free_exception(list,t,entrystate,0,exitlabel,false);
          { we don't need to save/restore registers here because reraise never }
          { we don't need to save/restore registers here because reraise never }
          { returns                                                            }
          { returns                                                            }
-         hlcg.g_call_system_proc(list,'fpc_raise_nested',[],nil);
+         hlcg.g_call_system_proc(list,'fpc_raise_nested',[],nil).resetiftemp;
          hlcg.a_label(list,exitlabel);
          hlcg.a_label(list,exitlabel);
          cleanupobjectstack(list);
          cleanupobjectstack(list);
       end;
       end;
@@ -723,7 +723,7 @@ implementation
 
 
     class procedure tcgexceptionstatehandler.handle_reraise(list: TAsmList; const t: texceptiontemps; const entrystate: texceptionstate; const exceptframekind: texceptframekind);
     class procedure tcgexceptionstatehandler.handle_reraise(list: TAsmList; const t: texceptiontemps; const entrystate: texceptionstate; const exceptframekind: texceptframekind);
       begin
       begin
-         hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_reraise',[],nil);
+         hlcg.g_call_system_proc(current_asmdata.CurrAsmList,'fpc_reraise',[],nil).resetiftemp;
       end;
       end;
 
 
 
 
@@ -786,7 +786,7 @@ implementation
 
 
     class procedure tcgexceptionstatehandler.popaddrstack(list: TAsmList);
     class procedure tcgexceptionstatehandler.popaddrstack(list: TAsmList);
       begin
       begin
-        hlcg.g_call_system_proc(list,'fpc_popaddrstack',[],nil);
+        hlcg.g_call_system_proc(list,'fpc_popaddrstack',[],nil).resetiftemp;
       end;
       end;
 
 
 {*****************************************************************************
 {*****************************************************************************