* 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;
if assigned(result) then
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;

View File

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

View File

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