compiler: reduce the overhead made in previous revision

git-svn-id: trunk@16507 -
This commit is contained in:
paul 2010-12-05 14:32:05 +00:00
parent 1c0e482d7d
commit 3e5f6e7a60

View File

@ -1828,34 +1828,6 @@ implementation
while assigned(stackitem) do while assigned(stackitem) do
begin begin
srsymtable:=stackitem^.symtable; srsymtable:=stackitem^.symtable;
srsym:=tsym(srsymtable.FindWithHash(hashedid));
if assigned(srsym) then
begin
{ use the class from withsymtable only when it is
defined in this unit }
if (srsymtable.symtabletype=withsymtable) and
assigned(srsymtable.defowner) and
(srsymtable.defowner.typ=objectdef) and
(srsymtable.defowner.owner.symtabletype in [globalsymtable,staticsymtable]) and
(srsymtable.defowner.owner.iscurrentunit) then
contextobjdef:=tobjectdef(srsymtable.defowner)
else
contextobjdef:=current_objectdef;
if (srsym.owner.symtabletype<>objectsymtable) or
is_visible_for_object(srsym,contextobjdef) then
begin
{ we need to know if a procedure references symbols
in the static symtable, because then it can't be
inlined from outside this unit }
if assigned(current_procinfo) and
(srsym.owner.symtabletype=staticsymtable) then
include(current_procinfo.flags,pi_uses_static_symtable);
addsymref(srsym);
result:=true;
exit;
end;
end;
{ also search for class helpers }
if (srsymtable.symtabletype=objectsymtable) then if (srsymtable.symtabletype=objectsymtable) then
begin begin
if searchsym_in_class(tobjectdef(srsymtable.defowner),tobjectdef(srsymtable.defowner),s,srsym,srsymtable) then if searchsym_in_class(tobjectdef(srsymtable.defowner),tobjectdef(srsymtable.defowner),s,srsym,srsymtable) then
@ -1863,6 +1835,36 @@ implementation
result:=true; result:=true;
exit; exit;
end; end;
end
else
begin
srsym:=tsym(srsymtable.FindWithHash(hashedid));
if assigned(srsym) then
begin
{ use the class from withsymtable only when it is
defined in this unit }
if (srsymtable.symtabletype=withsymtable) and
assigned(srsymtable.defowner) and
(srsymtable.defowner.typ=objectdef) and
(srsymtable.defowner.owner.symtabletype in [globalsymtable,staticsymtable]) and
(srsymtable.defowner.owner.iscurrentunit) then
contextobjdef:=tobjectdef(srsymtable.defowner)
else
contextobjdef:=current_objectdef;
if (srsym.owner.symtabletype<>objectsymtable) or
is_visible_for_object(srsym,contextobjdef) then
begin
{ we need to know if a procedure references symbols
in the static symtable, because then it can't be
inlined from outside this unit }
if assigned(current_procinfo) and
(srsym.owner.symtabletype=staticsymtable) then
include(current_procinfo.flags,pi_uses_static_symtable);
addsymref(srsym);
result:=true;
exit;
end;
end;
end; end;
stackitem:=stackitem^.next; stackitem:=stackitem^.next;
end; end;