summaryrefslogtreecommitdiff
path: root/gcc/ada/s-stausa.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-04 13:41:55 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-04 13:41:55 +0000
commitf239f5be0dd95fd0a814da3fbe434e27f367d5a9 (patch)
treefd677c39de60bb95b906b1170abe8bdfde73da29 /gcc/ada/s-stausa.ads
parent3a2879357a1cd6e028c2426c1d20ce33c2892ce1 (diff)
downloadgcc-f239f5be0dd95fd0a814da3fbe434e27f367d5a9.tar.gz
2011-08-04 Yannick Moy <moy@adacore.com>
* sem_prag.adb, sem.ads: Code cleanup. 2011-08-04 Tristan Gingold <gingold@adacore.com> * s-tassta.adb (Task_Wrapper): Rewrite the dynamic stack usage part. * s-stausa.adb, s-stausa.ads: Major rewrite. Now provides accurate results if possible. * s-stusta.adb (Print): Adjust after changes in s-stausa. * gnat_ugn.texi: Update dynamic stack usage section. 2011-08-04 Steve Baird <baird@adacore.com> * bindgen.adb (Gen_CodePeer_Wrapper): new procedure. Generate (if CodePeer_Mode is set) a "wrapper" subprogram which contains only a call to the user-defined main subprogram. (Gen_Main_Ada) - If CodePeer_Mode is set, then call the "wrapper" subprogram instead of directly calling the user-defined main subprogram. 2011-08-04 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch5.adb (Expand_N_Case_Statement): Check the statements of all alternatives of a case statement for controlled objects. Rename local variable A to Dead_Alt. (Expand_N_If_Statement): Check the then and else statements of an if statement for controlled objects. Check the then statements of all elsif parts of an if statement for controlled objects. (Expand_N_Loop_Statement): Check the statements of a loop for controlled objects. * exp_ch7.adb (Process_Transient_Objects): Rewrite the condition which detects a loop associated with the expansion of an array object. Augment the processing of the loop statements to account for a possible wrap done by Process_Statements_For_Controlled_Objects. * exp_ch9.adb (Expand_N_Asynchronous_Select): Check the triggering statements and abortable part of an asynchronous select for controlled objects. (Expand_N_Conditional_Entry_Call): Check the else statements of a conditional entry call for controlled objects. (Expand_N_Selective_Accept): Check the alternatives of a selective accept for controlled objects. (Expand_N_Timed_Entry_Call): Check the entry call and delay alternatives of a timed entry call for controlled objects. * exp_ch11.adb (Expand_Exception_Handlers): Check the statements of an exception handler for controlled objects. * exp_util.adb (Requires_Cleanup_Actions (List_Id, Boolean, Boolean)): Add formal parameter Nested_Constructs along with its associated comment. (Requires_Cleanup_Actions (Node_Id)): Update all calls to Requires_Cleanup_Actions. (Process_Statements_For_Controlled_Objects): New routine. * exp_util.ads (Process_Statements_For_Controlled_Objects): New routine. Inspect a node which contains a non-handled sequence of statements for controlled objects. If such an object is found, the statements are wrapped in a block. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177386 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-stausa.ads')
-rw-r--r--gcc/ada/s-stausa.ads78
1 files changed, 35 insertions, 43 deletions
diff --git a/gcc/ada/s-stausa.ads b/gcc/ada/s-stausa.ads
index 1cd78ea0465..c0449e8fbc8 100644
--- a/gcc/ada/s-stausa.ads
+++ b/gcc/ada/s-stausa.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -57,11 +57,8 @@ package System.Stack_Usage is
-- Amount of stack used. The value is calculated on the basis of the
-- mechanism used by GNAT to allocate it, and it is NOT a precise value.
- Variation : Natural;
- -- Possible variation in the amount of used stack. The real stack usage
- -- may vary in the range Value +/- Variation
-
- Max_Size : Natural;
+ Stack_Size : Natural;
+ -- Size of the stack
end record;
type Result_Array_Type is array (Positive range <>) of Task_Result;
@@ -91,8 +88,9 @@ package System.Stack_Usage is
-- begin
-- Initialize_Analyzer (A,
-- "Task t",
+ -- A_Storage_Size,
+ -- 0,
-- A_Storage_Size - A_Guard,
- -- A_Guard
-- To_Stack_Address (Bottom_Of_Stack'Address));
-- Fill_Stack (A);
-- Some_User_Code;
@@ -115,7 +113,9 @@ package System.Stack_Usage is
-- before the call to the instrumentation procedure.
-- Strategy: The user of this package should measure the bottom of stack
- -- before the call to Fill_Stack and pass it in parameter.
+ -- before the call to Fill_Stack and pass it in parameter. The impact
+ -- is very minor unless the stack used is very small, but in this case
+ -- you aren't very interested by the figure.
-- Instrumentation threshold at writing:
@@ -212,32 +212,29 @@ package System.Stack_Usage is
-- the memory will look like that:
--
-- Stack growing
- -- ----------------------------------------------------------------------->
- -- |<---------------------->|<----------------------------------->|
- -- | Stack frame | Memory filled with Analyzer.Pattern |
- -- | of Fill_Stack | |
- -- | (deallocated at | |
- -- | the end of the call) | |
- -- ^ | ^
- -- Analyzer.Bottom_Of_Stack | Analyzer.Top_Pattern_Mark
- -- ^
- -- Analyzer.Bottom_Pattern_Mark
+ -- ---------------------------------------------------------------------->
+ -- |<--------------------->|<----------------------------------->|
+ -- | Stack frames to | Memory filled with Analyzer.Pattern |
+ -- | Fill_Stack | |
+ -- ^ | ^
+ -- Analyzer.Stack_Base | Analyzer.Pattern_Limit
+ -- ^
+ -- Analyzer.Pattern_Limit +/- Analyzer.Pattern_Size
--
procedure Initialize_Analyzer
(Analyzer : in out Stack_Analyzer;
Task_Name : String;
- My_Stack_Size : Natural;
- Max_Pattern_Size : Natural;
- Bottom : Stack_Address;
- Top : Stack_Address;
+ Stack_Size : Natural;
+ Stack_Base : Stack_Address;
+ Pattern_Size : Natural;
Pattern : Interfaces.Unsigned_32 := 16#DEAD_BEEF#);
-- Should be called before any use of a Stack_Analyzer, to initialize it.
-- Max_Pattern_Size is the size of the pattern zone, might be smaller than
- -- the full stack size in order to take into account e.g. the secondary
- -- stack and a guard against overflow. The actual size taken will be
- -- readjusted with data already used at the time the stack is actually
- -- filled.
+ -- the full stack size Stack_Size in order to take into account e.g. the
+ -- secondary stack and a guard against overflow. The actual size taken
+ -- will be readjusted with data already used at the time the stack is
+ -- actually filled.
Is_Enabled : Boolean := False;
-- When this flag is true, then stack analysis is enabled
@@ -253,16 +250,14 @@ package System.Stack_Usage is
-- Stack growing
-- ----------------------------------------------------------------------->
-- |<---------------------->|<-------------->|<--------->|<--------->|
- -- | Stack frame | Array of | used | Memory |
- -- | of Compute_Result | Analyzer.Probe | during | filled |
- -- | (deallocated at | elements | the | with |
- -- | the end of the call) | | execution | pattern |
- -- | ^ | | |
- -- | Bottom_Pattern_Mark | | |
+ -- | Stack frames | Array of | used | Memory |
+ -- | to Compute_Result | Analyzer.Probe | during | filled |
+ -- | | elements | the | with |
+ -- | | | execution | pattern |
-- | | |
-- |<----------------------------------------------------> |
-- Stack used ^
- -- Top_Pattern_Mark
+ -- Pattern_Limit
procedure Report_Result (Analyzer : Stack_Analyzer);
-- Store the results of the computation in memory, at the address
@@ -288,6 +283,10 @@ private
Task_Name : String (1 .. Task_Name_Length);
-- Name of the task
+ Stack_Base : Stack_Address;
+ -- Address of the base of the stack, as given by the caller of
+ -- Initialize_Analyzer.
+
Stack_Size : Natural;
-- Entire size of the analyzed stack
@@ -297,11 +296,8 @@ private
Pattern : Pattern_Type;
-- Pattern used to recognize untouched memory
- Bottom_Pattern_Mark : Stack_Address;
- -- Bound of the pattern area on the stack closest to the bottom
-
- Top_Pattern_Mark : Stack_Address;
- -- Topmost bound of the pattern area on the stack
+ Pattern_Limit : Stack_Address;
+ -- Bound of the pattern area farthest to the base
Topmost_Touched_Mark : Stack_Address;
-- Topmost address of the pattern area whose value it is pointing
@@ -309,11 +305,7 @@ private
-- compensated, it is the topmost value of the stack pointer during
-- the execution.
- Bottom_Of_Stack : Stack_Address;
- -- Address of the bottom of the stack, as given by the caller of
- -- Initialize_Analyzer.
-
- Stack_Overlay_Address : System.Address;
+ Pattern_Overlay_Address : System.Address;
-- Address of the stack abstraction object we overlay over a
-- task's real stack, typically a pattern-initialized array.