diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-07-22 16:47:19 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-07-22 16:47:19 +0000 |
commit | 77fcf8aa859167aee3f7587018772da789189a38 (patch) | |
tree | 31f881f7507e7b6f759f8c8b5cdba6b3f31d98ba /compiler/symtype.pas | |
parent | f46ac3464864baf117555e500eced691d52b8735 (diff) | |
download | fpc-77fcf8aa859167aee3f7587018772da789189a38.tar.gz |
+ optimization that (re)orders instance fields of Delphi-style classes in
order to minimise memory losses due to alignment padding. Not yet enabled
by default at any optimization level, but can be (de)activated separately
via -Oo(no)orderfields
o added separate tdef.structalignment method that returns the alignment
of a type when it appears in a record/object/class (factors out
AIX-specific double alignment in structs)
o changed the handling of the offset of a delegate interface
implemented via a field, by taking the field offset on demand
rather than at declaration time (because the ordering optimization
causes the offsets of fields to be unknown until the entire
declaration has been parsed)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@21947 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/symtype.pas')
-rw-r--r-- | compiler/symtype.pas | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/symtype.pas b/compiler/symtype.pas index 6bf2399d43..ae2d381ffa 100644 --- a/compiler/symtype.pas +++ b/compiler/symtype.pas @@ -77,6 +77,8 @@ interface function size:asizeint;virtual;abstract; function packedbitsize:asizeint;virtual; function alignment:shortint;virtual;abstract; + { alignment when this type appears in a record/class/... } + function structalignment:shortint;virtual; function getvardef:longint;virtual;abstract; function getparentdef:tdef;virtual; function geTSymtable(t:tgeTSymtable):TSymtable;virtual; @@ -328,6 +330,12 @@ implementation end; + function tdef.structalignment: shortint; + begin + result:=alignment; + end; + + procedure tdef.ChangeOwner(st:TSymtable); begin // if assigned(Owner) then |