From patchwork Mon Jun 8 08:00:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1305009 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49gQhM2Yq2z9sRN for ; Mon, 8 Jun 2020 18:02:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6262F3945C23; Mon, 8 Jun 2020 08:00:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from rock.gnat.com (rock.gnat.com [IPv6:2620:20:4000:0:a9e:1ff:fe9b:1d1]) by sourceware.org (Postfix) with ESMTP id 99D103939C0B for ; Mon, 8 Jun 2020 08:00:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 99D103939C0B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=derodat@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4C81011787D; Mon, 8 Jun 2020 04:00:45 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9+OzxWTc2Unh; Mon, 8 Jun 2020 04:00:45 -0400 (EDT) Received: from tron.gnat.com (tron.gnat.com [205.232.38.10]) by rock.gnat.com (Postfix) with ESMTP id CB2671178A1; Mon, 8 Jun 2020 04:00:43 -0400 (EDT) Received: by tron.gnat.com (Postfix, from userid 4862) id CA14FBE; Mon, 8 Jun 2020 04:00:43 -0400 (EDT) Date: Mon, 8 Jun 2020 04:00:43 -0400 From: Pierre-Marie de Rodat To: gcc-patches@gcc.gnu.org Subject: [Ada] Implement AI12-0291 (Jorvik profile) Message-ID: <20200608080043.GA90427@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Steve Baird Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" The Jorvik profile is a newly defined profile, similar to the Ravenscar profile but less restrictive in some cases. It differs from the Ravenscar profile only in the removal of six restrictions and the relaxation of one (Ravenscar's Simple_Barriers restriction is replaced with a Pure_Barriers restriction). Tested on x86_64-pc-linux-gnu, committed on trunk 2020-06-08 Steve Baird gcc/ada/ * libgnat/s-rident.ads: Add Jorvik to the Profile_Name enumeration type. Add an element for Jorvik to the array aggregate that is the initial value of the constant Profile_Info. * targparm.adb (Get_Target_Parameters): Handle "pragma Profile (Jorvik);" similarly to "pragma Profile (Ravenscar);". * snames.ads-tmpl: Declare Name_Jorvik Name_Id. Unlike Ravenscar, Jorvik is not a pragma name and has no corresponding element in the Pragma_Id enumeration type; this means that its declaration must not occur between those of First_Pragma_Name and Last_Pragma_Name. * sem_prag.adb (Analyze_Pragma): Add call to Set_Ravenscar_Profile for Jorvik, similar to the existing calls for Ravenscar and the GNAT Ravenscar variants. --- gcc/ada/libgnat/s-rident.ads +++ gcc/ada/libgnat/s-rident.ads @@ -381,6 +381,7 @@ package System.Rident is Restricted_Tasking, Restricted, Ravenscar, + Jorvik, GNAT_Extended_Ravenscar, GNAT_Ravenscar_EDF); -- Names of recognized profiles. No_Profile is used to indicate that a @@ -545,6 +546,67 @@ package System.Rident is Max_Task_Entries => 0, others => 0)), + Jorvik => + + -- Restrictions for Jorvik profile .. + + -- Note: the table entries here only represent the + -- required restriction profile for Jorvik. The + -- full Jorvik profile also requires: + + -- pragma Dispatching_Policy (FIFO_Within_Priorities); + -- pragma Locking_Policy (Ceiling_Locking); + -- pragma Detect_Blocking; + + -- The differences between Ravenscar and Jorvik are + -- as follows: + -- 1) Ravenscar includes restriction Simple_Barriers; + -- Jorvik includes Pure_Barriers instead. + -- 2) The following 6 restrictions are included in + -- Ravenscar but not in Jorvik: + -- No_Implicit_Heap_Allocations + -- No_Relative_Delay + -- Max_Entry_Queue_Length => 1 + -- Max_Protected_Entries => 1 + -- No_Dependence => Ada.Calendar + -- No_Dependence => Ada.Synchronous_Barriers + -- + -- The last of those 7 (i.e., No_Dep => Ada.Synch_Bars) + -- is not reflected here (see sem_prag.adb). + + (Set => + (No_Abort_Statements => True, + No_Asynchronous_Control => True, + No_Dynamic_Attachment => True, + No_Dynamic_Priorities => True, + No_Local_Protected_Objects => True, + No_Protected_Type_Allocators => True, + No_Requeue_Statements => True, + No_Task_Allocators => True, + No_Task_Attributes_Package => True, + No_Task_Hierarchy => True, + No_Terminate_Alternatives => True, + Max_Asynchronous_Select_Nesting => True, + Max_Select_Alternatives => True, + Max_Task_Entries => True, + + -- plus these additional restrictions: + + No_Local_Timing_Events => True, + No_Select_Statements => True, + No_Specific_Termination_Handlers => True, + No_Task_Termination => True, + Pure_Barriers => True, + others => False), + + -- Value settings for Ravenscar (same as Restricted) + + Value => + (Max_Asynchronous_Select_Nesting => 0, + Max_Select_Alternatives => 0, + Max_Task_Entries => 0, + others => 0)), + GNAT_Extended_Ravenscar => -- Restrictions for GNAT_Extended_Ravenscar = --- gcc/ada/sem_prag.adb +++ gcc/ada/sem_prag.adb @@ -4330,9 +4330,9 @@ package body Sem_Prag is procedure Set_Ravenscar_Profile (Profile : Profile_Name; N : Node_Id); -- Activate the set of configuration pragmas and restrictions that make -- up the Profile. Profile must be either GNAT_Extended_Ravenscar, - -- GNAT_Ravenscar_EDF, or Ravenscar. N is the corresponding pragma node, - -- which is used for error messages on any constructs violating the - -- profile. + -- GNAT_Ravenscar_EDF, Jorvik, or Ravenscar. N is the corresponding + -- pragma node, which is used for error messages on any constructs + -- violating the profile. --------------------- -- Ada_2005_Pragma -- @@ -11162,7 +11162,7 @@ package body Sem_Prag is -- Set required policies -- pragma Task_Dispatching_Policy (FIFO_Within_Priorities) - -- (For Ravenscar and GNAT_Extended_Ravenscar profiles) + -- (For Ravenscar, Jorvik, and GNAT_Extended_Ravenscar profiles) -- pragma Task_Dispatching_Policy (EDF_Across_Priorities) -- (For GNAT_Ravenscar_EDF profile) -- pragma Locking_Policy (Ceiling_Locking) @@ -11283,6 +11283,10 @@ package body Sem_Prag is -- No_Dependence => Ada.Execution_Time.Group_Budget -- No_Dependence => Ada.Execution_Time.Timers + -- ??? Eventually when AI12-0073 is implemented, we'll register a + -- No_Dependence restriction on Ada.Synchronous_Barriers + -- for Ravenscar but not for Jorvik. + if Ada_Version >= Ada_2005 then Pref_Id := Make_Identifier (Loc, Name_Find ("ada")); Sel_Id := Make_Identifier (Loc, Name_Find ("execution_time")); @@ -21314,6 +21318,9 @@ package body Sem_Prag is if Chars (Argx) = Name_Ravenscar then Set_Ravenscar_Profile (Ravenscar, N); + elsif Chars (Argx) = Name_Jorvik then + Set_Ravenscar_Profile (Jorvik, N); + elsif Chars (Argx) = Name_Gnat_Extended_Ravenscar then Set_Ravenscar_Profile (GNAT_Extended_Ravenscar, N); --- gcc/ada/snames.ads-tmpl +++ gcc/ada/snames.ads-tmpl @@ -782,6 +782,7 @@ package Snames is Name_Info : constant Name_Id := N + $; Name_Internal : constant Name_Id := N + $; Name_Ivdep : constant Name_Id := N + $; + Name_Jorvik : constant Name_Id := N + $; Name_Link_Name : constant Name_Id := N + $; Name_Low_Order_First : constant Name_Id := N + $; Name_Lowercase : constant Name_Id := N + $; --- gcc/ada/targparm.adb +++ gcc/ada/targparm.adb @@ -334,6 +334,14 @@ package body Targparm is Opt.Locking_Policy := 'C'; goto Line_Loop_Continue; + -- Test for pragma Profile (Jorvik); + + elsif Looking_At_Skip ("pragma Profile (Jorvik);") then + Set_Profile_Restrictions (Jorvik); + Opt.Task_Dispatching_Policy := 'F'; + Opt.Locking_Policy := 'C'; + goto Line_Loop_Continue; + -- Test for pragma Profile (GNAT_Extended_Ravenscar); elsif Looking_At_Skip