diff --git a/dependencies/wasm/CMakeLists.txt b/dependencies/wasm/CMakeLists.txt index 9792ece6ca46..d81d068d9a45 100644 --- a/dependencies/wasm/CMakeLists.txt +++ b/dependencies/wasm/CMakeLists.txt @@ -16,7 +16,9 @@ if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") endif () if (WITH_WABT) - set(WABT_VER 1.0.25) + # TODO: this commit hash is temporary until WABT produces + # a new release tag with revised API + set(WABT_VER 09c40635207d42dd30ffaca22477fd3491dd9e7d) message(STATUS "Fetching WABT ${WABT_VER}...") FetchContent_Declare(wabt diff --git a/src/WasmExecutor.cpp b/src/WasmExecutor.cpp index 28ff29b897de..330c7b3cb11b 100644 --- a/src/WasmExecutor.cpp +++ b/src/WasmExecutor.cpp @@ -552,7 +552,7 @@ struct WabtContext { }; WabtContext &get_wabt_context(wabt::interp::Thread &thread) { - void *host_info = thread.host_info(); + void *host_info = thread.GetCallerInstance()->host_info(); wassert(host_info); return *(WabtContext *)host_info; } @@ -2542,6 +2542,8 @@ int WasmModuleContents::run(const void **args) { } WabtContext wabt_context(jit_user_context, *memory, bdmalloc); + internal_assert(instance->host_info() == nullptr); + instance->set_host_info(&wabt_context); wabt::interp::Values wabt_args; wabt::interp::Values wabt_results; @@ -2567,11 +2569,9 @@ int WasmModuleContents::run(const void **args) { } } - wabt::interp::Thread::Options options; - wabt::interp::Thread::Ptr thread = wabt::interp::Thread::New(store, options); - thread->set_host_info(&wabt_context); + wabt::interp::Thread thread(store); - auto r = func->Call(*thread, wabt_args, wabt_results, &trap); + auto r = func->Call(thread, wabt_args, wabt_results, &trap); if (WASM_DEBUG_LEVEL >= 2) { wabt::MemoryStream call_stream; WriteCall(&call_stream, func_name, *func_type, wabt_args, wabt_results, trap); @@ -2603,6 +2603,7 @@ int WasmModuleContents::run(const void **args) { // between multiple invocations of the same function. // bdmalloc.reset(); + instance->set_host_info(nullptr); return result; #endif