[fpc-devel] RTTI module and "IsManaged" critical problem

Maciej Izak hnb.code at gmail.com
Tue Dec 13 09:22:06 CET 2016

2016-12-12 23:14 GMT+01:00 Maciej Izak <hnb.code at gmail.com>:

> With second iteration we could add your modifications, I have no other
> objections.

New day new ideas :)

With my patch we don't really need ManagedFieldCount, ManagedFields,
ManagedFieldTable in TTypeData (each of Managed* can still be added later).
It means also much better memory usage and it solves RTL problems (which
was mentioned in my previous message). All what we need is:

=== code begin ===
  TInitManagedField = record
    TypeRefRef: TypeInfoPtr;
    FldOffset: SizeInt;

  PPRecInitTable = ^PRecInitTable;
  PRecInitTable = TRecInitTable;
  TRecInitTable = packed record
    Size: Longint;
    Terminator: Pointer;
    ManagedFieldCount: Longint;
    { ManagedFields: array[0..ManagedFieldCount - 1] of TInitManagedField
; }

  TRecordField = record
    Visibility: TVisibility;
    TypeRef: TypeInfoPtr;
    FldOffset: SizeInt;
    Name: PShortString; { can be NULL if no ext RTTI }

  TManagedField = TRecordField deprecated;

  TTypeData = record
  // ...
    tkRecord: (
      RecSize: Integer;
      RecInitTable: PPRecInitTable;
      case Boolean of
        True: (ManagedFldCount: Integer deprecated 'Use
or TotalFieldCount depending on your use case')
        False: (TotalFieldCount: Integer)
      { Fields: array[1..TotalFieldCount] of TRecordField }
      { Names: array[1..TotalFieldCount] of {packed} ShortString }
=== code end ===

I have hope that this is final solution :)

Best regards,
Maciej Izak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20161213/d288b946/attachment.html>

More information about the fpc-devel mailing list