فهرست منبع

* removed "and not is_class()" condition from is_managed_type(), because
tobjectdef.needs_inittable returns false for classes nowadays (and already
since quite some time)
* nevertheless replaced all usages in the compiler of x.needs_inittable with
is_managed_type(x) (in case some other condition is added again in the
future) and removed all remaining accompanying "and not is_class(x)"
checks

git-svn-id: trunk@15320 -

Jonas Maebe 15 سال پیش
والد
کامیت
f5c52b25cd

+ 3 - 5
compiler/defutil.pas

@@ -99,7 +99,7 @@ interface
     function is_in_limit(def_from,def_to : tdef) : boolean;
     function is_in_limit(def_from,def_to : tdef) : boolean;
 
 
     {# Returns whether def is reference counted }
     {# Returns whether def is reference counted }
-    function is_managed_type(def: tdef) : boolean;
+    function is_managed_type(def: tdef) : boolean;{$ifdef USEINLINE}inline;{$endif}
 
 
 
 
 {    function is_in_limit_value(val_from:TConstExprInt;def_from,def_to : tdef) : boolean;}
 {    function is_in_limit_value(val_from:TConstExprInt;def_from,def_to : tdef) : boolean;}
@@ -526,11 +526,9 @@ implementation
       end;
       end;
 
 
 
 
-    function is_managed_type(def: tdef): boolean;
+    function is_managed_type(def: tdef): boolean;{$ifdef USEINLINE}inline;{$endif}
       begin
       begin
-        result:=
-          def.needs_inittable and
-          not is_class(def);
+        result:=def.needs_inittable;
       end;
       end;
 
 
 
 

+ 3 - 5
compiler/ncal.pas

@@ -923,10 +923,8 @@ implementation
           begin
           begin
             { look for type conversion nodes which convert a }
             { look for type conversion nodes which convert a }
             { refcounted type into a non-refcounted type     }
             { refcounted type into a non-refcounted type     }
-            if (not n.resultdef.needs_inittable or
-                is_class(n.resultdef)) and
-               (ttypeconvnode(n).left.resultdef.needs_inittable and
-                not is_class(ttypeconvnode(n).left.resultdef)) then
+            if not is_managed_type(n.resultdef) and
+               is_managed_type(ttypeconvnode(n).left.resultdef) then
               exit;
               exit;
             n:=ttypeconvnode(n).left;
             n:=ttypeconvnode(n).left;
           end;
           end;
@@ -2160,7 +2158,7 @@ implementation
            not assigned(funcretnode) and
            not assigned(funcretnode) and
             (
             (
              (cnf_do_inline in callnodeflags) or
              (cnf_do_inline in callnodeflags) or
-             resultdef.needs_inittable or
+             is_managed_type(resultdef) or
              paramanager.ret_in_param(resultdef,procdefinition.proccalloption)
              paramanager.ret_in_param(resultdef,procdefinition.proccalloption)
             ) then
             ) then
           begin
           begin

+ 1 - 2
compiler/ncgbas.pas

@@ -396,8 +396,7 @@ interface
           internalerror(200108222);
           internalerror(200108222);
 
 
         { get a (persistent) temp }
         { get a (persistent) temp }
-        if (tempinfo^.typedef.needs_inittable) and
-           not is_class(tempinfo^.typedef) then
+        if is_managed_type(tempinfo^.typedef) then
           begin
           begin
             location_reset_ref(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.typedef),0);
             location_reset_ref(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.typedef),0);
             tg.GetTempTyped(current_asmdata.CurrAsmList,tempinfo^.typedef,tempinfo^.temptype,tempinfo^.location.reference);
             tg.GetTempTyped(current_asmdata.CurrAsmList,tempinfo^.typedef,tempinfo^.temptype,tempinfo^.location.reference);

+ 3 - 3
compiler/ncgcal.pas

@@ -163,7 +163,7 @@ implementation
 
 
              { release memory for refcnt out parameters }
              { release memory for refcnt out parameters }
              if (parasym.varspez=vs_out) and
              if (parasym.varspez=vs_out) and
-                (left.resultdef.needs_inittable) then
+                is_managed_type(left.resultdef) then
                begin
                begin
                  location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
                  location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
                  cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
                  cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
@@ -455,7 +455,7 @@ implementation
               we have used a temp, because then it is already done from tempcreatenode.
               we have used a temp, because then it is already done from tempcreatenode.
               Also no finalize is needed, because there is no risk of exceptions from the
               Also no finalize is needed, because there is no risk of exceptions from the
               function since this is code is only executed after the function call has returned }
               function since this is code is only executed after the function call has returned }
-            if funcretnode.resultdef.needs_inittable and
+            if is_managed_type(funcretnode.resultdef) and
                (funcretnode.nodetype<>temprefn) then
                (funcretnode.nodetype<>temprefn) then
               cg.g_decrrefcount(current_asmdata.CurrAsmList,funcretnode.resultdef,funcretnode.location.reference);
               cg.g_decrrefcount(current_asmdata.CurrAsmList,funcretnode.resultdef,funcretnode.location.reference);
 
 
@@ -496,7 +496,7 @@ implementation
            case location.loc of
            case location.loc of
              LOC_REFERENCE :
              LOC_REFERENCE :
                begin
                begin
-                 if resultdef.needs_inittable then
+                 if is_managed_type(resultdef) then
                     cg.g_finalize(current_asmdata.CurrAsmList,resultdef,location.reference);
                     cg.g_finalize(current_asmdata.CurrAsmList,resultdef,location.reference);
                   tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference);
                   tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference);
                end;
                end;

+ 7 - 8
compiler/ncgld.pas

@@ -153,8 +153,7 @@ implementation
            ([fc_inflowcontrol,fc_gotolabel] * flowcontrol <> []) or
            ([fc_inflowcontrol,fc_gotolabel] * flowcontrol <> []) or
            { not for refcounted types, because those locations are   }
            { not for refcounted types, because those locations are   }
            { still used later on in initialisation/finalisation code }
            { still used later on in initialisation/finalisation code }
-           (not(is_class(n.resultdef)) and
-            n.resultdef.needs_inittable) or
+           is_managed_type(n.resultdef) or
            { source and destination are temps (= not global variables) }
            { source and destination are temps (= not global variables) }
            not tg.istemp(n.location.reference) or
            not tg.istemp(n.location.reference) or
            not tg.istemp(newref) or
            not tg.istemp(newref) or
@@ -582,13 +581,13 @@ implementation
           loading the left node afterwards can destroy the flags.
           loading the left node afterwards can destroy the flags.
         }
         }
         if not(right.expectloc in [LOC_FLAGS,LOC_JUMP]) and
         if not(right.expectloc in [LOC_FLAGS,LOC_JUMP]) and
-           ((right.resultdef.needs_inittable) or
+           (is_managed_type(right.resultdef) or
             (node_complexity(right)>node_complexity(left))) then
             (node_complexity(right)>node_complexity(left))) then
          begin
          begin
            secondpass(right);
            secondpass(right);
            { increment source reference counter, this is
            { increment source reference counter, this is
              useless for constants }
              useless for constants }
-           if (right.resultdef.needs_inittable) and
+           if is_managed_type(right.resultdef) and
               not is_constnode(right) then
               not is_constnode(right) then
             begin
             begin
               location_force_mem(current_asmdata.CurrAsmList,right.location);
               location_force_mem(current_asmdata.CurrAsmList,right.location);
@@ -602,7 +601,7 @@ implementation
            { can be false                                             }
            { can be false                                             }
            secondpass(left);
            secondpass(left);
            { decrement destination reference counter }
            { decrement destination reference counter }
-           if (left.resultdef.needs_inittable) then
+           if is_managed_type(left.resultdef) then
              begin
              begin
                location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
                location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
                cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
                cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
@@ -615,7 +614,7 @@ implementation
            { calculate left sides }
            { calculate left sides }
            secondpass(left);
            secondpass(left);
            { decrement destination reference counter }
            { decrement destination reference counter }
-           if (left.resultdef.needs_inittable) then
+           if is_managed_type(left.resultdef) then
              begin
              begin
                location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
                location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
                cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
                cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
@@ -635,7 +634,7 @@ implementation
            flowcontrol:=oldflowcontrol;
            flowcontrol:=oldflowcontrol;
            { increment source reference counter, this is
            { increment source reference counter, this is
              useless for string constants}
              useless for string constants}
-           if (right.resultdef.needs_inittable) and
+           if is_managed_type(right.resultdef) and
               (right.nodetype<>stringconstn) then
               (right.nodetype<>stringconstn) then
              begin
              begin
                location_force_mem(current_asmdata.CurrAsmList,right.location);
                location_force_mem(current_asmdata.CurrAsmList,right.location);
@@ -1171,7 +1170,7 @@ implementation
               else
               else
               { normal array constructor of the same type }
               { normal array constructor of the same type }
                begin
                begin
-                 if resultdef.needs_inittable then
+                 if is_managed_type(resultdef) then
                    freetemp:=false;
                    freetemp:=false;
                  case hp.left.location.loc of
                  case hp.left.location.loc of
                    LOC_MMREGISTER,
                    LOC_MMREGISTER,

+ 11 - 16
compiler/ncgutil.pas

@@ -1223,7 +1223,7 @@ implementation
         if ((tsym(p).typ=localvarsym) or
         if ((tsym(p).typ=localvarsym) or
             ((tsym(p).typ=paravarsym) and
             ((tsym(p).typ=paravarsym) and
              (vo_is_funcret in tparavarsym(p).varoptions))) and
              (vo_is_funcret in tparavarsym(p).varoptions))) and
-           not(tabstractnormalvarsym(p).vardef.needs_inittable) and
+           not(is_managed_type(tabstractnormalvarsym(p).vardef)) and
            not(assigned(tabstractnormalvarsym(p).defaultconstsym)) then
            not(assigned(tabstractnormalvarsym(p).defaultconstsym)) then
          begin
          begin
            trashintval := trashintvalues[localvartrashing];
            trashintval := trashintvalues[localvartrashing];
@@ -1324,8 +1324,7 @@ implementation
            ) and
            ) and
            not(vo_is_typed_const in tabstractvarsym(p).varoptions) and
            not(vo_is_typed_const in tabstractvarsym(p).varoptions) and
            not(vo_is_external in tabstractvarsym(p).varoptions) and
            not(vo_is_external in tabstractvarsym(p).varoptions) and
-           not(is_class(tabstractvarsym(p).vardef)) and
-           tabstractvarsym(p).vardef.needs_inittable then
+           is_managed_type(tabstractvarsym(p).vardef) then
          begin
          begin
            OldAsmList:=current_asmdata.CurrAsmList;
            OldAsmList:=current_asmdata.CurrAsmList;
            current_asmdata.CurrAsmList:=TAsmList(arg);
            current_asmdata.CurrAsmList:=TAsmList(arg);
@@ -1361,8 +1360,7 @@ implementation
            (tlocalvarsym(p).refs>0) and
            (tlocalvarsym(p).refs>0) and
            not(vo_is_external in tlocalvarsym(p).varoptions) and
            not(vo_is_external in tlocalvarsym(p).varoptions) and
            not(vo_is_funcret in tlocalvarsym(p).varoptions) and
            not(vo_is_funcret in tlocalvarsym(p).varoptions) and
-           not(is_class(tlocalvarsym(p).vardef)) and
-           tlocalvarsym(p).vardef.needs_inittable then
+           is_managed_type(tlocalvarsym(p).vardef) then
           finalize_sym(TAsmList(arg),tsym(p));
           finalize_sym(TAsmList(arg),tsym(p));
       end;
       end;
 
 
@@ -1388,8 +1386,7 @@ implementation
                  (tstaticvarsym(p).varspez<>vs_const) and
                  (tstaticvarsym(p).varspez<>vs_const) and
                  not(vo_is_funcret in tstaticvarsym(p).varoptions) and
                  not(vo_is_funcret in tstaticvarsym(p).varoptions) and
                  not(vo_is_external in tstaticvarsym(p).varoptions) and
                  not(vo_is_external in tstaticvarsym(p).varoptions) and
-                 not(is_class(tstaticvarsym(p).vardef)) and
-                 tstaticvarsym(p).vardef.needs_inittable then
+                 is_managed_type(tstaticvarsym(p).vardef) then
                 finalize_sym(TAsmList(arg),tsym(p));
                 finalize_sym(TAsmList(arg),tsym(p));
             end;
             end;
           procsym :
           procsym :
@@ -1420,10 +1417,8 @@ implementation
         list:=TAsmList(arg);
         list:=TAsmList(arg);
         if (tsym(p).typ=paravarsym) then
         if (tsym(p).typ=paravarsym) then
          begin
          begin
-           needs_inittable :=
-             not is_class(tparavarsym(p).vardef) and
-             tparavarsym(p).vardef.needs_inittable;
-           do_trashing :=
+           needs_inittable:=is_managed_type(tparavarsym(p).vardef);
+           do_trashing:=
              (localvartrashing <> -1) and
              (localvartrashing <> -1) and
              (not assigned(tparavarsym(p).defaultconstsym)) and
              (not assigned(tparavarsym(p).defaultconstsym)) and
              not needs_inittable;
              not needs_inittable;
@@ -1499,8 +1494,7 @@ implementation
         if not(tsym(p).typ=paravarsym) then
         if not(tsym(p).typ=paravarsym) then
           exit;
           exit;
         list:=TAsmList(arg);
         list:=TAsmList(arg);
-        if not is_class(tparavarsym(p).vardef) and
-           tparavarsym(p).vardef.needs_inittable then
+        if is_managed_type(tparavarsym(p).vardef) then
          begin
          begin
            if (tparavarsym(p).varspez=vs_value) then
            if (tparavarsym(p).varspez=vs_value) then
             begin
             begin
@@ -1532,7 +1526,7 @@ implementation
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
            if assigned(hp^.def) and
            if assigned(hp^.def) and
-              hp^.def.needs_inittable then
+              is_managed_type(hp^.def) then
             begin
             begin
               reference_reset_base(href,current_procinfo.framepointer,hp^.pos,sizeof(pint));
               reference_reset_base(href,current_procinfo.framepointer,hp^.pos,sizeof(pint));
               cg.g_initialize(list,hp^.def,href);
               cg.g_initialize(list,hp^.def,href);
@@ -1551,7 +1545,7 @@ implementation
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
            if assigned(hp^.def) and
            if assigned(hp^.def) and
-              hp^.def.needs_inittable then
+              is_managed_type(hp^.def) then
             begin
             begin
               include(current_procinfo.flags,pi_needs_implicit_finally);
               include(current_procinfo.flags,pi_needs_implicit_finally);
               reference_reset_base(href,current_procinfo.framepointer,hp^.pos,sizeof(pint));
               reference_reset_base(href,current_procinfo.framepointer,hp^.pos,sizeof(pint));
@@ -1587,7 +1581,8 @@ implementation
           ressym:=tabstractnormalvarsym(current_procinfo.procdef.parast.Find('self'))
           ressym:=tabstractnormalvarsym(current_procinfo.procdef.parast.Find('self'))
         else
         else
           ressym:=tabstractnormalvarsym(current_procinfo.procdef.funcretsym);
           ressym:=tabstractnormalvarsym(current_procinfo.procdef.funcretsym);
-        if (ressym.refs>0) or (ressym.vardef.needs_inittable) then
+        if (ressym.refs>0) or
+           is_managed_type(ressym.vardef) then
           begin
           begin
             restmploc:=ressym.localloc;
             restmploc:=ressym.localloc;
 
 

+ 2 - 3
compiler/nld.pas

@@ -666,8 +666,7 @@ implementation
            exit;
            exit;
 
 
          { assignment to refcounted variable -> inc/decref }
          { assignment to refcounted variable -> inc/decref }
-         if (not is_class(left.resultdef) and
-            left.resultdef.needs_inittable) then
+         if is_managed_type(left.resultdef) then
            include(current_procinfo.flags,pi_do_call);
            include(current_procinfo.flags,pi_do_call);
 
 
         if (is_shortstring(left.resultdef)) then
         if (is_shortstring(left.resultdef)) then
@@ -689,7 +688,7 @@ implementation
             end;
             end;
            end
            end
         { call helpers for composite types containing automated types }
         { call helpers for composite types containing automated types }
-        else if (left.resultdef.needs_inittable) and
+        else if is_managed_type(left.resultdef) and
             (left.resultdef.typ in [arraydef,objectdef,recorddef]) and
             (left.resultdef.typ in [arraydef,objectdef,recorddef]) and
             not is_interfacecom(left.resultdef) and
             not is_interfacecom(left.resultdef) and
             not is_dynamic_array(left.resultdef) then
             not is_dynamic_array(left.resultdef) then

+ 2 - 2
compiler/opttail.pas

@@ -35,7 +35,7 @@ unit opttail;
     uses
     uses
       globtype,
       globtype,
       symconst,symsym,
       symconst,symsym,
-      defcmp,
+      defcmp,defutil,
       nutils,nbas,nflw,ncal,nld,ncnv,
       nutils,nbas,nflw,ncal,nld,ncnv,
       pass_1,
       pass_1,
       paramgr;
       paramgr;
@@ -192,7 +192,7 @@ unit opttail;
                  and slow down things anyways so a tail recursion call
                  and slow down things anyways so a tail recursion call
                  makes no sense
                  makes no sense
                }
                }
-               vardef.needs_inittable) then
+               is_managed_type(vardef)) then
                exit;
                exit;
 
 
         labelsym:=tlabelsym.create('$opttail');
         labelsym:=tlabelsym.create('$opttail');

+ 1 - 1
compiler/pdecsub.pas

@@ -396,7 +396,7 @@ implementation
          exit;
          exit;
         with tparavarsym(p) do
         with tparavarsym(p) do
          begin
          begin
-           if not vardef.needs_inittable and
+           if not is_managed_type(vardef) and
               paramanager.push_addr_param(varspez,vardef,tprocdef(arg).proccalloption) then
               paramanager.push_addr_param(varspez,vardef,tprocdef(arg).proccalloption) then
              varregable:=vr_intreg;
              varregable:=vr_intreg;
          end;
          end;

+ 1 - 1
compiler/pdecvar.pas

@@ -1480,7 +1480,7 @@ implementation
              { types that use init/final are not allowed in variant parts, but
              { types that use init/final are not allowed in variant parts, but
                classes are allowed }
                classes are allowed }
              if (variantrecordlevel>0) and
              if (variantrecordlevel>0) and
-                (hdef.needs_inittable and not is_class(hdef)) then
+                is_managed_type(hdef) then
                Message(parser_e_cant_use_inittable_here);
                Message(parser_e_cant_use_inittable_here);
 
 
              { try to parse the hint directives }
              { try to parse the hint directives }

+ 3 - 3
compiler/pinline.pas

@@ -312,7 +312,7 @@ implementation
                          ccallnode.createintern('fpc_getmem',para)));
                          ccallnode.createintern('fpc_getmem',para)));
 
 
                      { create call to fpc_initialize }
                      { create call to fpc_initialize }
-                     if tpointerdef(p.resultdef).pointeddef.needs_inittable then
+                     if is_managed_type(tpointerdef(p.resultdef).pointeddef) then
                        addstatement(newstatement,initialize_data_node(cderefnode.create(ctemprefnode.create(temp))));
                        addstatement(newstatement,initialize_data_node(cderefnode.create(ctemprefnode.create(temp))));
 
 
                      { copy the temp to the destination }
                      { copy the temp to the destination }
@@ -326,7 +326,7 @@ implementation
                   else
                   else
                    begin
                    begin
                      { create call to fpc_finalize }
                      { create call to fpc_finalize }
-                     if tpointerdef(p.resultdef).pointeddef.needs_inittable then
+                     if is_managed_type(tpointerdef(p.resultdef).pointeddef) then
                        addstatement(newstatement,finalize_data_node(cderefnode.create(p.getcopy)));
                        addstatement(newstatement,finalize_data_node(cderefnode.create(p.getcopy)));
 
 
                      { create call to fpc_freemem }
                      { create call to fpc_freemem }
@@ -394,7 +394,7 @@ implementation
                 ccallnode.createintern('fpc_getmem',para)));
                 ccallnode.createintern('fpc_getmem',para)));
 
 
             { create call to fpc_initialize }
             { create call to fpc_initialize }
-            if tpointerdef(p1.resultdef).pointeddef.needs_inittable then
+            if is_managed_type(tpointerdef(p1.resultdef).pointeddef) then
              begin
              begin
                para := ccallparanode.create(caddrnode.create_internal(crttinode.create
                para := ccallparanode.create(caddrnode.create_internal(crttinode.create
                           (tstoreddef(tpointerdef(p1.resultdef).pointeddef),initrtti,rdt_normal)),
                           (tstoreddef(tpointerdef(p1.resultdef).pointeddef),initrtti,rdt_normal)),

+ 6 - 9
compiler/psub.pas

@@ -148,8 +148,7 @@ implementation
       begin
       begin
         if (tsym(p).typ=paravarsym) and
         if (tsym(p).typ=paravarsym) and
            (tparavarsym(p).varspez=vs_value) and
            (tparavarsym(p).varspez=vs_value) and
-           not is_class(tparavarsym(p).vardef) and
-           tparavarsym(p).vardef.needs_inittable then
+           is_managed_type(tparavarsym(p).vardef) then
           include(current_procinfo.flags,pi_needs_implicit_finally);
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
       end;
 
 
@@ -160,8 +159,7 @@ implementation
         { occurs                                                            }
         { occurs                                                            }
         if (tsym(p).typ=localvarsym) and
         if (tsym(p).typ=localvarsym) and
            (tlocalvarsym(p).refs>0) and
            (tlocalvarsym(p).refs>0) and
-           not(is_class(tlocalvarsym(p).vardef)) and
-           tlocalvarsym(p).vardef.needs_inittable then
+           is_managed_type(tlocalvarsym(p).vardef) then
           include(current_procinfo.flags,pi_needs_implicit_finally);
           include(current_procinfo.flags,pi_needs_implicit_finally);
       end;
       end;
 
 
@@ -419,7 +417,7 @@ implementation
                   if is_object(current_objectdef) then
                   if is_object(current_objectdef) then
                     begin
                     begin
                       { finalize object data }
                       { finalize object data }
-                      if current_objectdef.needs_inittable then
+                      if is_managed_type(current_objectdef) then
                         addstatement(newstatement,finalize_data_node(load_self_node));
                         addstatement(newstatement,finalize_data_node(load_self_node));
                       { parameter 3 : vmt_offset }
                       { parameter 3 : vmt_offset }
                       { parameter 2 : pointer to vmt }
                       { parameter 2 : pointer to vmt }
@@ -485,7 +483,7 @@ implementation
             { no constructor }
             { no constructor }
             { must be the return value finalized before reraising the exception? }
             { must be the return value finalized before reraising the exception? }
             if (not is_void(current_procinfo.procdef.returndef)) and
             if (not is_void(current_procinfo.procdef.returndef)) and
-               (current_procinfo.procdef.returndef.needs_inittable) and
+               is_managed_type(current_procinfo.procdef.returndef) and
                (not paramanager.ret_in_param(current_procinfo.procdef.returndef, current_procinfo.procdef.proccalloption)) and
                (not paramanager.ret_in_param(current_procinfo.procdef.returndef, current_procinfo.procdef.proccalloption)) and
                (not is_class(current_procinfo.procdef.returndef)) then
                (not is_class(current_procinfo.procdef.returndef)) then
               addstatement(newstatement,finalize_data_node(load_result_node));
               addstatement(newstatement,finalize_data_node(load_result_node));
@@ -1509,9 +1507,8 @@ implementation
         if tsym(p).typ<>paravarsym then
         if tsym(p).typ<>paravarsym then
          exit;
          exit;
         with tparavarsym(p) do
         with tparavarsym(p) do
-          if (not is_class(vardef) and
-             vardef.needs_inittable and
-             (varspez in [vs_value,vs_out])) then
+          if is_managed_type(vardef) and
+             (varspez in [vs_value,vs_out]) then
             include(current_procinfo.flags,pi_do_call);
             include(current_procinfo.flags,pi_do_call);
       end;
       end;
 
 

+ 3 - 3
compiler/ptype.pas

@@ -523,7 +523,7 @@ implementation
          { restore symtable stack }
          { restore symtable stack }
          symtablestack.pop(recst);
          symtablestack.pop(recst);
          if trecorddef(record_dec).is_packed and
          if trecorddef(record_dec).is_packed and
-            record_dec.needs_inittable then
+            is_managed_type(record_dec) then
            Message(type_e_no_packed_inittable);
            Message(type_e_no_packed_inittable);
       end;
       end;
 
 
@@ -829,7 +829,7 @@ implementation
              begin
              begin
                arrdef.elementdef:=tt2;
                arrdef.elementdef:=tt2;
                if is_packed and
                if is_packed and
-                  tt2.needs_inittable then
+                  is_managed_type(tt2) then
                  Message(type_e_no_packed_inittable);
                  Message(type_e_no_packed_inittable);
              end;
              end;
         end;
         end;
@@ -1148,7 +1148,7 @@ implementation
                 (st.symtabletype=globalsymtable) and
                 (st.symtabletype=globalsymtable) and
                 not is_objc_class_or_protocol(def)
                 not is_objc_class_or_protocol(def)
                ) or
                ) or
-               def.needs_inittable or
+               is_managed_type(def) or
                (ds_init_table_used in def.defstates) then
                (ds_init_table_used in def.defstates) then
               RTTIWriter.write_rtti(def,initrtti);
               RTTIWriter.write_rtti(def,initrtti);
             { RTTI }
             { RTTI }

+ 1 - 2
compiler/symtable.pas

@@ -741,8 +741,7 @@ implementation
            localvarsym,
            localvarsym,
            paravarsym :
            paravarsym :
              begin
              begin
-               if not(is_class(tabstractvarsym(sym).vardef)) and
-                  tstoreddef(tabstractvarsym(sym).vardef).needs_inittable then
+               if is_managed_type(tabstractvarsym(sym).vardef) then
                  b_needs_init_final:=true;
                  b_needs_init_final:=true;
              end;
              end;
          end;
          end;