Kagome
Polkadot Runtime Engine in C++17
wavm_external_memory_provider.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_WAVM_IMPL_WAVM_MEMORY_PROVIDER_HPP
7 #define KAGOME_CORE_RUNTIME_WAVM_IMPL_WAVM_MEMORY_PROVIDER_HPP
8 
10 
11 namespace kagome::runtime::wavm {
12 
13  class IntrinsicModuleInstance;
14  class MemoryImpl;
15 
17  public:
19  std::shared_ptr<IntrinsicModuleInstance> intrinsic_module);
20 
21  std::optional<std::reference_wrapper<runtime::Memory>> getCurrentMemory()
22  const override;
23  outcome::result<void> resetMemory(WasmSize heap_base) override;
24 
25  private:
26  // it contains the memory itself
27  std::shared_ptr<IntrinsicModuleInstance> intrinsic_module_;
28  std::shared_ptr<Memory> current_memory_;
29  };
30 
31 } // namespace kagome::runtime::wavm
32 
33 #endif // KAGOME_CORE_RUNTIME_WAVM_IMPL_WAVM_MEMORY_PROVIDER_HPP
uint32_t WasmSize
Size type is uint32_t because we are working in 32 bit address space.
Definition: types.hpp:35
std::shared_ptr< IntrinsicModuleInstance > intrinsic_module_
WavmExternalMemoryProvider(std::shared_ptr< IntrinsicModuleInstance > intrinsic_module)
outcome::result< void > resetMemory(WasmSize heap_base) override
std::optional< std::reference_wrapper< runtime::Memory > > getCurrentMemory() const override