* fixed returning of records < 8 bytes but not a power of 2 from

functions under Darwin/x86
  * implemented "mwpascal" calling conventions for darwin/x86
    (pass const records by reference, destroyed registers are
     [eax,ecx,edx])

git-svn-id: trunk@3196 -
This commit is contained in:
Jonas Maebe 2006-04-12 12:19:08 +00:00
parent 76937d5222
commit f93ea93cea

View File

@ -93,6 +93,8 @@ unit cpupara;
function ti386paramanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean; function ti386paramanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
var
size: longint;
begin begin
case target_info.system of case target_info.system of
system_i386_win32 : system_i386_win32 :
@ -117,8 +119,11 @@ unit cpupara;
case def.deftype of case def.deftype of
recorddef : recorddef :
begin begin
if (def.size > 0) and size := def.size;
(def.size <= 8) then if (size > 0) and
(size <= 8) and
{ only if size is a power of 2 }
((size and (size-1)) = 0) then
begin begin
result := false; result := false;
exit; exit;
@ -166,7 +171,11 @@ unit cpupara;
(def.size<=16) then (def.size<=16) then
result:=false result:=false
else else
result:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (def.size>sizeof(aint)); result:=
(not(calloption in [pocall_cdecl,pocall_cppdecl]) and
(def.size>sizeof(aint))) or
((calloption = pocall_mwpascal) and
(varspez=vs_const));
end; end;
arraydef : arraydef :
begin begin
@ -229,7 +238,8 @@ unit cpupara;
pocall_safecall, pocall_safecall,
pocall_stdcall, pocall_stdcall,
pocall_cdecl, pocall_cdecl,
pocall_cppdecl : pocall_cppdecl,
pocall_mwpascal :
result:=[RS_EAX,RS_EDX,RS_ECX]; result:=[RS_EAX,RS_EDX,RS_ECX];
pocall_far16, pocall_far16,
pocall_pascal, pocall_pascal,