* change the class references in a class' field table to indirect references

git-svn-id: trunk@37482 -
This commit is contained in:
svenbarth 2017-10-17 20:34:21 +00:00
parent 2af27756da
commit 530213711f
2 changed files with 11 additions and 4 deletions

View File

@ -632,7 +632,7 @@ implementation
datatcb.queue_init(voidpointertype); datatcb.queue_init(voidpointertype);
{ reference to the vmt } { reference to the vmt }
datatcb.queue_emit_asmsym( datatcb.queue_emit_asmsym(
current_asmdata.RefAsmSymbol(classdef.vmt_mangledname,AT_DATA), current_asmdata.RefAsmSymbol(classdef.vmt_mangledname,AT_DATA,true),
tfieldvarsym(classdef.vmt_field).vardef); tfieldvarsym(classdef.vmt_field).vardef);
end; end;
classtabledef:=datatcb.end_anonymous_record; classtabledef:=datatcb.end_anonymous_record;

View File

@ -544,6 +544,13 @@ type
Name: ShortString; Name: ShortString;
end; end;
{$ifdef VER3_0}
PersistentClassRef = TPersistentClass;
{$else VER3_0}
PPersistentClass = ^TPersistentClass;
PersistentClassRef = PPersistentClass;
{$endif VER3_0}
PFieldClassTable = ^TFieldClassTable; PFieldClassTable = ^TFieldClassTable;
TFieldClassTable = TFieldClassTable =
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT} {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
@ -551,7 +558,7 @@ type
{$endif FPC_REQUIRES_PROPER_ALIGNMENT} {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
record record
Count: Word; Count: Word;
Entries: array[{$ifdef cpu16}0..16384 div sizeof(TPersistentClass){$else}Word{$endif}] of TPersistentClass; Entries: array[{$ifdef cpu16}0..16384 div sizeof(PersistentClassRef){$else}Word{$endif}] of PersistentClassRef;
end; end;
PFieldTable = ^TFieldTable; PFieldTable = ^TFieldTable;
@ -584,7 +591,7 @@ begin
ClassTable := FieldTable^.ClassTable; ClassTable := FieldTable^.ClassTable;
for i := 0 to ClassTable^.Count - 1 do for i := 0 to ClassTable^.Count - 1 do
begin begin
Result := ClassTable^.Entries[i]; Result := ClassTable^.Entries[i]{$ifndef VER3_0}^{$endif};
if Result.ClassNameIs(ShortClassName) then if Result.ClassNameIs(ShortClassName) then
exit; exit;
end; end;
@ -1701,7 +1708,7 @@ var
FieldClassTable := FieldTable^.ClassTable; FieldClassTable := FieldTable^.ClassTable;
for i := 0 to FieldClassTable^.Count -1 do for i := 0 to FieldClassTable^.Count -1 do
begin begin
Entry := FieldClassTable^.Entries[i]; Entry := FieldClassTable^.Entries[i]{$ifndef VER3_0}^{$endif};
//writeln(format('Looking for %s in field table of class %s. Found %s', //writeln(format('Looking for %s in field table of class %s. Found %s',
//[AClassName, ComponentClassType.ClassName, Entry.ClassName])); //[AClassName, ComponentClassType.ClassName, Entry.ClassName]));
if Entry.ClassNameIs(ShortClassName) and if Entry.ClassNameIs(ShortClassName) and