Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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: http://svn.freepascal.org/svn/fpc/trunk@35125 3ad0048d-3df7-0310-abae-a5850022a9f2
- Loading branch information
svenbarth
committed
Dec 13, 2016
1 parent
6f9ab61
commit 0c083ab
Showing
4 changed files
with
99 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
program trtti10; | ||
|
||
{$MODE DELPHI} | ||
|
||
uses | ||
TypInfo; | ||
|
||
type | ||
TFoo = record | ||
end; | ||
|
||
begin | ||
if GetTypeData(TypeInfo(TFoo)).RecInitTable = nil then | ||
Halt(1); | ||
end. |