Procházet zdrojové kódy

* fixed saving of registers with decr_ansistr

peter před 26 roky
rodič
revize
8fe79ed472
2 změnil soubory, kde provedl 20 přidání a 14 odebrání
  1. 11 6
      compiler/cg386add.pas
  2. 9 8
      compiler/cg386cal.pas

+ 11 - 6
compiler/cg386add.pas

@@ -154,22 +154,24 @@ implementation
                      begin
                         cmpop:=false;
                         secondpass(p^.left);
-
                         { to avoid problem with maybe_push and restore }
                         set_location(p^.location,p^.left^.location);
                         pushed:=maybe_push(p^.right^.registers32,p,false);
                         secondpass(p^.right);
                         if pushed then restore(p,false);
+                        { get the temp location, must be done before regs are
+                          released/pushed because after the release the regs are
+                          still used for the push (PFV) }
+                        clear_location(p^.location);
+                        p^.location.loc:=LOC_MEM;
+                        if gettempansistringreference(p^.location.reference) then
+                          decrstringref(cansistringdef,p^.location.reference);
                         { release used registers }
                         del_location(p^.right^.location);
                         del_location(p^.left^.location);
                         { push the still used registers }
                         pushusedregisters(pushedregs,$ff);
                         { push data }
-                        clear_location(p^.location);
-                        p^.location.loc:=LOC_MEM;
-                        if gettempansistringreference(p^.location.reference) then
-                          decrstringref(cansistringdef,p^.location.reference);
                         emitpushreferenceaddr(p^.location.reference);
                         emit_push_loc(p^.right^.location);
                         emit_push_loc(p^.left^.location);
@@ -2089,7 +2091,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.66  1999-06-09 23:22:37  peter
+  Revision 1.66.2.1  1999-06-14 17:24:40  peter
+    * fixed saving of registers with decr_ansistr
+
+  Revision 1.66  1999/06/09 23:22:37  peter
     + del_location
 
   Revision 1.65  1999/06/09 23:00:11  peter

+ 9 - 8
compiler/cg386cal.pas

@@ -994,14 +994,12 @@ implementation
               else if is_ansistring(p^.resulttype) or
                 is_widestring(p^.resulttype) then
                 begin
-                   gettempansistringreference(hr);
-                   { cleanup the temp slot }
-                   exprasmlist^.concat(new(pai386,op_reg(A_PUSH,S_L,R_EAX)));
-                   decrstringref(p^.resulttype,hr);
-                   exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,R_EAX)));
-
-                   exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,R_EAX,
+                   hregister:=getexplicitregister32(R_EAX);
+                   if gettempansistringreference(hr) then
+                     decrstringref(p^.resulttype,hr);
+                   exprasmlist^.concat(new(pai386,op_reg_ref(A_MOV,S_L,hregister,
                      newreference(hr))));
+                   ungetregister32(hregister);
                    p^.location.loc:=LOC_MEM;
                    p^.location.reference:=hr;
                 end
@@ -1167,7 +1165,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.90  1999-06-02 10:11:40  florian
+  Revision 1.90.2.1  1999-06-14 17:24:42  peter
+    * fixed saving of registers with decr_ansistr
+
+  Revision 1.90  1999/06/02 10:11:40  florian
     * make cycle fixed i.e. compilation with 0.99.10
     * some fixes for qword
     * start of register calling conventions