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

* init wpo collectors before parsing the interface of units
* also register classes assigned to classref typed constants as potentially
instantiated

git-svn-id: trunk@13218 -

Jonas Maebe 16 жил өмнө
parent
commit
380e957a79

+ 3 - 3
compiler/pmodules.pas

@@ -1034,6 +1034,9 @@ implementation
            needs to be added implicitly }
          current_module.updatemaps;
 
+         { create whole program optimisation information }
+         current_module.wpoinfo:=tunitwpoinfo.create;
+
          { ... parse the declarations }
          Message1(parser_u_parsing_interface,current_module.realmodulename^);
          symtablestack.push(current_module.globalsymtable);
@@ -1112,9 +1115,6 @@ implementation
          symtablestack.push(current_module.globalsymtable);
          symtablestack.push(current_module.localsymtable);
 
-         { create whole program optimisation information }
-         current_module.wpoinfo:=tunitwpoinfo.create;
-
          if not current_module.interface_only then
            begin
              Message1(parser_u_parsing_implementation,current_module.modulename^);

+ 7 - 1
compiler/ptconst.pas

@@ -44,7 +44,8 @@ implementation
        { parser specific stuff }
        pbase,pexpr,pdecvar,
        { codegen }
-       cpuinfo,cgbase,dbgbase
+       cpuinfo,cgbase,dbgbase,
+       wpobase
        ;
 
 {$maxfpuregisters 0}
@@ -329,6 +330,11 @@ implementation
                 if not Tobjectdef(tclassrefdef(n.resultdef).pointeddef).is_related(tobjectdef(def.pointeddef)) then
                   IncompatibleTypes(n.resultdef, def);
                 list.concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol(Tobjectdef(tclassrefdef(n.resultdef).pointeddef).vmt_mangledname)));
+                { update wpo info }
+                if not assigned(current_procinfo) or
+                   (po_inline in current_procinfo.procdef.procoptions) or
+                   wpoinfomanager.symbol_live(current_procinfo.procdef.mangledname) then
+                  tobjectdef(tclassrefdef(n.resultdef).pointeddef).register_maybe_created_object_type;
               end;
              niln:
                list.concat(Tai_const.Create_sym(nil));