Darwin/AArch64: adjust alignment info of custom-aligned paralocs

Resolves #40019
This commit is contained in:
Jonas Maebe 2022-12-06 21:38:16 +01:00
parent 8ad7decaa3
commit 851af5033f
2 changed files with 117 additions and 1 deletions

View File

@ -608,7 +608,11 @@ unit cpupara;
case we're on Darwin and have allocated a non-variadic argument
< 8 bytes previously }
if target_info.abi=abi_aarch64_darwin then
curstackoffset:=align(curstackoffset,paraloc^.def.alignment);
begin
curstackoffset:=align(curstackoffset,paraloc^.def.alignment);
if firstparaloc then
result.alignment:=newalignment(result.alignment,curstackoffset);
end;
{ on Darwin, non-variadic arguments take up their actual size
on the stack; on other platforms, they take up a multiple of

112
tests/webtbs/tw40019.pp Normal file
View File

@ -0,0 +1,112 @@
program tw40019;
{$mode delphi}{$H+}
type
TArray4IntegerType = array[0..3] of Longint;
TPoint = record
X : Longint; Y : Longint;
end;
TRect = record
case Longint of
0: (Left,Top,Right,Bottom : Longint);
1: (TopLeft,BottomRight : TPoint);
2: (Vector:TArray4IntegerType);
end;
THead=class
end;
TDrawCellInfo=class
m1,m2:integer;
end;
TCanvas=class
procedure dosmth(arect:TRect);
end;
TCellState=set of (A,B,C,D);
TDrawCellState=set of (xA,xB,xC,xD);
{ TGridObject }
TGridObject=class
fCellInfo:TDrawCellInfo;
procedure GetCellInfo(ACol, ARow:integer; AState:TCellState; AColHead, ARowHead:THead; ACellInfo:TDrawCellInfo);
procedure DrawCell(APrevCol, APrevRow, ACol, ARow, ANextCol, ANextRow: Integer;
AColHead, ARowHead: THead;
AState: TCellState; ARect: TRect; DrawSelection: Boolean; ACanvas: TCanvas);overload;virtual;
procedure DrawCell(CellInfo: TDrawCellInfo; APrevCol, APrevRow, ACol, ARow, ANextCol, ANextRow: Integer;
AColHead, ARowHead: THead;
AState: TCellState; ARect: TRect; DrawSelection: Boolean; ACanvas: TCanvas);
end;
procedure TGridObject.GetCellInfo(ACol, ARow: integer; AState: TCellState;
AColHead, ARowHead: THead; ACellInfo: TDrawCellInfo);
begin
AColHead:=ARowHead;
ACellInfo.m1:=ACellInfo.m2;
end;
procedure TGridObject.DrawCell(APrevCol, APrevRow, ACol, ARow, ANextCol, ANextRow: Integer;
AColHead, ARowHead: THead;
AState: TCellState; ARect: TRect; DrawSelection: Boolean; ACanvas: TCanvas);
var
ACellInfo: TDrawCellInfo;
begin
if ARect.left<>1 then
halt(1);
if ARect.right<>2 then
halt(2);
if ARect.top<>3 then
halt(3);
if ARect.bottom<>4 then
halt(4);
ACellInfo := fCellInfo;
GetCellInfo(ACol, ARow, AState, AColHead, ARowHead, ACellInfo);
if not Assigned(ACellInfo) then
ACellInfo := fCellInfo;
DrawCell(ACellInfo,APrevCol,APrevRow,ACol,ARow,ANextCol,ANextRow,
AColHead,ARowHead,AState,ARect,false,nil);
end;
procedure TGridObject.DrawCell(CellInfo: TDrawCellInfo; APrevCol, APrevRow, ACol, ARow, ANextCol, ANextRow: Integer;
AColHead, ARowHead: THead;
AState: TCellState; ARect: TRect; DrawSelection: Boolean; ACanvas: TCanvas);
var
//CellInfo: TDrawCellInfo;
FrameFlags, FrameFlagsOuter, RegionIndex: Integer;
begin
if drawSelection then Acanvas.dosmth(Arect);
end;
procedure TCanvas.dosmth(arect:TRect);
begin
if arect.left<>1 then
halt(21);
if arect.right<>2 then
halt(22);
if arect.top<>3 then
halt(23);
if arect.bottom<>4 then
halt(24);
arect.left:=arect.top+arect.right
end;
var go:TGridObject;
r: TRect;
begin
go:=TGridObject.Create;
r.left:=1;
r.right:=2;
r.top:=3;
r.bottom:=4;
go.DrawCell(nil,0,0,0,0,0,0,nil,nil,[],r,true,TCanvas.create);
end.