Implementation
Library dependency tower for xo-alloc2
Abstraction tower for xo-alloc2 components (simplified)
Abstraction tower for xo-alloc2 components (detailed)
Class |
Description |
|---|---|
|
Abstract allocator interface for runtime polymorphism |
|
Stub allocator interface for uninitialized variant |
|
Allocator interface template for representation |
|
Lookup allocator interface for representation |
|
Provide allocator methods for FOMO object |
Class |
Description |
|---|---|
|
Abstract interface for iteration over allocs |
|
Stub alloc-iterator interface for uninitialized variant |
|
Alloc-iterator interface template for representation |
|
Lookup alloc-iterator interface for representation |
|
Provide alloc-iterator methods for FOMO object |
Class |
Description |
|---|---|
|
Configuration for a |
|
VM-aware arena allocator |
|
Iterator over |
|
Adapt a |
|
Adapt a |
Class |
Description |
|---|---|
|
Return type for an alloc request, with error details. |
|
An opaque allocation. Value of an alloc-iterator. |
|
Per-allocator configuration of alloc headers |
|
Per-allocation header (8 bytes) |
|
Result of alloc-iterator comparison |
Example Object Diagram
representation for an arena allocator
Remarks:
When we know the allocator representation at compile time (
DArenahere), then we also know the interface (IAllocator_DArena). Devirtualization is easy since interface methods are all final.Size of a FOMO object is two pointers; it’s natural to create such objects on the fly and pass them by value. When storing an allocator in another data structure, we only need to use the RAllocator stack if we want runtime polymorphism for the stored allocator. Otherwise can store a
DArenainstance.
