Explorar o código

* Smartlinking with interfaces fixed
* Better smartlinking for rtti and init tables

michael %!s(int64=24) %!d(string=hai) anos
pai
achega
d75c4d6486
Modificáronse 4 ficheiros con 64 adicións e 18 borrados
  1. 21 5
      compiler/i386/n386obj.pas
  2. 25 11
      compiler/nobj.pas
  3. 9 1
      compiler/symdef.pas
  4. 9 1
      compiler/symsym.pas

+ 21 - 5
compiler/i386/n386obj.pas

@@ -31,9 +31,10 @@ implementation
 
 uses
   systems,
-  verbose,globals,
+  verbose,globals,globtype,
   aasm,
-  symconst,symbase,symtype,symtable,symdef,symsym,
+  symconst,symtype,symdef,symsym,
+  fmodule,
   nobj,
   temp_gen,
   cpubase,
@@ -141,7 +142,7 @@ procedure ti386classheader.cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef
 var
   oldexprasmlist: TAAsmoutput;
   lab : tasmsymbol;
-
+  make_global : boolean;
 begin
   if procdef.proctypeoption<>potype_none then
     Internalerror(200006137);
@@ -149,11 +150,22 @@ begin
      (procdef.procoptions*[po_containsself, po_classmethod, po_staticmethod,
        po_methodpointer, po_interrupt, po_iocheck]<>[]) then
     Internalerror(200006138);
+  if procdef.owner.symtabletype<>objectsymtable then
+    Internalerror(200109191);
 
   oldexprasmlist:=exprasmlist;
   exprasmlist:=asmlist;
 
-  exprasmList.concat(Tai_symbol.Createname(labelname,0));
+  make_global:=false;
+  if (not current_module.is_unit) or
+     (cs_create_smart in aktmoduleswitches) or
+     (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
+    make_global:=true;
+
+  if make_global then
+   exprasmList.concat(Tai_symbol.Createname_global(labelname,0))
+  else
+   exprasmList.concat(Tai_symbol.Createname(labelname,0));
 
   { set param1 interface to self  }
   adjustselfvalue(ioffset);
@@ -211,7 +223,11 @@ initialization
 end.
 {
   $Log$
-  Revision 1.2  2001-08-26 13:37:00  florian
+  Revision 1.3  2001-09-19 11:04:41  michael
+  * Smartlinking with interfaces fixed
+  * Better smartlinking for rtti and init tables
+
+  Revision 1.2  2001/08/26 13:37:00  florian
     * some cg reorganisation
     * some PPC updates
 

+ 25 - 11
compiler/nobj.pas

@@ -133,6 +133,7 @@ implementation
 {$endif}
        globtype,globals,verbose,
        symtable,symconst,symtype,symsym,types,
+       fmodule,
 {$ifdef GDB}
        gdb,
 {$endif GDB}
@@ -811,8 +812,8 @@ implementation
 
     function  tclassheader.gintfgetvtbllabelname(intfindex: integer): string;
       begin
-        gintfgetvtbllabelname:='_$$_'+upper(_class.objname^)+'_$$_'+
-          upper(_class.implementedinterfaces.interfaces(intfindex).objname^)+'_$$_VTBL';
+        gintfgetvtbllabelname:='VTBL_'+current_module.modulename^+'$_'+upper(_class.objname^)+
+                               '_$$_'+upper(_class.implementedinterfaces.interfaces(intfindex).objname^);
       end;
 
 
@@ -826,7 +827,10 @@ implementation
       begin
         implintf:=_class.implementedinterfaces;
         curintf:=implintf.interfaces(intfindex);
-        rawdata.concat(Tai_symbol.Createname(gintfgetvtbllabelname(intfindex),0));
+        if (cs_create_smart in aktmoduleswitches) then
+         rawdata.concat(Tai_symbol.Createname_global(gintfgetvtbllabelname(intfindex),0))
+        else
+         rawdata.concat(Tai_symbol.Createname(gintfgetvtbllabelname(intfindex),0));
         proccount:=implintf.implproccount(intfindex);
         for i:=1 to proccount do
           begin
@@ -1004,11 +1008,9 @@ implementation
                 ioffsets(i)^:=ioffsets(impintfindexes[i])^;
             gintfgenentry(i,impintfindexes[i],rawdata);
           end;
-        dataSegment.insertlist(rawdata);
+        dataSegment.concatlist(rawdata);
         rawdata.free;
-        if (cs_create_smart in aktmoduleswitches) then
-          rawcode.insert(Tai_cut.Create);
-        codeSegment.insertlist(rawcode);
+        codeSegment.concatlist(rawcode);
         rawcode.free;
         freemem(impintfindexes,(max+1)*sizeof(longint));
       end;
@@ -1153,10 +1155,21 @@ implementation
          vmtlist:=TAasmoutput.Create;
          genvmt(vmtlist);
 
+         if (cs_create_smart in aktmoduleswitches) then
+           dataSegment.concat(Tai_cut.Create);
+
          { write tables for classes, this must be done before the actual
            class is written, because we need the labels defined }
          if is_class(_class) then
           begin
+            { interface table }
+            if _class.implementedinterfaces.count>0 then
+             begin
+               if (cs_create_smart in aktmoduleswitches) then
+                codeSegment.concat(Tai_cut.Create);
+               interfacetable:=genintftable;
+             end;
+
             methodnametable:=genpublishedmethodstable;
             fieldtablelabel:=_class.generate_field_table;
             { write class name }
@@ -1171,9 +1184,6 @@ implementation
               intmessagetable:=genintmsgtab
             else
               dataSegment.concat(Tai_const.Create_32bit(0));
-            { interface table }
-            if _class.implementedinterfaces.count>0 then
-              interfacetable:=genintftable;
           end;
 
         { write debug info }
@@ -1260,7 +1270,11 @@ initialization
 end.
 {
   $Log$
-  Revision 1.3  2001-08-30 20:13:53  peter
+  Revision 1.4  2001-09-19 11:04:42  michael
+  * Smartlinking with interfaces fixed
+  * Better smartlinking for rtti and init tables
+
+  Revision 1.3  2001/08/30 20:13:53  peter
     * rtti/init table updates
     * rttisym for reusable global rtti/init info
     * support published for interfaces

+ 9 - 1
compiler/symdef.pas

@@ -1053,6 +1053,8 @@ implementation
              begin
                getdatalabel(localrttilab[rt]);
                write_child_rtti_data(rt);
+               if (cs_create_smart in aktmoduleswitches) then
+                rttiList.concat(Tai_cut.Create);
                rttiList.concat(Tai_symbol.Create(localrttilab[rt],0));
                write_rtti_data(rt);
                rttiList.concat(Tai_symbol_end.Create(localrttilab[rt]));
@@ -4844,6 +4846,8 @@ implementation
          count:=0;
          tablecount:=0;
          symtable.foreach({$ifdef FPC}@{$endif}count_published_fields);
+         if (cs_create_smart in aktmoduleswitches) then
+          rttiList.concat(Tai_cut.Create);
          rttiList.concat(Tai_label.Create(fieldtable));
          rttiList.concat(Tai_const.Create_16bit(count));
          rttiList.concat(Tai_const_symbol.Create(classtable));
@@ -5416,7 +5420,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.50  2001-09-17 21:29:12  peter
+  Revision 1.51  2001-09-19 11:04:42  michael
+  * Smartlinking with interfaces fixed
+  * Better smartlinking for rtti and init tables
+
+  Revision 1.50  2001/09/17 21:29:12  peter
     * merged netbsd, fpu-overflow from fixes branch
 
   Revision 1.49  2001/09/10 10:26:27  jonas

+ 9 - 1
compiler/symsym.pas

@@ -2433,6 +2433,8 @@ implementation
            def.rttitablesym:=rsym;
            { write rtti data }
            def.write_child_rtti_data(fullrtti);
+           if (cs_create_smart in aktmoduleswitches) then
+            rttiList.concat(Tai_cut.Create);
            rttiList.concat(Tai_symbol.Create(rsym.get_label,0));
            def.write_rtti_data(fullrtti);
            rttiList.concat(Tai_symbol_end.Create(rsym.get_label));
@@ -2469,6 +2471,8 @@ implementation
            def.inittablesym:=rsym;
            { write inittable data }
            def.write_child_rtti_data(initrtti);
+           if (cs_create_smart in aktmoduleswitches) then
+            rttiList.concat(Tai_cut.Create);
            rttiList.concat(Tai_symbol.Create(rsym.get_label,0));
            def.write_rtti_data(initrtti);
            rttiList.concat(Tai_symbol_end.Create(rsym.get_label));
@@ -2480,7 +2484,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.21  2001-09-02 21:18:29  peter
+  Revision 1.22  2001-09-19 11:04:42  michael
+  * Smartlinking with interfaces fixed
+  * Better smartlinking for rtti and init tables
+
+  Revision 1.21  2001/09/02 21:18:29  peter
     * split constsym.value in valueord,valueordptr,valueptr. The valueordptr
       is used for holding target platform pointer values. As those can be
       bigger than the source platform.