Kagome
Polkadot Runtime Engine in C++17
|
#include <memory_impl.hpp>
Public Member Functions | |
MemoryImpl (WAVM::Runtime::Memory *memory, std::unique_ptr< MemoryAllocator > &&allocator) | |
MemoryImpl (WAVM::Runtime::Memory *memory, WasmSize heap_base) | |
MemoryImpl (const MemoryImpl ©)=delete | |
MemoryImpl & | operator= (const MemoryImpl ©)=delete |
MemoryImpl (MemoryImpl &&move)=delete | |
MemoryImpl & | operator= (MemoryImpl &&move)=delete |
WasmPointer | allocate (WasmSize size) override |
std::optional< WasmSize > | deallocate (WasmPointer ptr) override |
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>> | |
T | load (WasmPointer addr) const |
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>> | |
T * | loadArray (WasmPointer addr, size_t num) const |
int8_t | load8s (WasmPointer addr) const override |
uint8_t | load8u (WasmPointer addr) const override |
int16_t | load16s (WasmPointer addr) const override |
uint16_t | load16u (WasmPointer addr) const override |
int32_t | load32s (WasmPointer addr) const override |
uint32_t | load32u (WasmPointer addr) const override |
int64_t | load64s (WasmPointer addr) const override |
uint64_t | load64u (WasmPointer addr) const override |
std::array< uint8_t, 16 > | load128 (WasmPointer addr) const override |
common::Buffer | loadN (WasmPointer addr, WasmSize n) const override |
std::string | loadStr (WasmPointer addr, WasmSize n) const override |
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>> | |
void | store (WasmPointer addr, T value) |
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>> | |
void | storeArray (WasmPointer addr, gsl::span< T > array) |
void | store8 (WasmPointer addr, int8_t value) override |
void | store16 (WasmPointer addr, int16_t value) override |
void | store32 (WasmPointer addr, int32_t value) override |
void | store64 (WasmPointer addr, int64_t value) override |
void | store128 (WasmPointer addr, const std::array< uint8_t, 16 > &value) override |
void | storeBuffer (WasmPointer addr, gsl::span< const uint8_t > value) override |
WasmSpan | storeBuffer (gsl::span< const uint8_t > value) override |
allocates buffer in memory and copies value into memory More... | |
WasmSize | size () const override |
Return the size of the memory. More... | |
void | resize (WasmSize new_size) override |
Public Member Functions inherited from kagome::runtime::Memory | |
virtual | ~Memory ()=default |
Private Member Functions | |
void | fill (PtrSize span, uint8_t value) |
Private Attributes | |
std::unique_ptr< MemoryAllocator > | allocator_ |
WAVM::Runtime::Memory * | memory_ |
log::Logger | logger_ |
Static Private Attributes | |
static constexpr uint32_t | kPageSize = 4096 |
Additional Inherited Members | |
Static Public Attributes inherited from kagome::runtime::Memory | |
static constexpr uint32_t | kMaxMemorySize |
Definition at line 27 of file memory_impl.hpp.
kagome::runtime::wavm::MemoryImpl::MemoryImpl | ( | WAVM::Runtime::Memory * | memory, |
std::unique_ptr< MemoryAllocator > && | allocator | ||
) |
Definition at line 12 of file memory_impl.cpp.
kagome::runtime::wavm::MemoryImpl::MemoryImpl | ( | WAVM::Runtime::Memory * | memory, |
WasmSize | heap_base | ||
) |
Definition at line 22 of file memory_impl.cpp.
|
delete |
|
delete |
|
overridevirtual |
Allocates memory of given size and returns address in the memory
size | allocated memory size |
Implements kagome::runtime::Memory.
Definition at line 31 of file memory_impl.cpp.
|
overridevirtual |
Deallocates memory in provided region
ptr | address of deallocated memory |
Implements kagome::runtime::Memory.
Definition at line 35 of file memory_impl.cpp.
|
inlineprivate |
Definition at line 113 of file memory_impl.hpp.
|
inline |
Definition at line 41 of file memory_impl.hpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 63 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 45 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 48 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 51 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 54 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 57 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 60 of file memory_impl.cpp.
|
overridevirtual |
Load integers from provided address
Implements kagome::runtime::Memory.
Definition at line 39 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 42 of file memory_impl.cpp.
|
inline |
Definition at line 48 of file memory_impl.hpp.
|
overridevirtual |
Load bytes from provided address into the buffer of size n
addr | address in memory to load bytes |
n | number of bytes to be loaded |
Implements kagome::runtime::Memory.
Definition at line 70 of file memory_impl.cpp.
|
overridevirtual |
Load string from address into buffer of size n
addr | address in memory to load bytes |
n | number of bytes |
Implements kagome::runtime::Memory.
Definition at line 77 of file memory_impl.cpp.
|
delete |
|
delete |
|
inlineoverridevirtual |
Resizes memory to the given size
new_size |
We use this condition to avoid deallocated_ pointers fixup
Implements kagome::runtime::Memory.
Definition at line 100 of file memory_impl.hpp.
|
inlineoverridevirtual |
Return the size of the memory.
Implements kagome::runtime::Memory.
Definition at line 96 of file memory_impl.hpp.
|
inline |
Definition at line 69 of file memory_impl.hpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 100 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 91 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 94 of file memory_impl.cpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 97 of file memory_impl.cpp.
|
overridevirtual |
Store integers at given address of the wasm memory
Implements kagome::runtime::Memory.
Definition at line 88 of file memory_impl.cpp.
|
inline |
Definition at line 78 of file memory_impl.hpp.
|
overridevirtual |
Implements kagome::runtime::Memory.
Definition at line 104 of file memory_impl.cpp.
|
overridevirtual |
allocates buffer in memory and copies value into memory
value | buffer to store |
Implements kagome::runtime::Memory.
Definition at line 109 of file memory_impl.cpp.
|
private |
Definition at line 120 of file memory_impl.hpp.
|
staticprivate |
Definition at line 119 of file memory_impl.hpp.
|
private |
Definition at line 122 of file memory_impl.hpp.
|
private |
Definition at line 121 of file memory_impl.hpp.