* renamed fobjcforcedprocname to fforcedprocname and also use it for the

JVM target to force virtual method calls to be name-based rather than
    VMT-entry-based

git-svn-id: trunk@27149 -
This commit is contained in:
Jonas Maebe 2014-03-16 11:24:25 +00:00
parent 908bbed312
commit 84442d05f9
3 changed files with 15 additions and 13 deletions

View File

@ -590,6 +590,10 @@ implementation
result:=inherited pass_1; result:=inherited pass_1;
if assigned(result) then if assigned(result) then
exit; exit;
{ set fforcedprocname so that even virtual method calls will be
name-based (instead of based on VMT entry numbers) }
if procdefinition.typ=procdef then
fforcedprocname:=stringdup(tprocdef(procdefinition).mangledname)
end; end;
end; end;

View File

@ -98,8 +98,10 @@ interface
pushedparasize : longint; pushedparasize : longint;
{ Objective-C support: force the call node to call the routine with { Objective-C support: force the call node to call the routine with
this name rather than the name of symtableprocentry (don't store this name rather than the name of symtableprocentry (don't store
to ppu, is set while processing the node) } to ppu, is set while processing the node). Also used on the JVM
fobjcforcedprocname: pshortstring; target for calling virtual methods, as this is name-based and not
based on VMT entry locations }
fforcedprocname: pshortstring;
public public
{ the symbol containing the definition of the procedure } { the symbol containing the definition of the procedure }
{ to call } { to call }
@ -1202,7 +1204,7 @@ implementation
funcretnode.free; funcretnode.free;
if assigned(varargsparas) then if assigned(varargsparas) then
varargsparas.free; varargsparas.free;
stringdispose(fobjcforcedprocname); stringdispose(fforcedprocname);
inherited destroy; inherited destroy;
end; end;
@ -2059,7 +2061,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); fforcedprocname:=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

View File

@ -869,10 +869,8 @@ implementation
{$endif vtentry} {$endif vtentry}
name_to_call:=''; name_to_call:='';
if assigned(fobjcforcedprocname) then if assigned(fforcedprocname) then
name_to_call:=fobjcforcedprocname^; name_to_call:=fforcedprocname^;
{ in the JVM, virtual method calls are also name-based }
{$ifndef jvm}
{ When methodpointer is typen we don't need (and can't) load { When methodpointer is typen we don't need (and can't) load
a pointer. We can directly call the correct procdef (PFV) } a pointer. We can directly call the correct procdef (PFV) }
if (name_to_call='') and if (name_to_call='') and
@ -951,7 +949,6 @@ implementation
extra_post_call_code; extra_post_call_code;
end end
else else
{$endif jvm}
begin begin
{ Load parameters that are in temporary registers in the { Load parameters that are in temporary registers in the
correct parameter register } correct parameter register }
@ -981,10 +978,9 @@ implementation
extra_interrupt_code; extra_interrupt_code;
extra_call_code; extra_call_code;
if (name_to_call='') then if (name_to_call='') then
if cnf_inherited in callnodeflags then name_to_call:=tprocdef(procdefinition).mangledname;
hlcg.a_call_name_inherited(current_asmdata.CurrAsmList,tprocdef(procdefinition),tprocdef(procdefinition).mangledname) if cnf_inherited in callnodeflags then
else hlcg.a_call_name_inherited(current_asmdata.CurrAsmList,tprocdef(procdefinition),name_to_call)
hlcg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition),tprocdef(procdefinition).mangledname,typedef,po_weakexternal in procdefinition.procoptions).resetiftemp
else else
hlcg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition),name_to_call,typedef,po_weakexternal in procdefinition.procoptions).resetiftemp; hlcg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition),name_to_call,typedef,po_weakexternal in procdefinition.procoptions).resetiftemp;
extra_post_call_code; extra_post_call_code;