1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- S Y S T E M . P O O L _ G L O B A L --
10 -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- Extensive contributions were provided by Ada Core Technologies Inc. --
33 ------------------------------------------------------------------------------
35 with System
.Storage_Pools
; use System
.Storage_Pools
;
36 with System
.Storage_Elements
;
39 package body System
.Pool_Global
is
41 package SSE
renames System
.Storage_Elements
;
48 (Pool
: in out Unbounded_No_Reclaim_Pool
;
49 Address
: out System
.Address
;
50 Storage_Size
: SSE
.Storage_Count
;
51 Alignment
: SSE
.Storage_Count
)
53 pragma Warnings
(Off
, Pool
);
54 pragma Warnings
(Off
, Alignment
);
56 Allocated
: System
.Address
;
59 Allocated
:= Memory
.Alloc
(Memory
.size_t
(Storage_Size
));
61 -- The call to Alloc returns an address whose alignment is compatible
62 -- with the worst case alignment requirement for the machine; thus the
63 -- Alignment argument can be safely ignored.
65 if Allocated
= Null_Address
then
77 (Pool
: in out Unbounded_No_Reclaim_Pool
;
78 Address
: System
.Address
;
79 Storage_Size
: SSE
.Storage_Count
;
80 Alignment
: SSE
.Storage_Count
)
82 pragma Warnings
(Off
, Pool
);
83 pragma Warnings
(Off
, Storage_Size
);
84 pragma Warnings
(Off
, Alignment
);
87 Memory
.Free
(Address
);
95 (Pool
: Unbounded_No_Reclaim_Pool
)
96 return SSE
.Storage_Count
98 pragma Warnings
(Off
, Pool
);
101 -- Intuitively, should return System.Memory_Size. But on Sun/Alsys,
102 -- System.Memory_Size > System.Max_Int, which means all you can do with
103 -- it is raise CONSTRAINT_ERROR...
105 return SSE
.Storage_Count
'Last;
108 end System
.Pool_Global
;