111
|
1 ------------------------------------------------------------------------------
|
|
2 -- --
|
|
3 -- GNAT COMPILER COMPONENTS --
|
|
4 -- --
|
|
5 -- S Y S T E M . P O O L _ S I Z E --
|
|
6 -- --
|
|
7 -- S p e c --
|
|
8 -- --
|
131
|
9 -- Copyright (C) 1992-2018, Free Software Foundation, Inc. --
|
111
|
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 -- As a special exception under Section 7 of GPL version 3, you are granted --
|
|
19 -- additional permissions described in the GCC Runtime Library Exception, --
|
|
20 -- version 3.1, as published by the Free Software Foundation. --
|
|
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 with System.Storage_Pools;
|
|
33 with System.Storage_Elements;
|
|
34
|
|
35 package System.Pool_Size is
|
|
36 pragma Elaborate_Body;
|
|
37 -- Needed to ensure that library routines can execute allocators
|
|
38
|
|
39 ------------------------
|
|
40 -- Stack_Bounded_Pool --
|
|
41 ------------------------
|
|
42
|
|
43 -- Allocation strategy:
|
|
44
|
|
45 -- Pool is a regular stack array, no use of malloc
|
|
46 -- user specified size
|
|
47 -- Space of pool is globally reclaimed by normal stack management
|
|
48
|
|
49 -- Used in the compiler for access types with 'STORAGE_SIZE rep. clause
|
|
50 -- Only used for allocating objects of the same type.
|
|
51
|
|
52 type Stack_Bounded_Pool
|
|
53 (Pool_Size : System.Storage_Elements.Storage_Count;
|
|
54 Elmt_Size : System.Storage_Elements.Storage_Count;
|
|
55 Alignment : System.Storage_Elements.Storage_Count)
|
|
56 is
|
|
57 new System.Storage_Pools.Root_Storage_Pool with record
|
|
58 First_Free : System.Storage_Elements.Storage_Count;
|
|
59 First_Empty : System.Storage_Elements.Storage_Count;
|
|
60 Aligned_Elmt_Size : System.Storage_Elements.Storage_Count;
|
|
61 The_Pool : System.Storage_Elements.Storage_Array
|
|
62 (1 .. Pool_Size);
|
|
63 end record;
|
|
64
|
|
65 overriding function Storage_Size
|
|
66 (Pool : Stack_Bounded_Pool) return System.Storage_Elements.Storage_Count;
|
|
67
|
|
68 overriding procedure Allocate
|
|
69 (Pool : in out Stack_Bounded_Pool;
|
|
70 Address : out System.Address;
|
|
71 Storage_Size : System.Storage_Elements.Storage_Count;
|
|
72 Alignment : System.Storage_Elements.Storage_Count);
|
|
73
|
|
74 overriding procedure Deallocate
|
|
75 (Pool : in out Stack_Bounded_Pool;
|
|
76 Address : System.Address;
|
|
77 Storage_Size : System.Storage_Elements.Storage_Count;
|
|
78 Alignment : System.Storage_Elements.Storage_Count);
|
|
79
|
|
80 overriding procedure Initialize (Pool : in out Stack_Bounded_Pool);
|
|
81
|
|
82 end System.Pool_Size;
|