* made tasmsymbol.refs private (merged)

This commit is contained in:
peter 2002-11-15 16:29:30 +00:00
parent fa18e5160a
commit edbd98176b
7 changed files with 77 additions and 34 deletions

View File

@ -47,6 +47,11 @@ interface
TAsmSectionSizes = array[TSection] of longint;
TAsmSymbol = class(TNamedIndexItem)
private
{ this need to be incremented with every symbol loading into the
paasmoutput, thus in loadsym/loadref/const_symbol (PFV) }
refs : longint;
public
defbind,
currbind : TAsmsymbind;
typ : TAsmsymtype;
@ -54,9 +59,6 @@ interface
section : TSection;
address,
size : longint;
{ this need to be incremented with every symbol loading into the
paasmoutput, thus in loadsym/loadref/const_symbol (PFV) }
refs : longint;
{ Alternate symbol which can be used for 'renaming' needed for
inlining }
altsymbol : tasmsymbol;
@ -74,6 +76,8 @@ interface
constructor create(const s:string;_bind:TAsmsymbind;_typ:Tasmsymtype);
procedure reset;
function is_used:boolean;
procedure increfs;
procedure decrefs;
procedure setaddress(_pass:byte;sec:TSection;offset,len:longint);
end;
@ -247,6 +251,7 @@ implementation
refs:=0;
end;
procedure tasmsymbol.reset;
begin
{ reset section info }
@ -261,11 +266,27 @@ implementation
taiowner:=nil;
end;
function tasmsymbol.is_used:boolean;
begin
is_used:=(refs>0);
end;
procedure tasmsymbol.increfs;
begin
inc(refs);
end;
procedure tasmsymbol.decrefs;
begin
dec(refs);
if refs<0 then
internalerror(200211121);
end;
procedure tasmsymbol.setaddress(_pass:byte;sec:TSection;offset,len:longint);
begin
if (_pass=pass) then
@ -310,7 +331,7 @@ implementation
is_addr := false;
proclocal := false;
{ write it always }
refs:=1;
increfs;
end;
constructor tasmlabel.createaddr(nr:longint);
@ -322,7 +343,7 @@ implementation
function tasmlabel.getname:string;
begin
getname:=inherited getname;
inc(refs);
increfs;
end;
@ -808,7 +829,7 @@ implementation
begin
with hp do
begin
if (refs>0) and
if is_used and
(section=Sec_none) and
not(currbind in [AB_EXTERNAL,AB_COMMON]) then
Message1(asmw_e_undefined_label,name);
@ -867,7 +888,10 @@ implementation
end.
{
$Log$
Revision 1.10 2002-11-15 01:58:45 peter
Revision 1.11 2002-11-15 16:29:30 peter
* made tasmsymbol.refs private (merged)
Revision 1.10 2002/11/15 01:58:45 peter
* merged changes from 1.0.7 up to 04-11
- -V option for generating bug report tracing
- more tracing for option parsing

View File

@ -806,7 +806,7 @@ uses
sym:=_sym;
offset:=0;
{ update sym info }
inc(sym.refs);
sym.increfs;
end;
constructor tai_const_symbol.Create_offset(_sym:tasmsymbol;ofs:longint);
@ -816,7 +816,7 @@ uses
sym:=_sym;
offset:=ofs;
{ update sym info }
inc(sym.refs);
sym.increfs;
end;
constructor tai_const_symbol.Create_rva(_sym:tasmsymbol);
@ -826,7 +826,7 @@ uses
sym:=_sym;
offset:=0;
{ update sym info }
inc(sym.refs);
sym.increfs;
end;
constructor tai_const_symbol.Createname(const name:string);
@ -836,7 +836,7 @@ uses
sym:=objectlibrary.newasmsymbol(name);
offset:=0;
{ update sym info }
inc(sym.refs);
sym.increfs;
end;
constructor tai_const_symbol.Createname_offset(const name:string;ofs:longint);
@ -846,7 +846,7 @@ uses
sym:=objectlibrary.newasmsymbol(name);
offset:=ofs;
{ update sym info }
inc(sym.refs);
sym.increfs;
end;
constructor tai_const_symbol.Createname_rva(const name:string);
@ -856,7 +856,7 @@ uses
sym:=objectlibrary.newasmsymbol(name);
offset:=0;
{ update sym info }
inc(sym.refs);
sym.increfs;
end;
@ -886,7 +886,7 @@ uses
begin
getcopy:=inherited getcopy;
{ we need to increase the reference number }
inc(sym.refs);
sym.increfs;
end;
@ -1408,8 +1408,6 @@ uses
case oper[i].typ of
top_ref:
dispose(oper[i].ref);
top_symbol:
dec(tasmsymbol(oper[i].sym).refs);
end;
inherited destroy;
end;
@ -1447,7 +1445,7 @@ uses
symofs:=sofs;
typ:=top_symbol;
end;
inc(s.refs);
s.increfs;
end;
@ -1469,7 +1467,7 @@ uses
typ:=top_ref;
{ mark symbol as used }
if assigned(ref^.symbol) then
inc(ref^.symbol.refs);
ref^.symbol.increfs;
end;
end;
@ -1648,7 +1646,10 @@ uses
end.
{
$Log$
Revision 1.11 2002-11-15 01:58:45 peter
Revision 1.12 2002-11-15 16:29:30 peter
* made tasmsymbol.refs private (merged)
Revision 1.11 2002/11/15 01:58:45 peter
* merged changes from 1.0.7 up to 04-11
- -V option for generating bug report tracing
- more tracing for option parsing

View File

@ -497,9 +497,9 @@ Var
exit;
if not GetFinalDestination(asml, Taicpu(p1),succ(level)) then
exit;
Dec(tasmlabel(hp.oper[0].sym).refs);
tasmlabel(hp.oper[0].sym).decrefs;
hp.oper[0].sym:=Taicpu(p1).oper[0].sym;
inc(tasmlabel(hp.oper[0].sym).refs);
tasmlabel(hp.oper[0].sym).increfs;
End
Else
If (Taicpu(p1).condition = inverse_cond[hp.condition]) then
@ -511,9 +511,9 @@ Var
{$endif finaldestdebug}
objectlibrary.getlabel(l);
insertllitem(asml,p1,p1.next,Tai_label.Create(l));
dec(tasmlabel(Taicpu(hp).oper[0].sym).refs);
tasmlabel(Taicpu(hp).oper[0].sym).decrefs;
hp.oper[0].sym := l;
inc(l.refs);
l.increfs;
{ this won't work, since the new label isn't in the labeltable }
{ so it will fail the rangecheck. Labeltable should become a }
{ hashtable to support this: }
@ -525,7 +525,7 @@ Var
insertllitem(asml,p1,p1.next,tai_comment.Create(
strpnew('next label reused'))));
{$endif finaldestdebug}
inc(l.refs);
l.increfs;
hp.oper[0].sym := l;
if not GetFinalDestination(asml, hp,succ(level)) then
exit;
@ -634,9 +634,9 @@ Begin
p:=Tai(p.next);
continue;
end;
Dec(Tai_label(hp2).l.refs);
Tai_label(hp2).l.decrefs;
Taicpu(p).oper[0].sym:=Taicpu(hp1).oper[0].sym;
Inc(Taicpu(p).oper[0].sym.refs);
Taicpu(p).oper[0].sym.increfs;
asml.remove(hp1);
hp1.free;
If (LabDif <> 0) Then
@ -2044,7 +2044,10 @@ End.
{
$Log$
Revision 1.34 2002-08-18 20:06:30 peter
Revision 1.35 2002-11-15 16:30:54 peter
* made tasmsymbol.refs private (merged)
Revision 1.34 2002/08/18 20:06:30 peter
* inlining is now also allowed in interface
* renamed write/load to ppuwrite/ppuload
* tnode storing in ppu

View File

@ -115,7 +115,7 @@ interface
if not assigned(p.altsymbol) then
objectlibrary.GenerateAltSymbol(p);
p:=p.altsymbol;
inc(p.refs);
p.increfs;
end;
end;
@ -288,7 +288,10 @@ begin
end.
{
$Log$
Revision 1.24 2002-11-15 01:58:51 peter
Revision 1.25 2002-11-15 16:29:30 peter
* made tasmsymbol.refs private (merged)
Revision 1.24 2002/11/15 01:58:51 peter
* merged changes from 1.0.7 up to 04-11
- -V option for generating bug report tracing
- more tracing for option parsing

View File

@ -256,7 +256,7 @@ implementation
begin
objectlibrary.getdatalabel(hl);
{ we still want a warning if unused }
hl.refs:=0;
hl.decrefs;
end
else
objectlibrary.getlabel(hl);
@ -624,7 +624,10 @@ implementation
end.
{
$Log$
Revision 1.57 2002-10-20 15:34:16 peter
Revision 1.58 2002-11-15 16:29:30 peter
* made tasmsymbol.refs private (merged)
Revision 1.57 2002/10/20 15:34:16 peter
* removed df_unique flag. It breaks code. For a good type=type <id>
a def copy is required

View File

@ -495,6 +495,8 @@ implementation
registerdef:=false;
UnionDef:=trecorddef.create(unionsymtable);
uniondef.isunion:=true;
if assigned(symtablestack.defowner) then
Uniondef.owner:=symtablestack.defowner.owner;
registerdef:=true;
symtablestack:=UnionSymtable;
startvarrecsize:=symtablestack.datasize;
@ -564,6 +566,7 @@ implementation
trecordsymtable(Unionsymtable).Insert_in(symtablestack,offset);
Unionsym.owner:=nil;
unionsym.free;
uniondef.owner:=nil;
uniondef.free;
end;
block_type:=old_block_type;
@ -575,7 +578,10 @@ implementation
end.
{
$Log$
Revision 1.38 2002-11-15 01:58:53 peter
Revision 1.39 2002-11-15 16:29:31 peter
* made tasmsymbol.refs private (merged)
Revision 1.38 2002/11/15 01:58:53 peter
* merged changes from 1.0.7 up to 04-11
- -V option for generating bug report tracing
- more tracing for option parsing

View File

@ -1131,7 +1131,7 @@ begin
begin
objectlibrary.getlabel(lab);
{ this label is forced to be used so it's always written }
inc(lab.refs);
lab.increfs;
end;
Gettasmlabel:=lab;
end;
@ -1592,7 +1592,10 @@ end;
end.
{
$Log$
Revision 1.46 2002-09-03 16:26:27 daniel
Revision 1.47 2002-11-15 16:29:31 peter
* made tasmsymbol.refs private (merged)
Revision 1.46 2002/09/03 16:26:27 daniel
* Make Tprocdef.defs protected
Revision 1.45 2002/08/25 19:25:20 peter