PR target/84827
[official-gcc.git] / gcc / ada / libgnat / s-stopoo.ads
blob37c49c2882fa163eb2b8bcb9d8f5915cf5a90f98
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-2018, 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;
44 pragma Preelaborable_Initialization (Root_Storage_Pool);
46 procedure Allocate
47 (Pool : in out Root_Storage_Pool;
48 Storage_Address : out System.Address;
49 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
50 Alignment : System.Storage_Elements.Storage_Count)
51 is abstract;
53 procedure Deallocate
54 (Pool : in out Root_Storage_Pool;
55 Storage_Address : System.Address;
56 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
57 Alignment : System.Storage_Elements.Storage_Count)
58 is abstract;
60 function Storage_Size
61 (Pool : Root_Storage_Pool)
62 return System.Storage_Elements.Storage_Count
63 is abstract;
65 private
66 type Root_Storage_Pool is abstract
67 new Ada.Finalization.Limited_Controlled with null record;
69 type Root_Storage_Pool_Ptr is access all Root_Storage_Pool'Class;
70 for Root_Storage_Pool_Ptr'Storage_Size use 0;
71 -- Type of the BIP_Storage_Pool extra parameter (see Exp_Ch6). The
72 -- Storage_Size clause is necessary, because otherwise we have a
73 -- chicken&egg problem; we can't be creating collection finalization code
74 -- in this low-level package, because that involves Pool_Global, which
75 -- imports this package.
77 -- ??? Are these two still needed? It might be possible to use Subpools.
78 -- Allocate_Any_Controlled / Deallocate_Any_Controlled for non-controlled
79 -- objects.
81 -- The following two procedures support the use of class-wide pool
82 -- objects in storage pools. When a local type is given a class-wide
83 -- storage pool, allocation and deallocation for the type must dispatch
84 -- to the operation of the specific pool, which is achieved by a call
85 -- to these procedures. (When the pool type is specific, the back-end
86 -- generates a call to the statically identified operation of the type).
88 procedure Allocate_Any
89 (Pool : in out Root_Storage_Pool'Class;
90 Storage_Address : out System.Address;
91 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
92 Alignment : System.Storage_Elements.Storage_Count);
94 procedure Deallocate_Any
95 (Pool : in out Root_Storage_Pool'Class;
96 Storage_Address : System.Address;
97 Size_In_Storage_Elements : System.Storage_Elements.Storage_Count;
98 Alignment : System.Storage_Elements.Storage_Count);
100 end System.Storage_Pools;