* Generate interface wrappers together with data structures of class they belong to, and place everything into single assembler slice (since all wrappers are always referenced by VPTR, attempting to smartlink them is useless). This removes separate iteration pass over symtables and reduces amount of smartlink files.

git-svn-id: trunk@26868 -
This commit is contained in:
sergei 2014-02-24 15:33:15 +00:00
parent e96e992705
commit 8f6d8b849e

View File

@ -936,7 +936,6 @@ implementation
if (ImplIntf=ImplIntf.VtblImplIntf) and if (ImplIntf=ImplIntf.VtblImplIntf) and
assigned(ImplIntf.ProcDefs) then assigned(ImplIntf.ProcDefs) then
begin begin
maybe_new_object_file(list);
for j:=0 to ImplIntf.ProcDefs.Count-1 do for j:=0 to ImplIntf.ProcDefs.Count-1 do
begin begin
pd:=TProcdef(ImplIntf.ProcDefs[j]); pd:=TProcdef(ImplIntf.ProcDefs[j]);
@ -949,7 +948,7 @@ implementation
tmps:=make_mangledname('WRPR',_class.owner,_class.objname^+'_$_'+ tmps:=make_mangledname('WRPR',_class.owner,_class.objname^+'_$_'+
ImplIntf.IntfDef.objname^+'_$_'+tostr(j)+'_$_'+pd.mangledname); ImplIntf.IntfDef.objname^+'_$_'+tostr(j)+'_$_'+pd.mangledname);
{ create wrapper code } { create wrapper code }
new_section(list,sec_code,tmps,0); new_section(list,sec_code,tmps,target_info.alignment.procalign);
hlcg.init_register_allocators; hlcg.init_register_allocators;
cg.g_intf_wrapper(list,pd,tmps,ImplIntf.ioffset); cg.g_intf_wrapper(list,pd,tmps,ImplIntf.ioffset);
hlcg.done_register_allocators; hlcg.done_register_allocators;
@ -959,23 +958,6 @@ implementation
end; end;
procedure gen_intf_wrappers(list:TAsmList;st:TSymtable);
var
i : longint;
def : tdef;
begin
for i:=0 to st.DefList.Count-1 do
begin
def:=tdef(st.DefList[i]);
{ if def can contain nested types then handle it symtable }
if def.typ in [objectdef,recorddef] then
gen_intf_wrappers(list,tabstractrecorddef(def).symtable);
if is_class(def) then
gen_intf_wrapper(list,tobjectdef(def));
end;
end;
procedure do_write_persistent_type_info(st:tsymtable;is_global:boolean); procedure do_write_persistent_type_info(st:tsymtable;is_global:boolean);
var var
i : longint; i : longint;
@ -1010,6 +992,8 @@ implementation
vmtwriter.free; vmtwriter.free;
include(def.defstates,ds_vmt_written); include(def.defstates,ds_vmt_written);
end; end;
if is_class(def) then
gen_intf_wrapper(current_asmdata.asmlists[al_globals],tobjectdef(def));
end; end;
procdef : procdef :
begin begin
@ -1045,7 +1029,6 @@ implementation
procedure write_persistent_type_info(st:tsymtable;is_global:boolean); procedure write_persistent_type_info(st:tsymtable;is_global:boolean);
begin begin
create_hlcodegen; create_hlcodegen;
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],st);
do_write_persistent_type_info(st,is_global); do_write_persistent_type_info(st,is_global);
destroy_hlcodegen; destroy_hlcodegen;
end; end;