Commit e57ab550 by Arnaud Charlet

[multiple changes]

2010-10-18  Vincent Celier  <celier@adacore.com>

	* prj.ads (Source_Data): New Boolean flag In_The_Queue.

2010-10-18  Tristan Gingold  <gingold@adacore.com>

	* s-stausa.ads: Add the Top parameter to Initialize_Analyzer.
	* s-stausa.adb: Use the top parameter.  In Fill_Stack, use the
	stack top if known.
	* s-tassta.adb (Task_Wrapper): Call Initialize_Analyzer after Enter_Task
	so that Pri_Stack_Info.Limit can be set and used.

2010-10-18  Robert Dewar  <dewar@adacore.com>

	* einfo.ads: Minor reformatting.
	* sem_res.adb (Resolve_Allocator): Add test for violating
	No_Anonymous_Allocators.

From-SVN: r165624
parent 468ee96a
2010-10-18 Vincent Celier <celier@adacore.com>
* prj.ads (Source_Data): New Boolean flag In_The_Queue.
2010-10-18 Tristan Gingold <gingold@adacore.com>
* s-stausa.ads: Add the Top parameter to Initialize_Analyzer.
* s-stausa.adb: Use the top parameter. In Fill_Stack, use the
stack top if known.
* s-tassta.adb (Task_Wrapper): Call Initialize_Analyzer after Enter_Task
so that Pri_Stack_Info.Limit can be set and used.
2010-10-18 Robert Dewar <dewar@adacore.com>
* einfo.ads: Minor reformatting.
* sem_res.adb (Resolve_Allocator): Add test for violating
No_Anonymous_Allocators.
2010-10-18 Robert Dewar <dewar@adacore.com> 2010-10-18 Robert Dewar <dewar@adacore.com>
* prj-nmsc.adb, prj.adb, sem_res.adb: Minor reformatting. * prj-nmsc.adb, prj.adb, sem_res.adb: Minor reformatting.
......
...@@ -3778,15 +3778,14 @@ package Einfo is ...@@ -3778,15 +3778,14 @@ package Einfo is
-- E_Access_Subtype is for an access subtype created by a subtype -- E_Access_Subtype is for an access subtype created by a subtype
-- declaration. -- declaration.
-- In addition, we define the kind E_Allocator_Type to label -- In addition, we define the kind E_Allocator_Type to label allocators.
-- allocators. This is because special resolution rules apply to this -- This is because special resolution rules apply to this construct.
-- construct. Eventually the constructs are labeled with the access -- Eventually the constructs are labeled with the access type imposed by
-- type imposed by the context. Gigi should never see the type -- the context. Gigi should never see the type E_Allocator.
-- E_Allocator.
-- Similarly, the type E_Access_Attribute_Type is used as the initial kind
-- Similarly, the type E_Access_Attribute_Type is used as the initial -- associated with an access attribute. After resolution a specific access
-- kind associated with an access attribute. After resolution a specific -- type will be established as determined by the context.
-- access type will be established as determined by the context.
-- Finally, the type Any_Access is used to label -null- during type -- Finally, the type Any_Access is used to label -null- during type
-- resolution. Any_Access is also replaced by the context type after -- resolution. Any_Access is also replaced by the context type after
......
...@@ -710,6 +710,9 @@ package Prj is ...@@ -710,6 +710,9 @@ package Prj is
-- Updated at the first call to Is_Compilable. Yes if source file is -- Updated at the first call to Is_Compilable. Yes if source file is
-- compilable. -- compilable.
In_The_Queue : Boolean := False;
-- True if the source has been put in the queue
Locally_Removed : Boolean := False; Locally_Removed : Boolean := False;
-- True if the source has been "excluded" -- True if the source has been "excluded"
...@@ -793,6 +796,7 @@ package Prj is ...@@ -793,6 +796,7 @@ package Prj is
Index => 0, Index => 0,
Locally_Removed => False, Locally_Removed => False,
Compilable => Unknown, Compilable => Unknown,
In_The_Queue => False,
Replaced_By => No_Source, Replaced_By => No_Source,
File => No_File, File => No_File,
Display_File => No_File, Display_File => No_File,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2004-2009, Free Software Foundation, Inc. -- -- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -232,7 +232,8 @@ package body System.Stack_Usage is ...@@ -232,7 +232,8 @@ package body System.Stack_Usage is
"ENVIRONMENT TASK", "ENVIRONMENT TASK",
My_Stack_Size, My_Stack_Size,
My_Stack_Size, My_Stack_Size,
System.Storage_Elements.To_Integer (Bottom_Of_Stack'Address)); System.Storage_Elements.To_Integer (Bottom_Of_Stack'Address),
0);
Fill_Stack (Environment_Task_Analyzer); Fill_Stack (Environment_Task_Analyzer);
...@@ -259,56 +260,90 @@ package body System.Stack_Usage is ...@@ -259,56 +260,90 @@ package body System.Stack_Usage is
Stack_Used_When_Filling : Integer; Stack_Used_When_Filling : Integer;
Current_Stack_Level : aliased Integer; Current_Stack_Level : aliased Integer;
Guard : constant Integer := 256;
-- Guard space between the Current_Stack_Level'Address and the last
-- allocated byte on the stack.
begin begin
-- Readjust the pattern size. When we arrive in this function, there is if Analyzer.Top_Pattern_Mark /= 0 then
-- already a given amount of stack used, that we won't analyze. -- Easiest and most accurate method: the top of the stack is known.
Stack_Used_When_Filling := Analyzer.Pattern_Size :=
Stack_Size Stack_Size (Analyzer.Top_Pattern_Mark,
(Analyzer.Bottom_Of_Stack, To_Stack_Address (Current_Stack_Level'Address))
To_Stack_Address (Current_Stack_Level'Address)) - Guard;
+ Natural (Current_Stack_Level'Size);
if Stack_Used_When_Filling > Analyzer.Pattern_Size then if System.Parameters.Stack_Grows_Down then
-- In this case, the known size of the stack is too small, we've Analyzer.Stack_Overlay_Address :=
-- already taken more than expected, so there's no possible To_Address (Analyzer.Top_Pattern_Mark);
-- computation else
Analyzer.Stack_Overlay_Address :=
To_Address (Analyzer.Top_Pattern_Mark
- Stack_Address (Analyzer.Pattern_Size));
end if;
Analyzer.Pattern_Size := 0; declare
else Pattern : aliased Stack_Slots
Analyzer.Pattern_Size := (1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern);
Analyzer.Pattern_Size - Stack_Used_When_Filling; for Pattern'Address use Analyzer.Stack_Overlay_Address;
end if; begin
if System.Parameters.Stack_Grows_Down then
for I in reverse Pattern'Range loop
Pattern (I) := Analyzer.Pattern;
end loop;
Analyzer.Bottom_Pattern_Mark :=
To_Stack_Address (Pattern (Pattern'Last)'Address);
else
for I in Pattern'Range loop
Pattern (I) := Analyzer.Pattern;
end loop;
Analyzer.Bottom_Pattern_Mark :=
To_Stack_Address (Pattern (Pattern'First)'Address);
end if;
end;
declare else
Stack : aliased Stack_Slots -- Readjust the pattern size. When we arrive in this function, there
(1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern); -- is already a given amount of stack used, that we won't analyze.
begin Stack_Used_When_Filling :=
Stack := (others => Analyzer.Pattern); Stack_Size (Analyzer.Bottom_Of_Stack,
To_Stack_Address (Current_Stack_Level'Address));
Analyzer.Stack_Overlay_Address := Stack'Address; if Stack_Used_When_Filling > Analyzer.Pattern_Size then
-- In this case, the known size of the stack is too small, we've
-- already taken more than expected, so there's no possible
-- computation
if Analyzer.Pattern_Size /= 0 then Analyzer.Pattern_Size := 0;
Analyzer.Bottom_Pattern_Mark :=
To_Stack_Address (Stack (Bottom_Slot_Index_In (Stack))'Address);
Analyzer.Top_Pattern_Mark :=
To_Stack_Address (Stack (Top_Slot_Index_In (Stack))'Address);
else else
Analyzer.Bottom_Pattern_Mark := To_Stack_Address (Stack'Address); Analyzer.Pattern_Size :=
Analyzer.Top_Pattern_Mark := To_Stack_Address (Stack'Address); Analyzer.Pattern_Size - Stack_Used_When_Filling;
end if; end if;
-- If Arr has been packed, the following assertion must be true (we declare
-- add the size of the element whose address is: Stack : aliased Stack_Slots
-- Min (Analyzer.Inner_Pattern_Mark, Analyzer.Outer_Pattern_Mark)): (1 .. Analyzer.Pattern_Size / Bytes_Per_Pattern);
pragma Assert begin
(Analyzer.Pattern_Size = 0 or else Stack := (others => Analyzer.Pattern);
Analyzer.Pattern_Size =
Stack_Size Analyzer.Stack_Overlay_Address := Stack'Address;
(Analyzer.Top_Pattern_Mark, Analyzer.Bottom_Pattern_Mark));
end; if Analyzer.Pattern_Size /= 0 then
Analyzer.Bottom_Pattern_Mark :=
To_Stack_Address
(Stack (Bottom_Slot_Index_In (Stack))'Address);
Analyzer.Top_Pattern_Mark :=
To_Stack_Address
(Stack (Top_Slot_Index_In (Stack))'Address);
else
Analyzer.Bottom_Pattern_Mark :=
To_Stack_Address (Stack'Address);
Analyzer.Top_Pattern_Mark :=
To_Stack_Address (Stack'Address);
end if;
end;
end if;
end Fill_Stack; end Fill_Stack;
------------------------- -------------------------
...@@ -321,17 +356,19 @@ package body System.Stack_Usage is ...@@ -321,17 +356,19 @@ package body System.Stack_Usage is
My_Stack_Size : Natural; My_Stack_Size : Natural;
Max_Pattern_Size : Natural; Max_Pattern_Size : Natural;
Bottom : Stack_Address; Bottom : Stack_Address;
Top : Stack_Address;
Pattern : Unsigned_32 := 16#DEAD_BEEF#) Pattern : Unsigned_32 := 16#DEAD_BEEF#)
is is
begin begin
-- Initialize the analyzer fields -- Initialize the analyzer fields
Analyzer.Bottom_Of_Stack := Bottom; Analyzer.Bottom_Of_Stack := Bottom;
Analyzer.Stack_Size := My_Stack_Size; Analyzer.Stack_Size := My_Stack_Size;
Analyzer.Pattern_Size := Max_Pattern_Size; Analyzer.Pattern_Size := Max_Pattern_Size;
Analyzer.Pattern := Pattern; Analyzer.Pattern := Pattern;
Analyzer.Result_Id := Next_Id; Analyzer.Result_Id := Next_Id;
Analyzer.Task_Name := (others => ' '); Analyzer.Task_Name := (others => ' ');
Analyzer.Top_Pattern_Mark := Top;
-- Compute the task name, and truncate if bigger than Task_Name_Length -- Compute the task name, and truncate if bigger than Task_Name_Length
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2004-2009, Free Software Foundation, Inc. -- -- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -218,10 +218,11 @@ package System.Stack_Usage is ...@@ -218,10 +218,11 @@ package System.Stack_Usage is
-- | of Fill_Stack | | -- | of Fill_Stack | |
-- | (deallocated at | | -- | (deallocated at | |
-- | the end of the call) | | -- | the end of the call) | |
-- ^ | | -- ^ | ^
-- Analyzer.Bottom_Of_Stack ^ | -- Analyzer.Bottom_Of_Stack | Analyzer.Top_Pattern_Mark
-- Analyzer.Bottom_Pattern_Mark ^ -- ^
-- Analyzer.Top_Pattern_Mark -- Analyzer.Bottom_Pattern_Mark
--
procedure Initialize_Analyzer procedure Initialize_Analyzer
(Analyzer : in out Stack_Analyzer; (Analyzer : in out Stack_Analyzer;
...@@ -229,6 +230,7 @@ package System.Stack_Usage is ...@@ -229,6 +230,7 @@ package System.Stack_Usage is
My_Stack_Size : Natural; My_Stack_Size : Natural;
Max_Pattern_Size : Natural; Max_Pattern_Size : Natural;
Bottom : Stack_Address; Bottom : Stack_Address;
Top : Stack_Address;
Pattern : Interfaces.Unsigned_32 := 16#DEAD_BEEF#); Pattern : Interfaces.Unsigned_32 := 16#DEAD_BEEF#);
-- Should be called before any use of a Stack_Analyzer, to initialize it. -- 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 -- Max_Pattern_Size is the size of the pattern zone, might be smaller than
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNARL is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1093,11 +1093,6 @@ package body System.Tasking.Stages is ...@@ -1093,11 +1093,6 @@ package body System.Tasking.Stages is
-- Assume a size of the stack taken at this stage -- Assume a size of the stack taken at this stage
Overflow_Guard :=
(if Size < Small_Stack_Limit
then Small_Overflow_Guard
else Big_Overflow_Guard);
if not Parameters.Sec_Stack_Dynamic then if not Parameters.Sec_Stack_Dynamic then
Self_ID.Common.Compiler_Data.Sec_Stack_Addr := Self_ID.Common.Compiler_Data.Sec_Stack_Addr :=
Secondary_Stack'Address; Secondary_Stack'Address;
...@@ -1109,9 +1104,24 @@ package body System.Tasking.Stages is ...@@ -1109,9 +1104,24 @@ package body System.Tasking.Stages is
Self_ID.Common.Task_Alternate_Stack := Task_Alternate_Stack'Address; Self_ID.Common.Task_Alternate_Stack := Task_Alternate_Stack'Address;
end if; end if;
Size := Size - Overflow_Guard; -- Set the guard page at the bottom of the stack. The call to unprotect
-- the page is done in Terminate_Task
Stack_Guard (Self_ID, True);
-- Initialize low-level TCB components, that cannot be initialized by
-- the creator. Enter_Task sets Self_ID.LL.Thread
Enter_Task (Self_ID);
-- Initialize dynamic stack usage
if System.Stack_Usage.Is_Enabled then if System.Stack_Usage.Is_Enabled then
Overflow_Guard :=
(if Size < Small_Stack_Limit
then Small_Overflow_Guard
else Big_Overflow_Guard);
STPO.Lock_RTS; STPO.Lock_RTS;
Initialize_Analyzer Initialize_Analyzer
(Self_ID.Common.Analyzer, (Self_ID.Common.Analyzer,
...@@ -1119,22 +1129,14 @@ package body System.Tasking.Stages is ...@@ -1119,22 +1129,14 @@ package body System.Tasking.Stages is
(1 .. Self_ID.Common.Task_Image_Len), (1 .. Self_ID.Common.Task_Image_Len),
Natural Natural
(Self_ID.Common.Compiler_Data.Pri_Stack_Info.Size), (Self_ID.Common.Compiler_Data.Pri_Stack_Info.Size),
Size, Size - Overflow_Guard,
SSE.To_Integer (Bottom_Of_Stack'Address)); SSE.To_Integer (Bottom_Of_Stack'Address),
SSE.To_Integer
(Self_ID.Common.Compiler_Data.Pri_Stack_Info.Limit));
STPO.Unlock_RTS; STPO.Unlock_RTS;
Fill_Stack (Self_ID.Common.Analyzer); Fill_Stack (Self_ID.Common.Analyzer);
end if; end if;
-- Set the guard page at the bottom of the stack. The call to unprotect
-- the page is done in Terminate_Task
Stack_Guard (Self_ID, True);
-- Initialize low-level TCB components, that cannot be initialized by
-- the creator. Enter_Task sets Self_ID.LL.Thread
Enter_Task (Self_ID);
-- We setup the SEH (Structured Exception Handling) handler if supported -- We setup the SEH (Structured Exception Handling) handler if supported
-- on the target. -- on the target.
......
...@@ -4324,6 +4324,10 @@ package body Sem_Res is ...@@ -4324,6 +4324,10 @@ package body Sem_Res is
(Typ, Associated_Storage_Pool (Etype (Parent (N)))); (Typ, Associated_Storage_Pool (Etype (Parent (N))));
end if; end if;
if Ekind (Etype (N)) = E_Anonymous_Access_Type then
Check_Restriction (No_Anonymous_Allocators, N);
end if;
-- An erroneous allocator may be rewritten as a raise Program_Error -- An erroneous allocator may be rewritten as a raise Program_Error
-- statement. -- statement.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment