6 #ifndef KAGOME_MEMORY_HPP 7 #define KAGOME_MEMORY_HPP 21 using kagome::common::literals::operator
""_MB;
27 using kagome::common::literals::operator
""_kB;
44 std::numeric_limits<uint32_t>::max();
109 const std::array<uint8_t, 16> &value) = 0;
111 gsl::span<const uint8_t> value) = 0;
122 #endif // KAGOME_MEMORY_HPP
Class represents arbitrary (including empty) byte buffer.
virtual int16_t load16s(WasmPointer addr) const =0
virtual uint16_t load16u(WasmPointer addr) const =0
virtual void store128(WasmPointer addr, const std::array< uint8_t, 16 > &value)=0
virtual int32_t load32s(WasmPointer addr) const =0
uint32_t WasmSize
Size type is uint32_t because we are working in 32 bit address space.
virtual void store32(WasmPointer addr, int32_t value)=0
virtual common::Buffer loadN(WasmPointer addr, WasmSize n) const =0
virtual uint32_t load32u(WasmPointer addr) const =0
virtual void store16(WasmPointer addr, int16_t value)=0
virtual void resize(WasmSize new_size)=0
virtual WasmPointer allocate(WasmSize size)=0
virtual ~Memory()=default
constexpr size_t kInitialMemorySize
virtual uint64_t load64u(WasmPointer addr) const =0
virtual int64_t load64s(WasmPointer addr) const =0
virtual std::array< uint8_t, 16 > load128(WasmPointer addr) const =0
virtual uint8_t load8u(WasmPointer addr) const =0
static constexpr uint32_t kMaxMemorySize
uint64_t WasmSpan
combination of pointer and size, where less significant part represents wasm pointer, and most significant represents size
virtual WasmSize size() const =0
Return the size of the memory.
uint32_t WasmPointer
type of wasm memory is 32 bit integer
constexpr size_t kMemoryPageSize
virtual int8_t load8s(WasmPointer addr) const =0
virtual void storeBuffer(WasmPointer addr, gsl::span< const uint8_t > value)=0
virtual std::string loadStr(WasmPointer addr, WasmSize n) const =0
virtual void store64(WasmPointer addr, int64_t value)=0
virtual void store8(WasmPointer addr, int8_t value)=0
virtual std::optional< WasmSize > deallocate(WasmPointer ptr)=0