OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [ada/] [s-pooglo.adb] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 281 jeremybenn
------------------------------------------------------------------------------
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
--          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
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;    use System.Storage_Pools;
33
with System.Memory;
34
 
35
package body System.Pool_Global is
36
 
37
   package SSE renames System.Storage_Elements;
38
 
39
   --------------
40
   -- Allocate --
41
   --------------
42
 
43
   procedure Allocate
44
     (Pool         : in out Unbounded_No_Reclaim_Pool;
45
      Address      : out System.Address;
46
      Storage_Size : SSE.Storage_Count;
47
      Alignment    : SSE.Storage_Count)
48
   is
49
      pragma Warnings (Off, Pool);
50
      pragma Warnings (Off, Alignment);
51
 
52
      Allocated : System.Address;
53
 
54
   begin
55
      Allocated := Memory.Alloc (Memory.size_t (Storage_Size));
56
 
57
      --  The call to Alloc returns an address whose alignment is compatible
58
      --  with the worst case alignment requirement for the machine; thus the
59
      --  Alignment argument can be safely ignored.
60
 
61
      if Allocated = Null_Address then
62
         raise Storage_Error;
63
      else
64
         Address := Allocated;
65
      end if;
66
   end Allocate;
67
 
68
   ----------------
69
   -- Deallocate --
70
   ----------------
71
 
72
   procedure Deallocate
73
     (Pool         : in out Unbounded_No_Reclaim_Pool;
74
      Address      : System.Address;
75
      Storage_Size : SSE.Storage_Count;
76
      Alignment    : SSE.Storage_Count)
77
   is
78
      pragma Warnings (Off, Pool);
79
      pragma Warnings (Off, Storage_Size);
80
      pragma Warnings (Off, Alignment);
81
 
82
   begin
83
      Memory.Free (Address);
84
   end Deallocate;
85
 
86
   ------------------
87
   -- Storage_Size --
88
   ------------------
89
 
90
   function Storage_Size
91
     (Pool  : Unbounded_No_Reclaim_Pool)
92
      return  SSE.Storage_Count
93
   is
94
      pragma Warnings (Off, Pool);
95
 
96
   begin
97
      --  Intuitively, should return System.Memory_Size. But on Sun/Alsys,
98
      --  System.Memory_Size > System.Max_Int, which means all you can do with
99
      --  it is raise CONSTRAINT_ERROR...
100
 
101
      return SSE.Storage_Count'Last;
102
   end Storage_Size;
103
 
104
end System.Pool_Global;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.