* Removed not very usefull nextglobal & previousglobal fields from

Tstoreddef, saving 78 kb of memory
This commit is contained in:
daniel 2004-02-06 22:37:00 +00:00
parent bba24d90b4
commit 42f9b1b0e2
3 changed files with 65 additions and 102 deletions

View File

@ -924,7 +924,7 @@ implementation
current_module.globalsymtable:=current_module.localsymtable;
current_module.localsymtable:=nil;
reset_global_defs;
reset_all_defs;
{ number all units, so we know if a unit is used by this unit or
needs to be added implicitly }
@ -982,7 +982,7 @@ implementation
exit;
{ reset ranges/stabs in exported definitions }
reset_global_defs;
reset_all_defs;
{ All units are read, now give them a number }
current_module.numberunits;
@ -1094,7 +1094,7 @@ implementation
end;
{$endif GDB}
reset_global_defs;
reset_all_defs;
if (Errorcount=0) then
begin
@ -1277,7 +1277,7 @@ implementation
loadunits;
{ reset ranges/stabs in exported definitions }
reset_global_defs;
reset_all_defs;
{ All units are read, now give them a number }
current_module.numberunits;
@ -1438,7 +1438,11 @@ implementation
end.
{
$Log$
Revision 1.138 2004-02-04 22:15:15 daniel
Revision 1.139 2004-02-06 22:37:00 daniel
* Removed not very usefull nextglobal & previousglobal fields from
Tstoreddef, saving 78 kb of memory
Revision 1.138 2004/02/04 22:15:15 daniel
* Rtti generation moved to ncgutil
* Assmtai usage of symsym removed
* operator overloading cleanup up

View File

@ -52,7 +52,9 @@ interface
************************************************}
tstoreddef = class(tdef)
protected
typesymderef : tderef;
public
{ persistent (available across units) rtti and init tables }
rttitablesym,
inittablesym : tsym; {trttisym}
@ -61,8 +63,6 @@ interface
{ local (per module) rtti and init tables }
localrttilab : array[trttitype] of tasmlabel;
{ linked list of global definitions }
nextglobal,
previousglobal : tstoreddef;
{$ifdef EXTDEBUG}
fileinfo : tfileposinfo;
{$endif}
@ -72,7 +72,7 @@ interface
{$endif GDB}
constructor create;
constructor ppuloaddef(ppufile:tcompilerppufile);
destructor destroy;override;
procedure reset;
function getcopy : tstoreddef;virtual;
procedure ppuwritedef(ppufile:tcompilerppufile);
procedure ppuwrite(ppufile:tcompilerppufile);virtual;abstract;
@ -680,10 +680,6 @@ interface
var
aktobjectdef : tobjectdef; { used for private functions check !! }
firstglobaldef, { linked list of all globals defs }
lastglobaldef : tstoreddef; { used to reset stabs/ranges }
{$ifdef GDB}
{ for STAB debugging }
globaltypecount : word;
@ -793,8 +789,6 @@ interface
function is_cppclass(def: tdef): boolean;
function is_class_or_interface(def: tdef): boolean;
procedure reset_global_defs;
implementation
@ -923,18 +917,6 @@ implementation
is_def_stab_written := not_written;
globalnb := 0;
{$endif GDB}
if assigned(lastglobaldef) then
begin
lastglobaldef.nextglobal := self;
previousglobal:=lastglobaldef;
end
else
begin
firstglobaldef := self;
previousglobal := nil;
end;
lastglobaldef := self;
nextglobal := nil;
fillchar(localrttilab,sizeof(localrttilab),0);
end;
@ -949,18 +931,6 @@ implementation
is_def_stab_written := not_written;
globalnb := 0;
{$endif GDB}
if assigned(lastglobaldef) then
begin
lastglobaldef.nextglobal := self;
previousglobal:=lastglobaldef;
end
else
begin
firstglobaldef := self;
previousglobal:=nil;
end;
lastglobaldef := self;
nextglobal := nil;
fillchar(localrttilab,sizeof(localrttilab),0);
{ load }
indexnr:=ppufile.getword;
@ -973,32 +943,21 @@ implementation
end;
destructor tstoreddef.destroy;
begin
{ first element ? }
if not(assigned(previousglobal)) then
begin
firstglobaldef := nextglobal;
if assigned(firstglobaldef) then
firstglobaldef.previousglobal:=nil;
end
else
begin
{ remove reference in the element before }
previousglobal.nextglobal:=nextglobal;
end;
{ last element ? }
if not(assigned(nextglobal)) then
begin
lastglobaldef := previousglobal;
if assigned(lastglobaldef) then
lastglobaldef.nextglobal:=nil;
end
else
nextglobal.previousglobal:=previousglobal;
previousglobal:=nil;
nextglobal:=nil;
end;
procedure Tstoreddef.reset;
begin
{$ifdef GDB}
if assigned(typesym) then
ttypesym(typesym).isusedinstab:=false;
is_def_stab_written:=not_written;
{$endif GDB}
if assigned(rttitablesym) then
trttisym(rttitablesym).lab := nil;
if assigned(inittablesym) then
trttisym(inittablesym).lab := nil;
localrttilab[initrtti]:=nil;
localrttilab[fullrtti]:=nil;
end;
function tstoreddef.getcopy : tstoreddef;
begin
@ -6058,40 +6017,6 @@ implementation
Definition Helpers
****************************************************************************}
procedure reset_global_defs;
var
def : tstoreddef;
{$ifdef debug}
prevdef : tstoreddef;
{$endif debug}
begin
{$ifdef debug}
prevdef:=nil;
{$endif debug}
{$ifdef GDB}
pglobaltypecount:=@globaltypecount;
{$endif GDB}
def:=firstglobaldef;
while assigned(def) do
begin
{$ifdef GDB}
if assigned(def.typesym) then
ttypesym(def.typesym).isusedinstab:=false;
def.is_def_stab_written:=not_written;
{$endif GDB}
if assigned(def.rttitablesym) then
trttisym(def.rttitablesym).lab := nil;
if assigned(def.inittablesym) then
trttisym(def.inittablesym).lab := nil;
def.localrttilab[initrtti]:=nil;
def.localrttilab[fullrtti]:=nil;
{$ifdef debug}
prevdef:=def;
{$endif debug}
def:=def.nextglobal;
end;
end;
function is_interfacecom(def: tdef): boolean;
begin
is_interfacecom:=
@ -6152,7 +6077,11 @@ implementation
end.
{
$Log$
Revision 1.215 2004-02-05 01:24:08 florian
Revision 1.216 2004-02-06 22:37:00 daniel
* Removed not very usefull nextglobal & previousglobal fields from
Tstoreddef, saving 78 kb of memory
Revision 1.215 2004/02/05 01:24:08 florian
* several fixes to compile x86-64 system
Revision 1.214 2004/02/03 22:32:54 peter

View File

@ -62,6 +62,7 @@ interface
procedure unchain_overloads(p : TNamedIndexItem;arg:pointer);
procedure loaddefs(ppufile:tcompilerppufile);
procedure loadsyms(ppufile:tcompilerppufile);
procedure reset_def(def:Tnamedindexitem;arg:pointer);
procedure writedefs(ppufile:tcompilerppufile);
procedure writesyms(ppufile:tcompilerppufile);
public
@ -75,6 +76,7 @@ interface
procedure deref;virtual;
procedure derefimpl;virtual;
procedure insert(sym : tsymentry);override;
procedure reset_all_defs;virtual;
function speedsearch(const s : stringid;speedvalue : cardinal) : tsymentry;override;
procedure allsymbolsused;
procedure allprivatesused;
@ -216,6 +218,8 @@ interface
procedure search_class_overloads(aprocsym : tprocsym);
function search_default_property(pd : tobjectdef) : tpropertysym;
procedure reset_all_defs;
{*** symtable stack ***}
{$ifdef DEBUG}
procedure test_symtablestack;
@ -840,6 +844,18 @@ implementation
Tstoredsym(p).isstabwritten:=false;
end;
procedure Tstoredsymtable.reset_def(def:Tnamedindexitem;arg:pointer);
begin
Tstoreddef(def).reset;
end;
procedure Tstoredsymtable.reset_all_defs;
begin
defindex.foreach(@reset_def,nil);
end;
procedure TStoredSymtable.concattypestab(p : TNamedIndexItem;arg:pointer);
var stabstr:Pchar;
@ -2142,6 +2158,18 @@ implementation
search_class_member:=nil;
end;
procedure reset_all_defs;
var st:Tsymtable;
begin
st:=symtablestack;
while st<>nil do
begin
Tstoredsymtable(st).reset_all_defs;
st:=st.next;
end;
end;
{*****************************************************************************
Definition Helpers
@ -2350,8 +2378,6 @@ implementation
symtablestack:=nil;
systemunit:=nil;
{$ifdef GDB}
firstglobaldef:=nil;
lastglobaldef:=nil;
globaltypecount:=1;
pglobaltypecount:=@globaltypecount;
{$endif GDB}
@ -2380,7 +2406,11 @@ implementation
end.
{
$Log$
Revision 1.134 2004-02-04 22:15:16 daniel
Revision 1.135 2004-02-06 22:37:00 daniel
* Removed not very usefull nextglobal & previousglobal fields from
Tstoreddef, saving 78 kb of memory
Revision 1.134 2004/02/04 22:15:16 daniel
* Rtti generation moved to ncgutil
* Assmtai usage of symsym removed
* operator overloading cleanup up