Kagome
Polkadot Runtime Engine in C++17
intrinsic_module_instance.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_WAVM_IMPL_INTRINSIC_MODULE_INSTANCE_HPP
7 #define KAGOME_CORE_RUNTIME_WAVM_IMPL_INTRINSIC_MODULE_INSTANCE_HPP
8 
9 #include <memory>
10 
11 #include <WAVM/IR/Types.h>
12 #include <WAVM/Runtime/Intrinsics.h>
13 #include <WAVM/Runtime/Runtime.h>
14 
15 namespace WAVM::Runtime {
16  struct Function;
17 
18 } // namespace WAVM::Runtime
19 
20 namespace kagome::runtime::wavm {
21 
22  class CompartmentWrapper;
23  struct ModuleParams;
24 
30  public:
32  WAVM::Runtime::GCPointer<WAVM::Runtime::Instance> module_instance,
33  std::shared_ptr<const CompartmentWrapper> compartment,
34  WAVM::IR::MemoryType intrinsic_memory_type);
35 
37  // to free the instance before compartment and thus
38  // allow the compartment to clean up everything on its destruction
39  module_instance_ = nullptr;
40  }
41 
42  WAVM::Runtime::Memory *getExportedMemory() const;
43  WAVM::Runtime::Function *getExportedFunction(
44  const std::string &name, WAVM::IR::FunctionType const &type) const;
45 
46  private:
47  WAVM::Runtime::GCPointer<WAVM::Runtime::Instance> module_instance_;
48  const std::shared_ptr<const CompartmentWrapper> compartment_;
49  WAVM::IR::MemoryType intrinsic_memory_type_;
50  };
51 
52 } // namespace kagome::runtime::wavm
53 
54 #endif // KAGOME_CORE_RUNTIME_WAVM_IMPL_INTRINSIC_MODULE_INSTANCE_HPP
const std::shared_ptr< const CompartmentWrapper > compartment_
WAVM::Runtime::GCPointer< WAVM::Runtime::Instance > module_instance_