2013-07-09 Tim Shen <timshen91@gmail.com>
[official-gcc.git] / gcc / ada / s-stopoo.ads
blobe2d66ff747d78726a2045c0a75d0359cbb2cb1b6
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . S T O R A G E _ P O O L S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
21 -- --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
25 -- --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
30 -- --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 -- --
34 ------------------------------------------------------------------------------
36 with Ada.Finalization;
37 with System.Storage_Elements;
39 package System.Storage_Pools is
40 pragma Preelaborate;
42 type Root_Storage_Pool is abstract
43 new Ada.Finalization.Limited_Controlled with private;
45 procedure Allocate
46 (Pool : in out Root_Storage_Pool;
47 Storage_Address : out System.Address;
48 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
49 Alignment : System.Storage_Elements.Storage_Count)
50 is abstract;
52 procedure Deallocate
53 (Pool : in out Root_Storage_Pool;
54 Storage_Address : System.Address;
55 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
56 Alignment : System.Storage_Elements.Storage_Count)
57 is abstract;
59 function Storage_Size
60 (Pool : Root_Storage_Pool)
61 return System.Storage_Elements.Storage_Count
62 is abstract;
64 private
65 type Root_Storage_Pool is abstract
66 new Ada.Finalization.Limited_Controlled with null record;
68 type Root_Storage_Pool_Ptr is access all Root_Storage_Pool'Class;
69 for Root_Storage_Pool_Ptr'Storage_Size use 0;
70 -- Type of the BIP_Storage_Pool extra parameter (see Exp_Ch6). The
71 -- Storage_Size clause is necessary, because otherwise we have a
72 -- chicken&egg problem; we can't be creating collection finalization code
73 -- in this low-level package, because that involves Pool_Global, which
74 -- imports this package.
76 -- ??? Are these two still needed? It might be possible to use Subpools.
77 -- Allocate_Any_Controlled / Deallocate_Any_Controlled for non-controlled
78 -- objects.
80 -- The following two procedures support the use of class-wide pool
81 -- objects in storage pools. When a local type is given a class-wide
82 -- storage pool, allocation and deallocation for the type must dispatch
83 -- to the operation of the specific pool, which is achieved by a call
84 -- to these procedures. (When the pool type is specific, the back-end
85 -- generates a call to the statically identified operation of the type).
87 procedure Allocate_Any
88 (Pool : in out Root_Storage_Pool'Class;
89 Storage_Address : out System.Address;
90 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
91 Alignment : System.Storage_Elements.Storage_Count);
93 procedure Deallocate_Any
94 (Pool : in out Root_Storage_Pool'Class;
95 Storage_Address : System.Address;
96 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
97 Alignment : System.Storage_Elements.Storage_Count);
99 end System.Storage_Pools;