Commit Graph

160 Commits

Author SHA1 Message Date
marco
9c8a2d29e1 # revisions: 40702,40703,40704,40747,40750,40765,41277,41535,41536,41537,41548,41549,41770
git-svn-id: branches/fixes_3_2@43399 -
2019-11-05 16:08:58 +00:00
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
marco
f42dffb36d --- Merging r39877 into '.':
U    compiler/x86_64/rax64att.pas
--- Recording mergeinfo for merge of r39877 into '.':
 U   .
--- Merging r39882 into '.':
U    compiler/nld.pas
A    tests/webtbf/tw34355.pp
--- Recording mergeinfo for merge of r39882 into '.':
 G   .
--- Merging r39885 into '.':
U    compiler/ncgrtti.pas
--- Recording mergeinfo for merge of r39885 into '.':
 G   .

# revisions: 39877,39882,39885

git-svn-id: branches/fixes_3_2@40286 -
2018-11-12 08:36:43 +00:00
marco
edf32cd5dc The Important Ones:
- 39683, 39684, 39685, 39686 (rework of Interface Method RTTI)
- 39687, 39688, 39689, 39690, 39709, 39710 (change of PPU version)

git-svn-id: branches/fixes_3_2@39809 -
2018-09-26 12:50:46 +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
Jonas Maebe
265c8e7bbc + support for specifying ms_abi_default, ms_abi_cdelc, sysv_abi_default, and
sysv_abi_cdecl calling conventions on x86-64 to force using the SYSV/
    Microsoft ABI on platforms that don't use it by default (mainly to ease
    porting pure assembler routines)

git-svn-id: trunk@35425 -
2017-02-11 19:57:12 +00:00
maciej-izak
1d301b6dbe More consequent writing of Rtti. Part of code related to recorddef moved from recorddef_rtti to write_child_data_rtti(). When typeinfo is used in code init Rtti is a child of the full Rtti. Commit also contains correction for code commited for mantis #31249 (r35376) and mantis #31305 (r35377) for objects. Before was impossible to compile code with usage of typeinfo() function for object without managed fields ("Undefined symbol" error).
+ Test attached

git-svn-id: trunk@35403 -
2017-02-06 18:52:37 +00:00
svenbarth
7e85e27865 * fix ncgrtti correctly (for once that warning was indeed useful :P )
git-svn-id: trunk@35388 -
2017-02-04 13:46:26 +00:00
florian
4b63da81aa * initialize para to avoid warning
git-svn-id: trunk@35387 -
2017-02-04 13:30:19 +00:00
svenbarth
c1390b3442 * fix for Mantis #31249: applied (adjusted) patch provided by Maciej Izak
Commit message:
[PATCH] More consistent RTTI (also better performance) for classic
 objects (reference to initrtti from fullrtti).

git-svn-id: trunk@35376 -
2017-01-31 18:21:53 +00:00
svenbarth
f517311227 * ensure that the indirect symbols for VMT, RTTI and IID reside in the same sections as the symbols they point to -> reduces the amount of sections for them by half
git-svn-id: trunk@35367 -
2017-01-29 17:43:39 +00:00
svenbarth
1d40e7e159 * correctly encapsulate the location records
git-svn-id: trunk@35354 -
2017-01-28 16:00:53 +00:00
svenbarth
26135d605f + implement interface RTTI inspired by the changes from Steve Hildebrandt, yet not exactly the same. Like his implementation this one isn't Delphi compatible either.
+ added test

git-svn-id: trunk@35341 -
2017-01-27 17:00:15 +00:00
svenbarth
41dccb75b9 * for open array parameters the RTTI of the element def needs to be available/written; this is Delphi compatible
git-svn-id: trunk@35340 -
2017-01-27 16:55:17 +00:00
svenbarth
d044969d88 * applied adjusted patch from Mantis #31250 by Maciej Izak
Adjusted message:
 [PATCH] Remove redundant code in TRTTIWriter for get_rtti_label,
 get_rtti_label_ord2str, get_rtti_label_str2ord (use extended ref_rtti). 
 Replace ref_rtti by get_rtti_label in few places in ncgrtii (no functional 
 change).

git-svn-id: trunk@35336 -
2017-01-27 14:11:38 +00:00
svenbarth
5fa5ff1730 + new method TRTTIWriter.methods_write_rtti() to ensure that the TypeInfo of parameters and result type of methods is written (can be restricted to certain visibilities and whether hidden parameters shall be checked as well)
git-svn-id: trunk@35290 -
2017-01-13 16:25:22 +00:00
svenbarth
22e23fea8c + new parameter allow_hidden for params_write_rtti() so that writing of the TypeInfo of hidden parameters can be enforced as well
git-svn-id: trunk@35288 -
2017-01-13 16:22:42 +00:00
svenbarth
cf18b7116e * write_paralocs() takes a pcgpara instead of a tparavarsym as this is needed for the result location as well
git-svn-id: trunk@35287 -
2017-01-13 16:20:30 +00:00
svenbarth
f905303c4a + new TParamFlag pfResult if the result is passed as a parameter and thus needs to be set up as well
git-svn-id: trunk@35286 -
2017-01-13 16:17:03 +00:00
svenbarth
854a82b58b * move write_param_flag() from local to class scope
git-svn-id: trunk@35280 -
2017-01-13 13:58:55 +00:00
svenbarth
5275c36393 + extend TParamFlags by values for hidden parameters in general and especially the hidden high, self and vmt parameters (this is necessary so a manager approach for Invoke() can be used with as few knowledge about the involved calling conventions as possible)
Note: with this TParamFlags exceeds the size of a Byte

git-svn-id: trunk@35267 -
2017-01-08 16:08:35 +00:00
svenbarth
6b641394d0 * fix for Mantis #31201: don't write any RTTI for undefined defs (and while we're at it abort if an error def is encountered)
+ added test

git-svn-id: trunk@35256 -
2017-01-07 14:35:25 +00:00
svenbarth
417f1cd49d + initial implementation of the RTTI for parameter locations (not *yet* used by anything)
The parameter manager converts from the internal compiler representation of
a parameter's location to an RTTI representation. As the general implementation
more or less directly uses the compiler structures for this a platform specific
parameter manager may override this functionality in case some parameter
information changed in a non-backwards compatible way.
The RTTI parameter location has a layout that allows for an easy enumeration
as the size is fixed for all locations. Additionally there are properties that
allow for easy access to the information stored in them.

git-svn-id: trunk@35250 -
2017-01-06 22:21:37 +00:00
svenbarth
0ed00f64f5 * move writing of the calling convention into its own method
git-svn-id: trunk@35249 -
2017-01-06 20:55:25 +00:00
svenbarth
e3f10500b0 * move writing of the methodkind into its own function (and return the value as its a bit more complicated to calculate than merely checking proctypeoption)
git-svn-id: trunk@35248 -
2017-01-06 20:46:31 +00:00
florian
2e779239ad * fix rtti for targets with a max. C record alignment > 8 bytes
git-svn-id: trunk@35225 -
2017-01-03 18:44:50 +00:00
florian
0b82f71e8d * take care of the fact that there are 32 bit abis (e.g. ARMHF) which align qword on 8 byte boundaries, resolves issue #31132
git-svn-id: trunk@35218 -
2016-12-30 15:32:56 +00:00
svenbarth
7023a6f95b * have the remaining 7 Boolean types also use tkBool as typekind instead of tkInteger
git-svn-id: trunk@35186 -
2016-12-23 16:05:14 +00:00
svenbarth
dbbb6dca32 * correctly treat Boolean64 as otUQword and QWordBool as otSQWord (the former having QWord range 0..1, the latter Low(Int64)..High(Int64))
git-svn-id: trunk@35185 -
2016-12-23 16:04:12 +00:00
svenbarth
26e7d005aa * use Low(LongInt) and Max(LongInt) as min/max values for the RTTI of the ByteBool, WordBool and LongBool types to be Delphi compatible; the range of the defs is not changed to avoid the application of range checks
git-svn-id: trunk@35184 -
2016-12-23 16:01:59 +00:00
Jonas Maebe
d8c4980b2e * don't reuse the same type with the typed const builder for
differently-sized types

git-svn-id: trunk@35153 -
2016-12-18 13:57:15 +00:00
Jonas Maebe
691c2d655e * put multiple statements of the else-part of case between begin..end
git-svn-id: trunk@35152 -
2016-12-18 13:57:12 +00:00
Jonas Maebe
fe6b662c37 * fixed range error
git-svn-id: trunk@35151 -
2016-12-18 13:57:09 +00:00
Jonas Maebe
bcb7fedb3c * fixed indentation
git-svn-id: trunk@35150 -
2016-12-18 13:57:06 +00:00
svenbarth
86207c9b55 - remove no longer valid {otNone} comment
git-svn-id: trunk@35136 -
2016-12-16 14:23:14 +00:00
svenbarth
a9d14fe30b * extend TOrdType by entries for 64-bit values
* have tkInt64 and tkQWord entries also contain the OrdType field (basically the compiler can now use the same function to generate them only with different type kinds)

+ added test

git-svn-id: trunk@35135 -
2016-12-16 14:22:04 +00:00
svenbarth
7089677a22 * change RecInitTable into a direct reference to avoid an unnecessary indirection as both the full and init RTTI of a record always reside inside the same unit
git-svn-id: trunk@35128 -
2016-12-14 18:40:16 +00:00
svenbarth
e580e22576 * extend ref_rtti() with the possibility to use a direct reference if really desired
git-svn-id: trunk@35127 -
2016-12-14 18:38:54 +00:00
svenbarth
12dba952f0 * integration of Part 2 patch of Mantis #30687 with a few adjustments:
- indentation in ncgrtti.pas
  - fewer ifdefs in rtti.inc
  - InitTable/Terminator field as first field to avoid padding on targets that require proper alignment and have SizeOf(Pointer) > 4

Original message by Maciej Izak:

Breaking change for rtti layout for record rtti. Init table
is always accessible from regular rtti. Rtti table contains indirect
reference to init table, additionally init table contains nil-terminator (for
rtl purposes - the only way to determine kind of info : init or rtti). Pros:

* will be possible to create more Delphi compatible code for RTTI, finally end-user can access to *real* managed fields of records (some work on TypInfo.pp is still required but is not necessary).
* important step forward for management operators (anyway this commit is not directly related to management operators)
* much more optimal memory allocation/initialization/finalization for records created/destroyed by InitializeArray/FinalizeArray, for example:

type
  TBar = record
    f1,f2,f3,f4,f5,f6,f7,f8,f9: byte;
    s: string;
  end;

previously:

  GetMem(PB, SizeOf(TBar));
  InitializeArray(PB, TypeInfo(TBar), 1); // FPC_INITIALIZE was executed 10 times

now:

  GetMem(PB, SizeOf(TBar));
  InitializeArray(PB, TypeInfo(TBar), 1); // FPC_INITIALIZE is executed just once

+ test attached

git-svn-id: trunk@35125 -
2016-12-13 23:03:11 +00:00
Jonas Maebe
5efb32285a * fixed alignment for interface RTTI (patch by Alfred, mantis #30182)
git-svn-id: trunk@34695 -
2016-10-09 12:34:01 +00:00
Jonas Maebe
4c9903455e - don't apply const_align() to alignments passed to high level typed
constant builder, it will do so itself if necessary

git-svn-id: trunk@34632 -
2016-10-06 06:25:02 +00:00