Kagome
Polkadot Runtime Engine in C++17
wavm_external_memory_provider.cpp
Go to the documentation of this file.
1 
7 
11 
12 namespace kagome::runtime::wavm {
13 
15  std::shared_ptr<IntrinsicModuleInstance> module)
16  : intrinsic_module_{std::move(module)} {
17  BOOST_ASSERT(intrinsic_module_ != nullptr);
18  }
19 
20  std::optional<std::reference_wrapper<runtime::Memory>>
22  return current_memory_
23  ? std::optional<std::reference_wrapper<runtime::Memory>>(
25  : std::nullopt;
26  }
27 
29  WasmSize heap_base) {
30  current_memory_ = std::make_unique<MemoryImpl>(
31  intrinsic_module_->getExportedMemory(), heap_base);
32  return outcome::success();
33  }
34 
35 } // namespace kagome::runtime::wavm
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