- removed extra "fordefinition" parameter again from tprocdef.mangledname(),

since the definition-specific adorning of JVM mangled names is Jasmin-
    specific, and such code has no place in symdef
  * moved code to adorn JVM mangled names for Jasmin definitions to agjasmin

git-svn-id: branches/jvmbackend@18346 -
This commit is contained in:
Jonas Maebe 2011-08-20 07:49:31 +00:00
parent e269f68359
commit 28740dce2d
41 changed files with 167 additions and 178 deletions

View File

@ -50,6 +50,7 @@ interface
procedure WriteExtraHeader(obj: tobjectdef); procedure WriteExtraHeader(obj: tobjectdef);
procedure WriteInstruction(hp: tai); procedure WriteInstruction(hp: tai);
procedure NewAsmFileForObjectDef(obj: tobjectdef); procedure NewAsmFileForObjectDef(obj: tobjectdef);
function MethodDefinition(pd: tprocdef): string;
procedure WriteProcDef(pd: tprocdef); procedure WriteProcDef(pd: tprocdef);
procedure WriteSymtableProcdefs(st: TSymtable); procedure WriteSymtableProcdefs(st: TSymtable);
procedure WriteSymtableObjectDefs(st: TSymtable); procedure WriteSymtableObjectDefs(st: TSymtable);
@ -336,8 +337,6 @@ implementation
begin begin
if (tai_symbol(hp).sym.typ = AT_FUNCTION) then if (tai_symbol(hp).sym.typ = AT_FUNCTION) then
begin begin
AsmWrite('.method ');
AsmWriteLn(tai_symbol(hp).sym.name);
end end
else else
begin begin
@ -348,8 +347,6 @@ implementation
end; end;
ait_symbol_end : ait_symbol_end :
begin begin
AsmWriteLn('.end method');
AsmLn;
end; end;
ait_instruction : ait_instruction :
@ -523,22 +520,46 @@ implementation
end; end;
procedure TJasminAssembler.WriteProcDef(pd: tprocdef); function TJasminAssembler.MethodDefinition(pd: tprocdef): string;
begin begin
{ abstract method? } case pd.visibility of
if is_javainterface(tdef(pd.owner.defowner)) or vis_hidden,
(po_abstractmethod in pd.procoptions) then vis_strictprivate:
begin result:='private ';
AsmWrite('.method '); vis_strictprotected:
AsmWriteln(pd.mangledname(true)); result:='protected ';
AsmWriteln('.end method'); vis_protected,
AsmLn; vis_private,
exit; vis_public:
end; result:='public ';
else
WriteTree(pd.exprasmlist); internalerror(2010122609);
end;
if (pd.procsym.owner.symtabletype in [globalsymtable,staticsymtable,localsymtable]) or
(po_staticmethod in pd.procoptions) then
result:=result+'static ';
if is_javainterface(tdef(pd.owner.defowner)) then
result:=result+'abstract ';
result:=result+pd.jvmmangledbasename;
end; end;
procedure TJasminAssembler.WriteProcDef(pd: tprocdef);
var
procname: string;
begin
if not assigned(pd.exprasmlist) and
(not is_javainterface(pd.struct) or
(pd.proctypeoption in [potype_unitinit,potype_unitfinalize])) then
exit;
AsmWrite('.method ');
AsmWriteln(MethodDefinition(pd));
WriteTree(pd.exprasmlist);
AsmWriteln('.end method');
AsmLn;
end;
procedure TJasminAssembler.WriteSymtableProcdefs(st: TSymtable); procedure TJasminAssembler.WriteSymtableProcdefs(st: TSymtable);
var var
i : longint; i : longint;

View File

@ -2497,7 +2497,7 @@ unit cgcpu;
end end
{ case 0 } { case 0 }
else else
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname(false)))); list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)));
list.concatlist(current_procinfo.aktlocaldata); list.concatlist(current_procinfo.aktlocaldata);
current_procinfo.Free; current_procinfo.Free;

View File

@ -2097,7 +2097,7 @@ implementation
]) ])
else else
append_entry(DW_TAG_subprogram,true, append_entry(DW_TAG_subprogram,true,
[DW_AT_name,DW_FORM_string,def.mangledname(false)+#0 [DW_AT_name,DW_FORM_string,def.mangledname+#0
{ data continues below } { data continues below }
{ problem: base reg isn't known here { problem: base reg isn't known here
DW_AT_frame_base,DW_FORM_block1,1 DW_AT_frame_base,DW_FORM_block1,1
@ -2152,9 +2152,9 @@ implementation
current_asmdata.asmlists[al_procedures].insertbefore(tai_label.create(procendlabel),def.procendtai); current_asmdata.asmlists[al_procedures].insertbefore(tai_label.create(procendlabel),def.procendtai);
if (target_info.system = system_powerpc64_linux) then if (target_info.system = system_powerpc64_linux) then
procentry := '.' + def.mangledname(false) procentry := '.' + def.mangledname
else else
procentry := def.mangledname(false); procentry := def.mangledname;
append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(procentry)); append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(procentry));
append_labelentry(DW_AT_high_pc,procendlabel); append_labelentry(DW_AT_high_pc,procendlabel);

View File

@ -1058,13 +1058,13 @@ implementation
ss:=tostr(N_LBRAC)+',0,0,'; ss:=tostr(N_LBRAC)+',0,0,';
if target_info.cpu=cpu_powerpc64 then if target_info.cpu=cpu_powerpc64 then
ss:=ss+'.'; ss:=ss+'.';
ss:=ss+def.mangledname(false); ss:=ss+def.mangledname;
if not(af_stabs_use_function_absolute_addresses in target_asm.flags) then if not(af_stabs_use_function_absolute_addresses in target_asm.flags) then
begin begin
ss:=ss+'-'; ss:=ss+'-';
if target_info.cpu=cpu_powerpc64 then if target_info.cpu=cpu_powerpc64 then
ss:=ss+'.'; ss:=ss+'.';
ss:=ss+def.mangledname(false); ss:=ss+def.mangledname;
end; end;
templist.concat(Tai_stab.Create_ansistr(stab_stabn,ss)); templist.concat(Tai_stab.Create_ansistr(stab_stabn,ss));
// RBRAC // RBRAC
@ -1074,7 +1074,7 @@ implementation
ss:=ss+'-'; ss:=ss+'-';
if target_info.cpu=cpu_powerpc64 then if target_info.cpu=cpu_powerpc64 then
ss:=ss+'.'; ss:=ss+'.';
ss:=ss+def.mangledname(false); ss:=ss+def.mangledname;
end; end;
templist.concat(Tai_stab.Create_ansistr(stab_stabn,ss)); templist.concat(Tai_stab.Create_ansistr(stab_stabn,ss));
@ -1091,7 +1091,7 @@ implementation
{ including the LBRAC/RBRAC ones } { including the LBRAC/RBRAC ones }
if (target_info.system in systems_darwin) then if (target_info.system in systems_darwin) then
templist.concat(Tai_stab.create(stab_stabs, templist.concat(Tai_stab.create(stab_stabs,
strpnew('"",'+tostr(N_FUNCTION)+',0,0,'+stabsendlabel.name+'-'+def.mangledname(false)))); strpnew('"",'+tostr(N_FUNCTION)+',0,0,'+stabsendlabel.name+'-'+def.mangledname)));
current_asmdata.asmlists[al_procedures].insertlistafter(def.procendtai,templist); current_asmdata.asmlists[al_procedures].insertlistafter(def.procendtai,templist);
@ -1123,8 +1123,7 @@ implementation
assigned(tprocdef(def.owner.defowner).procsym) then assigned(tprocdef(def.owner.defowner).procsym) then
info := ','+GetSymName(def.procsym)+','+GetSymName(tprocdef(def.owner.defowner).procsym); info := ','+GetSymName(def.procsym)+','+GetSymName(tprocdef(def.owner.defowner).procsym);
end; end;
templist.concat(Tai_stab.Create_ansistr(stab_stabs,'"'+ansistring(obj)+':'+RType+def_stab_number(def.returndef)+info+'",'+tostr(n_function)+',0,'+tostr(def.fileinfo.line)+','+ansistring(def.mangledname(false)))); templist.concat(Tai_stab.Create_ansistr(stab_stabs,'"'+ansistring(obj)+':'+RType+def_stab_number(def.returndef)+info+'",'+tostr(n_function)+',0,'+tostr(def.fileinfo.line)+','+ansistring(def.mangledname)));
current_asmdata.asmlists[al_procedures].insertlistbefore(def.procstarttai,templist); current_asmdata.asmlists[al_procedures].insertlistbefore(def.procstarttai,templist);
{ para types } { para types }

View File

@ -135,13 +135,13 @@ procedure exportname(const s : string; options: word);
var var
item: TCmdStrListItem; item: TCmdStrListItem;
begin begin
exportprocsym(sym,pd.mangledname(false),0,options); exportprocsym(sym,pd.mangledname,0,options);
{ walk through all aliases } { walk through all aliases }
item:=TCmdStrListItem(pd.aliasnames.first); item:=TCmdStrListItem(pd.aliasnames.first);
while assigned(item) do while assigned(item) do
begin begin
{ avoid duplicate entries, sometimes aliasnames contains the mangledname } { avoid duplicate entries, sometimes aliasnames contains the mangledname }
if item.str<>pd.mangledname(false) then if item.str<>pd.mangledname then
exportprocsym(sym,item.str,0,options); exportprocsym(sym,item.str,0,options);
item:=TCmdStrListItem(item.next); item:=TCmdStrListItem(item.next);
end; end;

View File

@ -157,7 +157,7 @@ begin
(target_info.system in [system_i386_freebsd,system_x86_64_freebsd,system_x86_64_linux,system_i386_linux,system_x86_64_solaris,system_i386_solaris]) then (target_info.system in [system_i386_freebsd,system_x86_64_freebsd,system_x86_64_linux,system_i386_linux,system_x86_64_solaris,system_i386_solaris]) then
begin begin
{$ifdef x86} {$ifdef x86}
sym:=current_asmdata.RefAsmSymbol(pd.mangledname(false)); sym:=current_asmdata.RefAsmSymbol(pd.mangledname);
reference_reset_symbol(r,sym,0,sizeof(pint)); reference_reset_symbol(r,sym,0,sizeof(pint));
if cs_create_pic in current_settings.moduleswitches then if cs_create_pic in current_settings.moduleswitches then
r.refaddr:=addr_pic r.refaddr:=addr_pic
@ -167,7 +167,7 @@ begin
{$endif x86} {$endif x86}
end end
else else
cg.a_jmp_name(current_asmdata.asmlists[al_procedures],pd.mangledname(false)); cg.a_jmp_name(current_asmdata.asmlists[al_procedures],pd.mangledname);
current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
end; end;
exportedsymnames.insert(hp2.name^); exportedsymnames.insert(hp2.name^);

View File

@ -1807,7 +1807,7 @@ implementation
procedure thlcgobj.gen_proc_symbol_end(list: TAsmList); procedure thlcgobj.gen_proc_symbol_end(list: TAsmList);
begin begin
list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname(true))); list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname));
current_procinfo.procdef.procendtai:=tai(list.last); current_procinfo.procdef.procendtai:=tai(list.last);
@ -1815,7 +1815,7 @@ implementation
if (current_procinfo.procdef.proctypeoption = potype_proginit) then if (current_procinfo.procdef.proctypeoption = potype_proginit) then
{ setinitname may generate a new section -> don't add to the { setinitname may generate a new section -> don't add to the
current list, because we assume this remains a text section } current list, because we assume this remains a text section }
exportlib.setinitname(current_asmdata.AsmLists[al_exports],current_procinfo.procdef.mangledname(false)); exportlib.setinitname(current_asmdata.AsmLists[al_exports],current_procinfo.procdef.mangledname);
if (current_procinfo.procdef.proctypeoption=potype_proginit) then if (current_procinfo.procdef.proctypeoption=potype_proginit) then
begin begin
@ -2015,7 +2015,7 @@ implementation
begin begin
{ add the procedure to the al_procedures } { add the procedure to the al_procedures }
maybe_new_object_file(current_asmdata.asmlists[al_procedures]); maybe_new_object_file(current_asmdata.asmlists[al_procedures]);
new_section(current_asmdata.asmlists[al_procedures],sec_code,lower(pd.mangledname(true)),getprocalign); new_section(current_asmdata.asmlists[al_procedures],sec_code,lower(pd.mangledname),getprocalign);
current_asmdata.asmlists[al_procedures].concatlist(code); current_asmdata.asmlists[al_procedures].concatlist(code);
{ save local data (casetable) also in the same file } { save local data (casetable) also in the same file }
if assigned(data) and if assigned(data) and

View File

@ -705,11 +705,11 @@ unit cgcpu;
begin begin
if (target_info.system <> system_i386_darwin) then if (target_info.system <> system_i386_darwin) then
begin begin
lab:=current_asmdata.RefAsmSymbol(procdef.mangledname(false)); lab:=current_asmdata.RefAsmSymbol(procdef.mangledname);
list.concat(taicpu.op_sym(A_JMP,S_NO,lab)) list.concat(taicpu.op_sym(A_JMP,S_NO,lab))
end end
else else
list.concat(taicpu.op_sym(A_JMP,S_NO,get_darwin_call_stub(procdef.mangledname(false),false))) list.concat(taicpu.op_sym(A_JMP,S_NO,get_darwin_call_stub(procdef.mangledname,false)))
end; end;
List.concat(Tai_symbol_end.Createname(labelname)); List.concat(Tai_symbol_end.Createname(labelname));

View File

@ -1613,7 +1613,7 @@ unit cgcpu;
end end
{ case 0 } { case 0 }
else else
// list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname(false)))); // list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)));
List.concat(Tai_symbol_end.Createname(labelname)); List.concat(Tai_symbol_end.Createname(labelname));
end; end;

View File

@ -699,7 +699,7 @@ const
begin begin
if tprocsym(sym).procdeflist.count>1 then if tprocsym(sym).procdeflist.count>1 then
Message(asmr_w_calling_overload_func); Message(asmr_w_calling_overload_func);
hs:=tprocdef(tprocsym(sym).procdeflist[0]).mangledname(false); hs:=tprocdef(tprocsym(sym).procdeflist[0]).mangledname;
end; end;
typesym : typesym :
begin begin

View File

@ -1686,7 +1686,7 @@ begin
op_onr24methodaddr; op_onr24methodaddr;
end end
else else
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname(false)))); list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)));
{ Delay slot } { Delay slot }
list.Concat(TAiCpu.Op_none(A_NOP)); list.Concat(TAiCpu.Op_none(A_NOP));

View File

@ -1727,7 +1727,7 @@ implementation
begin begin
if assigned(current_procinfo) and if assigned(current_procinfo) and
not(po_inline in current_procinfo.procdef.procoptions) and not(po_inline in current_procinfo.procdef.procoptions) and
not wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname(true)) then not wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname) then
begin begin
{$ifdef debug_deadcode} {$ifdef debug_deadcode}
writeln(' NOT adding creadion of ',def.typename,' because performed in dead stripped proc: ',current_procinfo.procdef.typename); writeln(' NOT adding creadion of ',def.typename,' because performed in dead stripped proc: ',current_procinfo.procdef.typename);
@ -1923,7 +1923,7 @@ implementation
(srsym.typ<>procsym) or (srsym.typ<>procsym) or
(tprocsym(srsym).ProcdefList.count<>1) then (tprocsym(srsym).ProcdefList.count<>1) then
Message1(cg_f_unknown_compilerproc,'objc.'+msgsendname); Message1(cg_f_unknown_compilerproc,'objc.'+msgsendname);
fobjcforcedprocname:=stringdup(tprocdef(tprocsym(srsym).ProcdefList[0]).mangledname(false)); fobjcforcedprocname:=stringdup(tprocdef(tprocsym(srsym).ProcdefList[0]).mangledname);
{ B) Handle self } { B) Handle self }
{ 1) in case of sending a message to a superclass, self is a pointer to { 1) in case of sending a message to a superclass, self is a pointer to
@ -3878,7 +3878,7 @@ implementation
{$ifdef DEBUGINLINE} {$ifdef DEBUGINLINE}
writeln; writeln;
writeln('**************************',tprocdef(procdefinition).mangledname(false)); writeln('**************************',tprocdef(procdefinition).mangledname);
printnode(output,result); printnode(output,result);
{$endif DEBUGINLINE} {$endif DEBUGINLINE}
end; end;

View File

@ -714,7 +714,7 @@ implementation
assigned(methodpointer) and assigned(methodpointer) and
(methodpointer.nodetype<>typen) and (methodpointer.nodetype<>typen) and
(not assigned(current_procinfo) or (not assigned(current_procinfo) or
wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname(true))) then wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname)) then
tobjectdef(tprocdef(procdefinition).struct).register_vmt_call(tprocdef(procdefinition).extnumber); tobjectdef(tprocdef(procdefinition).struct).register_vmt_call(tprocdef(procdefinition).extnumber);
{$ifdef vtentry} {$ifdef vtentry}
if not is_interface(tprocdef(procdefinition)._class) then if not is_interface(tprocdef(procdefinition)._class) then
@ -763,7 +763,7 @@ implementation
vmtoffset:=tobjectdef(tprocdef(procdefinition).struct).vmtmethodoffset(tprocdef(procdefinition).extnumber); vmtoffset:=tobjectdef(tprocdef(procdefinition).struct).vmtmethodoffset(tprocdef(procdefinition).extnumber);
{ register call for WPO } { register call for WPO }
if (not assigned(current_procinfo) or if (not assigned(current_procinfo) or
wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname(true))) then wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname)) then
tobjectdef(tprocdef(procdefinition).struct).register_vmt_call(tprocdef(procdefinition).extnumber); tobjectdef(tprocdef(procdefinition).struct).register_vmt_call(tprocdef(procdefinition).extnumber);
{$ifndef x86} {$ifndef x86}
pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR); pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
@ -826,9 +826,9 @@ implementation
extra_call_code; extra_call_code;
if (name_to_call='') then if (name_to_call='') then
if cnf_inherited in callnodeflags then if cnf_inherited in callnodeflags then
hlcg.a_call_name_inherited(current_asmdata.CurrAsmList,tprocdef(procdefinition),tprocdef(procdefinition).mangledname(false)) hlcg.a_call_name_inherited(current_asmdata.CurrAsmList,tprocdef(procdefinition),tprocdef(procdefinition).mangledname)
else else
hlcg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition),tprocdef(procdefinition).mangledname(false),po_weakexternal in procdefinition.procoptions) hlcg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition),tprocdef(procdefinition).mangledname,po_weakexternal in procdefinition.procoptions)
else else
hlcg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition),name_to_call,po_weakexternal in procdefinition.procoptions); hlcg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition),name_to_call,po_weakexternal in procdefinition.procoptions);
extra_post_call_code; extra_post_call_code;

View File

@ -500,7 +500,7 @@ implementation
not is_objectpascal_helper(procdef.struct) then not is_objectpascal_helper(procdef.struct) then
begin begin
if (not assigned(current_procinfo) or if (not assigned(current_procinfo) or
wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname(true))) then wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname)) then
tobjectdef(procdef.struct).register_vmt_call(procdef.extnumber); tobjectdef(procdef.struct).register_vmt_call(procdef.extnumber);
{$ifdef vtentry} {$ifdef vtentry}
if not is_interface(procdef.struct) then if not is_interface(procdef.struct) then
@ -527,7 +527,7 @@ implementation
else else
begin begin
{ load address of the function } { load address of the function }
reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname(false)),0,sizeof(pint)); reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname),0,sizeof(pint));
hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister); cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister);
cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference); cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference);
@ -538,14 +538,14 @@ implementation
pd:=tprocdef(tprocsym(symtableentry).ProcdefList[0]); pd:=tprocdef(tprocsym(symtableentry).ProcdefList[0]);
if (po_external in pd.procoptions) then if (po_external in pd.procoptions) then
location.reference.base := location.reference.base :=
cg.g_indirect_sym_load(current_asmdata.CurrAsmList,pd.mangledname(false), cg.g_indirect_sym_load(current_asmdata.CurrAsmList,pd.mangledname,
po_weakexternal in pd.procoptions); po_weakexternal in pd.procoptions);
{!!!!! Be aware, work on virtual methods too } {!!!!! Be aware, work on virtual methods too }
if (location.reference.base = NR_NO) then if (location.reference.base = NR_NO) then
if not(po_weakexternal in pd.procoptions) then if not(po_weakexternal in pd.procoptions) then
location.reference.symbol:=current_asmdata.RefAsmSymbol(procdef.mangledname(false)) location.reference.symbol:=current_asmdata.RefAsmSymbol(procdef.mangledname)
else else
location.reference.symbol:=current_asmdata.WeakRefAsmSymbol(procdef.mangledname(false)); location.reference.symbol:=current_asmdata.WeakRefAsmSymbol(procdef.mangledname);
end; end;
end; end;
labelsym : labelsym :

View File

@ -341,7 +341,7 @@ implementation
if not(po_virtualmethod in tprocdef(propaccesslist.procdef).procoptions) or if not(po_virtualmethod in tprocdef(propaccesslist.procdef).procoptions) or
is_objectpascal_helper(tprocdef(propaccesslist.procdef).struct) then is_objectpascal_helper(tprocdef(propaccesslist.procdef).struct) then
begin begin
current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname(false),0)); current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname,0));
typvalue:=1; typvalue:=1;
end end
else else

View File

@ -2296,7 +2296,7 @@ implementation
procedure gen_proc_symbol_end(list:TAsmList); procedure gen_proc_symbol_end(list:TAsmList);
begin begin
list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname(true))); list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname));
current_procinfo.procdef.procendtai:=tai(list.last); current_procinfo.procdef.procendtai:=tai(list.last);

View File

@ -427,7 +427,7 @@ implementation
inherited printnodedata(t); inherited printnodedata(t);
write(t,printnodeindention,'symbol = ',symtableentry.name); write(t,printnodeindention,'symbol = ',symtableentry.name);
if symtableentry.typ=procsym then if symtableentry.typ=procsym then
write(t,printnodeindention,'procdef = ',fprocdef.mangledname(false)); write(t,printnodeindention,'procdef = ',fprocdef.mangledname);
writeln(t,''); writeln(t,'');
end; end;

View File

@ -244,7 +244,7 @@ implementation
if not(nf_ignore_for_wpo in flags) and if not(nf_ignore_for_wpo in flags) and
(not assigned(current_procinfo) or (not assigned(current_procinfo) or
(po_inline in current_procinfo.procdef.procoptions) or (po_inline in current_procinfo.procdef.procoptions) or
wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname(true))) then wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname)) then
begin begin
{ keep track of which classes might be instantiated via a classrefdef } { keep track of which classes might be instantiated via a classrefdef }
if (left.resultdef.typ=classrefdef) then if (left.resultdef.typ=classrefdef) then

View File

@ -980,7 +980,7 @@ implementation
current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(pint)))); current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(pint))));
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(p^.nl)); current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(p^.nl));
current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(pint)))); current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(pint))));
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname(false),0)); current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,0));
if assigned(p^.r) then if assigned(p^.r) then
writestrentry(p^.r); writestrentry(p^.r);
@ -1024,7 +1024,7 @@ implementation
current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(longint)))); current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(longint))));
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(p^.data.messageinf.i)); current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(p^.data.messageinf.i));
current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(pint)))); current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(pint))));
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname(false),0)); current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,0));
if assigned(p^.r) then if assigned(p^.r) then
writeintentry(p^.r); writeintentry(p^.r);
@ -1102,7 +1102,7 @@ implementation
begin begin
if assigned(p^.l) then if assigned(p^.l) then
writedmtaddressentry(p^.l); writedmtaddressentry(p^.l);
al_globals.concat(Tai_const_symbol.Createname(p^.data.mangledname(false),0)); al_globals.concat(Tai_const_symbol.Createname(p^.data.mangledname,0));
if assigned(p^.r) then if assigned(p^.r) then
writedmtaddressentry(p^.r); writedmtaddressentry(p^.r);
end; end;
@ -1186,7 +1186,7 @@ implementation
if po_abstractmethod in pd.procoptions then if po_abstractmethod in pd.procoptions then
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)) current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil))
else else
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(pd.mangledname(false),0)); current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(pd.mangledname,0));
end; end;
end; end;
end; end;
@ -1311,7 +1311,7 @@ implementation
begin begin
pd:=tprocdef(AImplIntf.procdefs[i]); pd:=tprocdef(AImplIntf.procdefs[i]);
hs:=make_mangledname('WRPR',_class.owner,_class.objname^+'_$_'+AImplIntf.IntfDef.objname^+'_$_'+ hs:=make_mangledname('WRPR',_class.owner,_class.objname^+'_$_'+AImplIntf.IntfDef.objname^+'_$_'+
tostr(i)+'_$_'+pd.mangledname(false)); tostr(i)+'_$_'+pd.mangledname);
{ create reference } { create reference }
rawdata.concat(Tai_const.Createname(hs,0)); rawdata.concat(Tai_const.Createname(hs,0));
end; end;
@ -1358,7 +1358,7 @@ implementation
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_pint(AImplIntf.VtblImplIntf.IOffset)); current_asmdata.asmlists[al_globals].concat(Tai_const.Create_pint(AImplIntf.VtblImplIntf.IOffset));
etStaticMethodResult, etStaticMethodClass: etStaticMethodResult, etStaticMethodClass:
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname( current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(
tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef).mangledname(false), tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef).mangledname,
0 0
)); ));
etVirtualMethodResult, etVirtualMethodClass: etVirtualMethodResult, etVirtualMethodClass:
@ -1468,7 +1468,7 @@ implementation
if (po_abstractmethod in vmtpd.procoptions) then if (po_abstractmethod in vmtpd.procoptions) then
procname:='FPC_ABSTRACTERROR' procname:='FPC_ABSTRACTERROR'
else if not wpoinfomanager.optimized_name_for_vmt(_class,vmtpd,procname) then else if not wpoinfomanager.optimized_name_for_vmt(_class,vmtpd,procname) then
procname:=vmtpd.mangledname(false); procname:=vmtpd.mangledname;
List.concat(Tai_const.createname(procname,0)); List.concat(Tai_const.createname(procname,0));
{$ifdef vtentry} {$ifdef vtentry}
hs:='VTENTRY'+'_'+_class.vmt_mangledname+'$$'+tostr(_class.vmtmethodoffset(i) div sizeof(pint)); hs:='VTENTRY'+'_'+_class.vmt_mangledname+'$$'+tostr(_class.vmtmethodoffset(i) div sizeof(pint));

View File

@ -322,7 +322,7 @@ procedure tobjcrttiwriter.gen_objc_methods(list: tasmlist; objccls: tobjectdef;
{ reference to the obj-c encoded function parameters (signature) } { reference to the obj-c encoded function parameters (signature) }
list.Concat(tai_const.Create_sym(defs[i].encsym)); list.Concat(tai_const.Create_sym(defs[i].encsym));
{ mangled name of the method } { mangled name of the method }
sym:=current_asmdata.GetAsmSymbol(defs[i].def.mangledname(false)); sym:=current_asmdata.GetAsmSymbol(defs[i].def.mangledname);
if not assigned(sym) then if not assigned(sym) then
internalerror(2009091601); internalerror(2009091601);
list.Concat(tai_const.Create_sym(sym)); list.Concat(tai_const.Create_sym(sym));

View File

@ -104,7 +104,7 @@ unit opttail;
begin begin
{ found one! } { found one! }
{ {
writeln('tail recursion optimization for ',p.mangledname(false)); writeln('tail recursion optimization for ',p.mangledname);
printnode(output,n); printnode(output,n);
} }
{ create assignments for all parameters } { create assignments for all parameters }

View File

@ -708,7 +708,7 @@ unit optvirt;
vmcs_yes: vmcs_yes:
begin begin
{ add info about devirtualised vmt entry } { add info about devirtualised vmt entry }
classdevirtinfo.addstaticmethod(i,pvmtentry(node.def.vmtentries[i])^.procdef.mangledname(false)); classdevirtinfo.addstaticmethod(i,pvmtentry(node.def.vmtentries[i])^.procdef.mangledname);
end; end;
vmcs_unreachable: vmcs_unreachable:
begin begin

View File

@ -107,7 +107,7 @@ implementation
not(po_exports in pd.procoptions)) then not(po_exports in pd.procoptions)) then
Message(parser_e_illegal_symbol_exported) Message(parser_e_illegal_symbol_exported)
else else
InternalProcName:=pd.mangledname(false); InternalProcName:=pd.mangledname;
end; end;
typesym : typesym :
begin begin

View File

@ -404,12 +404,12 @@ implementation
begin begin
pd := tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_constructor); pd := tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_constructor);
if assigned(pd) then if assigned(pd) then
unitinits.concat(Tai_const.Createname(pd.mangledname(false),0)) unitinits.concat(Tai_const.Createname(pd.mangledname,0))
else else
unitinits.concat(Tai_const.Create_pint(0)); unitinits.concat(Tai_const.Create_pint(0));
pd := tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_destructor); pd := tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_destructor);
if assigned(pd) then if assigned(pd) then
unitinits.concat(Tai_const.Createname(pd.mangledname(false),0)) unitinits.concat(Tai_const.Createname(pd.mangledname,0))
else else
unitinits.concat(Tai_const.Create_pint(0)); unitinits.concat(Tai_const.Create_pint(0));
inc(count); inc(count);
@ -908,7 +908,7 @@ implementation
include(pd.procoptions,po_hascallingconvention); include(pd.procoptions,po_hascallingconvention);
pd.forwarddef:=false; pd.forwarddef:=false;
pd.setmangledname(target_info.cprefix+name); pd.setmangledname(target_info.cprefix+name);
pd.aliasnames.insert(pd.mangledname(true)); pd.aliasnames.insert(pd.mangledname);
handle_calling_convention(pd); handle_calling_convention(pd);
{ We don't need is a local symtable. Change it into the static { We don't need is a local symtable. Change it into the static
symtable } symtable }
@ -1522,13 +1522,13 @@ implementation
((tsymtable(arg).symtabletype=staticsymtable) and (po_public in tprocdef(tprocsym(sym).ProcdefList[i]).procoptions)) ((tsymtable(arg).symtabletype=staticsymtable) and (po_public in tprocdef(tprocsym(sym).ProcdefList[i]).procoptions))
) then ) then
begin begin
procexport(tprocdef(tprocsym(sym).ProcdefList[i]).mangledname(false)); procexport(tprocdef(tprocsym(sym).ProcdefList[i]).mangledname);
{ walk through all aliases } { walk through all aliases }
item:=TCmdStrListItem(tprocdef(tprocsym(sym).ProcdefList[i]).aliasnames.first); item:=TCmdStrListItem(tprocdef(tprocsym(sym).ProcdefList[i]).aliasnames.first);
while assigned(item) do while assigned(item) do
begin begin
{ avoid duplicate entries, sometimes aliasnames contains the mangledname } { avoid duplicate entries, sometimes aliasnames contains the mangledname }
if item.str<>tprocdef(tprocsym(sym).ProcdefList[i]).mangledname(false) then if item.str<>tprocdef(tprocsym(sym).ProcdefList[i]).mangledname then
procexport(item.str); procexport(item.str);
item:=TCmdStrListItem(item.next); item:=TCmdStrListItem(item.next);
end; end;

View File

@ -730,12 +730,12 @@ unit cgppc;
case target_info.system of case target_info.system of
system_powerpc_darwin, system_powerpc_darwin,
system_powerpc64_darwin: system_powerpc64_darwin:
list.concat(taicpu.op_sym(A_B,get_darwin_call_stub(procdef.mangledname(false),false))); list.concat(taicpu.op_sym(A_B,get_darwin_call_stub(procdef.mangledname,false)));
system_powerpc64_linux: system_powerpc64_linux:
{$note ts:todo add GOT change?? - think not needed :) } {$note ts:todo add GOT change?? - think not needed :) }
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname(false)))); list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol('.' + procdef.mangledname)));
else else
list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname(false)))) list.concat(taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(procdef.mangledname)))
end; end;
List.concat(Tai_symbol_end.Createname(labelname)); List.concat(Tai_symbol_end.Createname(labelname));
end; end;

View File

@ -1582,7 +1582,7 @@ implementation
isnestedproc:=(current_procinfo.procdef.parast.symtablelevel>normal_function_level); isnestedproc:=(current_procinfo.procdef.parast.symtablelevel>normal_function_level);
{ Insert mangledname } { Insert mangledname }
pd.aliasnames.insert(pd.mangledname(true)); pd.aliasnames.insert(pd.mangledname);
{ Handle Export of this procedure } { Handle Export of this procedure }
if (po_exports in pd.procoptions) and if (po_exports in pd.procoptions) and
@ -1590,7 +1590,7 @@ implementation
begin begin
pd.aliasnames.insert(pd.procsym.realname); pd.aliasnames.insert(pd.procsym.realname);
if cs_link_deffile in current_settings.globalswitches then if cs_link_deffile in current_settings.globalswitches then
deffile.AddExport(pd.mangledname(false)); deffile.AddExport(pd.mangledname);
end; end;
{ Insert result variables in the localst } { Insert result variables in the localst }
@ -1817,9 +1817,9 @@ implementation
begin begin
if (po_global in pd.procoptions) or if (po_global in pd.procoptions) or
(cs_profile in current_settings.moduleswitches) then (cs_profile in current_settings.moduleswitches) then
current_asmdata.DefineAsmSymbol(pd.mangledname(false),AB_GLOBAL,AT_FUNCTION) current_asmdata.DefineAsmSymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION)
else else
current_asmdata.DefineAsmSymbol(pd.mangledname(false),AB_LOCAL,AT_FUNCTION); current_asmdata.DefineAsmSymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION);
end; end;
current_structdef:=old_current_structdef; current_structdef:=old_current_structdef;

View File

@ -346,7 +346,7 @@ implementation
{ update wpo info } { update wpo info }
if not assigned(current_procinfo) or if not assigned(current_procinfo) or
(po_inline in current_procinfo.procdef.procoptions) or (po_inline in current_procinfo.procdef.procoptions) or
wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname(true)) then wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname) then
tobjectdef(tclassrefdef(n.resultdef).pointeddef).register_maybe_created_object_type; tobjectdef(tclassrefdef(n.resultdef).pointeddef).register_maybe_created_object_type;
end; end;
niln: niln:
@ -547,7 +547,7 @@ implementation
if po_abstractmethod in pd.procoptions then if po_abstractmethod in pd.procoptions then
Message(type_e_cant_take_address_of_abstract_method) Message(type_e_cant_take_address_of_abstract_method)
else else
list.concat(Tai_const.Createname(pd.mangledname(false),offset)); list.concat(Tai_const.Createname(pd.mangledname,offset));
end; end;
staticvarsym : staticvarsym :
list.concat(Tai_const.Createname(tstaticvarsym(srsym).mangledname,offset)); list.concat(Tai_const.Createname(tstaticvarsym(srsym).mangledname,offset));
@ -1014,7 +1014,7 @@ implementation
(tloadnode(n).symtableentry.typ=procsym) then (tloadnode(n).symtableentry.typ=procsym) then
begin begin
pd:=tloadnode(n).procdef; pd:=tloadnode(n).procdef;
list.concat(Tai_const.createname(pd.mangledname(false),0)); list.concat(Tai_const.createname(pd.mangledname,0));
{ nested procvar typed consts can only be initialised with nil { nested procvar typed consts can only be initialised with nil
(checked above) or with a global procedure (checked here), (checked above) or with a global procedure (checked here),
because in other cases we need a valid frame pointer } because in other cases we need a valid frame pointer }

View File

@ -987,28 +987,28 @@ unit raatt;
AS_DATA: AS_DATA:
Begin Begin
new_section(curList,sec_data,lower(current_procinfo.procdef.mangledname(true)),0); new_section(curList,sec_data,lower(current_procinfo.procdef.mangledname),0);
lasTSec:=sec_data; lasTSec:=sec_data;
Consume(AS_DATA); Consume(AS_DATA);
end; end;
AS_TEXT: AS_TEXT:
Begin Begin
new_section(curList,sec_code,lower(current_procinfo.procdef.mangledname(true)),0); new_section(curList,sec_code,lower(current_procinfo.procdef.mangledname),0);
lasTSec:=sec_code; lasTSec:=sec_code;
Consume(AS_TEXT); Consume(AS_TEXT);
end; end;
AS_INIT: AS_INIT:
Begin Begin
new_section(curList,sec_init,lower(current_procinfo.procdef.mangledname(true)),0); new_section(curList,sec_init,lower(current_procinfo.procdef.mangledname),0);
lasTSec:=sec_init; lasTSec:=sec_init;
Consume(AS_INIT); Consume(AS_INIT);
end; end;
AS_FINI: AS_FINI:
Begin Begin
new_section(curList,sec_fini,lower(current_procinfo.procdef.mangledname(true)),0); new_section(curList,sec_fini,lower(current_procinfo.procdef.mangledname),0);
lasTSec:=sec_fini; lasTSec:=sec_fini;
Consume(AS_FINI); Consume(AS_FINI);
end; end;
@ -1178,7 +1178,7 @@ unit raatt;
if lasTSec<>sec_code then if lasTSec<>sec_code then
begin begin
Message(asmr_w_assembler_code_not_returned_to_text); Message(asmr_w_assembler_code_not_returned_to_text);
new_section(curList,sec_code,lower(current_procinfo.procdef.mangledname(true)),0); new_section(curList,sec_code,lower(current_procinfo.procdef.mangledname),0);
end; end;
{ Return the list in an asmnode } { Return the list in an asmnode }
assemble:=curlist; assemble:=curlist;
@ -1450,7 +1450,7 @@ unit raatt;
begin begin
if Tprocsym(sym).ProcdefList.Count>1 then if Tprocsym(sym).ProcdefList.Count>1 then
Message(asmr_w_calling_overload_func); Message(asmr_w_calling_overload_func);
hs:=tprocdef(tprocsym(sym).ProcdefList[0]).mangledname(false); hs:=tprocdef(tprocsym(sym).ProcdefList[0]).mangledname;
hssymtyp:=AT_FUNCTION; hssymtyp:=AT_FUNCTION;
end; end;
typesym : typesym :

View File

@ -906,7 +906,7 @@ Begin
Message(asmr_w_calling_overload_func); Message(asmr_w_calling_overload_func);
l:=opr.ref.offset; l:=opr.ref.offset;
opr.typ:=OPR_SYMBOL; opr.typ:=OPR_SYMBOL;
opr.symbol:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(sym).ProcdefList[0]).mangledname(false)); opr.symbol:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(sym).ProcdefList[0]).mangledname);
opr.symofs:=l; opr.symofs:=l;
hasvar:=true; hasvar:=true;
SetupVar:=TRUE; SetupVar:=TRUE;
@ -1400,7 +1400,7 @@ Begin
procdef:=tprocdef(tprocsym(sym).ProcdefList[0]); procdef:=tprocdef(tprocsym(sym).ProcdefList[0]);
if (not needvmtofs) then if (not needvmtofs) then
begin begin
mangledname:=procdef.mangledname(false); mangledname:=procdef.mangledname;
end end
else else
begin begin

View File

@ -1393,7 +1393,7 @@ implementation
end end
else else
begin begin
reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname(false)),0,sizeof(pint)); reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname),0,sizeof(pint));
href.refaddr := addr_high; href.refaddr := addr_high;
list.concat(taicpu.op_ref_reg(A_SETHI,href,NR_G1)); list.concat(taicpu.op_ref_reg(A_SETHI,href,NR_G1));
g1_used:=true; g1_used:=true;

View File

@ -115,7 +115,7 @@ unit ncpuset;
{ Delay slot } { Delay slot }
current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP)); current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP));
{ generate jump table } { generate jump table }
new_section(current_procinfo.aktlocaldata,sec_data,current_procinfo.procdef.mangledname(true),sizeof(pint)); new_section(current_procinfo.aktlocaldata,sec_data,current_procinfo.procdef.mangledname,sizeof(pint));
current_procinfo.aktlocaldata.concat(Tai_label.Create(table)); current_procinfo.aktlocaldata.concat(Tai_label.Create(table));
last:=min_; last:=min_;
genitem(current_procinfo.aktlocaldata,hp); genitem(current_procinfo.aktlocaldata,hp);

View File

@ -573,16 +573,14 @@ interface
procedure derefimpl;override; procedure derefimpl;override;
function GetSymtable(t:tGetSymtable):TSymtable;override; function GetSymtable(t:tGetSymtable):TSymtable;override;
function GetTypeName : string;override; function GetTypeName : string;override;
{ on some targets the mangled name for defining a procedure is function mangledname : string;
different from the mangled name used for calling it later }
function mangledname(fordefinition: boolean) : string;
procedure setmangledname(const s : string); procedure setmangledname(const s : string);
function fullprocname(showhidden:boolean):string; function fullprocname(showhidden:boolean):string;
function defaultmangledname: string; function defaultmangledname: string;
function cplusplusmangledname : string; function cplusplusmangledname : string;
function objcmangledname : string; function objcmangledname : string;
function jvmmangledname: string; function jvmmangledbasename: string;
procedure adornmangledname(var name: string; fordefinition: boolean);{$ifndef jvm}inline;{$endif} procedure makejvmmangledcallname(var name: string);
function is_methodpointer:boolean;override; function is_methodpointer:boolean;override;
function is_addressonly:boolean;override; function is_addressonly:boolean;override;
procedure make_external; procedure make_external;
@ -3616,7 +3614,7 @@ implementation
if (cs_link_deffile in current_settings.globalswitches) and if (cs_link_deffile in current_settings.globalswitches) and
(tf_need_export in target_info.flags) and (tf_need_export in target_info.flags) and
(po_exports in procoptions) then (po_exports in procoptions) then
deffile.AddExport(mangledname(false)); deffile.AddExport(mangledname);
forwarddef:=false; forwarddef:=false;
interfacedef:=false; interfacedef:=false;
hasforward:=false; hasforward:=false;
@ -3954,7 +3952,7 @@ implementation
end; end;
function tprocdef.mangledname(fordefinition: boolean) : string; function tprocdef.mangledname : string;
begin begin
if assigned(_mangledname) then if assigned(_mangledname) then
begin begin
@ -3963,20 +3961,19 @@ implementation
{$else} {$else}
mangledname:=_mangledname^; mangledname:=_mangledname^;
{$endif} {$endif}
adornmangledname(mangledname,fordefinition);
exit; exit;
end; end;
{$ifndef jvm} {$ifndef jvm}
mangledname:=defaultmangledname; mangledname:=defaultmangledname;
{$else not jvm} {$else not jvm}
mangledname:=jvmmangledname; mangledname:=jvmmangledbasename;
makejvmmangledcallname(mangledname);
{$endif not jvm} {$endif not jvm}
{$ifdef compress} {$ifdef compress}
_mangledname:=stringdup(minilzw_encode(mangledname)); _mangledname:=stringdup(minilzw_encode(mangledname));
{$else} {$else}
_mangledname:=stringdup(mangledname); _mangledname:=stringdup(mangledname);
{$endif} {$endif}
adornmangledname(mangledname,fordefinition);
end; end;
@ -4202,78 +4199,50 @@ implementation
end; end;
procedure tprocdef.adornmangledname(var name: string; fordefinition: boolean); procedure tprocdef.makejvmmangledcallname(var name: string);
{$ifdef jvm}
var var
owningunit: tsymtable; owningunit: tsymtable;
tmpresult: string; tmpresult: string;
{$endif jvm}
begin begin
{$ifdef jvm} { see tprocdef.jvmmangledbasename for description of the format }
{ see tprocdef.jvmmangledname for description of the format } { invocation: package/class name }
if fordefinition then case procsym.owner.symtabletype of
begin globalsymtable,
case visibility of staticsymtable,
vis_hidden, localsymtable:
vis_strictprivate: begin
tmpresult:='private '; if po_has_importdll in procoptions then
vis_strictprotected:
tmpresult:='protected ';
vis_protected,
vis_private,
vis_public:
tmpresult:='public ';
else
internalerror(2010122609);
end;
if (procsym.owner.symtabletype in [globalsymtable,staticsymtable,localsymtable]) or
(po_staticmethod in procoptions) then
tmpresult:=tmpresult+'static ';
if is_javainterface(tdef(owner.defowner)) then
tmpresult:=tmpresult+'abstract ';
end
else
begin
{ invocation: package/class name }
case procsym.owner.symtabletype of
globalsymtable,
staticsymtable,
localsymtable:
begin begin
if po_has_importdll in procoptions then tmpresult:='';
begin { import_dll comes from "external 'import_dll_name' name 'external_name'" }
tmpresult:=''; if assigned(import_dll) then
{ import_dll comes from "external 'import_dll_name' name 'external_name'" } tmpresult:=import_dll^+'/'
if assigned(import_dll) then
tmpresult:=import_dll^+'/'
else
internalerror(2010122607);
end;
owningunit:=procsym.owner;
while (owningunit.symtabletype in [localsymtable,objectsymtable,recordsymtable]) do
owningunit:=owner.defowner.owner;
tmpresult:=tmpresult+owningunit.realname^+'/';
end;
objectsymtable:
case tobjectdef(procsym.owner.defowner).objecttype of
odt_javaclass,
odt_interfacejava:
begin
tmpresult:=tobjectdef(procsym.owner.defowner).jvm_full_typename+'/'
end
else else
internalerror(2010122606); internalerror(2010122607);
end;
owningunit:=procsym.owner;
while (owningunit.symtabletype in [localsymtable,objectsymtable,recordsymtable]) do
owningunit:=owner.defowner.owner;
tmpresult:=tmpresult+owningunit.realname^+'/';
end;
objectsymtable:
case tobjectdef(procsym.owner.defowner).objecttype of
odt_javaclass,
odt_interfacejava:
begin
tmpresult:=tobjectdef(procsym.owner.defowner).jvm_full_typename+'/'
end end
else else
internalerror(2010122605); internalerror(2010122606);
end; end
end; else
internalerror(2010122605);
end;
name:=tmpresult+name; name:=tmpresult+name;
{$endif}
end; end;
function tprocdef.jvmmangledname: string; function tprocdef.jvmmangledbasename: string;
var var
owningunit: tsymtable; owningunit: tsymtable;
parasize, parasize,
@ -4283,7 +4252,7 @@ implementation
tmpresult: ansistring; tmpresult: ansistring;
begin begin
{ format: { format:
* method definition: * method definition (in Jasmin):
(private|protected|public) [static] method(parametertypes)returntype (private|protected|public) [static] method(parametertypes)returntype
* method invocation * method invocation
package/class/method(parametertypes)returntype package/class/method(parametertypes)returntype
@ -5559,12 +5528,12 @@ implementation
begin begin
{ copied from psub.read_proc } { copied from psub.read_proc }
if assigned(tobjectdef(pd.struct).import_lib) then if assigned(tobjectdef(pd.struct).import_lib) then
current_module.AddExternalImport(tobjectdef(pd.struct).import_lib^,pd.mangledname(false),pd.mangledname(false),0,false,false) current_module.AddExternalImport(tobjectdef(pd.struct).import_lib^,pd.mangledname,pd.mangledname,0,false,false)
else else
begin begin
{ add import name to external list for DLL scanning } { add import name to external list for DLL scanning }
if tf_has_dllscanner in target_info.flags then if tf_has_dllscanner in target_info.flags then
current_module.dllscannerinputlist.Add(pd.mangledname(false),pd); current_module.dllscannerinputlist.Add(pd.mangledname,pd);
end; end;
end; end;

View File

@ -146,13 +146,13 @@ begin
{ the manglednames can already be the same when the procedure { the manglednames can already be the same when the procedure
is declared with cdecl } is declared with cdecl }
pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]); pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]);
if pd.mangledname(false)<>hp2.name^ then if pd.mangledname<>hp2.name^ then
begin begin
{$ifdef i386} {$ifdef i386}
{ place jump in al_procedures } { place jump in al_procedures }
current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90)); current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname(false)))); current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
{$endif i386} {$endif i386}
end; end;

View File

@ -147,13 +147,13 @@ begin
{ the manglednames can already be the same when the procedure { the manglednames can already be the same when the procedure
is declared with cdecl } is declared with cdecl }
pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]); pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]);
if pd.mangledname(false)<>hp2.name^ then if pd.mangledname<>hp2.name^ then
begin begin
{$ifdef i386} {$ifdef i386}
{ place jump in al_procedures } { place jump in al_procedures }
current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90)); current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname(false)))); current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
{$endif i386} {$endif i386}
end; end;

View File

@ -224,13 +224,13 @@ begin
{ the manglednames can already be the same when the procedure { the manglednames can already be the same when the procedure
is declared with cdecl } is declared with cdecl }
pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]); pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]);
if pd.mangledname(false)<>hp2.name^ then if pd.mangledname<>hp2.name^ then
begin begin
{$ifdef i386} {$ifdef i386}
{ place jump in al_procedures } { place jump in al_procedures }
current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90)); current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname(false)))); current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
{$endif i386} {$endif i386}
end; end;

View File

@ -226,13 +226,13 @@ begin
{ the manglednames can already be the same when the procedure { the manglednames can already be the same when the procedure
is declared with cdecl } is declared with cdecl }
pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]); pd:=tprocdef(tprocsym(hp2.sym).ProcdefList[0]);
if pd.mangledname(false)<>hp2.name^ then if pd.mangledname<>hp2.name^ then
begin begin
{$ifdef i386} {$ifdef i386}
{ place jump in al_procedures } { place jump in al_procedures }
current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90)); current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname(false)))); current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(pd.mangledname)));
current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^));
{$endif i386} {$endif i386}
end; end;

View File

@ -866,7 +866,7 @@ implementation
staticvarsym : staticvarsym :
asmsym:=current_asmdata.RefAsmSymbol(tstaticvarsym(hp.sym).mangledname); asmsym:=current_asmdata.RefAsmSymbol(tstaticvarsym(hp.sym).mangledname);
procsym : procsym :
asmsym:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(hp.sym).ProcdefList[0]).mangledname(false)) asmsym:=current_asmdata.RefAsmSymbol(tprocdef(tprocsym(hp.sym).ProcdefList[0]).mangledname)
else else
internalerror(200709272); internalerror(200709272);
end end

View File

@ -2017,10 +2017,10 @@ unit cgx86;
mcountPrefix:=''; mcountPrefix:='';
end; end;
current_asmdata.getaddrlabel(pl); current_asmdata.getaddrlabel(pl);
new_section(list,sec_data,lower(current_procinfo.procdef.mangledname(true)),sizeof(pint)); new_section(list,sec_data,lower(current_procinfo.procdef.mangledname),sizeof(pint));
list.concat(Tai_label.Create(pl)); list.concat(Tai_label.Create(pl));
list.concat(Tai_const.Create_32bit(0)); list.concat(Tai_const.Create_32bit(0));
new_section(list,sec_code,lower(current_procinfo.procdef.mangledname(true)),0); new_section(list,sec_code,lower(current_procinfo.procdef.mangledname),0);
list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EDX)); list.concat(Taicpu.Op_reg(A_PUSH,S_L,NR_EDX));
list.concat(Taicpu.Op_sym_ofs_reg(A_MOV,S_L,pl,0,NR_EDX)); list.concat(Taicpu.Op_sym_ofs_reg(A_MOV,S_L,pl,0,NR_EDX));
a_call_name(list,target_info.Cprefix+mcountprefix+'mcount',false); a_call_name(list,target_info.Cprefix+mcountprefix+'mcount',false);

View File

@ -147,7 +147,7 @@ implementation
jtlist:=current_procinfo.aktlocaldata; jtlist:=current_procinfo.aktlocaldata;
sectype:=sec_data; sectype:=sec_data;
end; end;
new_section(jtlist,sectype,current_procinfo.procdef.mangledname(true),sizeof(aint)); new_section(jtlist,sectype,current_procinfo.procdef.mangledname,sizeof(aint));
jtlist.concat(Tai_label.Create(table)); jtlist.concat(Tai_label.Create(table));
genitem(jtlist,hp); genitem(jtlist,hp);
end; end;

View File

@ -996,7 +996,7 @@ Unit Rax86int;
begin begin
if Tprocsym(sym).ProcdefList.Count>1 then if Tprocsym(sym).ProcdefList.Count>1 then
Message(asmr_w_calling_overload_func); Message(asmr_w_calling_overload_func);
hs:=tprocdef(tprocsym(sym).ProcdefList[0]).mangledname(false); hs:=tprocdef(tprocsym(sym).ProcdefList[0]).mangledname;
hssymtyp:=AT_FUNCTION; hssymtyp:=AT_FUNCTION;
end; end;
typesym : typesym :

View File

@ -192,7 +192,7 @@ unit cgcpu;
end end
else else
begin begin
sym:=current_asmdata.RefAsmSymbol(procdef.mangledname(false)); sym:=current_asmdata.RefAsmSymbol(procdef.mangledname);
reference_reset_symbol(r,sym,0,sizeof(pint)); reference_reset_symbol(r,sym,0,sizeof(pint));
if (cs_create_pic in current_settings.moduleswitches) and if (cs_create_pic in current_settings.moduleswitches) and
{ darwin/x86_64's assembler doesn't want @PLT after call symbols } { darwin/x86_64's assembler doesn't want @PLT after call symbols }