mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-24 20:09:26 +01:00
* don't use symid anymore as fallback when sorting fields, as it's no longer
guaranteed to be set. Instead, temporarily assign fieldoffsets to determine
their order in the sort function (fixes webtbs/tw15415 with -O4 after
r32153)
git-svn-id: trunk@32159 -
This commit is contained in:
parent
6b89ea1af2
commit
ed211b9888
@ -1242,7 +1242,7 @@ implementation
|
||||
to each other can improve cache behaviour) }
|
||||
result:=field2.vardef.alignment-field1.vardef.alignment;
|
||||
if result=0 then
|
||||
result:=field1.symid-field2.symid;
|
||||
result:=field1.fieldoffset-field2.fieldoffset;
|
||||
end;
|
||||
|
||||
|
||||
@ -1259,6 +1259,10 @@ implementation
|
||||
if maybereorder and
|
||||
(cs_opt_reorder_fields in current_settings.optimizerswitches) then
|
||||
begin
|
||||
{ assign dummy field offsets so we can know their order in the
|
||||
sorting routine }
|
||||
for i:=0 to list.count-1 do
|
||||
tfieldvarsym(list[i]).fieldoffset:=i;
|
||||
{ sort the non-class fields to minimise losses due to alignment }
|
||||
list.sort(@field_alignment_compare);
|
||||
{ now fill up gaps caused by alignment skips with smaller fields
|
||||
@ -1352,6 +1356,9 @@ implementation
|
||||
{ there may be small gaps left *before* inserted fields }
|
||||
until not changed;
|
||||
end;
|
||||
{ reset the dummy field offsets }
|
||||
for i:=0 to list.count-1 do
|
||||
tfieldvarsym(list[i]).fieldoffset:=-1;
|
||||
{ finally, set the actual field offsets }
|
||||
for i:=0 to list.count-1 do
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user