DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

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 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T V

⟦152f3bbba⟧ TextFile

    Length: 13854 (0x361e)
    Types: TextFile
    Names: »V«

Derivation

└─⟦516dceb10⟧ Bits:30000751 8mm tape, Rational 1000, RCI_VADS
    └─ ⟦9a14c9417⟧ »DATA« 
        └─⟦this⟧ 

TextFile

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;