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;
|
||||
|
|
@ -1,4 +1,2 @@
|
|||
(notonline)-->
|
||||
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span>
|
||||
<span style="color: #004080;">atom</span> <span style="color: #000000;">mem</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">allocate</span><span style="color: #0000FF;">(</span><span style="color: #000000;">size</span><span style="color: #0000FF;">,</span><span style="color: #004600;">true</span><span style="color: #0000FF;">)</span>
|
||||
<!--
|
||||
without js
|
||||
atom mem = allocate(size,true)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,13 @@
|
|||
(notonline)-->
|
||||
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span>
|
||||
<span style="color: #004080;">sequence</span> <span style="color: #000000;">ap</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{}</span>
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">ap_allocate</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">size</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000080;font-style:italic;">-- allocate some memory and add it to the arena pool 'ap' for later release</span>
|
||||
<span style="color: #004080;">atom</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">allocate</span><span style="color: #0000FF;">(</span><span style="color: #000000;">size</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">ap</span> <span style="color: #0000FF;">=</span> <span style="color: #7060A8;">append</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ap</span><span style="color: #0000FF;">,</span><span style="color: #000000;">res</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #000000;">res</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
<span style="color: #008080;">procedure</span> <span style="color: #000000;">ap_free</span><span style="color: #0000FF;">()</span>
|
||||
<span style="color: #000080;font-style:italic;">-- free all memory allocated in arena pool 'ap'</span>
|
||||
<span style="color: #7060A8;">free</span><span style="color: #0000FF;">(</span><span style="color: #000000;">ap</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #000000;">ap</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{}</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
|
||||
<!--
|
||||
without js
|
||||
sequence ap = {}
|
||||
function ap_allocate(integer size)
|
||||
-- allocate some memory and add it to the arena pool 'ap' for later release
|
||||
atom res = allocate(size)
|
||||
ap = append(ap,res)
|
||||
return res
|
||||
end function
|
||||
procedure ap_free()
|
||||
-- free all memory allocated in arena pool 'ap'
|
||||
free(ap)
|
||||
ap = {}
|
||||
end procedure
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue