From b3ed3cc5dfec190341133d5f69d06d96633bbf5f Mon Sep 17 00:00:00 2001 From: Kim-Anh Tran Date: Tue, 27 Feb 2018 07:51:51 +0100 Subject: [PATCH] [wasm] Clone export wrappers when cloning the compiled module Currently all instances share the exact same export wrappers (pointed to by the corresponding compiled module). This bug, however, does not cause a problem at runtime. This CL makes sure that all compiled modules have their own export wrapper table during instance instantiation. Change-Id: I385d79ab8ad42672f7ab72755387d161b1e9ee81 Reviewed-on: https://chromium-review.googlesource.com/937715 Commit-Queue: Kim-Anh Tran Reviewed-by: Clemens Hammacher Cr-Commit-Position: refs/heads/master@{#51585} --- src/wasm/wasm-objects.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc index f2634e6b42..4a44dafe05 100644 --- a/src/wasm/wasm-objects.cc +++ b/src/wasm/wasm-objects.cc @@ -1467,6 +1467,10 @@ Handle WasmCompiledModule::Clone( return ret; } + Handle export_copy = isolate->factory()->CopyFixedArray( + handle(module->export_wrappers(), isolate)); + ret->set_export_wrappers(*export_copy); + std::unique_ptr native_module = module->GetNativeModule()->Clone(); // construct the wrapper in 2 steps, because its construction may trigger GC,