瀏覽代碼

* 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 -
sergei 11 年之前
父節點
當前提交
8f6d8b849e
共有 1 個文件被更改,包括 3 次插入20 次删除
  1. 3 20
      compiler/ncgvmt.pas

+ 3 - 20
compiler/ncgvmt.pas

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