Kagome
Polkadot Runtime Engine in C++17
intrinsic_module_instance.cpp
Go to the documentation of this file.
1 
7 
8 #include <WAVM/Runtime/Intrinsics.h>
9 
13 
14 namespace kagome::runtime::wavm {
15 
17  WAVM::Runtime::GCPointer<WAVM::Runtime::Instance> module_instance,
18  std::shared_ptr<const CompartmentWrapper> compartment,
19  WAVM::IR::MemoryType intrinsic_memory_type)
20  : module_instance_{std::move(module_instance)},
21  compartment_{std::move(compartment)},
22  intrinsic_memory_type_{intrinsic_memory_type} {
23  BOOST_ASSERT(compartment_);
24  BOOST_ASSERT(module_instance_);
25  }
26 
27  WAVM::Runtime::Memory *IntrinsicModuleInstance::getExportedMemory() const {
28  return getTypedInstanceExport(module_instance_,
31  }
32 
34  const std::string &name, WAVM::IR::FunctionType const &type) const {
35  // discard 'intrinsic' calling convention
36  WAVM::IR::FunctionType wasm_type{type.results(), type.params()};
37  return getTypedInstanceExport(module_instance_, name.data(), wasm_type);
38  }
39 
40 } // namespace kagome::runtime::wavm
IntrinsicModuleInstance(WAVM::Runtime::GCPointer< WAVM::Runtime::Instance > module_instance, std::shared_ptr< const CompartmentWrapper > compartment, WAVM::IR::MemoryType intrinsic_memory_type)
WAVM::Runtime::Function * getExportedFunction(const std::string &name, WAVM::IR::FunctionType const &type) const
const std::shared_ptr< const CompartmentWrapper > compartment_
WAVM::Runtime::GCPointer< WAVM::Runtime::Instance > module_instance_
static constexpr std::string_view kIntrinsicMemoryName