* rtl.h (struct rtx_def): Update comments.
[official-gcc.git] / gcc / ada / s-pooglo.adb
blob102dd3ccbfb67ace094f04cfabe3449d1bce011d
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . P O O L _ G L O B A L --
6 -- --
7 -- B o d y --
8 -- --
9 -- --
10 -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
11 -- --
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. --
22 -- --
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. --
29 -- --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 -- --
33 ------------------------------------------------------------------------------
35 with System.Storage_Pools; use System.Storage_Pools;
36 with System.Storage_Elements;
37 with System.Memory;
39 package body System.Pool_Global is
41 package SSE renames System.Storage_Elements;
43 --------------
44 -- Allocate --
45 --------------
47 procedure Allocate
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;
58 begin
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
66 raise Storage_Error;
67 else
68 Address := Allocated;
69 end if;
70 end Allocate;
72 ----------------
73 -- Deallocate --
74 ----------------
76 procedure Deallocate
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);
86 begin
87 Memory.Free (Address);
88 end Deallocate;
90 ------------------
91 -- Storage_Size --
92 ------------------
94 function Storage_Size
95 (Pool : Unbounded_No_Reclaim_Pool)
96 return SSE.Storage_Count
98 pragma Warnings (Off, Pool);
100 begin
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;
106 end Storage_Size;
108 end System.Pool_Global;