diff --git a/compiler/aasmdata.pas b/compiler/aasmdata.pas index e0eac8a7ef..7d313040d7 100644 --- a/compiler/aasmdata.pas +++ b/compiler/aasmdata.pas @@ -135,6 +135,22 @@ interface section_count : longint; constructor create; function getlasttaifilepos : pfileposinfo; + { inserts another List at the begin and make this List empty } + procedure insertList(p : TLinkedList); override; + { inserts another List before the provided item and make this List empty } + procedure insertListBefore(Item:TLinkedListItem;p : TLinkedList); override; + { inserts another List after the provided item and make this List empty } + procedure insertListAfter(Item:TLinkedListItem;p : TLinkedList); override; + { concats another List at the end and make this List empty } + procedure concatList(p : TLinkedList); override; + { concats another List at the start and makes a copy + the list is ordered in reverse. + } + procedure insertListcopy(p : TLinkedList); override; + { concats another List at the end and makes a copy } + procedure concatListcopy(p : TLinkedList); override; + { removes all items from the list, the items are not freed } + procedure RemoveAll; override; end; TAsmCFI=class @@ -338,6 +354,59 @@ implementation end; + procedure TAsmList.insertList(p : TLinkedList); + begin + inherited insertList(p); + inc(section_count,TAsmList(p).section_count); + TAsmList(p).section_count:=0; + end; + + + procedure TAsmList.insertListBefore(Item : TLinkedListItem; p : TLinkedList); + begin + inherited insertListBefore(Item,p); + inc(section_count,TAsmList(p).section_count); + TAsmList(p).section_count:=0; + end; + + + procedure TAsmList.insertListAfter(Item : TLinkedListItem; p : TLinkedList); + begin + inherited insertListAfter(Item,p); + inc(section_count,TAsmList(p).section_count); + TAsmList(p).section_count:=0; + end; + + + procedure TAsmList.concatList(p : TLinkedList); + begin + inherited concatList(p); + inc(section_count,TAsmList(p).section_count); + TAsmList(p).section_count:=0; + end; + + + procedure TAsmList.insertListcopy(p : TLinkedList); + begin + inherited insertListcopy(p); + inc(section_count,TAsmList(p).section_count); + end; + + + procedure TAsmList.concatListcopy(p : TLinkedList); + begin + inherited concatListcopy(p); + inc(section_count,TAsmList(p).section_count); + end; + + + procedure TAsmList.RemoveAll; + begin + inherited RemoveAll; + section_count:=0; + end; + + {**************************************************************************** TAsmData ****************************************************************************} @@ -424,8 +493,8 @@ implementation CurrAsmList:=TAsmList.create; for hal:=low(TAsmListType) to high(TAsmListType) do AsmLists[hal]:=TAsmList.create; - WideInits :=TLinkedList.create; - ResStrInits:=TLinkedList.create; + WideInits :=TAsmList.create; + ResStrInits:=TAsmList.create; { CFI } FAsmCFI:=CAsmCFI.Create; end; diff --git a/compiler/cclasses.pas b/compiler/cclasses.pas index 0a2d2a124a..f0e7b76d40 100644 --- a/compiler/cclasses.pas +++ b/compiler/cclasses.pas @@ -365,21 +365,21 @@ type { Gets last Item } function GetLast:TLinkedListItem; { inserts another List at the begin and make this List empty } - procedure insertList(p : TLinkedList); + procedure insertList(p : TLinkedList); virtual; { inserts another List before the provided item and make this List empty } - procedure insertListBefore(Item:TLinkedListItem;p : TLinkedList); + procedure insertListBefore(Item:TLinkedListItem;p : TLinkedList); virtual; { inserts another List after the provided item and make this List empty } - procedure insertListAfter(Item:TLinkedListItem;p : TLinkedList); + procedure insertListAfter(Item:TLinkedListItem;p : TLinkedList); virtual; { concats another List at the end and make this List empty } - procedure concatList(p : TLinkedList); + procedure concatList(p : TLinkedList); virtual; { concats another List at the start and makes a copy the list is ordered in reverse. } - procedure insertListcopy(p : TLinkedList); + procedure insertListcopy(p : TLinkedList); virtual; { concats another List at the end and makes a copy } - procedure concatListcopy(p : TLinkedList); + procedure concatListcopy(p : TLinkedList); virtual; { removes all items from the list, the items are not freed } - procedure RemoveAll; + procedure RemoveAll; virtual; property First:TLinkedListItem read FFirst; property Last:TLinkedListItem read FLast; property Count:Integer read FCount; diff --git a/compiler/cresstr.pas b/compiler/cresstr.pas index a0440eab86..0180cdc376 100644 --- a/compiler/cresstr.pas +++ b/compiler/cresstr.pas @@ -119,7 +119,7 @@ uses Constructor Tresourcestrings.Create; begin - List:=TLinkedList.Create; + List:=TAsmList.Create; end; diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 3aec54cb72..5610bd153f 100644 --- a/compiler/nbas.pas +++ b/compiler/nbas.pas @@ -816,7 +816,6 @@ implementation begin n.p_asm:=TAsmList.create; n.p_asm.concatlistcopy(p_asm); - n.p_asm.section_count:=p_asm.section_count; end else n.p_asm := nil; n.currenttai:=currenttai; diff --git a/compiler/ncgbas.pas b/compiler/ncgbas.pas index e486194012..c230a8c8ec 100644 --- a/compiler/ncgbas.pas +++ b/compiler/ncgbas.pas @@ -394,9 +394,6 @@ interface current_asmdata.CurrAsmList.concatlist(p_asm); end; - { Update section count } - current_asmdata.currasmlist.section_count:=current_asmdata.currasmlist.section_count+p_asm.section_count; - { Release register used in the assembler block } if (not has_registerlist) then cg.deallocallcpuregisters(current_asmdata.CurrAsmList);