Fix constructor 64bit (#167)

* use 64bit variant

* Fix registers for FPC constructor

* fix only fpc 3.0.0 and up
This commit is contained in:
Martin 2017-10-28 16:12:13 +01:00 committed by Carlo Kok
parent 627cf28b33
commit fa55490db0
2 changed files with 24 additions and 1 deletions

View File

@ -10261,7 +10261,7 @@ begin
// the VMT class pointer in EDX so they are effectively swaped // the VMT class pointer in EDX so they are effectively swaped
// using register calling convention // using register calling convention
{$IFDEF CPU64} {$IFDEF CPU64}
PPSVariantU32(IntVal).Data := Int64(FSelf); PPSVariantS64(IntVal).Data := Int64(FSelf);
{$ELSE} {$ELSE}
PPSVariantU32(IntVal).Data := Cardinal(FSelf); PPSVariantU32(IntVal).Data := Cardinal(FSelf);
{$ENDIF} {$ENDIF}

View File

@ -340,6 +340,9 @@ _XMM0: Double;
Registers: TRegisters; Registers: TRegisters;
{$IFNDEF WINDOWS} {$IFNDEF WINDOWS}
RegUsageFloat: Byte; RegUsageFloat: Byte;
{$ENDIF}
{$IFDEF FPC}
IsConstructor,IsVirtualCons: Boolean;
{$ENDIF} {$ENDIF}
RegUsage: Byte; RegUsage: Byte;
CallData: TPSList; CallData: TPSList;
@ -628,6 +631,19 @@ _XMM0: Double;
Result := True; Result := True;
end; end;
begin 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; InnerfuseCall := False;
if Address = nil then if Address = nil then
exit; // need address exit; // need address
@ -650,6 +666,13 @@ begin
FillChar(Registers, Sizeof(REgisters), 0); FillChar(Registers, Sizeof(REgisters), 0);
_RAX := 0; _RAX := 0;
RegUsage := 0; RegUsage := 0;
{$IF DEFINED (fpc) and (fpc_version >= 3)} // 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 if assigned(_Self) then begin
StoreReg(IPointer(_Self)); StoreReg(IPointer(_Self));
end; end;