97: OSX crashes on single/floats (alignment)

git-svn-id: http://code.remobjects.com/svn/pascalscript@258 5c9d2617-0215-0410-a2ee-e80e04d1c6d8
This commit is contained in:
ck 2011-10-20 12:53:54 +00:00
parent 6974813ee5
commit 30e34f56df

View File

@ -246,7 +246,7 @@ const
function TPSExec.InnerfuseCall(_Self, Address: Pointer; CallingConv: TPSCallingConvention; Params: TPSList; res: PPSVariantIFC): Boolean; function TPSExec.InnerfuseCall(_Self, Address: Pointer; CallingConv: TPSCallingConvention; Params: TPSList; res: PPSVariantIFC): Boolean;
var var
Stack: ansistring; a, Stack: ansistring;
I: Longint; I: Longint;
RegUsage: Byte; RegUsage: Byte;
CallData: TPSList; CallData: TPSList;
@ -549,6 +549,11 @@ begin
if not GetPtr(rp(Params[I])) then Exit; if not GetPtr(rp(Params[I])) then Exit;
end; end;
{$IFDEF DARWIN}
if (length(Stack) mod 16) <> 0 then begin
Stack := Stack + StringOfChar(ansichar(#32), 16 - (Length(Stack) mod 16)) ;
end;
{$ENDIF}
if assigned(res) then begin if assigned(res) then begin
case res^.aType.BaseType of case res^.aType.BaseType of
{$IFNDEF PS_NOWIDESTRING}btWideString, btUnicodeString, {$ENDIF} {$IFNDEF PS_NOWIDESTRING}btWideString, btUnicodeString, {$ENDIF}
@ -626,6 +631,11 @@ begin
Stack := StringOfChar(AnsiChar(#0),4) +Stack; Stack := StringOfChar(AnsiChar(#0),4) +Stack;
Pointer((@Stack[1])^) := _Self; Pointer((@Stack[1])^) := _Self;
end; end;
{$IFDEF DARWIN}
if (length(Stack) mod 16) <> 0 then begin
Stack := Stack + StringOfChar(ansichar(#32), 16 - (Length(Stack) mod 16)) ;
end;
{$ENDIF}
if assigned(res) then begin if assigned(res) then begin
case res^.aType.BaseType of case res^.aType.BaseType of
btSingle: tbtsingle(res^.Dta^) := RealFloatCall_Other(Address, @Stack[Length(Stack)-3], Length(Stack) div 4); btSingle: tbtsingle(res^.Dta^) := RealFloatCall_Other(Address, @Stack[Length(Stack)-3], Length(Stack) div 4);
@ -662,6 +672,11 @@ begin
Stack := StringOfChar(AnsiChar(#0),4) +Stack; Stack := StringOfChar(AnsiChar(#0),4) +Stack;
Pointer((@Stack[1])^) := _Self; Pointer((@Stack[1])^) := _Self;
end; end;
{$IFDEF DARWIN}
if (length(Stack) mod 16) <> 0 then begin
Stack := Stack + StringOfChar(ansichar(#32), 16 - (Length(Stack) mod 16)) ;
end;
{$ENDIF}
OleCheck(RealCall_Other(Address, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil)); OleCheck(RealCall_Other(Address, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil));
Result := True; Result := True;
end; end;
@ -675,6 +690,11 @@ begin
for I := Params.Count - 1 downto 0 do begin for I := Params.Count - 1 downto 0 do begin
if not GetPtr(Params[I]) then Exit; if not GetPtr(Params[I]) then Exit;
end; end;
{$IFDEF DARWIN}
if (length(Stack) mod 16) <> 0 then begin
Stack := Stack + StringOfChar(ansichar(#32), 16 - (Length(Stack) mod 16)) ;
end;
{$ENDIF}
if assigned(res) then begin if assigned(res) then begin
case res^.aType.BaseType of case res^.aType.BaseType of
btSingle: tbtsingle(res^.dta^) := RealFloatCall_Cdecl(Address, @Stack[Length(Stack)-3], Length(Stack) div 4); btSingle: tbtsingle(res^.dta^) := RealFloatCall_Cdecl(Address, @Stack[Length(Stack)-3], Length(Stack) div 4);
@ -748,4 +768,4 @@ begin
end; end;
end; end;