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/cclasses.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/cclasses.pas')
-rw-r--r-- | compiler/cclasses.pas | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/cclasses.pas b/compiler/cclasses.pas index bb9558e1e0..c90bfef0e6 100644 --- a/compiler/cclasses.pas +++ b/compiler/cclasses.pas @@ -151,6 +151,7 @@ type function Last: TObject; {$ifdef CCLASSESINLINE}inline;{$endif} procedure Move(CurIndex, NewIndex: Integer); {$ifdef CCLASSESINLINE}inline;{$endif} procedure Assign(Obj:TFPObjectList); + procedure ConcatListCopy(Obj:TFPObjectList); procedure Pack; {$ifdef CCLASSESINLINE}inline;{$endif} procedure Sort(Compare: TListSortCompare); {$ifdef CCLASSESINLINE}inline;{$endif} procedure ForEachCall(proc2call:TObjectListCallback;arg:pointer); {$ifdef CCLASSESINLINE}inline;{$endif} @@ -1088,10 +1089,15 @@ begin end; procedure TFPObjectList.Assign(Obj: TFPObjectList); +begin + Clear; + ConcatListCopy(Obj); +end; + +procedure TFPObjectList.ConcatListCopy(Obj: TFPObjectList); var i: Integer; begin - Clear; for I := 0 to Obj.Count - 1 do Add(Obj[i]); end; |