From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100359 invoked by alias); 6 Jun 2016 09:19:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 100347 invoked by uid 89); 6 Jun 2016 09:19:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.2 required=5.0 tests=AWL,BAYES_50,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=contracts, frozen, etype, U*ebotcazou X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 06 Jun 2016 09:18:52 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 6F885812F5 for ; Mon, 6 Jun 2016 11:18:49 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r2mcnZpsaAvd for ; Mon, 6 Jun 2016 11:18:49 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 377FA812F3 for ; Mon, 6 Jun 2016 11:18:49 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Remove deferred freezing of subprograms in Freeze_Entity Date: Mon, 06 Jun 2016 09:19:00 -0000 Message-ID: <4402208.cRVLUXTxOq@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-35-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1644800.FV7oR4AB6Y" Content-Transfer-Encoding: 7Bit X-SW-Source: 2016-06/txt/msg00358.txt.bz2 This is a multi-part message in MIME format. --nextPart1644800.FV7oR4AB6Y Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 854 This removes the specific mechanism present in Freeze_Entity to defer the freezing of functions returning an incomplete type coming from a limited context. It was invented to cope with the old elaboration model for subprograms in gigi, which didn't really implement AI05-151 and AI05-019. The new elaboration model implements both AIs so the mechanism is obsolete. No functional change. Tested on x86_64-suse-linux, applied on the mainline. 2016-06-06 Eric Botcazou * einfo.ads (Returns_Limited_View): Remove. (Set_Returns_Limited_View ): Likewise. * einfo.adb (Returns_Limited_View): Likewise. (Set_Returns_Limited_View ): Likewise. * freeze.adb (Late_Freeze_Subprogram): Remove. (Freeze_Entity): Do not defer the freezing of functions returning an incomplete type coming from a limited context. -- Eric Botcazou --nextPart1644800.FV7oR4AB6Y Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" Content-length: 9902 Index: einfo.ads =================================================================== --- einfo.ads (revision 237088) +++ einfo.ads (working copy) @@ -3973,12 +3973,6 @@ package Einfo is -- by reference, either because its return type is a by-reference-type -- or because the function explicitly uses the secondary stack. --- Returns_Limited_View (Flag134) --- Defined in function entities. Set if the return type of the function --- at the point of definition is a limited view. Used to handle the late --- freezing of the function when it is called in the current semantic --- unit while it is still unfrozen. - -- Reverse_Bit_Order (Flag164) [base type only] -- Defined in all record type entities. Set if entity has a Bit_Order -- aspect (set by an aspect clause or attribute definition clause) that @@ -5972,7 +5966,6 @@ package Einfo is -- Requires_Overriding (Flag213) (non-generic case only) -- Return_Present (Flag54) -- Returns_By_Ref (Flag90) - -- Returns_Limited_View (Flag134) (non-generic case only) -- Rewritten_For_C (Flag287) (generate C code only) -- Sec_Stack_Needed_For_Return (Flag167) -- SPARK_Pragma_Inherited (Flag265) @@ -7174,7 +7167,6 @@ package Einfo is function Return_Applies_To (Id : E) return N; function Return_Present (Id : E) return B; function Returns_By_Ref (Id : E) return B; - function Returns_Limited_View (Id : E) return B; function Reverse_Bit_Order (Id : E) return B; function Reverse_Storage_Order (Id : E) return B; function Rewritten_For_C (Id : E) return B; @@ -7848,7 +7840,6 @@ package Einfo is procedure Set_Return_Applies_To (Id : E; V : N); procedure Set_Return_Present (Id : E; V : B := True); procedure Set_Returns_By_Ref (Id : E; V : B := True); - procedure Set_Returns_Limited_View (Id : E; V : B := True); procedure Set_Reverse_Bit_Order (Id : E; V : B := True); procedure Set_Reverse_Storage_Order (Id : E; V : B := True); procedure Set_Rewritten_For_C (Id : E; V : B := True); @@ -8678,7 +8669,6 @@ package Einfo is pragma Inline (Return_Applies_To); pragma Inline (Return_Present); pragma Inline (Returns_By_Ref); - pragma Inline (Returns_Limited_View); pragma Inline (Reverse_Bit_Order); pragma Inline (Reverse_Storage_Order); pragma Inline (Rewritten_For_C); @@ -9143,7 +9133,6 @@ package Einfo is pragma Inline (Set_Return_Applies_To); pragma Inline (Set_Return_Present); pragma Inline (Set_Returns_By_Ref); - pragma Inline (Set_Returns_Limited_View); pragma Inline (Set_Reverse_Bit_Order); pragma Inline (Set_Reverse_Storage_Order); pragma Inline (Set_Rewritten_For_C); Index: einfo.adb =================================================================== --- einfo.adb (revision 237088) +++ einfo.adb (working copy) @@ -432,7 +432,6 @@ package body Einfo is -- No_Pool_Assigned Flag131 -- Is_Default_Init_Cond_Procedure Flag132 -- Has_Inherited_Default_Init_Cond Flag133 - -- Returns_Limited_View Flag134 -- Has_Aliased_Components Flag135 -- No_Strict_Aliasing Flag136 -- Is_Machine_Code_Subprogram Flag137 @@ -3065,12 +3064,6 @@ package body Einfo is return Flag90 (Id); end Returns_By_Ref; - function Returns_Limited_View (Id : E) return B is - begin - pragma Assert (Ekind (Id) = E_Function); - return Flag134 (Id); - end Returns_Limited_View; - function Reverse_Bit_Order (Id : E) return B is begin pragma Assert (Is_Record_Type (Id)); @@ -6142,12 +6135,6 @@ package body Einfo is Set_Flag90 (Id, V); end Set_Returns_By_Ref; - procedure Set_Returns_Limited_View (Id : E; V : B := True) is - begin - pragma Assert (Ekind (Id) = E_Function); - Set_Flag134 (Id, V); - end Set_Returns_Limited_View; - procedure Set_Reverse_Bit_Order (Id : E; V : B := True) is begin pragma Assert @@ -9141,7 +9128,6 @@ package body Einfo is W ("Requires_Overriding", Flag213 (Id)); W ("Return_Present", Flag54 (Id)); W ("Returns_By_Ref", Flag90 (Id)); - W ("Returns_Limited_View", Flag134 (Id)); W ("Reverse_Bit_Order", Flag164 (Id)); W ("Reverse_Storage_Order", Flag93 (Id)); W ("Rewritten_For_C", Flag287 (Id)); Index: freeze.adb =================================================================== --- freeze.adb (revision 237088) +++ freeze.adb (working copy) @@ -1934,9 +1934,6 @@ package body Freeze is Has_Default_Initialization : Boolean := False; -- This flag gets set to true for a variable with default initialization - Late_Freezing : Boolean := False; - -- Used to detect attempt to freeze function declared in another unit - Result : List_Id := No_List; -- List of freezing actions, left at No_List if none @@ -1973,9 +1970,8 @@ package body Freeze is function Freeze_Profile (E : Entity_Id) return Boolean; -- Freeze formals and return type of subprogram. If some type in the - -- profile is a limited view, freezing of the entity will take place - -- elsewhere, and the function returns False. This routine will be - -- modified if and when we can implement AI05-019 efficiently ??? + -- profile is incomplete and we are in an instance, freezing of the + -- entity will take place elsewhere, and the function returns False. procedure Freeze_Record_Type (Rec : Entity_Id); -- Freeze record type, including freezing component types, and freezing @@ -1985,16 +1981,6 @@ package body Freeze is -- Determine whether an arbitrary entity is subject to Boolean aspect -- Import and its value is specified as True. - procedure Late_Freeze_Subprogram (E : Entity_Id); - -- Following AI05-151, a function can return a limited view of a type - -- declared elsewhere. In that case the function cannot be frozen at - -- the end of its enclosing package. If its first use is in a different - -- unit, it cannot be frozen there, but if the call is legal the full - -- view of the return type is available and the subprogram can now be - -- frozen. However the freeze node cannot be inserted at the point of - -- call, but rather must go in the package holding the function, so that - -- the backend can process it in the proper context. - function New_Freeze_Node return Node_Id; -- Create a new freeze node for entity E @@ -3300,15 +3286,6 @@ package body Freeze is if Ekind (E) = E_Function then - -- Check whether function is declared elsewhere. Previous code - -- used Get_Source_Unit on both arguments, but the values are - -- equal in the case of a parent and a child unit. - -- Confusion with subunits in code ???? - - Late_Freezing := - not In_Same_Extended_Unit (E, N) - and then Returns_Limited_View (E); - -- Freeze return type R_Type := Etype (E); @@ -3326,24 +3303,6 @@ package body Freeze is then R_Type := Full_View (R_Type); Set_Etype (E, R_Type); - - -- If the return type is a limited view and the non-limited - -- view is still incomplete, the function has to be frozen at a - -- later time. If the function is abstract there is no place at - -- which the full view will become available, and no code to be - -- generated for it, so mark type as frozen. - - elsif Ekind (R_Type) = E_Incomplete_Type - and then From_Limited_With (R_Type) - and then Ekind (Non_Limited_View (R_Type)) = E_Incomplete_Type - then - if Is_Abstract_Subprogram (E) then - null; - else - Set_Is_Frozen (E, False); - Set_Returns_Limited_View (E); - return False; - end if; end if; Freeze_And_Append (R_Type, N, Result); @@ -4613,25 +4572,6 @@ package body Freeze is return False; end Has_Boolean_Aspect_Import; - ---------------------------- - -- Late_Freeze_Subprogram -- - ---------------------------- - - procedure Late_Freeze_Subprogram (E : Entity_Id) is - Spec : constant Node_Id := - Specification (Unit_Declaration_Node (Scope (E))); - Decls : List_Id; - - begin - if Present (Private_Declarations (Spec)) then - Decls := Private_Declarations (Spec); - else - Decls := Visible_Declarations (Spec); - end if; - - Append_List (Result, Decls); - end Late_Freeze_Subprogram; - --------------------- -- New_Freeze_Node -- --------------------- @@ -5111,12 +5051,6 @@ package body Freeze is Freeze_Subprogram (E); end if; - if Late_Freezing then - Late_Freeze_Subprogram (E); - Ghost_Mode := Save_Ghost_Mode; - return No_List; - end if; - -- If warning on suspicious contracts then check for the case of -- a postcondition other than False for a No_Return subprogram. --nextPart1644800.FV7oR4AB6Y--