Browse Source

* fix register leak in with debug

peter 22 năm trước cách đây
mục cha
commit
75cb52213f
2 tập tin đã thay đổi với 20 bổ sung6 xóa
  1. 14 3
      compiler/ncgmem.pas
  2. 6 3
      compiler/pass_2.pas

+ 14 - 3
compiler/ncgmem.pas

@@ -387,6 +387,7 @@ implementation
         withstartlabel,withendlabel : tasmlabel;
         pp : pchar;
         mangled_length  : longint;
+        refnode : tnode;
 {$endif GDB}
       begin
         location_reset(location,LOC_VOID,OS_NO);
@@ -397,7 +398,14 @@ implementation
             { load reference }
             if (withrefnode.nodetype=derefn) and
                (tderefnode(withrefnode).left.nodetype=temprefn) then
-              secondpass(withrefnode);
+              refnode:=tderefnode(withrefnode).left
+            else
+              refnode:=withrefnode;
+            secondpass(refnode);
+            location_release(exprasmlist,refnode.location);
+            location_freetemp(exprasmlist,refnode.location);
+            if not(refnode.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
+              internalerror(2003092810);
 
             inc(withlevel);
             objectlibrary.getaddrlabel(withstartlabel);
@@ -406,7 +414,7 @@ implementation
             withdebugList.concat(Tai_stabs.Create(strpnew(
                '"with'+tostr(withlevel)+':'+tostr(symtablestack.getnewtypecount)+
                '=*'+tstoreddef(left.resulttype.def).numberstring+'",'+
-               tostr(N_LSYM)+',0,0,'+tostr(withrefnode.location.reference.offset))));
+               tostr(N_LSYM)+',0,0,'+tostr(refnode.location.reference.offset))));
             mangled_length:=length(current_procinfo.procdef.mangledname);
             getmem(pp,mangled_length+50);
             strpcopy(pp,'192,0,0,'+withstartlabel.name);
@@ -866,7 +874,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.74  2003-09-28 17:55:03  peter
+  Revision 1.75  2003-09-28 21:45:52  peter
+    * fix register leak in with debug
+
+  Revision 1.74  2003/09/28 17:55:03  peter
     * parent framepointer changed to hidden parameter
     * tloadparentfpnode added
 

+ 6 - 3
compiler/pass_2.pas

@@ -94,7 +94,7 @@ implementation
              'add-slashn',  {slashn}
              'add-andn',  {andn}
              'subscriptn',  {subscriptn}
-             'dderef',       {derefn}
+             'deref',       {derefn}
              'addr',        {addrn}
              'ordconst',    {ordconstn}
              'typeconv',    {typeconvn}
@@ -299,7 +299,7 @@ implementation
 {$ifdef EXTDEBUG}
               for sr:=first_int_imreg to last_int_imreg do
                 if not(sr in rg.unusedregsint) then
-                  Comment(V_Warning,'Register '+std_regname(newreg(R_INTREGISTER,sr,R_SUBWHOLE))+' not released');
+                  Comment(V_Warning,'Register '+std_regname(newreg(R_INTREGISTER,sr,R_SUBNONE))+' not released');
 {$endif EXTDEBUG}
 
               if assigned(current_procinfo.procdef) then
@@ -312,7 +312,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.65  2003-09-28 17:55:04  peter
+  Revision 1.66  2003-09-28 21:45:52  peter
+    * fix register leak in with debug
+
+  Revision 1.65  2003/09/28 17:55:04  peter
     * parent framepointer changed to hidden parameter
     * tloadparentfpnode added