Several adjustments because virtual methods in helpers are just normal methods and a VMT isn't generated for them either.

* $CPU/cgcpu.pas: disable the generation of VMT loading code
* dbgstabs.pas, dbgdwarf.pas: treat virtual methods of helpers as normal methods
* ncgcal.pas: don't register virtual helper methods for WPO 
* ncgrtti.pas: write virtual helper methods as normal methods to RTTI
* nobj.pas: correctly handle final and override cases in helpers
* pdecvar.pas: property getters
* rautils.pas: no VMT offset in records

git-svn-id: branches/svenbarth/classhelpers@17150 -
This commit is contained in:
svenbarth 2011-03-20 10:41:45 +00:00
parent 42129251da
commit 96116a6c3a
14 changed files with 32 additions and 15 deletions

View File

@ -2488,7 +2488,8 @@ unit cgcpu;
g_adjust_self_value(list,procdef,ioffset);
{ case 4 }
if po_virtualmethod in procdef.procoptions then
if (po_virtualmethod in procdef.procoptions) and
not is_objectpascal_helper(procdef.struct) then
begin
loadvmttor12;
op_onr12methodaddr;

View File

@ -2081,7 +2081,8 @@ implementation
append_attribute(DW_AT_external,DW_FORM_flag,[true]);
{ Abstract or virtual/overriding method. }
if (([po_abstractmethod, po_virtualmethod, po_overridingmethod] * def.procoptions) <> []) and
not is_objc_class_or_protocol(def.struct) then
not is_objc_class_or_protocol(def.struct) and
not is_objectpascal_helper(def.struct) then
begin
if not(po_abstractmethod in def.procoptions) then
append_attribute(DW_AT_virtuality,DW_FORM_data1,[ord(DW_VIRTUALITY_virtual)])

View File

@ -414,7 +414,8 @@ implementation
if tsym(p).typ = procsym then
begin
pd :=tprocdef(tprocsym(p).ProcdefList[0]);
if (po_virtualmethod in pd.procoptions) then
if (po_virtualmethod in pd.procoptions) and
not is_objectpascal_helper(pd.struct) then
begin
lindex := pd.extnumber;
{doesnt seem to be necessary

View File

@ -662,7 +662,8 @@ unit cgcpu;
{ set param1 interface to self }
g_adjust_self_value(list,procdef,ioffset);
if po_virtualmethod in procdef.procoptions then
if (po_virtualmethod in procdef.procoptions) and
not is_objectpascal_helper(procdef.struct) then
begin
if (procdef.proccalloption=pocall_register) then
begin

View File

@ -1605,7 +1605,8 @@ unit cgcpu;
// g_adjust_self_value(list,procdef,ioffset);
{ case 4 }
if po_virtualmethod in procdef.procoptions then
if (po_virtualmethod in procdef.procoptions) and
not is_objectpascal_helper(procdef.struct) then
begin
// loadvmttor11;
// op_onr11methodaddr;

View File

@ -1679,7 +1679,8 @@ begin
{ set param1 interface to self }
g_adjust_self_value(list, procdef, ioffset);
if po_virtualmethod in procdef.procoptions then
if (po_virtualmethod in procdef.procoptions) and
not is_objectpascal_helper(procdef.struct) then
begin
loadvmttor24;
op_onr24methodaddr;

View File

@ -688,6 +688,7 @@ implementation
otherwise optimised called methods are no longer registered)
}
if (po_virtualmethod in procdefinition.procoptions) and
not is_objectpascal_helper(tprocdef(procdefinition).struct) and
assigned(methodpointer) and
(methodpointer.nodetype<>typen) and
(not assigned(current_procinfo) or

View File

@ -338,7 +338,8 @@ implementation
{ When there was an error then procdef is not assigned }
if not assigned(propaccesslist.procdef) then
exit;
if not(po_virtualmethod in tprocdef(propaccesslist.procdef).procoptions) then
if not(po_virtualmethod in tprocdef(propaccesslist.procdef).procoptions) or
is_objectpascal_helper(tprocdef(propaccesslist.procdef).struct) then
begin
current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname,0));
typvalue:=1;

View File

@ -270,7 +270,8 @@ implementation
{ check that we are not trying to override a final method }
if (po_finalmethod in vmtpd.procoptions) and
hasequalpara and (po_overridingmethod in pd.procoptions) and is_class(_class) then
hasequalpara and (po_overridingmethod in pd.procoptions) and
(is_class(_class) or is_objectpascal_helper(_class)) then
MessagePos1(pd.fileinfo,parser_e_final_can_no_be_overridden,pd.fullprocname(false))
else
{ old definition has virtual
@ -281,8 +282,11 @@ implementation
(
{ new one does not have reintroduce in case of an objccategory }
(is_objccategory(_class) and not(po_reintroduce in pd.procoptions)) or
{ new one does not have override in case of objpas/objc class/intf/proto }
(is_class_or_interface_or_objc(_class) and not is_objccategory(_class) and not(po_overridingmethod in pd.procoptions))
{ new one does not have override in case of objpas/objc class/helper/intf/proto }
(
(is_class_or_interface_or_objc(_class) or is_objectpascal_helper(_class)) and
not is_objccategory(_class) and not(po_overridingmethod in pd.procoptions)
)
)
) then
begin

View File

@ -844,7 +844,8 @@ implementation
case p.propaccesslist[palt_read].firstsym^.sym.typ of
procsym :
begin
if (po_virtualmethod in tprocdef(p.propaccesslist[palt_read].procdef).procoptions) then
if (po_virtualmethod in tprocdef(p.propaccesslist[palt_read].procdef).procoptions) and
not is_objectpascal_helper(tprocdef(p.propaccesslist[palt_read].procdef).struct) then
ImplIntf.IType:=etVirtualMethodResult
else
ImplIntf.IType:=etStaticMethodResult;

View File

@ -718,7 +718,8 @@ unit cgppc;
g_adjust_self_value(list,procdef,ioffset);
{ case 4 }
if po_virtualmethod in procdef.procoptions then
if (po_virtualmethod in procdef.procoptions) and
not is_objectpascal_helper(procdef.struct) then
begin
loadvmttor11;
op_onr11methodaddr;

View File

@ -1392,7 +1392,8 @@ Begin
else
begin
{ can only get the vmtoffset of virtual methods }
if not(po_virtualmethod in procdef.procoptions) then
if not(po_virtualmethod in procdef.procoptions) or
is_objectpascal_helper(procdef.struct) then
Message1(asmr_e_no_vmtoffset_possible,FullTypeName(procdef,nil))
else
begin

View File

@ -1375,7 +1375,8 @@ implementation
{ set param1 interface to self }
g_adjust_self_value(list,procdef,ioffset);
if po_virtualmethod in procdef.procoptions then
if (po_virtualmethod in procdef.procoptions) and
not is_objectpascal_helper(procdef.struct) then
begin
if (procdef.extnumber=$ffff) then
Internalerror(200006139);

View File

@ -168,7 +168,8 @@ unit cgcpu;
{ set param1 interface to self }
g_adjust_self_value(list,procdef,ioffset);
if po_virtualmethod in procdef.procoptions then
if (po_virtualmethod in procdef.procoptions) and
not is_objectpascal_helper(procdef.struct) then
begin
if (procdef.extnumber=$ffff) then
Internalerror(200006139);