* fix alignment of ParamList

* fix test for architectures using aligned rtti

git-svn-id: trunk@42516 -
This commit is contained in:
florian 2019-07-28 12:43:15 +00:00
parent 911a59a721
commit 1a67ffdd22
2 changed files with 6 additions and 1 deletions

View File

@ -714,7 +714,10 @@ unit TypInfo;
tkMethod: tkMethod:
(MethodKind : TMethodKind; (MethodKind : TMethodKind;
ParamCount : Byte; ParamCount : Byte;
ParamList : array[0..1023] of Char case Boolean of
False: (ParamList : array[0..1023] of Char);
{ dummy for proper alignment }
True: (ParamListDummy : Word);
{in reality ParamList is a array[1..ParamCount] of: {in reality ParamList is a array[1..ParamCount] of:
record record
Flags : TParamFlags; Flags : TParamFlags;

View File

@ -281,6 +281,8 @@ begin
v := 0; v := 0;
for i:= 1 to DTypeData^.ParamCount do for i:= 1 to DTypeData^.ParamCount do
begin begin
{ due to the uncommon usage pattern, the alignment approach is uncommon as well }
Inc(CurrentParamPosition,AlignTParamFlags(@DTypeData^.ParamList[CurrentParamPosition])-@DTypeData^.ParamList[CurrentParamPosition]);
{ First Handle the ParamFlag } { First Handle the ParamFlag }
Flag:=pword(@DTypeData^.ParamList[CurrentParamPosition])^; Flag:=pword(@DTypeData^.ParamList[CurrentParamPosition])^;
Flags:=TParamFlags(Flag); Flags:=TParamFlags(Flag);