2
0
Эх сурвалжийг харах

* finally!? fixed
with <function with result in temp> do
My last and also Peter's fix before were wrong :(

florian 26 жил өмнө
parent
commit
78977be752

+ 25 - 3
compiler/cg386mem.pas

@@ -781,7 +781,7 @@ implementation
 
     procedure secondwith(var p : ptree);
       var
-        usetemp : boolean;
+        usetemp,with_expr_in_temp : boolean;
       begin
          if assigned(p^.left) then
             begin
@@ -811,10 +811,24 @@ implementation
                  end
                else
                  begin
-                   emit_lea_loc_reg(p^.left^.location,R_EDI,true);
+                   emit_lea_loc_reg(p^.left^.location,R_EDI,false);
                    usetemp:=true;
                  end;
 
+               release_loc(p^.left^.location);
+
+               { if the with expression is stored in a temp    }
+               { area we must make it persistent and shouldn't }
+               { release it (FK)                               }
+               if (p^.left^.location.loc in [LOC_MEM,LOC_REFERENCE]) and
+                 istemp(p^.left^.location.reference) then
+                 begin
+                    normaltemptopersistant(p^.left^.location.reference.offset);
+                    with_expr_in_temp:=true;
+                 end
+               else
+                 with_expr_in_temp:=false;
+
                { if usetemp is set the value must be in %edi }
                if usetemp then
                 begin
@@ -833,6 +847,9 @@ implementation
                if usetemp then
                  ungetpersistanttemp(p^.withreference^.offset);
 
+               if with_expr_in_temp then
+                 ungetpersistanttemp(p^.left^.location.reference.offset);
+
                dispose(p^.withreference);
                p^.withreference:=nil;
             end;
@@ -842,7 +859,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.56  1999-09-13 20:49:41  florian
+  Revision 1.57  1999-09-14 07:59:46  florian
+    * finally!? fixed
+         with <function with result in temp> do
+      My last and also Peter's fix before were wrong :(
+
+  Revision 1.56  1999/09/13 20:49:41  florian
     * hopefully an error in Peter's previous commit fixed
 
   Revision 1.55  1999/09/10 15:42:50  peter

+ 6 - 2
compiler/cgai386.pas

@@ -488,7 +488,6 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
                                emit_ref_reg(A_MOV,S_L,
                                  newreference(t.reference),reg);
                              end;
-                           ungetiftemp(t.reference);
                          end;
         else
          internalerror(330);
@@ -3350,7 +3349,12 @@ procedure mov_reg_to_dest(p : ptree; s : topsize; reg : tregister);
 end.
 {
   $Log$
-  Revision 1.41  1999-09-12 08:48:04  florian
+  Revision 1.42  1999-09-14 07:59:47  florian
+    * finally!? fixed
+         with <function with result in temp> do
+      My last and also Peter's fix before were wrong :(
+
+  Revision 1.41  1999/09/12 08:48:04  florian
     * bugs 593 and 607 fixed
     * some other potential bugs with array constructors fixed
     * for classes compiled in $M+ and it's childs, the default access method

+ 8 - 1
compiler/tccal.pas

@@ -1122,6 +1122,8 @@ implementation
                         p^.location.loc:=LOC_FPU;
                         p^.registersfpu:=1;
                      end
+                   else
+                     p^.location.loc:=LOC_MEM;
                 end;
            end;
          must_be_valid:=store_valid;
@@ -1217,7 +1219,12 @@ implementation
 end.
 {
   $Log$
-  Revision 1.63  1999-09-10 18:48:11  florian
+  Revision 1.64  1999-09-14 07:59:48  florian
+    * finally!? fixed
+         with <function with result in temp> do
+      My last and also Peter's fix before were wrong :(
+
+  Revision 1.63  1999/09/10 18:48:11  florian
     * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
     * most things for stored properties fixed