Browse Source

* arrays are always passed by addr
* cdecl array of const is passed by value so it doesn't allocate
anything

peter 20 years ago
parent
commit
adc66eaf55
1 changed files with 15 additions and 9 deletions
  1. 15 9
      compiler/x86_64/cpupara.pas

+ 15 - 9
compiler/x86_64/cpupara.pas

@@ -109,7 +109,9 @@ unit cpupara;
                  loc1:=LOC_REGISTER;
                  loc1:=LOC_REGISTER;
              end;
              end;
            arraydef:
            arraydef:
-             loc1:=LOC_REFERENCE;
+             begin
+               loc1:=LOC_REFERENCE;
+             end;
            variantdef:
            variantdef:
              loc1:=LOC_REFERENCE;
              loc1:=LOC_REFERENCE;
            stringdef:
            stringdef:
@@ -182,13 +184,12 @@ unit cpupara;
             result:=(def.size>sizeof(aint));
             result:=(def.size>sizeof(aint));
           arraydef :
           arraydef :
             begin
             begin
-              result:=(
-                       (tarraydef(def).highrange>=tarraydef(def).lowrange) and
-                       (def.size>sizeof(aint))
-                      ) or
-                      is_open_array(def) or
-                      is_array_of_const(def) or
-                      is_array_constructor(def);
+              result:=not(
+                          { cdecl array of const need to be ignored and therefor be puhsed
+                            as value parameter with length 0 }
+                          (calloption in [pocall_cdecl,pocall_cppdecl]) and
+                          is_array_of_const(def)
+                         );
             end;
             end;
           objectdef :
           objectdef :
             result:=is_object(def);
             result:=is_object(def);
@@ -492,7 +493,12 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2005-02-03 20:04:49  peter
+  Revision 1.17  2005-02-06 18:59:15  peter
+    * arrays are always passed by addr
+    * cdecl array of const is passed by value so it doesn't allocate
+      anything
+
+  Revision 1.16  2005/02/03 20:04:49  peter
     * push_addr_param must be defined per target
     * push_addr_param must be defined per target
 
 
   Revision 1.15  2005/02/03 18:32:25  peter
   Revision 1.15  2005/02/03 18:32:25  peter