* properly fixed allocating procedure symbols, now also works for nested

procedures

git-svn-id: trunk@2029 -
This commit is contained in:
Jonas Maebe 2005-12-22 20:43:29 +00:00
parent 80fef1e8ad
commit dbf94f4713
2 changed files with 27 additions and 10 deletions

View File

@ -54,6 +54,7 @@ interface
function maybe_pushfpu(list:taasmoutput;needed : byte;var l:tlocation) : boolean;
procedure alloc_proc_symbol(pd: tprocdef);
procedure gen_proc_symbol(list:Taasmoutput);
procedure gen_proc_symbol_end(list:Taasmoutput);
procedure gen_proc_entry_code(list:Taasmoutput);
@ -1647,6 +1648,25 @@ implementation
Entry/Exit
****************************************************************************}
procedure alloc_proc_symbol(pd: tprocdef);
var
sym: tai_symbol;
item: tstringlistitem;
begin
item := tstringlistitem(pd.aliasnames.first);
while assigned(item) do
begin
if (cs_profile in aktmoduleswitches) or
(po_global in current_procinfo.procdef.procoptions) then
sym := Tai_symbol.createname_global(item.str,AT_FUNCTION,0)
else
sym := Tai_symbol.createname(item.str,AT_FUNCTION,0);
sym.free;
item := tstringlistitem(item.next);
end;
end;
procedure gen_proc_symbol(list:Taasmoutput);
var
hs : string;

View File

@ -609,7 +609,7 @@ implementation
oldprocinfo : tprocinfo;
oldaktmaxfpuregisters : longint;
oldfilepos : tfileposinfo;
templist, symlist : Taasmoutput;
templist : Taasmoutput;
headertai : tai;
curralign : longint;
begin
@ -642,7 +642,6 @@ implementation
aktbreaklabel:=nil;
aktcontinuelabel:=nil;
templist:=Taasmoutput.create;
symlist:=Taasmoutput.create;
{ add parast/localst to symtablestack }
add_to_symtablestack;
@ -688,12 +687,6 @@ implementation
set_first_temp_offset;
generate_parameter_info;
{ allocate the symbol associated with the procedure, so that }
{ references to itself are not treated as references to }
{ externals }
aktfilepos:=entrypos;
gen_proc_symbol(symlist);
{ Allocate space in temp/registers for parast and localst }
aktfilepos:=entrypos;
gen_alloc_symtable(aktproccode,procdef.parast);
@ -783,9 +776,10 @@ implementation
{ generate symbol and save end of header position }
aktfilepos:=entrypos;
headertai:=tai(symlist.last);
gen_proc_symbol(templist);
headertai:=tai(templist.last);
{ insert symbol }
aktproccode.insertlist(symlist);
aktproccode.insertlist(templist);
{ Free space in temp/registers for parast and localst, must be
done after gen_entry_code }
@ -911,6 +905,9 @@ implementation
var
_class,hp : tobjectdef;
begin
{ allocate the symbol for this procedure }
alloc_proc_symbol(procdef);
{ insert symtables for the class, but only if it is no nested function }
if assigned(procdef._class) and
not(assigned(parent) and