![]() |
mutable
A Database System for Research and Fast Prototyping
|
Represents a mapping created by a memory::Allocator
.
More...
#include <memory.hpp>
Public Member Functions | |
Memory () | |
Memory (void *addr, std::size_t size) | |
~Memory () | |
Memory (const Memory &)=delete | |
Memory (Memory &&other) | |
Memory & | operator= (Memory &&other) |
Allocator & | allocator () const |
Returns a reference to the allocator that created this allocation. | |
void * | addr () const |
Returns a pointer to the beginning of the virtual address space where this allocation is mapped to. | |
std::size_t | size () const |
Returns the size in bytes of this allocation. | |
std::size_t | offset () const |
Returns the offset in bytes of this allocation within its allocator. | |
template<typename T > | |
T | as () |
Returns a pointer to the beginning of the virtual address space where this allocation is mapped to, converted to type T . | |
template<typename T > | |
const T | as () const |
Returns a pointer to the beginning of the virtual address space where this allocation is mapped to, converted to type T . | |
void | map (std::size_t size, std::size_t offset_src, const AddressSpace &vm, std::size_t offset_dst) const |
Map size bytes starting at offset_src into the address space of vm at offset offset_dst . | |
void | dump (std::ostream &out) const |
void | dump () const |
Private Member Functions | |
Memory (Allocator &allocator, void *addr, std::size_t size, std::size_t offset) | |
Private Attributes | |
Allocator * | allocator_ = nullptr |
the allocator that created this memory allocation | |
void * | addr_ = nullptr |
pointer to the virtual address space where this allocation is mapped to | |
std::size_t | size_ = 0 |
the size of this allocation | |
std::size_t | offset_ = 0 |
the offset of this allocation within its allocator | |
Friends | |
struct | Allocator |
void | swap (Memory &first, Memory &second) |
Represents a mapping created by a memory::Allocator
.
The class holds all information on the mapping, i.e. a reference to the allocator that created the mapping, a pointer to the beginning of the virtual address range that was mapped to, the offset within the allocator, and the size of the allocation.
Definition at line 77 of file memory.hpp.
|
private |
Definition at line 78 of file memory.cpp.
|
inline |
Definition at line 98 of file memory.hpp.
|
inline |
Definition at line 99 of file memory.hpp.
|
inline |
Definition at line 100 of file memory.hpp.
References m::allocator< Actual >::deallocate().
|
delete |
|
inline |
Definition at line 102 of file memory.hpp.
References m::swap().
|
inline |
Returns a pointer to the beginning of the virtual address space where this allocation is mapped to.
Definition at line 109 of file memory.hpp.
Referenced by dump(), m::PaxStore::dump(), m::RowStore::dump(), map(), and m::ColumnStore::memory().
|
inline |
Returns a reference to the allocator that created this allocation.
Definition at line 107 of file memory.hpp.
References M_insist.
Returns a pointer to the beginning of the virtual address space where this allocation is mapped to, converted to type T
.
Definition at line 118 of file memory.hpp.
References m::T().
Referenced by m::RowStore::at().
Returns a pointer to the beginning of the virtual address space where this allocation is mapped to, converted to type T
.
Definition at line 122 of file memory.hpp.
References m::T().
void Memory::dump | ( | ) | const |
M_LCOV_EXCL_START void Memory::dump | ( | std::ostream & | out | ) | const |
Definition at line 107 of file memory.cpp.
References addr(), allocator(), m::memory::Allocator::fd(), offset(), and size().
void Memory::map | ( | std::size_t | size, |
std::size_t | offset_src, | ||
const AddressSpace & | vm, | ||
std::size_t | offset_dst | ||
) | const |
Map size
bytes starting at offset_src
into the address space of vm
at offset offset_dst
.
Definition at line 85 of file memory.cpp.
References addr(), allocator(), m::memory::AddressSpace::as(), m::Is_Page_Aligned(), M_insist, offset(), m::memory::AddressSpace::size(), and size().
Referenced by m::WasmEngine::WasmContext::map_table(), and m::wasm::Module::Memory().
|
inline |
Returns the offset in bytes of this allocation within its allocator.
Definition at line 113 of file memory.hpp.
Definition at line 104 of file memory.hpp.
References m::swap().
|
inline |
Returns the size in bytes of this allocation.
Definition at line 111 of file memory.hpp.
Referenced by m::ColumnStore::ColumnStore(), dump(), and map().
Definition at line 79 of file memory.hpp.
Definition at line 90 of file memory.hpp.
|
private |
pointer to the virtual address space where this allocation is mapped to
Definition at line 83 of file memory.hpp.
|
private |
the allocator that created this memory allocation
Definition at line 82 of file memory.hpp.
|
private |
the offset of this allocation within its allocator
Definition at line 85 of file memory.hpp.
|
private |
the size of this allocation
Definition at line 84 of file memory.hpp.