[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 <kimanh@google.com>
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51585}
This commit is contained in:
Kim-Anh Tran 2018-02-27 07:51:51 +01:00 committed by Commit Bot
parent ef2aba3325
commit b3ed3cc5df

View File

@ -1467,6 +1467,10 @@ Handle<WasmCompiledModule> WasmCompiledModule::Clone(
return ret;
}
Handle<FixedArray> export_copy = isolate->factory()->CopyFixedArray(
handle(module->export_wrappers(), isolate));
ret->set_export_wrappers(*export_copy);
std::unique_ptr<wasm::NativeModule> native_module =
module->GetNativeModule()->Clone();
// construct the wrapper in 2 steps, because its construction may trigger GC,