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] AI-266


Tested on i686-linux, committed on trunk

This patch implements the new Ada 2005 feature that    
supports task termination procedures, as defined in AI-266-02            
(http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-10266.TXT).           
This is a mechanism for associating a protected procedure with a task. This 
procedure is invoked when a task is about to terminate. It helps mitigating
the hazard of tasks terminating silently.

This patch also implements a way to analyze the amount of stack
taken by an Ada task at run-time. It fills each Ada task
stack with a special pattern, at beginning, (including the
environment task if GNAT_STACK_LIMIT is set). When a task is
finished, the stack is analyzed and we assume that the area
that still contains the pattern has not been touched.
Results are stored and displayed at the end of the
execution, except if the result buffer is full. In this last
case, results are displayed on the fly. This mechanism
is enabled by adding -u<number> flag to gnatbind, where
<number> is the size of the buffer of results.

Finally, this patch also  adds a soft emulation of the PowerPC AltiVec
extension to the GNAT library under the GNAT.Altivec hierarchy.
This provides a convenient interface to manipulate vectors.

2005-12-05  Jose Ruiz  <ruiz@adacore.com>
	    Quentin Ochem  <ochem@adacore.com>
	    Florian Villoing  <villoing@adacore.com>

        * a-taster.ads, a-taster.adb: New files.

	* a-elchha.adb (Last_Chance_Handler): Change the task termination soft
	link to the version that does nothing. This way the task termination
	routine is not executed twice for the environment task when finishing
	because of an unhandled exception.

	* a-exextr.adb (Notify_Unhandled_Exception): Call the task termination
	handler because of an unhandled exception.

	* a-taside.adb (Abort_Tasks): Call the Abort_Tasks procedure from
	System.Tasking.Utilities instead of that in System.Tasking.Stages.

	* s-finimp.adb (initialization code): Modify the soft link for the
	finalization of the global list instead of Adafinal.

	* s-soflin.ads, s-soflin.adb (Task_Termination_NT): Add this
	non-tasking version of the soft link for task termination. We do
	nothing since if we are using the non-tasking version it
	means that the task termination functionality is not used.
	(Null_Finalize_Global_List): Add this null version for the procedure
	in charge of finalizing the global list for controlled objects.
	(Null_Adafinal): Remove this procedure. Adafinal_NT has been created
	instead for handling run-time termination in a more flexible way.
	(Adafinal_NT): This new procedure will take care of finalizing the
	global list for controlled objects if needed, but no tasking
	finalization.

	* s-tarest.adb (Task_Lock): Do not try to lock again the
	Global_Task_Lock if we already own it. Otherwise, we get blocked in
	some run-time operations.
	(Task_Unlock): Do not try to actually unlock the Global_Task_Lock
	until all nested locks have been released.
	(Task_Wrapper): Call the fall-back task termination handler. It
	applies to all tasks but the environment task.
	(Finalize_Global_Tasks): Add the call for the task termination
	procedure for the environment task.
	(Task_Wrapper): suppress warnings around declaration of
	Secondary_Stack_Address.

	* s-tasini.adb (Final_Task_Unlock): Global_Task_Lock_Nesting has been
	moved to the Common_ATCB record.
	(Task_Lock): Global_Task_Lock_Nesting has been moved to the
	Common_ATCB record.
	(Task_Unlock): Global_Task_Lock_Nesting has been moved to the
	Common_ATCB record.

	* s-taskin.adb (Initialize_ATCB): Initialize Global_Task_Lock_Nesting,
	Fall_Back_Handler, and Specific_Handler.

	* s-taskin.ads (Cause_Of_Termination): Redefine this type here, already
	defined in Ada.Task_Termination, to avoid circular dependencies.
	(Termination_Handler): Redefine this type here, alredy defined in
	Ada.Task_Termination, for avoiding circular dependencies.
	(Common_ATCB): Add the Fall_Back_Handler and Specific_Handler required
	for storing task termination handlers. In addition,
	Global_Task_Lock_Nesting has been moved from Ada_Task_Control_Block to
	Common_ATCB because it is used by both the regular and the restricted
	run times.
	(Ada_Task_Control_Block): Move Global_Task_Lock_Nesting from here to
	Common_ATCB because it is used by both the regular and the restricted
	run times.
	(Common_ATCB): Added a dynamic task analyzer field.

	* s-tassta.adb (Abort_Tasks): Move the code in charge of checking
	potentially blocking operations to System.Tasking.Utilities.Abort_Tasks.
	(Task_Wrapper): Call the task termination handler. It applies to all
	tasks but the environment task.
	(Finalize_Global_Tasks): Call the task termination procedure for the
	environment task. The call to Finalize_Global_List is now performed
	using the soft links mechanism.
	(Task_Wrapper): added dynamic stack analysis.

	* s-tasuti.adb (Abort_Tasks): The code in charge of checking
	potentially blocking operations has been moved from
	System.Tasking.Stages.Abort_Tasks to this procedure. There can be
	direct calls to System.Tasking.Utilities.Abort_Tasks that do not pass
	through System.Tasking.Stages.Abort_Tasks, and we do not want to miss
	this run-time check.

	* s-solita.adb (Task_Termination_Handler_T): Add this task-safe version
	of task termination procedure.
	(Init_Tasking_Soft_Links): Install the task-safe version of the soft
	link for the task termination procedure.

	* bindusg.adb: (Bindusg): Added documentation for -u option.

	* bindgen.adb (Get_Main_Ada) Added handling of dynamic stack analysis.
	(Get_Main_C): Add handling of dynamic stack analysis.
	(Gen_Output_File_C): Add external functions for dynamic stack analysis.

	* Makefile.rtl: Add entry for a-taster (Ada.Task_Termination).
	(GNATRTL_NONTASKING_OBJS) Added entries for dynamic stack analysis
	(GNATRTL_NONTASKING_OBJS): Add AltiVec files.

	* opt.ads: Added flags used by dynamic stack measurement.
	(Max_Line_Length): Remove (not used anymore)

	* s-io.ads, s-io.adb (Standard_Error): new subprogram
	(Standart_Output): new subprogram
	(Set_Output): new subprogram
	(Put): now uses the value of Current_Out to know if the output has to be
	send to stderr or stdout.
	
	* s-stausa.ads: Complete implementation.

	* switch-b.adb: Added handling of -u switch for dynamic stack analysis.
	
	* impunit.adb (Non_Imp_File_Names_05): Add Ada.Task_Termination to the
	list of Ada 05 files.
	(GNAT Library Units): Add AltiVec files.

	* g-allein.ads, g-alleve.adb, g-alleve.ads, g-altcon.adb,
	g-altcon.ads, g-altive.ads, g-alveop.adb, g-alveop.ads
	g-alvety.ads, g-alvevi.ads: New files providing altivec API.

Attachment: difs.3.gz
Description: application/gunzip


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