DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦a9616fd97⟧ Ada Source

    Length: 16384 (0x4000)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, generic, package V_Memory, seg_03bda3

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with V_I_Mem;
with System;
package V_Memory is

    pragma Suppress (All_Checks);

--   PURPOSE : V_MEMORY provides memory management operations.  Three
--             distinct memory management methods are supported:
--
--               Fixed Pools
--               Flex Pools
--               Heap Pools
--
--             For each type of pool, the following operations are
--             provided:
--
--               Creation
--               Deletion
--               Allocation
--               Deallocation
--
--             with the exception that deallocation is not provided for
--             heap pools.  The allocation and deallocation operations
--             are implemented as generics which may be instantiated
--             to create allocators and deallocators for a given type
--             of object for a given type of pool.
--
--             Fixed memory pools are made up of constant sized blocks,
--             providing fast allocation and deallocation.  Fixed memory
--             pools are best suited for storage of objects of relatively
--             homogenous size.
--
--             Flex memory pools contain variable size blocks, providing
--             efficient use of memory.  The problem of fragmentation,
--             inherent in variable-size memory allocation schemes, is
--             diminished by V_MEMORY's concept of granularity, whereby
--             blocks are allocated on boundaries specified at system
--             configuration time.  Flex pools are organized around a
--             standard boundary tag scheme, providing for compaction
--             of adjacent blocks.
--
--             Heap pools provide the fastest memory allocation in V_MEMORY.
--             There is no deallocation of heap memory, and therefore,
--             no space overhead in managing the pool, and minimal
--             processing overhead in allocating from the heap.
--
--             In addition to the pool management routines, a procedure
--             is provided to return the current value of the stack
--             pointer and the lower limit of the stack.  Under certain
--             conditions, the code generated for this in-lined procedure
--             does not use the stack, making the operation non-intrusive.


-- The following types are used to identify the different types of pools.

    type Fixed_Pool_Id is private;
    type Flex_Pool_Id is private;
    type Heap_Pool_Id is private;


-- The following exceptions may be raised by the pool management
-- routines.

    Bad_Pool_Creation_Parameter : exception;

    -- BAD_POOL_CREATION_PARAMETER is raised if a pool could not be
    -- created because a parameter passed to the create operation
    -- was unacceptable.

    No_Available_Pool : exception;

    -- NO_AVAILABLE_POOL is raised if a pool could not be created because
    -- the maximum number of pools had already been allocated.

    Invalid_Pool_Id : exception;

    -- INVALID_POOL_ID is raised if the pool id passed to a pool operation
    -- does not correspond to an existing pool.

    No_Memory : exception;

    -- NO_MEMORY is raised if a memory request could not be honored due to
    -- insufficient memory in the pool.

    Bad_Block : exception;

    -- BAD_BLOCK is raised if a deallocation request is made of memory
    -- which is not identifiable as an allocated block from a pool.

    Object_Larger_Than_Fixed_Block_Size : exception;

    -- OBJECT_LARGER_THAN_FIXED_BLOCK_SIZE is raised if an attempt is made
    -- to allocate an object from a fixed pool which is larger than the size
    -- of the blocks in the pool.

    Unconstrained_Object : exception;

    -- The current version of V_MEMORY doesn't support unconstrained
    -- object types. This exception is raised by the allocation/deallocation
    -- subprograms if instantiated with an unconstrained object type.

    Unexpected_V_Memory_Error : exception;

    -- UNEXPECTED_V_MEMORY_ERROR may be raised if an unexpected
    -- error occurs during an V_MEMORY operation.


    procedure Initialize_Services
                 (Top_Of_Memory : in System.Address :=
                     System."+" (16#FFFF_FFFF#);
                  Machine_Boundary : in Integer := Integer'Size;
                  Granularity : in Integer := 16);
    pragma Inline_Only (Initialize_Services);

    -- Purpose:       Initialize memory services.  This procedure must be
    --                called before any of the memory services.  This procedure
    --                is called by the V_MEMORY package body, using the
    --                default parameters.  Therefore, you only
    --                need to call to override the default parameters.
    --
    -- Where:
    --
    --   top_of_memory    is the highest memory location addressable
    --                    by the target/host.  The default is 16#FFFF_FFFF#.
    --
    --   machine_boundary is the CPU's natural boundary in BITS.  This is an
    --                    extremely important parameter on machines
    --                    that impose specific bit alignment for certain data
    --                    types.  The default is integer'size.
    --
    --   granularity      controls memory fragmentation within all the flex
    --                    memory pools.  These pools provide memory allocation
    --                    in variably-sized blocks.  The value is specified
    --                    in BYTES and causes all allocation requests to be
    --                    rounded up to the nearest multiple of this value.
    --                    The default is 16 bytes.


    procedure Create_Fixed_Pool (Base_Address : in System.Address;
                                 Pool_Size : in Natural;
                                 Block_Size : in Natural;
                                 Pool : out Fixed_Pool_Id);
    pragma Inline_Only (Create_Fixed_Pool);

    -- Purpose:       Create a fixed pool.
    --
    -- Where:
    --
    --   base_address is the address at which the pool should start.
    --
    --   pool_size    is the amount of memory to allocate to the pool.
    --
    --   block_size   is the size of each block in the pool.
    --
    --   pool         identifies the pool that was created.
    --
    -- Notes:         Because the pool contains control structures,
    --                the number of blocks in the pool will be less
    --                than pool_size / block_size.
    --
    -- Exceptions:
    --
    --   BAD_POOL_CREATION_PARAMETER is raised if a pool creation parameter
    --   was invalid.
    --
    --   NO_AVAILABLE_POOL is raised if the maximum number of pools which
    --   may exist simultaneously in the system have already been allocated.


    generic
        type Object is private;
        type Pointer is access Object;
    function Fixed_Object_Allocation
                (Pool : in Fixed_Pool_Id; Value : in Object) return Pointer;
    -- pragma INLINE(FIXED_OBJECT_ALLOCATION);

    -- Purpose:       Allocate an object of type OBJECT from the given
    --                fixed pool, initializing it with the value VALUE.
    --
    -- Where:
    --
    --   pool         is the fixed pool to allocate the object from.
    --
    --   value        is the initial value for the object.
    --
    -- Exceptions:
    --
    --   INVALID_POOL_ID is raised if pool does not identify a pool
    --   created by CREATE_FIXED_POOL.
    --
    --   NO_MEMORY is raised if the object could not be allocated from
    --   the pool due to insufficient memory.
    --
    --   OBJECT_LARGER_THAN_FIXED_BLOCK_SIZE is raised if the size of
    --   the object exceeded the size of the pool's blocks.
    --
    --   UNCONSTRAINED_OBJECT is raised if generic was instantiated with
    --   an unconstrained OBJECT type.

    generic
        type Object is private;
        type Pointer is access Object;
    procedure Fixed_Object_Deallocation (Location : in Pointer);
    -- pragma INLINE(FIXED_OBJECT_DEALLOCATION);

    -- Purpose:       To deallocate the memory at the given location.
    --
    -- Where:
    --
    --   location     points to the object whose space is to be
    --                deallocated.
    --
    -- Exceptions:
    --
    --   BAD_BLOCK is raised if the pointer does not point to a
    --   block in a fixed pool.
    --
    --   UNCONSTRAINED_OBJECT is raised if generic was instantiated with
    --   an unconstrained OBJECT type.


    procedure Destroy_Fixed_Pool (Pool : in Fixed_Pool_Id);
    pragma Inline_Only (Destroy_Fixed_Pool);

    -- Purpose:       To delete an entire fixed pool.
    --
    -- Where:
    --
    --   pool         is the pool to be deleted.
    --
    -- Exceptions:
    --
    --   INVALID_POOL_ID is raised if pool does not identify a pool
    --   created by CREATE_FIXED_POOL.


    procedure Create_Flex_Pool (Base_Address : in System.Address;
                                Pool_Size : in Natural;
                                Pool : out Flex_Pool_Id);
    pragma Inline_Only (Create_Flex_Pool);

    -- Purpose:       Create a flex pool.
    --
    -- Where:
    --
    --   base_address is the address at which the pool should start.
    --
    --   pool_size    is the amount of memory to allocate to the pool.
    --
    --   pool         identifies the pool that was created.
    --
    -- Exceptions:
    --
    --   BAD_POOL_CREATION_PARAMETER is raised if a pool creation parameter
    --   was invalid.
    --
    --   NO_AVAILABLE_POOL is raised if the maximum number of pools which
    --   may exist simultaneously in the system have already been allocated.


    generic
        type Object is private;
        type Pointer is access Object;
    function Flex_Object_Allocation
                (Pool : in Flex_Pool_Id; Value : in Object) return Pointer;
    -- pragma INLINE(FLEX_OBJECT_ALLOCATION);

    -- Purpose:       Allocate an object of type OBJECT from the given
    --                flex pool, initializing it with the value VALUE.
    --
    -- Where:
    --
    --   pool         is the flex pool to allocate the object from.
    --
    --   value        is the initial value for the object.
    --
    -- Exceptions:
    --
    --   INVALID_POOL_ID is raised if pool does not identify a pool
    --   created by CREATE_FLEX_POOL.
    --
    --   NO_MEMORY is raised if the object could not be allocated from
    --   the pool due to insufficient memory.
    --
    --   UNCONSTRAINED_OBJECT is raised if generic was instantiated with
    --   an unconstrained OBJECT type.


    generic
        type Object is private;
        type Pointer is access Object;
    procedure Flex_Object_Deallocation (Location : in Pointer);
    -- pragma INLINE(FLEX_OBJECT_DEALLOCATION);

    -- Purpose:       To deallocate the memory at the given location.
    --
    -- Where:
    --
    --   location     points to the object whose space is to be
    --                deallocated.
    --
    -- Exceptions:
    --
    --   BAD_BLOCK is raised if the pointer does not point to a
    --   block in a flex pool.
    --
    --   UNCONSTRAINED_OBJECT is raised if generic was instantiated with
    --   an unconstrained OBJECT type.


    procedure Destroy_Flex_Pool (Pool : in Flex_Pool_Id);
    pragma Inline_Only (Destroy_Flex_Pool);

    -- Purpose:       To delete an entire flex pool.
    --
    -- Where:
    --
    --   pool         is the pool to be deleted.
    --
    -- Exceptions:
    --
    --   INVALID_POOL_ID is raised if pool does not identify a pool
    --   created by CREATE_FLEX_POOL.


    procedure Create_Heap_Pool (Base_Address : in System.Address;
                                Pool_Size : in Natural;
                                Pool : out Heap_Pool_Id);
    pragma Inline_Only (Create_Heap_Pool);

    -- Purpose:       Create a heap pool.
    --
    -- Where:
    --
    --   base_address is the address at which the pool should start.
    --
    --   pool_size    is the amount of memory to allocate to the pool.
    --
    --   pool         identifies the pool that was created.
    --
    -- Exceptions:
    --
    --   BAD_POOL_CREATION_PARAMETER is raised if a pool creation parameter
    --   was invalid.
    --
    --   NO_AVAILABLE_POOL is raised if the maximum number of pools which
    --   may exist simultaneously in the system have already been allocated.


    generic
        type Object is private;
        type Pointer is access Object;
    function Heap_Object_Allocation
                (Pool : in Heap_Pool_Id; Value : in Object) return Pointer;
    -- pragma INLINE(HEAP_OBJECT_ALLOCATION);

    -- Purpose:       Allocate an object of type OBJECT from the given
    --                heap pool, initializing it with the value VALUE.
    --
    -- Where:
    --
    --   pool         is the heap pool to allocate the object from.
    --
    --   value        is the initial value for the object.
    --
    -- Exceptions:
    --
    --   INVALID_POOL_ID is raised if pool does not identify a pool
    --   created by CREATE_HEAP_POOL.
    --
    --   NO_MEMORY is raised if the object could not be allocated from
    --   the pool due to insufficient memory.
    --
    --   UNCONSTRAINED_OBJECT is raised if generic was instantiated with
    --   an unconstrained OBJECT type.


    procedure Destroy_Heap_Pool (Pool : in Heap_Pool_Id);
    pragma Inline_Only (Destroy_Heap_Pool);

    -- Purpose:       To delete an entire heap pool.
    --
    -- Where:
    --
    --   pool         is the pool to be deleted.
    --
    -- Exceptions:
    --
    --   INVALID_POOL_ID is raised if pool does not identify a pool
    --   created by CREATE_HEAP_POOL.

private
    type Fixed_Pool_Id is new V_I_Mem.Pool_Id;
    type Flex_Pool_Id is new V_I_Mem.Pool_Id;
    type Heap_Pool_Id is new V_I_Mem.Pool_Id;
end V_Memory;



E3 Meta Data

    nblk1=f
    nid=0
    hdr6=1e
        [0x00] rec0=1e rec1=00 rec2=01 rec3=042
        [0x01] rec0=12 rec1=00 rec2=02 rec3=01e
        [0x02] rec0=1a rec1=00 rec2=03 rec3=054
        [0x03] rec0=1b rec1=00 rec2=04 rec3=05a
        [0x04] rec0=18 rec1=00 rec2=05 rec3=032
        [0x05] rec0=12 rec1=00 rec2=06 rec3=016
        [0x06] rec0=1d rec1=00 rec2=07 rec3=01e
        [0x07] rec0=1a rec1=00 rec2=08 rec3=042
        [0x08] rec0=20 rec1=00 rec2=09 rec3=050
        [0x09] rec0=20 rec1=00 rec2=0a rec3=006
        [0x0a] rec0=1d rec1=00 rec2=0b rec3=028
        [0x0b] rec0=21 rec1=00 rec2=0c rec3=00e
        [0x0c] rec0=1f rec1=00 rec2=0d rec3=008
        [0x0d] rec0=1b rec1=00 rec2=0e rec3=068
        [0x0e] rec0=12 rec1=00 rec2=0f rec3=000
    tail 0x21739b740856574309e9c 0x42a00088462060003