Ver código fonte

* const record parameters > 8 bytes are now passed by reference for non
cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
GPC (slightly more efficient than Metrowerks behaviour below, but
less efficient in most cases than our previous scheme)
+ "mwpascal" procedure directive to support the const record parameter
behaviour of Metrowerks Pascal, which passes all const records by
reference

Jonas Maebe 20 anos atrás
pai
commit
bfa2301575

+ 12 - 2
compiler/globals.pas

@@ -1902,7 +1902,8 @@ end;
          'REGISTER',
          'SAFECALL',
          'STDCALL',
-         'SOFTFLOAT'
+         'SOFTFLOAT',
+         'MWPASCAL'
         );
       var
         t : tproccalloption;
@@ -2294,7 +2295,16 @@ end;
 end.
 {
   $Log$
-  Revision 1.174  2005-03-20 22:36:45  olle
+  Revision 1.175  2005-03-27 14:10:52  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.174  2005/03/20 22:36:45  olle
     * Cleaned up handling of source file extension.
     + Added support for .p extension for macos and darwin
 

+ 16 - 3
compiler/globtype.pas

@@ -219,7 +219,10 @@ than 255 characters. That's why using Ansi Strings}
            available calling conventions available for the cpu
            this replaces either pocall_fastcall or pocall_stdcall.
          }
-         pocall_softfloat
+         pocall_softfloat,
+         { Metrowerks Pascal. Special case on Mac OS (X): passes all }
+         { constant records by reference.                            }
+         pocall_mwpascal
        );
        tproccalloptions = set of tproccalloption;
 
@@ -264,7 +267,8 @@ than 255 characters. That's why using Ansi Strings}
            'Register',
            'SafeCall',
            'StdCall',
-           'SoftFloat'
+           'SoftFloat',
+           'MWPascal'
          );
 
        { Default calling convention }
@@ -319,7 +323,16 @@ implementation
 end.
 {
   $Log$
-  Revision 1.71  2005-02-17 17:52:39  peter
+  Revision 1.72  2005-03-27 14:10:52  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.71  2005/02/17 17:52:39  peter
     * allow enum arithmetics inside an enum def, compatible with delphi
 
   Revision 1.70  2005/02/14 17:13:06  peter

+ 21 - 3
compiler/pdecsub.pas

@@ -1399,7 +1399,7 @@ type
    end;
 const
   {Should contain the number of procedure directives we support.}
-  num_proc_directives=36;
+  num_proc_directives=37;
   proc_direcdata:array[1..num_proc_directives] of proc_dir_rec=
    (
     (
@@ -1574,6 +1574,15 @@ const
       mutexclpocall : [pocall_inline,pocall_internproc];
       mutexclpotype : [potype_constructor,potype_destructor,potype_operator];
       mutexclpo     : [po_interrupt,po_external]
+    ),(
+      idtok:_MWPASCAL;
+      pd_flags : [pd_interface,pd_implemen,pd_body,pd_procvar];
+      handler  : nil;
+      pocall   : pocall_mwpascal;
+      pooption : [];
+      mutexclpocall : [];
+      mutexclpotype : [];
+      mutexclpo     : []
     ),(
       idtok:_NEAR;
       pd_flags : [pd_implemen,pd_body,pd_procvar,pd_notobjintf];
@@ -1718,7 +1727,7 @@ const
       pocall   : pocall_none;
       pooption : [po_varargs];
       mutexclpocall : [pocall_internproc,pocall_stdcall,pocall_register,
-                       pocall_inline,pocall_far16,pocall_oldfpccall];
+                       pocall_inline,pocall_far16,pocall_oldfpccall,pocall_mwpascal];
       mutexclpotype : [];
       mutexclpo     : [po_assembler,po_interrupt]
     ),(
@@ -2449,7 +2458,16 @@ const
 end.
 {
   $Log$
-  Revision 1.230  2005-02-14 17:13:07  peter
+  Revision 1.231  2005-03-27 14:10:52  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.230  2005/02/14 17:13:07  peter
     * truncate log
 
   Revision 1.229  2005/02/03 17:11:40  peter

+ 13 - 2
compiler/powerpc/cpuinfo.pas

@@ -54,7 +54,9 @@ Const
      { the difference to stdcall is only the name mangling }
      pocall_cdecl,
      { the difference to stdcall is only the name mangling }
-     pocall_cppdecl
+     pocall_cppdecl,
+     { pass all const records by reference }
+     pocall_mwpascal
    ];
 
    processorsstr : array[tprocessors] of string[10] = ('',
@@ -72,7 +74,16 @@ Implementation
 end.
 {
   $Log$
-  Revision 1.23  2005-03-25 21:55:43  jonas
+  Revision 1.24  2005-03-27 14:10:53  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.23  2005/03/25 21:55:43  jonas
     * removed some unused variables
 
   Revision 1.22  2005/02/14 17:13:10  peter

+ 19 - 2
compiler/powerpc/cpupara.pas

@@ -185,7 +185,15 @@ unit cpupara;
           formaldef :
             result:=true;
           recorddef:
-            result :=(target_info.abi<>abi_powerpc_aix);
+            result :=
+              (target_info.abi<>abi_powerpc_aix) or
+              ((varspez = vs_const) and
+               ((calloption = pocall_mwpascal) or
+                (not (calloption in [pocall_cdecl,pocall_cppdecl]) and
+                 (def.size > 8)
+                )
+               )
+              );
           arraydef:
             result:=(tarraydef(def).highrange>=tarraydef(def).lowrange) or
                              is_open_array(def) or
@@ -652,7 +660,16 @@ begin
 end.
 {
   $Log$
-  Revision 1.90  2005-02-19 14:04:14  jonas
+  Revision 1.91  2005-03-27 14:10:53  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.90  2005/02/19 14:04:14  jonas
     * don't lose sign of ord types for register parameters
 
   Revision 1.89  2005/02/14 17:13:10  peter

+ 11 - 2
compiler/ppu.pas

@@ -44,7 +44,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion=48;
+  CurrentPPUVersion=49;
 
 { buffer sizes }
   maxentrysize = 1024;
@@ -1069,7 +1069,16 @@ end;
 end.
 {
   $Log$
-  Revision 1.64  2005-02-14 17:13:07  peter
+  Revision 1.65  2005-03-27 14:10:52  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.64  2005/02/14 17:13:07  peter
     * truncate log
 
   Revision 1.63  2005/01/24 17:46:18  olle

+ 11 - 2
compiler/symconst.pas

@@ -411,7 +411,7 @@ const
      pocall_cdecl,pocall_cppdecl,pocall_syscall
    ];
 
-   pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal];
+   pushleftright_pocalls : tproccalloptions = [pocall_register,pocall_pascal,pocall_mwpascal];
 
      SymTypeName : array[tsymtyp] of string[12] = (
        'abstractsym','globalvar','localvar','paravar','fieldvar',
@@ -441,7 +441,16 @@ initialization
 end.
 {
   $Log$
-  Revision 1.102  2005-02-14 17:13:07  peter
+  Revision 1.103  2005-03-27 14:10:52  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.102  2005/02/14 17:13:07  peter
     * truncate log
 
   Revision 1.101  2005/01/30 11:26:40  peter

+ 12 - 1
compiler/tokens.pas

@@ -195,6 +195,7 @@ type
     _EXTERNAL,
     _FUNCTION,
     _LOCATION,
+    _MWPASCAL,
     _OPERATOR,
     _OVERLOAD,
     _OVERRIDE,
@@ -430,6 +431,7 @@ const
       (str:'EXTERNAL'      ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'FUNCTION'      ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'LOCATION'      ;special:false;keyword:m_none;op:NOTOKEN),
+      (str:'MWPASCAL'      ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'OPERATOR'      ;special:false;keyword:m_fpc;op:NOTOKEN),
       (str:'OVERLOAD'      ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'OVERRIDE'      ;special:false;keyword:m_none;op:NOTOKEN),
@@ -529,7 +531,16 @@ end;
 end.
 {
   $Log$
-  Revision 1.36  2005-02-14 17:13:09  peter
+  Revision 1.37  2005-03-27 14:10:53  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.36  2005/02/14 17:13:09  peter
     * truncate log
 
   Revision 1.35  2005/01/06 02:13:03  karoly

+ 16 - 3
compiler/utils/ppudump.pp

@@ -793,7 +793,10 @@ type
       available calling conventions available for the cpu
       this replaces either pocall_fastcall or pocall_stdcall.
     }
-    pocall_softfloat
+    pocall_softfloat,
+    { Metrowerks Pascal. Special case on Mac OS (X): passes all }
+    { constant records by reference.                            }
+    pocall_mwpascal    
   );
   tproccalloptions=set of tproccalloption;
   tproctypeoption=(potype_none,
@@ -869,7 +872,8 @@ const
      'Register',
      'SafeCall',
      'StdCall',
-     'SoftFloat'
+     'SoftFloat',
+     'MWPascal'
    );
   proctypeopts=6;
   proctypeopt : array[1..proctypeopts] of tproctypeopt=(
@@ -2151,7 +2155,16 @@ begin
 end.
 {
   $Log$
-  Revision 1.67  2005-03-07 18:38:46  peter
+  Revision 1.68  2005-03-27 14:10:53  jonas
+    * const record parameters > 8 bytes are now passed by reference for non
+      cdecl/cppdecl procedures on Mac OS/Mac OS X to fix compatibility with
+      GPC (slightly more efficient than Metrowerks behaviour below, but
+      less efficient in most cases than our previous scheme)
+    + "mwpascal" procedure directive to support the const record parameter
+      behaviour of Metrowerks Pascal, which passes all const records by
+      reference
+
+  Revision 1.67  2005/03/07 18:38:46  peter
     * explicit paraloc for funcret
     * libsym for powerpc ppu's