Commit Graph

196 Commits

Author SHA1 Message Date
Jonas Maebe
49fb1b4c29 RTTI: don't generate full RTTI for internal types
These are types created by the code generator for internal purposes, and hence
are never queried by user code
2022-10-29 14:24:37 +02:00
florian
e25594c48e * correctly truncate rtti symbol names of enumeration types, resolves #39829 2022-07-11 22:07:57 +02:00
Sven/Sarah Barth
1e37eef3d2 * use an anonymous symbol for the record operator table as its typing is different for each incarnation anyway 2021-12-26 16:36:16 +01:00
Jonas Maebe
cc315e0ac7 * fix tw3930 after r37927
o "unique" class (and interface) type aliases should actually not exist at
     all except for overload resolution. All the rest (VMT, UUID, RTTI, ...)
     should be taken from the aliased class/interface
   o there is one Delphi-incompatibily left after this change, but it shouldn't
     matter: tw8180 does not compile if you change the declaration to
     "tcl=class(TInterfacedObject,XStr,iinterface)", while Kylix does compile
     that. It doesn't really matter though, because in Kylix this actually
     adds iinterface twice as implemented interface, so there is no point
     in accepting this.

git-svn-id: trunk@46773 -
2020-09-05 12:25:09 +00:00
yury
b4139720e6 * RTTI: Offset of record fields is defined as SizeInt not ptruint.
git-svn-id: trunk@46460 -
2020-08-16 13:27:56 +00:00
Jonas Maebe
4ba19f5418 * add support for creating non-address-only procvars to
cprocvar.getreusableprocaddr()

git-svn-id: trunk@44516 -
2020-04-02 21:21:36 +00:00
yury
1b3a3a7983 * Removed lot of unused local vars. It is useful to turn on the notes in options. :)
git-svn-id: trunk@44053 -
2020-01-28 18:45:33 +00:00
Jonas Maebe
1a9e246c29 * added is_normal_fieldvarsym() helper and use it
o fixes several places where there was a check whether something is a
     fieldvarsym, but not whether it's an instance rather than a class field

git-svn-id: trunk@43786 -
2019-12-24 22:12:44 +00:00
svenbarth
0b3418e978 * use the size of the generated anonymous record instead of the manual tracked size so that any padding is picked up as well
git-svn-id: trunk@42521 -
2019-07-28 19:50:30 +00:00
svenbarth
4c338b1f70 * generate correctly aligned string RTTI, fixes trtti7 on ARM
git-svn-id: trunk@42488 -
2019-07-23 20:53:54 +00:00
Jonas Maebe
18dfdb423e * don't apply user-specified constant alignments to RTTI data
git-svn-id: trunk@42481 -
2019-07-22 12:06:22 +00:00
Jonas Maebe
83611b83cc * reverted r42463, the internalerrors were caused by a bug in the LLVM typed
constant builder

git-svn-id: trunk@42478 -
2019-07-21 11:07:02 +00:00
florian
217ae6e4bb * more fixes to rtti after attribute branch merging
git-svn-id: trunk@42476 -
2019-07-21 08:28:29 +00:00
Jonas Maebe
12e63d8a2c * don't reuse defs for attribute lists or individual attributes with parameters, as
they don't have a constant size
   o fixes LLVM internalerror 2015122402 for test/tcustomattr{12,13,19}

git-svn-id: trunk@42463 -
2019-07-20 12:08:55 +00:00
florian
f04afdd5ea * compilation fixed
git-svn-id: trunk@42449 -
2019-07-14 21:40:29 +00:00
florian
3206ac3508 * properly align rtti for orddefs
git-svn-id: trunk@42448 -
2019-07-14 21:29:30 +00:00
Jonas Maebe
d8903ce6b3 - removed maxcrecordalign parameter/field from recordsymtables, as this value
cannot be modified in the settings (so we can directly use the one from
    current_settings)

git-svn-id: trunk@42447 -
2019-07-14 19:24:32 +00:00
florian
c932dfaf70 * first bunch of fixes for rtti for arm after attribute commits, fixes mostly alignment issues
git-svn-id: trunk@42446 -
2019-07-14 17:45:55 +00:00
svenbarth
ced3885dbb * generate construction function for the attributes used in a unit using a more straight forward approach
ToDo: "collect" attributes of same type and same argument list and generate constructor only once for them

git-svn-id: trunk@42394 -
2019-07-12 22:07:20 +00:00
svenbarth
71fa4d1fe2 * the RTTI of an attribute not only consists of the creation function, but also of the attribute's type, a pointer to the constructor and a data blob containing the constant parameters
+ added test

git-svn-id: trunk@42390 -
2019-07-12 22:07:05 +00:00
svenbarth
3ad24c9db8 * as attributes can be part of any type they are best suited in a common part of TTypeData
git-svn-id: trunk@42375 -
2019-07-12 22:06:09 +00:00
svenbarth
e296b26e9e - remove unit info and related code again as that will be handled similar, but differently with dynamic packages
git-svn-id: trunk@42369 -
2019-07-12 22:05:47 +00:00
svenbarth
ee940c8270 * always write a class' reference to the attribute table, even if the unit does not have attributes
git-svn-id: trunk@42368 -
2019-07-12 22:05:42 +00:00
svenbarth
d137e06ade * instead of embedding the attributes inside the class' and property's type data only store a reference to a table of attributes
git-svn-id: trunk@42365 -
2019-07-12 22:05:29 +00:00
svenbarth
39bab2dbcc * rename trtti_attributesdef to trtti_attributes_list
git-svn-id: trunk@42359 -
2019-07-12 22:05:00 +00:00
svenbarth
b2932393df Reintegration of Custom Attributes branch by Joost van der Sluis with patches reworked by Svetozar Belic [patch 1/3]
Implemented attributes for class types and properties (based on work by Joost van der Sluis). Added TCustomAttribute - a base class for attributes. Added TUnitInfo record to RTTI. It contains the unit name and unit options (for now only a flag which specifies if the unit contains attributes). Added several tests for attributes.

git-svn-id: trunk@42356 -
2019-07-12 22:04:48 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
svenbarth
f7817d25ff * parameter type needs to be Nil for formal parameters (Delphi compatible)
* adjusted test trtti15
+ added test trtti19

git-svn-id: trunk@41770 -
2019-03-22 22:29:20 +00:00
yury
e5c2d13671 * Do not set pi_needs_got in current_procinfo.flags at the node level, since the GOT usage can only be estimated there. Instead set the pi_needs_got flag at places where the GOT register is accessed during the code generation. This eliminates generation of the unneeded initialization of the GOT register and fixes linker errors when the _GLOBAL_OFFSET_TABLE_ symbol is referenced but no actual GOT references are present.
git-svn-id: trunk@41460 -
2019-02-25 13:35:40 +00:00
Jonas Maebe
50ab607676 + customint torddef type to create arbitraty bit-width integers
o use this to handle non-power-of-two-sized parameters for llvm
   o no general support in the parser/code generator, so don't expose

git-svn-id: trunk@40398 -
2018-11-29 20:57:08 +00:00
yury
0a3c94bc72 * Moved inline methods to the beginning in order to allow them to be actually inlined in this unit.
git-svn-id: trunk@40219 -
2018-11-04 19:50:09 +00:00
yury
4357caaad8 * Removed unused local vars.
git-svn-id: trunk@40183 -
2018-11-02 18:44:29 +00:00
yury
c306f57ecb * Reverted r39947. According to Sven, the $self parameters is not required to be first parameter in RTTI. Appropriate tests will be fixed.
git-svn-id: trunk@39952 -
2018-10-17 08:52:57 +00:00
Jonas Maebe
0b246f3dbd * converted Boolean8 to an internal type, and mapped Boolean to the
new internal pasbool1(type) (part of mantis #34411)
   o apply the _Bool x86-64 parameter passing rules only to pasbool1

git-svn-id: trunk@39949 -
2018-10-16 21:14:18 +00:00
yury
84b5129f1d * Fixed writing of method's RTTI for aarch64 by explicitly writing the $self parameter first.
git-svn-id: trunk@39947 -
2018-10-16 17:24:07 +00:00
svenbarth
b9ec7e1e06 * generate RTTI for *all* parameters of a method or procedure variable
git-svn-id: trunk@39885 -
2018-10-07 12:25:33 +00:00
svenbarth
a076677336 * instead of a flags field generate a table with all Initialize operators of all fields (nested or not, parent class or not) for class types; objects and records don't use this (yet)
git-svn-id: trunk@39690 -
2018-08-29 19:21:35 +00:00
svenbarth
2e1327b6b2 * use pooled constant references for the parameter locations as more often than not they're equal between multiple methdos (e.g. the Self argument is always the same)
* using this the TypInfo unit can navigate interface methods and VMT method parameters much more quickly as the latter have a constant size now

git-svn-id: trunk@39686 -
2018-08-29 19:20:31 +00:00
svenbarth
029ec93df6 * use pooled constant references for the names of VMT methods in the RTTI
git-svn-id: trunk@39685 -
2018-08-29 19:20:27 +00:00
svenbarth
228d3252cc * use pooled constant references for the parameter names of VMT methods in the RTTI
git-svn-id: trunk@39684 -
2018-08-29 19:20:24 +00:00
svenbarth
3f96c0baed * use reverse_longword() instead of reverse_byte(); fixes the management operators of records inside classes on big endian systems
git-svn-id: trunk@39265 -
2018-06-20 21:11:19 +00:00
svenbarth
ac0322c323 + add a flags field to the record init RTTI which declares whether
a) the current record contains a field with non-trivial initialization
    b) and of the parents contains such a field (only relevant for objects and classes)

git-svn-id: trunk@39255 -
2018-06-20 19:00:17 +00:00
florian
31f78ea2b6 + implementation of the vectorcall calling convention by J. Gareth Moreton
+ tests

git-svn-id: trunk@38206 -
2018-02-11 17:50:37 +00:00
svenbarth
0bf71958f2 * ensure that the correct RTTI data is written for "array of const" parameters as well
git-svn-id: trunk@37725 -
2017-12-12 19:55:24 +00:00
svenbarth
50788e8b3b * correctly encapsulate the RTTI data for sets to avoid alignment problems with the new SetSize field (fixes compilation on Sparc and basically every other target that requires proper alignment with 64-bit values dictating an 8-Byte alignment)
git-svn-id: trunk@37201 -
2017-09-13 21:05:04 +00:00
svenbarth
5c97248f85 + also write the set's size to the RTTI as that simplifies handling in Invoke()
git-svn-id: trunk@37090 -
2017-08-31 19:23:12 +00:00
svenbarth
7b675b6769 * correctly write the type of open array parameters as the element def and not the array def
+ added test that shows the linking error if not done so (otherwise that should already be covered by trtti15.pp)

git-svn-id: trunk@37083 -
2017-08-29 20:17:24 +00:00
florian
126b834976 * ncgrtti has to use target pointer sizes, so changed SizeOf(PtrInt) into SizeOf(PInt), should fix #31964
* try to avoid to use anonymous records in ncgrtti

git-svn-id: trunk@36416 -
2017-06-04 19:57:46 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
maciej-izak
af8e0efe57 * Rtti info about Management Operators (MO) in init table for records. Note: commit contains minimal changes for RTL (for proper "make") no functional changes. More RTL changes for fully functionally MO in next commits.
compiler/ncgrtti.pas
  + write_record_operators procedure which fills simple VMT like table for MO.
  * recorddef_rtti save MO (if exists)
  * objectdef_rtti_fields save nil pointer/entry for objects rtti (have same RTL parts like for records)

compiler/options.pas
  + new define FPC_HAS_MANAGEMENT_OPERATORS

compiler/symconst.pas
  + new item itp_init_record_operators for tinternaltypeprefix enum
  + new entry '$init_record_operators$' in internaltypeprefixName

rtl/inc/rtti.inc
  + new field RecordOp (pointer to MO VMT table) in TRecordInfoInit
  + new types to handle MO VMT: TRTTIRecordOpVMT, PRTTIRecordOpVMT, TRTTIRecCopyOp, TRTTIRecVarOp

rtl/objpas/typinfo.pp
  + RecordOp field for TRecInitData record

git-svn-id: trunk@35445 -
2017-02-19 00:22:59 +00:00