Pārlūkot izejas kodu

Ensure that no unnecessary symbols are generated for generics.

ncgrtti.pas, TRTTIWriter:
  * write_rtti: don't write rtti for generic definitions or generic dummy symbols
psub.pas:
  * tcgprocinfo.parse_body: don't allocate a proc symbol for generics
  * read_proc: don't define an assembler symbol for global generics
pkgutil.pas:
  * exportprocsym: don't export a procdef if it's generic
  * insert_export: don't export generic record- and objectdefs

git-svn-id: branches/svenbarth/packages@32574 -
svenbarth 9 gadi atpakaļ
vecāks
revīzija
3d2e1b7634
3 mainītis faili ar 14 papildinājumiem un 3 dzēšanām
  1. 6 0
      compiler/ncgrtti.pas
  2. 4 1
      compiler/pkgutil.pas
  3. 4 2
      compiler/psub.pas

+ 6 - 0
compiler/ncgrtti.pas

@@ -1353,6 +1353,12 @@ implementation
         { only write rtti of definitions from the current module }
         { only write rtti of definitions from the current module }
         if not findunitsymtable(def.owner).iscurrentunit then
         if not findunitsymtable(def.owner).iscurrentunit then
           exit;
           exit;
+        if (df_generic in def.defoptions) or
+           (
+             (def.typ=undefineddef) and
+             (sp_generic_dummy in def.typesym.symoptions)
+           ) then
+          exit;
         { check if separate initrtti is actually needed }
         { check if separate initrtti is actually needed }
         if (rt=initrtti) and (not def.needs_separate_initrtti) then
         if (rt=initrtti) and (not def.needs_separate_initrtti) then
           rt:=fullrtti;
           rt:=fullrtti;

+ 4 - 1
compiler/pkgutil.pas

@@ -90,7 +90,8 @@ implementation
                   (symtable.symtabletype=staticsymtable) and
                   (symtable.symtabletype=staticsymtable) and
                   ([po_public,po_has_public_name]*pd.procoptions<>[])
                   ([po_public,po_has_public_name]*pd.procoptions<>[])
                 )
                 )
-              ) then
+              ) and
+              not pd.is_generic then
             begin
             begin
               exportallprocdefnames(tprocsym(sym),pd,[]);
               exportallprocdefnames(tprocsym(sym),pd,[]);
             end;
             end;
@@ -157,6 +158,8 @@ implementation
               objectdef:
               objectdef:
                 begin
                 begin
                   def:=tabstractrecorddef(ttypesym(sym).typedef);
                   def:=tabstractrecorddef(ttypesym(sym).typedef);
+                  if def.is_generic then
+                    exit;
                   def.symtable.SymList.ForEachCall(@exportabstractrecordsymproc,def.symtable);
                   def.symtable.SymList.ForEachCall(@exportabstractrecordsymproc,def.symtable);
                   if (def.typ=objectdef) and (oo_has_vmt in tobjectdef(def).objectoptions) then
                   if (def.typ=objectdef) and (oo_has_vmt in tobjectdef(def).objectoptions) then
                     begin
                     begin

+ 4 - 2
compiler/psub.pas

@@ -1736,7 +1736,8 @@ implementation
     {$endif state_tracking}
     {$endif state_tracking}
 
 
          { allocate the symbol for this procedure }
          { allocate the symbol for this procedure }
-         alloc_proc_symbol(procdef);
+         if not (df_generic in procdef.defoptions) then
+           alloc_proc_symbol(procdef);
 
 
          { add parast/localst to symtablestack }
          { add parast/localst to symtablestack }
          add_to_symtablestack;
          add_to_symtablestack;
@@ -2119,7 +2120,8 @@ implementation
          { treated as references to external symbols, needed for darwin.   }
          { treated as references to external symbols, needed for darwin.   }
 
 
          { make sure we don't change the binding of real external symbols }
          { make sure we don't change the binding of real external symbols }
-         if not(po_external in pd.procoptions) and (pocall_internproc<>pd.proccalloption)  then
+         if not(po_external in pd.procoptions) and (pocall_internproc<>pd.proccalloption)
+             and not (df_generic in pd.defoptions) then
            begin
            begin
              if (po_global in pd.procoptions) or
              if (po_global in pd.procoptions) or
                 (cs_profile in current_settings.moduleswitches) then
                 (cs_profile in current_settings.moduleswitches) then