Bläddra i källkod

Switch record/object fields to indirect type information references.

compiler/ncgrtti.pas, TRTTIWriter.fields_write_rtti_data:
  * use the indirect reference for the object parent type
  * use the indirect reference for the field type

rtl/inc/rtti.inc:
  * TRecordElement: change TypeInfo to PPointer for 2.7.1 and newer
  * RecordRTTI: correctly dereference the element type for 2.7.1 and newer
  * fpc_copy: correctly reference the element type for 2.7.1 and newer

git-svn-id: branches/svenbarth/packages@28290 -
svenbarth 11 år sedan
förälder
incheckning
6ff7fcb99b
2 ändrade filer med 12 tillägg och 3 borttagningar
  1. 2 2
      compiler/ncgrtti.pas
  2. 10 1
      rtl/inc/rtti.inc

+ 2 - 2
compiler/ncgrtti.pas

@@ -160,7 +160,7 @@ implementation
             Assigned(tobjectdef(def).childof) and
             ((rt=fullrtti) or (tobjectdef(def).childof.needs_inittable)) then
           begin
-            write_rtti_reference(tobjectdef(def).childof,rt);
+            write_rtti_reference(tobjectdef(def).childof,rt,true);
             current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_pint(0));
             inc(fieldcnt);
           end;
@@ -176,7 +176,7 @@ implementation
                ) and
                not is_objc_class_or_protocol(tfieldvarsym(sym).vardef) then
               begin
-                write_rtti_reference(tfieldvarsym(sym).vardef,rt);
+                write_rtti_reference(tfieldvarsym(sym).vardef,rt,true);
                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_pint(tfieldvarsym(sym).fieldoffset));
                 inc(fieldcnt);
               end;

+ 10 - 1
rtl/inc/rtti.inc

@@ -30,10 +30,11 @@ type
   packed
 {$endif USE_PACKED}
   record
-    TypeInfo: Pointer;
     {$ifdef VER2_6}
+    TypeInfo: Pointer;
     Offset: Longint;
     {$else}
+    TypeInfo: PPointer;
     Offset: SizeInt;
     {$endif}
   end;
@@ -109,7 +110,11 @@ begin
   { Process elements }
   for i:=1 to count Do
     begin
+{$ifdef ver2_6}
       rttiproc(Data+PRecordElement(typeInfo)^.Offset,PRecordElement(typeInfo)^.TypeInfo);
+{$else}
+      rttiproc(Data+PRecordElement(typeInfo)^.Offset,PRecordElement(typeInfo)^.TypeInfo^);
+{$endif}
       Inc(PRecordElement(typeInfo));
     end;
 end;
@@ -312,7 +317,11 @@ begin
         { Process elements with rtti }
         for i:=1 to count Do
           begin
+            {$ifdef ver2_6}
             Info:=PRecordElement(Temp)^.TypeInfo;
+            {$else}
+            Info:=PRecordElement(Temp)^.TypeInfo^;
+            {$endif}
             Offset:=PRecordElement(Temp)^.Offset;
             Inc(PRecordElement(Temp));
             if Offset>expectedoffset then