20 std::shared_ptr<storage::trie::TrieStorage> storage,
21 std::shared_ptr<storage::trie::TrieSerializer> serializer,
22 std::shared_ptr<CompartmentWrapper> compartment,
23 std::shared_ptr<ModuleParams> module_params,
24 std::shared_ptr<IntrinsicModule> intrinsic_module,
25 std::shared_ptr<host_api::HostApiFactory> host_api_factory,
26 std::shared_ptr<blockchain::BlockHeaderRepository> block_header_repo,
27 std::shared_ptr<storage::changes_trie::ChangesTracker> changes_tracker,
28 std::shared_ptr<kagome::runtime::SingleModuleCache> last_compiled_module,
29 std::shared_ptr<runtime::RuntimePropertiesCache> cache)
30 : storage_{std::move(storage)},
32 compartment_{std::move(compartment)},
33 module_params_{std::move(module_params)},
34 intrinsic_module_{std::move(intrinsic_module)},
38 last_compiled_module_{std::move(last_compiled_module)},
42 BOOST_ASSERT(compartment_ !=
nullptr);
43 BOOST_ASSERT(module_params_ !=
nullptr);
44 BOOST_ASSERT(intrinsic_module_ !=
nullptr);
48 BOOST_ASSERT(last_compiled_module_ !=
nullptr);
49 BOOST_ASSERT(
cache_ !=
nullptr);
54 WAVM::Runtime::Instance *runtime_instance,
55 std::shared_ptr<IntrinsicModuleInstance> intrinsic_instance)
const {
56 auto new_storage_provider =
59 std::make_shared<CoreApiFactoryImpl>(compartment_,
66 last_compiled_module_,
69 std::shared_ptr<MemoryProvider> memory_provider;
70 switch (memory_origin) {
71 case MemoryOrigin::EXTERNAL:
73 std::make_shared<WavmExternalMemoryProvider>(intrinsic_instance);
75 case MemoryOrigin::INTERNAL: {
76 auto *memory = WAVM::Runtime::getDefaultMemory(runtime_instance);
77 memory_provider = std::make_shared<WavmInternalMemoryProvider>(memory);
81 core_factory, memory_provider, new_storage_provider));
84 std::move(new_storage_provider),
std::shared_ptr< RuntimePropertiesCache > cache_
BinaryenInstanceEnvironment make() const
std::shared_ptr< blockchain::BlockHeaderRepository > block_header_repo_
std::shared_ptr< storage::changes_trie::ChangesTracker > changes_tracker_
InstanceEnvironmentFactory(std::shared_ptr< storage::trie::TrieStorage > storage, std::shared_ptr< storage::trie::TrieSerializer > serializer, std::shared_ptr< CompartmentWrapper > compartment, std::shared_ptr< ModuleParams > module_params, std::shared_ptr< IntrinsicModule > intrinsic_module, std::shared_ptr< host_api::HostApiFactory > host_api_factory, std::shared_ptr< blockchain::BlockHeaderRepository > block_header_repo, std::shared_ptr< storage::changes_trie::ChangesTracker > changes_tracker, std::shared_ptr< SingleModuleCache > last_compiled_module, std::shared_ptr< RuntimePropertiesCache > cache)
std::shared_ptr< storage::trie::TrieStorage > storage_
std::shared_ptr< storage::trie::TrieSerializer > serializer_
std::shared_ptr< host_api::HostApiFactory > host_api_factory_