소스 검색

* fix exception handling code generator memory leaks

git-svn-id: branches/debug_eh@40734 -
Jonas Maebe 6 년 전
부모
커밋
9f928b2805
2개의 변경된 파일9개의 추가작업 그리고 8개의 파일을 삭제
  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
           the end of the try-block. That will not magically fix the state
           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;
 
 
@@ -212,7 +212,7 @@ implementation
           be combined with marking stores inside try blocks as volatile and the
           loads afterwards as well in order to guarantee correct optimizations
           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 }
         reg:=hlcg.getintregister(list,ossinttype);
@@ -284,7 +284,7 @@ implementation
 
     class procedure tllvmexceptionstatehandler.end_catch(list: TAsmList);
       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;
       end;
 
@@ -297,7 +297,7 @@ implementation
 
     class procedure tllvmexceptionstatehandler.catch_all_end(list: TAsmList);
       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;
 
 
@@ -367,6 +367,7 @@ implementation
             hlcg.a_cmp_reg_loc_label(list,typeidres.Def,OC_EQ,exceptiontypeidreg,exceptloc,catchstartlab);
             hlcg.a_jmp_always(list,nextonlabel);
             hlcg.a_label(list,catchstartlab);
+            typeidres.resetiftemp;
           end;
 
         wrappedexception:=hlcg.getaddressregister(list,voidpointertype);

+ 4 - 4
compiler/ncgflw.pas

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