fixes for 64 bit constructor (and some ifdef)

git-svn-id: trunk@56210 -
This commit is contained in:
martin 2017-10-26 16:11:48 +00:00
parent fac364fd3b
commit 6548ec54ea
2 changed files with 25 additions and 2 deletions

View File

@ -9383,7 +9383,7 @@ begin
{$ENDIF}
RegisterDelphiFunction(@Null, 'Null', cdRegister);
RegisterDelphiFunction(@VarIsNull, 'VarIsNull', cdRegister);
RegisterDelphiFunction(@variants.VarType, 'VarType', cdRegister);
RegisterDelphiFunction(@{$IFDEF FPC}variants.{$ENDIF}VarType, 'VarType', cdRegister);
{$IFNDEF PS_NOIDISPATCH}
RegisterDelphiFunction(@IDispatchInvoke, 'IdispatchInvoke', cdregister);
{$ENDIF}
@ -10260,7 +10260,7 @@ begin
// the VMT class pointer in EDX so they are effectively swaped
// using register calling convention
{$IFDEF CPU64}
PPSVariantU32(IntVal).Data := Int64(FSelf);
PPSVariantS64(IntVal).Data := Int64(FSelf);
{$ELSE}
PPSVariantU32(IntVal).Data := Cardinal(FSelf);
{$ENDIF}

View File

@ -335,6 +335,9 @@ _XMM0: Double;
Registers: TRegisters;
{$IFNDEF WINDOWS}
RegUsageFloat: Byte;
{$ENDIF}
{$IFDEF FPC}
IsConstructor,IsVirtualCons: Boolean;
{$ENDIF}
RegUsage: Byte;
CallData: TPSList;
@ -623,6 +626,19 @@ _XMM0: Double;
Result := True;
end;
begin
{$IFDEF FPC}
if (Integer(CallingConv) and 128) <> 0 then begin
IsVirtualCons := true;
CAllingConv := TPSCallingConvention(Integer(CallingConv) and not 128);
end else
IsVirtualCons:= false;
if (Integer(CallingConv) and 64) <> 0 then begin
IsConstructor := true;
CAllingConv := TPSCallingConvention(Integer(CallingConv) and not 64);
end else
IsConstructor := false;
{$ENDIF}
InnerfuseCall := False;
if Address = nil then
exit; // need address
@ -645,6 +661,13 @@ begin
FillChar(Registers, Sizeof(REgisters), 0);
_RAX := 0;
RegUsage := 0;
{$IFDEF FPC} // FIX FOR FPC constructor calls
if IsConstructor then begin
if not GetPtr(rp(Params[0])) then exit; // this goes first
DisposePPSVariantIFC(Params[0]);
Params.Delete(0);
end;
{$ENDIF}
if assigned(_Self) then begin
StoreReg(IPointer(_Self));
end;