Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/wavm/wavm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ struct Wavm : public WasmVm {
std::map<std::string, Intrinsics::Module> intrinsic_modules_;
std::map<std::string, WAVM::Runtime::GCPointer<WAVM::Runtime::Instance>>
intrinsic_module_instances_;
std::vector<std::unique_ptr<Intrinsics::Function>> envoyFunctions_;
std::vector<std::unique_ptr<Intrinsics::Function>> host_functions_;
uint8_t *memory_base_ = nullptr;
AbiVersion abi_version_ = AbiVersion::Unknown;
};
Expand All @@ -268,7 +268,7 @@ Wavm::~Wavm() {
context_ = nullptr;
intrinsic_module_instances_.clear();
intrinsic_modules_.clear();
envoyFunctions_.clear();
host_functions_.clear();
if (compartment_) {
ASSERT(tryCollectCompartment(std::move(compartment_)));
}
Expand Down Expand Up @@ -415,7 +415,7 @@ std::string_view Wavm::getPrecompiledSectionName() { return "wavm.precompiled_ob
std::unique_ptr<WasmVm> createWavmVm() { return std::make_unique<proxy_wasm::Wavm::Wavm>(); }

template <typename R, typename... Args>
IR::FunctionType inferEnvoyFunctionType(R (*)(void *, Args...)) {
IR::FunctionType inferHostFunctionType(R (*)(void *, Args...)) {
return IR::FunctionType(IR::inferResultType<R>(), IR::TypeTuple({IR::inferValueType<Args>()...}),
IR::CallingConvention::intrinsic);
}
Expand All @@ -426,9 +426,9 @@ template <typename R, typename... Args>
void registerCallbackWavm(WasmVm *vm, std::string_view module_name, std::string_view function_name,
R (*f)(Args...)) {
auto wavm = static_cast<proxy_wasm::Wavm::Wavm *>(vm);
wavm->envoyFunctions_.emplace_back(new Intrinsics::Function(
wavm->host_functions_.emplace_back(new Intrinsics::Function(
&wavm->intrinsic_modules_[std::string(module_name)], function_name.data(),
reinterpret_cast<void *>(f), inferEnvoyFunctionType(f)));
reinterpret_cast<void *>(f), inferHostFunctionType(f)));
}

template void registerCallbackWavm<void, void *>(WasmVm *vm, std::string_view module_name,
Expand Down