Selaa lähdekoodia

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

git-svn-id: trunk@37482 -
svenbarth 7 vuotta sitten
vanhempi
commit
530213711f
2 muutettua tiedostoa jossa 11 lisäystä ja 4 poistoa
  1. 1 1
      compiler/ncgvmt.pas
  2. 10 3
      rtl/objpas/classes/reader.inc

+ 1 - 1
compiler/ncgvmt.pas

@@ -632,7 +632,7 @@ implementation
                 datatcb.queue_init(voidpointertype);
                 { reference to the vmt }
                 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);
               end;
             classtabledef:=datatcb.end_anonymous_record;

+ 10 - 3
rtl/objpas/classes/reader.inc

@@ -544,6 +544,13 @@ type
     Name: ShortString;
   end;
 
+{$ifdef VER3_0}
+  PersistentClassRef = TPersistentClass;
+{$else VER3_0}
+  PPersistentClass = ^TPersistentClass;
+  PersistentClassRef = PPersistentClass;
+{$endif VER3_0}
+
   PFieldClassTable = ^TFieldClassTable;
   TFieldClassTable =
 {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
@@ -551,7 +558,7 @@ type
 {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
   record
     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;
 
   PFieldTable = ^TFieldTable;
@@ -584,7 +591,7 @@ begin
       ClassTable := FieldTable^.ClassTable;
       for i := 0 to ClassTable^.Count - 1 do
       begin
-        Result := ClassTable^.Entries[i];
+        Result := ClassTable^.Entries[i]{$ifndef VER3_0}^{$endif};
         if Result.ClassNameIs(ShortClassName) then
           exit;
       end;
@@ -1701,7 +1708,7 @@ var
         FieldClassTable := FieldTable^.ClassTable;
         for i := 0 to FieldClassTable^.Count -1 do
         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',
             //[AClassName, ComponentClassType.ClassName, Entry.ClassName]));
           if Entry.ClassNameIs(ShortClassName) and