* fixed class VMT generation for the i8086 medium memory model (near code, far data) by setting correctly the Tasmsymtype to each symbol according to whether it points to code or data

git-svn-id: trunk@25276 -
This commit is contained in:
nickysn 2013-08-18 00:03:55 +00:00
parent 57cdd8c106
commit 088c06d308
2 changed files with 26 additions and 19 deletions

View File

@ -343,7 +343,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,0)); current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname,AT_FUNCTION,0));
typvalue:=1; typvalue:=1;
end end
else else
@ -857,7 +857,7 @@ implementation
if not is_objectpascal_helper(def) then if not is_objectpascal_helper(def) then
if (oo_has_vmt in def.objectoptions) then if (oo_has_vmt in def.objectoptions) then
current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(def.vmt_mangledname,0)) current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(def.vmt_mangledname,AT_DATA,0))
else else
current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_nil_dataptr); current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_nil_dataptr);
@ -1307,7 +1307,7 @@ implementation
function TRTTIWriter.ref_rtti(def:tdef;rt:trttitype):tasmsymbol; function TRTTIWriter.ref_rtti(def:tdef;rt:trttitype):tasmsymbol;
begin begin
result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)); result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt),AT_DATA);
if (cs_create_pic in current_settings.moduleswitches) and if (cs_create_pic in current_settings.moduleswitches) and
assigned(current_procinfo) then assigned(current_procinfo) then
include(current_procinfo.flags,pi_needs_got); include(current_procinfo.flags,pi_needs_got);
@ -1343,7 +1343,7 @@ implementation
function TRTTIWriter.get_rtti_label(def:tdef;rt:trttitype):tasmsymbol; function TRTTIWriter.get_rtti_label(def:tdef;rt:trttitype):tasmsymbol;
begin begin
result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)); result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt),AT_DATA);
if (cs_create_pic in current_settings.moduleswitches) and if (cs_create_pic in current_settings.moduleswitches) and
assigned(current_procinfo) then assigned(current_procinfo) then
include(current_procinfo.flags,pi_needs_got); include(current_procinfo.flags,pi_needs_got);
@ -1351,7 +1351,7 @@ implementation
function TRTTIWriter.get_rtti_label_ord2str(def:tdef;rt:trttitype):tasmsymbol; function TRTTIWriter.get_rtti_label_ord2str(def:tdef;rt:trttitype):tasmsymbol;
begin begin
result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_o2s'); result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_o2s',AT_DATA);
if (cs_create_pic in current_settings.moduleswitches) and if (cs_create_pic in current_settings.moduleswitches) and
assigned(current_procinfo) then assigned(current_procinfo) then
include(current_procinfo.flags,pi_needs_got); include(current_procinfo.flags,pi_needs_got);
@ -1359,7 +1359,7 @@ implementation
function TRTTIWriter.get_rtti_label_str2ord(def:tdef;rt:trttitype):tasmsymbol; function TRTTIWriter.get_rtti_label_str2ord(def:tdef;rt:trttitype):tasmsymbol;
begin begin
result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_s2o'); result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_s2o',AT_DATA);
if (cs_create_pic in current_settings.moduleswitches) and if (cs_create_pic in current_settings.moduleswitches) and
assigned(current_procinfo) then assigned(current_procinfo) then
include(current_procinfo.flags,pi_needs_got); include(current_procinfo.flags,pi_needs_got);

View File

@ -242,7 +242,7 @@ implementation
list.concat(cai_align.create(const_align(sizeof(pint)))); list.concat(cai_align.create(const_align(sizeof(pint))));
list.concat(Tai_const.Create_sym(p^.nl)); list.concat(Tai_const.Create_sym(p^.nl));
list.concat(cai_align.create(const_align(sizeof(pint)))); list.concat(cai_align.create(const_align(sizeof(pint))));
list.concat(Tai_const.Createname(p^.data.mangledname,0)); list.concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0));
if assigned(p^.r) then if assigned(p^.r) then
writestrentry(list,p^.r); writestrentry(list,p^.r);
@ -286,7 +286,7 @@ implementation
list.concat(cai_align.create(const_align(sizeof(longint)))); list.concat(cai_align.create(const_align(sizeof(longint))));
list.concat(Tai_const.Create_32bit(p^.data.messageinf.i)); list.concat(Tai_const.Create_32bit(p^.data.messageinf.i));
list.concat(cai_align.create(const_align(sizeof(pint)))); list.concat(cai_align.create(const_align(sizeof(pint))));
list.concat(Tai_const.Createname(p^.data.mangledname,0)); list.concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0));
if assigned(p^.r) then if assigned(p^.r) then
writeintentry(list,p^.r); writeintentry(list,p^.r);
@ -449,7 +449,7 @@ implementation
if po_abstractmethod in pd.procoptions then if po_abstractmethod in pd.procoptions then
lists[0].concat(Tai_const.Create_nil_codeptr) lists[0].concat(Tai_const.Create_nil_codeptr)
else else
lists[0].concat(Tai_const.Createname(pd.mangledname,0)); lists[0].concat(Tai_const.Createname(pd.mangledname,AT_FUNCTION,0));
end; end;
end; end;
end; end;
@ -547,7 +547,7 @@ implementation
if (tf_requires_proper_alignment in target_info.flags) then if (tf_requires_proper_alignment in target_info.flags) then
list.concat(cai_align.Create(sizeof(TConstPtrUInt))); list.concat(cai_align.Create(sizeof(TConstPtrUInt)));
for i:=0 to classtablelist.Count-1 do for i:=0 to classtablelist.Count-1 do
list.concat(Tai_const.Createname(tobjectdef(classtablelist[i]).vmt_mangledname,0)); list.concat(Tai_const.Createname(tobjectdef(classtablelist[i]).vmt_mangledname,AT_DATA,0));
result:=fieldtable; result:=fieldtable;
end end
else else
@ -585,7 +585,7 @@ implementation
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); tostr(i)+'_$_'+pd.mangledname);
{ create reference } { create reference }
rawdata.concat(Tai_const.Createname(hs,0)); rawdata.concat(Tai_const.Createname(hs,AT_FUNCTION,0));
end; end;
end; end;
rawdata.concat(tai_symbol_end.createname(vtblstr)); rawdata.concat(tai_symbol_end.createname(vtblstr));
@ -599,12 +599,12 @@ implementation
{ GUID (or nil for Corba interfaces) } { GUID (or nil for Corba interfaces) }
if AImplIntf.IntfDef.objecttype in [odt_interfacecom] then if AImplIntf.IntfDef.objecttype in [odt_interfacecom] then
rawdata.concat(Tai_const.CreateName( rawdata.concat(Tai_const.CreateName(
make_mangledname('IID',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),0)) make_mangledname('IID',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0))
else else
rawdata.concat(Tai_const.Create_nil_dataptr); rawdata.concat(Tai_const.Create_nil_dataptr);
{ VTable } { VTable }
rawdata.concat(Tai_const.Createname(intf_get_vtbl_name(AImplIntf.VtblImplIntf),0)); rawdata.concat(Tai_const.Createname(intf_get_vtbl_name(AImplIntf.VtblImplIntf),AT_DATA,0));
{ IOffset field } { IOffset field }
case AImplIntf.VtblImplIntf.IType of case AImplIntf.VtblImplIntf.IType of
etFieldValue, etFieldValueClass, etFieldValue, etFieldValueClass,
@ -613,6 +613,7 @@ implementation
etStaticMethodResult, etStaticMethodClass: etStaticMethodResult, etStaticMethodClass:
rawdata.concat(Tai_const.Createname( rawdata.concat(Tai_const.Createname(
tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef).mangledname, tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef).mangledname,
AT_FUNCTION,
0 0
)); ));
etVirtualMethodResult, etVirtualMethodClass: etVirtualMethodResult, etVirtualMethodClass:
@ -626,7 +627,7 @@ implementation
{ IIDStr } { IIDStr }
rawdata.concat(Tai_const.CreateName( rawdata.concat(Tai_const.CreateName(
make_mangledname('IIDSTR',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),0)); make_mangledname('IIDSTR',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0));
{ IType } { IType }
rawdata.concat(Tai_const.Create_pint(aint(AImplIntf.VtblImplIntf.IType))); rawdata.concat(Tai_const.Create_pint(aint(AImplIntf.VtblImplIntf.IType)));
end; end;
@ -774,7 +775,7 @@ implementation
procname:='FPC_EMPTYMETHOD' procname:='FPC_EMPTYMETHOD'
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; procname:=vmtpd.mangledname;
List.concat(Tai_const.createname(procname,0)); List.concat(Tai_const.createname(procname,AT_FUNCTION,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));
current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0)); current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0));
@ -850,7 +851,7 @@ implementation
{ it is not written for parents that don't have any vmt !! } { it is not written for parents that don't have any vmt !! }
if assigned(_class.childof) and if assigned(_class.childof) and
(oo_has_vmt in _class.childof.objectoptions) then (oo_has_vmt in _class.childof.objectoptions) then
current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,0)) current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,AT_DATA,0))
else else
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr); current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr);
@ -865,9 +866,15 @@ implementation
else else
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr); current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr);
{ pointer to method table or nil } { pointer to method table or nil }
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(methodnametable)); if assigned(methodnametable) then
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(methodnametable))
else
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr);
{ pointer to field table } { pointer to field table }
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(fieldtablelabel)); if assigned(fieldtablelabel) then
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(fieldtablelabel))
else
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr);
{ pointer to type info of published section } { pointer to type info of published section }
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,fullrtti))); current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,fullrtti)));
{ inittable for con-/destruction } { inittable for con-/destruction }
@ -883,7 +890,7 @@ implementation
else if _class.implements_any_interfaces then else if _class.implements_any_interfaces then
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr) current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr)
else else
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol('FPC_EMPTYINTF'))); current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol('FPC_EMPTYINTF',AT_DATA)));
{ table for string messages } { table for string messages }
if (oo_has_msgstr in _class.objectoptions) then if (oo_has_msgstr in _class.objectoptions) then
current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(strmessagetable)) current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(strmessagetable))