Description
Defines representation shared by relocatable allocation algorithms. Algorithm packages interpret allocation tokens, own their metadata layout, and state their synchronization and recovery rules. No stored handle contains a native address or Ada access value.
Allocation_Capabilities
type Allocation_Capabilities is record
Search : Search_Bound;
Allocation_Contention : Contention_Scope;
Release_Contention : Contention_Scope;
In_Band_Metadata : Boolean;
Splits_Blocks : Boolean;
Coalesces_On_Release : Boolean;
Timed_Contention : Boolean;
Release_Exclusion : Boolean;
end record;
Compile-time behavioral capabilities of an allocation algorithm. These values describe its public contract; the algorithm's persisted identity remains the compatibility authority on attachment.
Record fields
- Search
Worst-case allocation search class
- Allocation_Contention
Contention scope for allocation
- Release_Contention
Contention scope for reclamation
- In_Band_Metadata
Whether managed bytes contain block metadata
- Splits_Blocks
Whether allocation can split a larger free block
- Coalesces_On_Release
Whether release immediately joins neighbors
- Timed_Contention
Whether timed allocation and release are present
- Release_Exclusion
Whether payload access must exclude release
Allocation_Handle
type Allocation_Handle is record
Token : Interfaces.Unsigned_64 := 0;
Generation : Interfaces.Unsigned_64 := 0;
end record;
Fixed-width opaque allocation identity. Token is interpreted only by the selected algorithm. Generation is nonzero for every live allocation and must not wrap to revive an older handle.
Record fields
- Token
Algorithm-defined arena-relative allocation token
- Generation
Nonzero allocation generation
Allocation_Result
type Allocation_Result is (Allocated, Exhausted, Allocation_Contended);
Allocation attempt outcome.
Enumeration literals
- Allocated
Value names a newly allocated block
- Exhausted
No free block can satisfy the request
- Allocation_Contended
Another caller owns allocator metadata
Contention_Scope
type Contention_Scope is (Whole_Allocator, Per_Allocation, External_Exclusion);
Stored-metadata contention scope used by one operation class.
Enumeration literals
- Whole_Allocator
One persisted guard serializes the allocator
- Per_Allocation
Independent allocations have separate state
- External_Exclusion
The caller supplies synchronization
Metadata
type Metadata is record
Usable_Capacity : Interfaces.Unsigned_32;
Minimum_Block_Size : Interfaces.Unsigned_32;
Instance_ID : Interfaces.Unsigned_64;
Incarnation : Interfaces.Unsigned_32;
Extent : Byte_Count;
end record;
Immutable configuration common to attached allocator instances.
Record fields
- Usable_Capacity
Bytes in the algorithm-managed allocation area; in-band algorithms may reserve part of this area for block metadata
- Minimum_Block_Size
Smallest allocation unit and alignment
- Instance_ID
Caller-selected nonzero arena identity
- Incarnation
Persisted initialization epoch for dependencies
- Extent
Complete allocator metadata and payload extent
Null_Allocation
Null_Allocation : constant Allocation_Handle := (Token => 0, Generation => 0);
Null allocation relationship.
Search_Bound
type Search_Bound is (Constant_Class_Bound, Logarithmic, Linear);
Asymptotic search bound stated by an allocation implementation.
Enumeration literals
- Constant_Class_Bound
Search examines a fixed number of classes
- Logarithmic
Search grows logarithmically with managed blocks
- Linear
Search may inspect every managed block