This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Allow task-type specific secondary-stack size definition


This patch provides a GNAT specific aspect and pragma Secondary_Stack_Size
that enables users to specify the size of the secondary stack for each
task type. On targets that use dynamic secondary stack size allocation,
this pragma defines the initial size of the secondary stack. On targets
using fixed secondary stack allocation, such as bare boards, the pragma
defines the amount of primary stack that will be reserved for secondary
stack.

When the restriction No_Secondary_Stack is in place, this patch now
suppresses the allocation of secondary stacks on targets using fixed
secondary stacks (except for the environment task where
System.Secondary_Stack.Default_Secondary_Stack_Size must be changed instead).

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-01-06  Patrick Bernardi  <bernardi@adacore.com>

	* aspect.adb, aspect.ads: Added new aspect Secondary_Stack_Size.
	* exp_ch3.adb (Build_Init_Statements): As part of initialising
	the value record of a task, set its _Secondary_Stack_Size field
	if present.
	* exp_ch9.adb (Expand_N_Task_Type_Declaration): Create
	a _Secondary_Stack_Size field in the value record of
	the task if a Secondary_Stack_Size rep item is present.
	(Make_Task_Create_Call): Include secondary stack size
	parameter. If No_Secondary_Stack restriction is in place, passes
	stack size of 0.
	* par-prag.adb, sem_prag.adb, sem_prag.ads: Added new pragma
	Secondary_Stack_Size.
	* s-secsta.adb, s-secsta.ads (Minimum_Secondary_Stack_Size): New
	function to define the overhead of the secondary stack.
	* s-tarest.adb (Create_Restricted_Task,
	Create_Restricted_Task_Sequential): Functions now include
	Secondary_Stack_Size parameter to pass to Initialize_ATCB.
	* s-tarest.adb (Create_Restricted_Task,
	Create_Restricted_Task_Sequential): Calls to Initialize_ATCB
	now include Secondary_Stack_Size parameter.
	(Task_Wrapper):
	Secondary stack now allocated to the size specified by the
	Secondary_Stack_Size parameter in the task's ATCB.
	* s-taskin.adb, s-taskin.adb (Common_ATCB, Initialise_ATCB): New
	Secondary_Stack_Size component.
	* s-tassta.adb, s-tassta.ads (Create_Restricted_Task,
	Create_Restricted_Task_Sequential): Function now include
	Secondary_Stack_Size parameter.
	(Task_Wrapper): Secondary stack
	now allocated to the size specified by the Secondary_Stack_Size
	parameter in the task's ATCB.
	* sem_ch13.adb (Analyze_Aspect_Specification): Add support
	for Secondary_Stack_Size aspect, turning the aspect into its
	corresponding internal attribute.
	(Analyze_Attribute_Definition):
	Process Secondary_Stack_Size attribute.
	* snames.adb-tmpl, snames.ads-tmpl: Added names
	Name_Secondary_Stack_Size, Name_uSecondary_Stack_Size,
	Attribute_Secondary_Stack_Size and Pragma_Secondary_Stack_Size.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]