Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,2 +0,0 @@
|
|||
type My_Pointer is access My_Object;
|
||||
for My_Pointer'Storage_Pool use My_Pool;
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
with System.Storage_Elements; use System.Storage_Elements;
|
||||
with System.Storage_Pools; use System.Storage_Pools;
|
||||
|
||||
package Arena_Pools is
|
||||
type Arena (Size : Storage_Count) is new Root_Storage_Pool with private;
|
||||
overriding
|
||||
procedure Allocate
|
||||
( Pool : in out Arena;
|
||||
Address : out System.Address;
|
||||
Size : Storage_Count;
|
||||
Alignment : Storage_Count
|
||||
);
|
||||
overriding
|
||||
procedure Deallocate
|
||||
( Pool : in out Arena;
|
||||
Address : System.Address;
|
||||
Size : Storage_Count;
|
||||
Alignment : Storage_Count
|
||||
) is null;
|
||||
overriding
|
||||
function Storage_Size (Pool : Arena) return Storage_Count;
|
||||
private
|
||||
type Arena (Size : Storage_Count) is new Root_Storage_Pool with record
|
||||
Free : Storage_Offset := 1;
|
||||
Core : Storage_Array (1..Size);
|
||||
end record;
|
||||
end Arena_Pools;
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
package body Arena_Pools is
|
||||
procedure Allocate
|
||||
( Pool : in out Arena;
|
||||
Address : out System.Address;
|
||||
Size : Storage_Count;
|
||||
Alignment : Storage_Count
|
||||
) is
|
||||
Free : constant Storage_Offset :=
|
||||
Pool.Free + Alignment - Pool.Core (Pool.Free)'Address mod Alignment + Size;
|
||||
begin
|
||||
if Free - 1 > Pool.Size then
|
||||
raise Storage_Error;
|
||||
end if;
|
||||
Pool.Free := Free;
|
||||
Address := Pool.Core (Pool.Free - Size)'Address;
|
||||
end Allocate;
|
||||
|
||||
function Storage_Size (Pool : Arena) return Storage_Count is
|
||||
begin
|
||||
return Pool.Size;
|
||||
end Storage_Size;
|
||||
end Arena_Pools;
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
with Arena_Pools;
|
||||
use Arena_Pools;
|
||||
|
||||
procedure Test_Allocator is
|
||||
Pool : Arena_Pools.Arena (1024);
|
||||
type Integer_Ptr is access Integer;
|
||||
for Integer_Ptr'Storage_Pool use Pool;
|
||||
|
||||
X : Integer_Ptr := new Integer'(1);
|
||||
Y : Integer_Ptr := new Integer'(2);
|
||||
Z : Integer_Ptr;
|
||||
begin
|
||||
Z := new Integer;
|
||||
Z.all := X.all + Y.all;
|
||||
end Test_Allocator;
|
||||
Loading…
Add table
Add a link
Reference in a new issue