From 40705a085f5c62d59b23caf6c44cef21638248c1 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 22 May 2010 20:51:50 +0000 Subject: [PATCH] * 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 - --- compiler/defutil.pas | 4 ++-- compiler/nbas.pas | 5 +---- compiler/ncnv.pas | 2 +- compiler/ptype.pas | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/defutil.pas b/compiler/defutil.pas index 96a7efb777..458e87c153 100644 --- a/compiler/defutil.pas +++ b/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 diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 27a3ed15f5..a8b56f4daa 100644 --- a/compiler/nbas.pas +++ b/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; diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index f6177eaae4..0091d1e935 100644 --- a/compiler/ncnv.pas +++ b/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 diff --git a/compiler/ptype.pas b/compiler/ptype.pas index f27d8a7902..c8dfaaad47 100644 --- a/compiler/ptype.pas +++ b/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