Parcourir la source

* fixed darwin cycle

Jonas Maebe il y a 20 ans
Parent
commit
2e944b3b71
3 fichiers modifiés avec 46 ajouts et 8 suppressions
  1. 11 3
      compiler/ncgcal.pas
  2. 22 4
      compiler/ncgutil.pas
  3. 13 1
      compiler/parabase.pas

+ 11 - 3
compiler/ncgcal.pas

@@ -703,7 +703,9 @@ implementation
 {$ifdef cputargethasfixedstack}
                                { Can't have a data copied to the stack, every location
                                  must contain a valid size field }
-                               if ppn.tempcgpara.size=OS_NO then
+                               
+                               if (ppn.tempcgpara.size=OS_NO) and
+                                  not(ppn.tempcgpara.is_single_reference(tmpparaloc)) then
                                  internalerror(200501281);
                                reference_reset_base(href,callerparaloc^.reference.index,callerparaloc^.reference.offset);
                                { copy parameters in case they were moved to a temp. location because we've a fixed stack }
@@ -713,7 +715,10 @@ implementation
                                      reference_reset_base(htempref,tmpparaloc^.reference.index,tmpparaloc^.reference.offset);
                                      { use concatcopy, because it can also be a float which fails when
                                        load_ref_ref is used }
-                                     cg.g_concatcopy(exprasmlist,htempref,href,tcgsize2size[tmpparaloc^.size]);
+                                     if (ppn.tempcgpara.size <> OS_NO) then
+                                       cg.g_concatcopy(exprasmlist,htempref,href,tcgsize2size[tmpparaloc^.size])
+                                      else
+                                       cg.g_concatcopy(exprasmlist,htempref,href,sizeleft)
                                    end;
                                  LOC_REGISTER:
                                    cg.a_load_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href);
@@ -1220,7 +1225,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.198  2005-01-29 11:36:52  peter
+  Revision 1.199  2005-01-30 21:51:57  jonas
+    * fixed darwin cycle
+
+  Revision 1.198  2005/01/29 11:36:52  peter
     * update x86_64 with new cpupara
 
   Revision 1.197  2005/01/20 17:47:01  peter

+ 22 - 4
compiler/ncgutil.pas

@@ -1379,9 +1379,24 @@ implementation
                       while assigned(paraloc) do
                         begin
                           unget_para(paraloc^);
-                          gen_load_ref(paraloc^,href,sizeleft);
-                          inc(href.offset,TCGSize2Size[paraloc^.size]);
-                          dec(sizeleft,TCGSize2Size[paraloc^.size]);
+                          if (currpara.paraloc[calleeside].is_single_reference(paraloc)) then
+                            begin
+                              gen_load_ref(paraloc^,href,sizeleft);
+                              { May be needed later, when we add support for     }
+                              { passing the same parameter in multiple locations }
+                              { Currently, is_single_reference returns only true }
+                              { if paraloc^.next = nil (JM)                      }
+                              inc(href.offset,sizeleft);
+                              sizeleft := 0;
+                            end
+                          else
+                            begin
+                              if (paraloc^.size = OS_NO) then
+                                internalerror(2005013010);
+                              gen_load_ref(paraloc^,href,tcgsize2size[paraloc^.size]);
+                              inc(href.offset,TCGSize2Size[paraloc^.size]);
+                              dec(sizeleft,TCGSize2Size[paraloc^.size]);
+                            end;
                           paraloc:=paraloc^.next;
                         end;
                     end;
@@ -2407,7 +2422,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.258  2005-01-24 22:08:32  peter
+  Revision 1.259  2005-01-30 21:51:57  jonas
+    * fixed darwin cycle
+
+  Revision 1.258  2005/01/24 22:08:32  peter
     * interface wrapper generation moved to cgobj
     * generate interface wrappers after the module is parsed
 

+ 13 - 1
compiler/parabase.pas

@@ -63,6 +63,7 @@ unit parabase;
           procedure   reset;
           function    getcopy:tcgpara;
           procedure   check_simple_location;
+          function    is_single_reference(l: pcgparalocation): boolean;
           function    add_location:pcgparalocation;
           procedure   get_location(var newloc:tlocation);
        end;
@@ -176,6 +177,14 @@ implementation
       end;
 
 
+    function tcgpara.is_single_reference(l: pcgparalocation): boolean;
+      begin
+        result :=
+          (l^.loc = LOC_REFERENCE) and
+          not assigned(l^.next);
+      end;
+
+
     procedure tcgpara.check_simple_location;
       begin
         if not assigned(location) then
@@ -252,7 +261,10 @@ end.
 
 {
    $Log$
-   Revision 1.9  2005-01-18 22:19:20  peter
+   Revision 1.10  2005-01-30 21:51:57  jonas
+     * fixed darwin cycle
+
+   Revision 1.9  2005/01/18 22:19:20  peter
      * multiple location support for i386 a_param_ref
      * remove a_param_copy_ref for i386