From e23534eec41d2c01527770f64ca761db8b5b9405 Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 4 May 2013 16:05:04 +0000 Subject: [PATCH] compiler, rtl: some rtti related changes: - write pint instead of 32 bit for record field offset (compiler uses aintsize = pint in TRecordDef), use PtrInt in RTL for record reading - add tkRecord to TTypeData (field and type names are taken from Delphi help) - add tkProcedure as alias to tkProcVar git-svn-id: trunk@24424 - --- compiler/ncgrtti.pas | 2 +- rtl/inc/rtti.inc | 2 +- rtl/objpas/typinfo.pp | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index f4ed1c5d19..d1dc8ca22b 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -175,7 +175,7 @@ implementation not is_objc_class_or_protocol(tfieldvarsym(sym).vardef) then begin current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(tfieldvarsym(sym).vardef,rt))); - current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_pint(tfieldvarsym(sym).fieldoffset)); inc(fieldcnt); end; end; diff --git a/rtl/inc/rtti.inc b/rtl/inc/rtti.inc index caaf389652..48c6571661 100644 --- a/rtl/inc/rtti.inc +++ b/rtl/inc/rtti.inc @@ -20,7 +20,7 @@ type PRecordElement=^TRecordElement; TRecordElement=packed record TypeInfo: Pointer; - Offset: Longint; + Offset: PtrInt; end; PRecordInfo=^TRecordInfo; diff --git a/rtl/objpas/typinfo.pp b/rtl/objpas/typinfo.pp index f288e54cc7..5a4b5a203c 100644 --- a/rtl/objpas/typinfo.pp +++ b/rtl/objpas/typinfo.pp @@ -152,6 +152,12 @@ unit typinfo; UnitName : ShortString // here the properties follow as array of TPropInfo ); + tkRecord: + ( + RecSize: Integer; + ManagedFldCount: Integer; + {ManagedFields: array[1..ManagedFldCount] of TManagedField} + ); tkHelper: (HelperParent : PTypeInfo; ExtendedInfo : PTypeInfo; @@ -213,6 +219,14 @@ unit typinfo; end; // unsed, just for completeness + TManagedField = + {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT} + packed + {$endif FPC_REQUIRES_PROPER_ALIGNMENT} + record + TypeRef: PTypeInfo; + FldOffset: PtrInt; + end; TPropData = {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT} packed @@ -249,6 +263,7 @@ unit typinfo; TPropList = array[0..65535] of PPropInfo; const + tkProcedure = tkProcVar; // for compatibility with Delphi tkAny = [Low(TTypeKind)..High(TTypeKind)]; tkMethods = [tkMethod]; tkProperties = tkAny-tkMethods-[tkUnknown];