Sfoglia il codice sorgente

* renamed is_refcounted_type() into is_managed_type(), because it also
returns true for variants and those aren't refcounted
* also allow tempnodes for pointers to managed types to be put in
registers (not sure why it was disabled, and there are no
testsuite regressions by enabling it)

git-svn-id: trunk@15319 -

Jonas Maebe 15 anni fa
parent
commit
40705a085f
4 ha cambiato i file con 5 aggiunte e 8 eliminazioni
  1. 2 2
      compiler/defutil.pas
  2. 1 4
      compiler/nbas.pas
  3. 1 1
      compiler/ncnv.pas
  4. 1 1
      compiler/ptype.pas

+ 2 - 2
compiler/defutil.pas

@@ -99,7 +99,7 @@ interface
     function is_in_limit(def_from,def_to : tdef) : boolean;
 
     {# Returns whether def is reference counted }
-    function is_refcounted_type(def: tdef) : boolean;
+    function is_managed_type(def: tdef) : boolean;
 
 
 {    function is_in_limit_value(val_from:TConstExprInt;def_from,def_to : tdef) : boolean;}
@@ -526,7 +526,7 @@ implementation
       end;
 
 
-    function is_refcounted_type(def: tdef): boolean;
+    function is_managed_type(def: tdef): boolean;
       begin
         result:=
           def.needs_inittable and

+ 1 - 4
compiler/nbas.pas

@@ -712,10 +712,7 @@ implementation
            { size of register operations must be known }
            (def_cgsize(_typedef)<>OS_NO) and
            { no init/final needed }
-           not (_typedef.needs_inittable) and
-           ((_typedef.typ <> pointerdef) or
-            (is_object(tpointerdef(_typedef).pointeddef) or
-             not tpointerdef(_typedef).pointeddef.needs_inittable)) then
+           not is_managed_type(_typedef) then
           include(tempinfo^.flags,ti_may_be_in_reg);
       end;
 

+ 1 - 1
compiler/ncnv.pas

@@ -1725,7 +1725,7 @@ implementation
                      { some conversions, like dynarray to pointer in Delphi
                        mode, must not be removed, because then we get memory
                        leaks due to missing temp finalization }
-                     (not is_refcounted_type(left.resultdef) or
+                     (not is_managed_type(left.resultdef) or
                      { different kinds of refcounted types may need calls
                        to different kinds of refcounting helpers }
                       (resultdef=left.resultdef)) then

+ 1 - 1
compiler/ptype.pas

@@ -440,7 +440,7 @@ implementation
                            Message(parser_e_no_local_para_def);
                          consume(_OF);
                          single_type(t2,false,false);
-                         if is_refcounted_type(t2) then
+                         if is_managed_type(t2) then
                            Message(parser_e_no_refcounted_typed_file);
                          def:=tfiledef.createtyped(t2);
                       end