* cleanup deleting of defs

git-svn-id: trunk@5902 -
This commit is contained in:
peter 2007-01-11 20:46:57 +00:00
parent aaec51dd3f
commit 91dbd27a42
12 changed files with 39 additions and 61 deletions

View File

@ -311,7 +311,7 @@ unit cg64f32;
procedure tcg64f32.a_load64_reg_subsetref(list : TAsmList; fromreg: tregister64; const sref: tsubsetreference);
var
tmpreg: tregister;
tmpsref: tsubsetreference;
@ -337,7 +337,7 @@ unit cg64f32;
inc(tmpsref.ref.offset,4);
cg.a_load_reg_subsetref(list,OS_32,OS_32,fromreg.reghi,tmpsref);
end;
procedure tcg64f32.a_load64_const_subsetref(list: TAsmlist; a: int64; const sref: tsubsetreference);
@ -757,7 +757,7 @@ unit cg64f32;
inc(temploc.reference.offset,4);
cg.g_rangecheck(list,temploc,hdef,todef);
hdef.free;
hdef.owner.deletedef(hdef);
if from_signed and to_signed then
begin
@ -788,7 +788,7 @@ unit cg64f32;
location_copy(temploc,l);
temploc.size:=OS_32;
cg.g_rangecheck(list,temploc,hdef,todef);
hdef.free;
hdef.owner.deletedef(hdef);
cg.a_label(list,endlabel);
end;
end

View File

@ -32,7 +32,7 @@
}
unit dbgdwarf;
{$i fpcdefs.inc}
{$i fpcdefs.inc}
interface
@ -1459,8 +1459,7 @@ implementation
for i:=0 to st.DefList.Count-1 do
begin
def:=tdef(st.DefList[i]);
if not(df_deleted in def.defoptions) and
(def.dbg_state=dbg_state_used) then
if (def.dbg_state=dbg_state_used) then
appenddef(def);
end;
end;
@ -2161,7 +2160,7 @@ implementation
if use_64bit_headers then
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_64bit,
current_asmdata.RefAsmSymbol('.Ldebug_abbrev0')))
else
else
current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_32bit,
current_asmdata.RefAsmSymbol('.Ldebug_abbrev0')));
{ address size }

View File

@ -30,7 +30,7 @@ interface
dbgbase,
symtype,symdef,symsym,symtable,symbase,
aasmtai,aasmdata;
const
{ stab types }
N_GSYM = $20;
@ -913,8 +913,7 @@ implementation
for i:=0 to st.DefList.Count-1 do
begin
def:=tdef(st.DefList[i]);
if not(df_deleted in def.defoptions) and
(def.dbg_state=dbg_state_used) then
if (def.dbg_state=dbg_state_used) then
insertdef(list,def);
end;
end;

View File

@ -430,8 +430,7 @@ implementation
for i:=0 to objdef.symtable.DefList.Count-1 do
begin
def:=tdef(objdef.symtable.DefList[i]);
if assigned(def) and
(def.typ=procdef) then
if def.typ=procdef then
begin
pd:=tprocdef(def);
{ Find VMT procsym }
@ -498,7 +497,8 @@ implementation
for i:=0 to IntfDef.symtable.DefList.Count-1 do
begin
def:=tdef(IntfDef.symtable.DefList[i]);
if def.typ=procdef then
if assigned(def) and
(def.typ=procdef) then
begin
{ Find implementing procdef
1. Check for mapped name

View File

@ -2622,9 +2622,8 @@ const
{ encountered, it must already use the new mangled name (JM) }
end;
{ the procdef will be released by the symtable, we release
at least the parast }
currpd.free;
{ Release current procdef }
currpd.owner.deletedef(currpd);
currpd:=fwpd;
end
else

View File

@ -640,8 +640,9 @@ implementation
end;
{ remove temporary procvardefs }
readprocdef.free;
writeprocdef.free;
readprocdef.owner.deletedef(readprocdef);
writeprocdef.owner.deletedef(writeprocdef);
result:=p;
end;
@ -1366,7 +1367,7 @@ implementation
recst.fieldalignment:=unionsymtable.recordalignment;
trecordsymtable(recst).insertunionst(Unionsymtable,offset);
uniondef.free;
uniondef.owner.deletedef(uniondef);
end;
block_type:=old_block_type;
current_object_option:=old_current_object_option;

View File

@ -783,8 +783,6 @@ implementation
for i:=0 to st.DefList.Count-1 do
begin
def:=tdef(st.DefList[i]);
if df_deleted in def.defoptions then
continue;
case def.typ of
recorddef :
write_persistent_type_info(trecorddef(def).symtable);

View File

@ -88,7 +88,6 @@ interface
TSymtable = class
public
clearing : boolean;
name : pshortstring;
realname : pshortstring;
DefList : TFPObjectList;
@ -261,11 +260,17 @@ implementation
procedure TSymtable.clear;
var
i : integer;
begin
clearing:=true;
SymList.Clear;
{ Prevent recursive calls between TDef.destroy and TSymtable.Remove }
if DefList.OwnsObjects then
begin
for i := 0 to DefList.Count-1 do
TDefEntry(DefList[i]).Owner:=nil;
end;
DefList.Clear;
clearing:=false;
end;
@ -318,7 +323,8 @@ implementation
begin
if def.Owner<>self then
internalerror(200611122);
DefList.Remove(def);
def.Owner:=nil;
DefList.Remove(def);
end;

View File

@ -147,9 +147,7 @@ type
{ type is a generic }
df_generic,
{ type is a specialization of a generic type }
df_specialization,
{ type is deleted does not to be stored in ppu }
df_deleted
df_specialization
);
tdefoptions=set of tdefoption;

View File

@ -64,7 +64,6 @@ interface
constructor create(dt:tdeftyp);
constructor ppuload(dt:tdeftyp;ppufile:tcompilerppufile);
destructor destroy;override;
procedure FreeInstance;override;
procedure reset;virtual;
function getcopy : tstoreddef;virtual;
procedure ppuwrite(ppufile:tcompilerppufile);virtual;
@ -855,23 +854,11 @@ implementation
end;
procedure tstoreddef.FreeInstance;
begin
if assigned(owner) and
(not owner.clearing) then
begin
include(defoptions,df_deleted);
exit;
end;
inherited FreeInstance;
end;
destructor tstoreddef.destroy;
begin
{ remove also index from symtable }
// if assigned(owner) then
// owner.deletedef(self);
{ Direct calls are not allowed, use symtable.deletedef() }
if assigned(owner) then
internalerror(200612311);
if assigned(generictokenbuf) then
begin
generictokenbuf.free;

View File

@ -388,8 +388,7 @@ implementation
for i:=0 to DefList.Count-1 do
begin
def:=tstoreddef(DefList[i]);
if not(df_deleted in def.defoptions) then
def.ppuwrite(ppufile);
def.ppuwrite(ppufile);
end;
{ write end of definitions }
ppufile.writeentry(ibenddefs);
@ -426,8 +425,7 @@ implementation
for i:=0 to DefList.Count-1 do
begin
def:=tstoreddef(DefList[i]);
if not(df_deleted in def.defoptions) then
def.buildderef;
def.buildderef;
end;
{ interface symbols }
for i:=0 to SymList.Count-1 do
@ -447,8 +445,7 @@ implementation
for i:=0 to DefList.Count-1 do
begin
def:=tstoreddef(DefList[i]);
if not(df_deleted in def.defoptions) then
def.buildderefimpl;
def.buildderefimpl;
end;
end;
@ -473,8 +470,7 @@ implementation
for i:=0 to DefList.Count-1 do
begin
def:=tstoreddef(DefList[i]);
if not(df_deleted in def.defoptions) then
def.deref;
def.deref;
end;
{ interface symbols }
for i:=0 to SymList.Count-1 do
@ -495,8 +491,7 @@ implementation
for i:=0 to DefList.Count-1 do
begin
def:=tstoreddef(DefList[i]);
if not(df_deleted in def.defoptions) then
def.derefimpl;
def.derefimpl;
end;
end;
@ -658,8 +653,7 @@ implementation
for i:=0 to DefList.Count-1 do
begin
def:=tstoreddef(DefList[i]);
if not(df_deleted in def.defoptions) then
def.reset;
def.reset;
end;
end;
@ -1004,7 +998,6 @@ implementation
for i:=0 to unionst.DefList.Count-1 do
begin
def:=TDef(unionst.DefList[i]);
// unionst.DefList.List[i]:=nil;
def.ChangeOwner(self);
end;
_datasize:=storesize;

View File

@ -748,9 +748,7 @@ type
{ type is a generic }
df_generic,
{ type is a specialization of a generic type }
df_specialization,
{ type is deleted does not to be stored in ppu }
df_deleted
df_specialization
);
tdefoptions=set of tdefoption;