* use pooled constant references for the names of VMT methods in the RTTI

git-svn-id: trunk@39685 -
This commit is contained in:
svenbarth 2018-08-29 19:20:27 +00:00
parent 228d3252cc
commit 029ec93df6
2 changed files with 12 additions and 5 deletions

View File

@ -230,7 +230,7 @@ implementation
write_methodkind(tcb,def);
tcb.emit_ord_const(def.paras.count,u16inttype);
tcb.emit_ord_const(def.callerargareasize,ptrsinttype);
tcb.emit_shortstring_const(sym.realname);
tcb.emit_pooled_shortstring_const_ref(sym.realname);
for k:=0 to def.paras.count-1 do
begin

View File

@ -354,15 +354,17 @@ unit TypInfo;
function GetResultLocs: PParameterLocations; inline;
function GetTail: Pointer; inline;
function GetNext: PIntfMethodEntry; inline;
function GetName: ShortString; inline;
public
ResultType: PPTypeInfo;
CC: TCallConv;
Kind: TMethodKind;
ParamCount: Word;
StackSize: SizeInt;
Name: ShortString;
NamePtr: PShortString;
{ Params: array[0..ParamCount - 1] of TVmtMethodParam }
{ ResultLocs: TParameterLocations (if ResultType != Nil) }
property Name: ShortString read GetName;
property Param[Index: Word]: PVmtMethodParam read GetParam;
property ResultLocs: PParameterLocations read GetResultLocs;
property Tail: Pointer read GetTail;
@ -2990,7 +2992,7 @@ begin
Result := Nil
else
begin
Result := PVmtMethodParam(aligntoptr(PByte(@Name[0]) + SizeOf(Name[0]) + Length(Name)));
Result := PVmtMethodParam(aligntoptr(PByte(@NamePtr) + SizeOf(NamePtr)));
while Index > 0 do
begin
Result := Result^.Next;
@ -3004,7 +3006,7 @@ begin
if not Assigned(ResultType) then
Result := Nil
else if ParamCount = 0 then
Result := PParameterLocations(aligntoptr(PByte(@Name[0]) + SizeOf(Name[0]) + Length(Name)))
Result := PParameterLocations(aligntoptr(PByte(@NamePtr) + SizeOf(NamePtr)))
else
Result := PParameterLocations(aligntoptr(Param[ParamCount - 1]^.Tail));
end;
@ -3019,7 +3021,7 @@ begin
Result := PByte(@retloc^.Count) + SizeOf(retloc^.Count) + SizeOf(TParameterLocation) * retloc^.Count;
end
else if ParamCount = 0 then
Result := PByte(@Name[0]) + Length(Name) + SizeOf(Byte)
Result := PByte(@NamePtr) + SizeOf(NamePtr)
else
Result := Param[ParamCount - 1]^.Tail;
end;
@ -3029,6 +3031,11 @@ begin
Result := PIntfMethodEntry(aligntoptr(Tail));
end;
function TIntfMethodEntry.GetName: ShortString;
begin
Result := NamePtr^;
end;
{ TIntfMethodTable }
function TIntfMethodTable.GetMethod(Index: Word): PIntfMethodEntry;