From 0edbc24e91f5a4c906204767942c3d781a688654 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 23 Sep 2005 13:22:25 +0000 Subject: [PATCH] * add FSectsIndex that stores the sections in order, the old FSects is renamed to FSectsDict and will only be used for lookups git-svn-id: trunk@1165 - --- compiler/aasmbase.pas | 29 +++++++++++++++++++---------- compiler/ogelf.pas | 2 -- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/compiler/aasmbase.pas b/compiler/aasmbase.pas index f802b5e2f2..10fbc6df5e 100644 --- a/compiler/aasmbase.pas +++ b/compiler/aasmbase.pas @@ -158,7 +158,10 @@ interface private FName : string[80]; FCurrSec : TAsmSection; - FSects : TDictionary; + { Sections will be stored in order in SectsIndex, this is at least + required for stabs debuginfo. The SectsDict is only used for lookups (PFV) } + FSectsDict : TDictionary; + FSectsIndex : TIndexArray; FCAsmSection : TAsmSectionClass; { Symbols that will be defined in this object file } FSymbols : TIndexArray; @@ -193,10 +196,10 @@ interface procedure afterwrite;virtual; procedure resetsections; procedure fixuprelocs; - property Name:string{$ifndef VER1_9_4}[80]{$endif} read FName; + property Name:string[80] read FName; property CurrSec:TAsmSection read FCurrSec; property Symbols:TindexArray read FSymbols; - property Sects:TDictionary read FSects; + property Sects:TIndexArray read FSectsIndex; end; TAsmObjectDataClass = class of TAsmObjectData; @@ -259,6 +262,7 @@ implementation verbose; const + sectsgrow = 100; symbolsgrow = 100; @@ -549,8 +553,11 @@ implementation begin inherited create; FName:=n; - { sections } - FSects:=tdictionary.create; + { sections, the SectsIndex owns the items, the FSectsDict + is only used for lookups } + FSectsDict:=tdictionary.create; + FSectsDict.noclear:=true; + FSectsIndex:=tindexarray.create(sectsgrow); FStabsRecSize:=1; FStabsSec:=nil; FStabStrSec:=nil; @@ -564,7 +571,8 @@ implementation destructor TAsmObjectData.destroy; begin - FSects.free; + FSectsDict.free; + FSectsIndex.free; FSymbols.free; end; @@ -595,14 +603,15 @@ implementation secname : string; begin secname:=sectionname(atype,aname); - result:=TasmSection(FSects.search(secname)); + result:=TasmSection(FSectsDict.search(secname)); if not assigned(result) then begin {$warning TODO make alloconly configurable} if atype=sec_bss then include(aoptions,aso_alloconly); result:=CAsmSection.create(secname,atype,aalign,aoptions); - FSects.Insert(result); + FSectsDict.Insert(result); + FSectsIndex.Insert(result); result.owner:=self; end; FCurrSec:=result; @@ -699,13 +708,13 @@ implementation procedure TAsmObjectData.resetsections; begin - FSects.foreach(@section_reset,nil); + FSectsDict.foreach(@section_reset,nil); end; procedure TAsmObjectData.fixuprelocs; begin - FSects.foreach(@section_fixuprelocs,nil); + FSectsDict.foreach(@section_fixuprelocs,nil); end; diff --git a/compiler/ogelf.pas b/compiler/ogelf.pas index 6d13603422..99510c7c6a 100644 --- a/compiler/ogelf.pas +++ b/compiler/ogelf.pas @@ -304,8 +304,6 @@ implementation ****************************************************************************} constructor telf32objectdata.create(const n:string); - var - s : string; begin inherited create(n); CAsmSection:=TElf32Section;