Browse Source

+ mw_pascal calling convention support for ARM, ppc64 and x86_64: identical
to cdecl, except that all const record parameters are passed by reference
(required for Mac OS X interfaces)

git-svn-id: trunk@14114 -

Jonas Maebe 15 years ago
parent
commit
62c1781bea

+ 4 - 1
compiler/arm/cpuinfo.pas

@@ -91,7 +91,10 @@ Const
      { same as stdcall only different name mangling }
      pocall_cppdecl,
      { same as stdcall but floating point numbers are handled like equal sized integers }
-     pocall_softfloat
+     pocall_softfloat,
+     { same as stdcall (requires that all const records are passed by
+       reference, but that's already done for stdcall) }
+     pocall_mwpascal
    ];
 
    cputypestr : array[tcputype] of string[8] = ('',

+ 2 - 0
compiler/arm/cpupara.pas

@@ -164,6 +164,8 @@ unit cpupara;
           objectdef:
             result:=is_object(def) and ((varspez=vs_const) or (def.size=0));
           recorddef:
+            { note: should this ever be changed, make sure that const records
+                are always passed by reference for calloption=pocall_mwpascal }
             result:=(varspez=vs_const) or (def.size=0);
           variantdef,
           formaldef:

+ 4 - 1
compiler/powerpc64/cpuinfo.pas

@@ -48,7 +48,10 @@ 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,
+    { the difference with stdcall is that all const record
+      parameters are passed by reference }
+    pocall_mwpascal
     ];
 
   cputypestr: array[tcputype] of string[10] = ('',

+ 5 - 4
compiler/powerpc64/cpupara.pas

@@ -173,10 +173,11 @@ begin
     recorddef:
       result :=
         ((varspez = vs_const) and
-        (
-         (not (calloption in [pocall_cdecl, pocall_cppdecl]) and
-         (def.size > 8))
-        )
+         (
+          (not (calloption in [pocall_cdecl, pocall_cppdecl]) and
+          (def.size > 8))
+         ) or
+         (calloption = pocall_mwpascal)
         );
     arraydef:
       result := (tarraydef(def).highrange >= tarraydef(def).lowrange) or

+ 2 - 1
compiler/x86_64/cpuinfo.pas

@@ -67,7 +67,8 @@ Const
      pocall_safecall,
      pocall_stdcall,
      pocall_cdecl,
-     pocall_cppdecl
+     pocall_cppdecl,
+     pocall_mwpascal
    ];
 
    cputypestr : array[tcputype] of string[10] = ('',

+ 5 - 0
compiler/x86_64/cpupara.pas

@@ -284,6 +284,11 @@ unit cpupara;
               { Win ABI depends on size to pass it in a register or not }
               if (target_info.system=system_x86_64_win64) then
                 result:=not structure_in_registers(varspez,def.size)
+              { MetroWerks Pascal: const records always passed by reference
+                (for Mac OS X interfaces) }
+              else if (calloption=pocall_mwpascal) and
+                      (varspez=vs_const) then
+                result:=true
               else
               { linux ABI always passes it as value parameter }
                 result:=false;