File : s-secsta-zfp.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-2014, 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
  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 : constant := 10 * 1024;
  41    --  Default size of a secondary stack
  42 
  43    procedure SS_Init
  44      (Stk  : System.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 and aligned to Standard'Maximum_Alignment.
  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      (Address      : out System.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. If an
  68    --  additional chunk have been allocated, it will never be freed during a
  69 
  70 private
  71 
  72    SS_Pool : Integer;
  73    --  Unused entity that is just present to ease the sharing of the pool
  74    --  mechanism for specific allocation/deallocation in the compiler
  75 
  76    type Mark_Id is new SSE.Integer_Address;
  77 
  78 end System.Secondary_Stack;