File : s-secsta-cert.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . S E C O N D A R Y _ S T A C K --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
17 -- --
18 -- --
19 -- --
20 -- --
21 -- --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
30 ------------------------------------------------------------------------------
31
32 -- Version for use in HI-E mode, when thread registration is used
33
34 with System.Storage_Elements;
35
36 package System.Secondary_Stack is
37
38 package SSE renames System.Storage_Elements;
39
40 Default_Secondary_Stack_Size : Natural := 10 * 1024;
41 -- Default size of a secondary stack. May be modified by binder -D switch
42
43 procedure SS_Init
44 (Stk : Address;
45 Size : Natural := Default_Secondary_Stack_Size);
46 -- Initialize the secondary stack with a main stack of the given Size.
47 --
48 -- Stk is an "in" parameter that is already pointing to a memory area of
49 -- size Size.
50 --
51 -- The secondary stack is fixed, and any attempt to allocate more than the
52 -- initial size will result in a Storage_Error being raised.
53
54 procedure SS_Allocate
55 (Addr : out Address;
56 Storage_Size : SSE.Storage_Count);
57 -- Allocate enough space for a 'Storage_Size' bytes object with Maximum
58 -- alignment. The address of the allocated space is returned in 'Address'
59
60 type Mark_Id is private;
61 -- Type used to mark the stack
62
63 function SS_Mark return Mark_Id;
64 -- Return the Mark corresponding to the current state of the stack
65
66 procedure SS_Release (M : Mark_Id);
67 -- Restore the state of the stack corresponding to the mark M
68
69 function SS_Get_Max return Long_Long_Integer;
70 -- Return maximum used space in storage units for the current secondary
71 -- stack. The returned value shows the largest amount of space allocated
72 -- so far during execution of the program.
73
74 private
75
76 SS_Pool : Integer;
77 -- Unused entity that is just present to ease the sharing of the pool
78 -- mechanism for specific allocation/deallocation in the compiler
79
80 type Mark_Id is new SSE.Integer_Address;
81
82 end System.Secondary_Stack;