summaryrefslogtreecommitdiff
path: root/compiler/cclasses.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-07-22 16:47:19 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-07-22 16:47:19 +0000
commit77fcf8aa859167aee3f7587018772da789189a38 (patch)
tree31f881f7507e7b6f759f8c8b5cdba6b3f31d98ba /compiler/cclasses.pas
parentf46ac3464864baf117555e500eced691d52b8735 (diff)
downloadfpc-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.pas8
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;