2
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
3d2e1b7634

+ 6 - 0
compiler/ncgrtti.pas

@@ -1353,6 +1353,12 @@ implementation
         { only write rtti of definitions from the current module }
         if not findunitsymtable(def.owner).iscurrentunit then
           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 }
         if (rt=initrtti) and (not def.needs_separate_initrtti) then
           rt:=fullrtti;

+ 4 - 1
compiler/pkgutil.pas

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

+ 4 - 2
compiler/psub.pas

@@ -1736,7 +1736,8 @@ implementation
     {$endif state_tracking}
 
          { 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_to_symtablestack;
@@ -2119,7 +2120,8 @@ implementation
          { treated as references to external symbols, needed for darwin.   }
 
          { 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
              if (po_global in pd.procoptions) or
                 (cs_profile in current_settings.moduleswitches) then