|
|
Description[wasm] Do not patch memory references in imported functions.
BUG=v8:5860
R=rossberg@chromium.org
Review-Url: https://codereview.chromium.org/2653533003
Cr-Commit-Position: refs/heads/master@{#42622}
Committed: https://chromium.googlesource.com/v8/v8/+/e9b22dde28993cc116fbfc78e2ff3c836c8f6cad
Patch Set 1 #Patch Set 2 : Do not reset memory references in imported functions either #Patch Set 3 : Fix WasmCompiledModule #Patch Set 4 : Rebase #Patch Set 5 : [wasm] Do not patch memory references in imported functions. #Patch Set 6 : ]This patch should apply #
Messages
Total messages: 37 (28 generated)
The CQ bit was checked by titzer@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux_dbg_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng/builds/19771) v8_linux_dbg_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng_triggered/b...) v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/16157) v8_mac_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng_triggered/bui...)
lgtm
The CQ bit was checked by titzer@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_gyp_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng/build...) v8_linux64_gyp_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng_trigg...)
The CQ bit was checked by titzer@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_win_nosnap_shared_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_rel_ng...) v8_win_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/21429)
The CQ bit was checked by titzer@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by titzer@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from rossberg@chromium.org Link to the patchset: https://codereview.chromium.org/2653533003/#ps40001 (title: "Fix WasmCompiledModule")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for src/wasm/wasm-module.cc: While running git apply --index -p1; error: patch failed: src/wasm/wasm-module.cc:1305 error: src/wasm/wasm-module.cc: patch does not apply Patch: src/wasm/wasm-module.cc Index: src/wasm/wasm-module.cc diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc index a36a9685011f9c957c806ab3a6d846f19f27b025..21ed3e15fd71d237c05997b5a7ab297d3e862262 100644 --- a/src/wasm/wasm-module.cc +++ b/src/wasm/wasm-module.cc @@ -119,9 +119,11 @@ void* TryAllocateBackingStore(Isolate* isolate, size_t size, } void RelocateMemoryReferencesInCode(Handle<FixedArray> code_table, + uint32_t num_imported_functions, Address old_start, Address start, uint32_t prev_size, uint32_t new_size) { - for (int i = 0; i < code_table->length(); ++i) { + for (int i = static_cast<int>(num_imported_functions); + i < code_table->length(); ++i) { DCHECK(code_table->get(i)->IsCode()); Handle<Code> code = Handle<Code>(Code::cast(code_table->get(i))); AllowDeferredHandleDereference embedding_raw_address; @@ -564,7 +566,8 @@ static void ResetCompiledModule(Isolate* isolate, WasmInstanceObject* owner, if (fct_obj != nullptr && fct_obj != undefined && (old_mem_size > 0 || globals_start != nullptr || function_tables)) { FixedArray* functions = FixedArray::cast(fct_obj); - for (int i = 0; i < functions->length(); ++i) { + for (int i = compiled_module->num_imported_functions(); + i < functions->length(); ++i) { Code* code = Code::cast(functions->get(i)); bool changed = false; for (RelocIterator it(code, mode_mask); !it.done(); it.next()) { @@ -988,6 +991,7 @@ MaybeHandle<WasmCompiledModule> WasmModule::CompileFunctions( // serializable. Instantiation may occur off a deserialized version of this // object. Handle<WasmCompiledModule> ret = WasmCompiledModule::New(isolate, shared); + ret->set_num_imported_functions(num_imported_functions); ret->set_code_table(code_table); ret->set_min_mem_pages(min_mem_pages); ret->set_max_mem_pages(max_mem_pages); @@ -1305,8 +1309,9 @@ class WasmInstanceBuilder { ? static_cast<Address>( compiled_module_->memory()->backing_store()) : nullptr; - RelocateMemoryReferencesInCode(code_table, old_mem_start, mem_start, - old_mem_size, mem_size); + RelocateMemoryReferencesInCode( + code_table, module_->num_imported_functions, old_mem_start, mem_start, + old_mem_size, mem_size); compiled_module_->set_memory(memory_); } else { if (!LoadDataSegments(nullptr, 0)) return nothing; @@ -2338,8 +2343,9 @@ void UncheckedUpdateInstanceMemory(Isolate* isolate, Address new_mem_start = static_cast<Address>(new_buffer->backing_store()); DCHECK_NOT_NULL(new_mem_start); Handle<FixedArray> code_table = instance->compiled_module()->code_table(); - RelocateMemoryReferencesInCode(code_table, old_mem_start, new_mem_start, - old_size, new_size); + RelocateMemoryReferencesInCode( + code_table, instance->compiled_module()->module()->num_imported_functions, + old_mem_start, new_mem_start, old_size, new_size); } int32_t wasm::GrowWebAssemblyMemory(Isolate* isolate,
The CQ bit was checked by titzer@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from rossberg@chromium.org Link to the patchset: https://codereview.chromium.org/2653533003/#ps60001 (title: "Rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by titzer@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from rossberg@chromium.org Link to the patchset: https://codereview.chromium.org/2653533003/#ps80001 (title: "[wasm] Do not patch memory references in imported functions.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for src/wasm/wasm-module.cc: While running git apply --index -p1; error: patch failed: src/wasm/wasm-module.cc:1305 error: src/wasm/wasm-module.cc: patch does not apply Patch: src/wasm/wasm-module.cc Index: src/wasm/wasm-module.cc diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc index a36a9685011f9c957c806ab3a6d846f19f27b025..21ed3e15fd71d237c05997b5a7ab297d3e862262 100644 --- a/src/wasm/wasm-module.cc +++ b/src/wasm/wasm-module.cc @@ -119,9 +119,11 @@ void* TryAllocateBackingStore(Isolate* isolate, size_t size, } void RelocateMemoryReferencesInCode(Handle<FixedArray> code_table, + uint32_t num_imported_functions, Address old_start, Address start, uint32_t prev_size, uint32_t new_size) { - for (int i = 0; i < code_table->length(); ++i) { + for (int i = static_cast<int>(num_imported_functions); + i < code_table->length(); ++i) { DCHECK(code_table->get(i)->IsCode()); Handle<Code> code = Handle<Code>(Code::cast(code_table->get(i))); AllowDeferredHandleDereference embedding_raw_address; @@ -564,7 +566,8 @@ static void ResetCompiledModule(Isolate* isolate, WasmInstanceObject* owner, if (fct_obj != nullptr && fct_obj != undefined && (old_mem_size > 0 || globals_start != nullptr || function_tables)) { FixedArray* functions = FixedArray::cast(fct_obj); - for (int i = 0; i < functions->length(); ++i) { + for (int i = compiled_module->num_imported_functions(); + i < functions->length(); ++i) { Code* code = Code::cast(functions->get(i)); bool changed = false; for (RelocIterator it(code, mode_mask); !it.done(); it.next()) { @@ -988,6 +991,7 @@ MaybeHandle<WasmCompiledModule> WasmModule::CompileFunctions( // serializable. Instantiation may occur off a deserialized version of this // object. Handle<WasmCompiledModule> ret = WasmCompiledModule::New(isolate, shared); + ret->set_num_imported_functions(num_imported_functions); ret->set_code_table(code_table); ret->set_min_mem_pages(min_mem_pages); ret->set_max_mem_pages(max_mem_pages); @@ -1305,8 +1309,9 @@ class WasmInstanceBuilder { ? static_cast<Address>( compiled_module_->memory()->backing_store()) : nullptr; - RelocateMemoryReferencesInCode(code_table, old_mem_start, mem_start, - old_mem_size, mem_size); + RelocateMemoryReferencesInCode( + code_table, module_->num_imported_functions, old_mem_start, mem_start, + old_mem_size, mem_size); compiled_module_->set_memory(memory_); } else { if (!LoadDataSegments(nullptr, 0)) return nothing; @@ -2338,8 +2343,9 @@ void UncheckedUpdateInstanceMemory(Isolate* isolate, Address new_mem_start = static_cast<Address>(new_buffer->backing_store()); DCHECK_NOT_NULL(new_mem_start); Handle<FixedArray> code_table = instance->compiled_module()->code_table(); - RelocateMemoryReferencesInCode(code_table, old_mem_start, new_mem_start, - old_size, new_size); + RelocateMemoryReferencesInCode( + code_table, instance->compiled_module()->module()->num_imported_functions, + old_mem_start, new_mem_start, old_size, new_size); } int32_t wasm::GrowWebAssemblyMemory(Isolate* isolate,
The CQ bit was checked by titzer@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from rossberg@chromium.org Link to the patchset: https://codereview.chromium.org/2653533003/#ps100001 (title: "]This patch should apply")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 100001, "attempt_start_ts": 1485249100578380, "parent_rev": "dd310b434181902a8e8a93890dd634a2e8cfc825", "commit_rev": "e9b22dde28993cc116fbfc78e2ff3c836c8f6cad"}
Message was sent while issue was closed.
Description was changed from ========== [wasm] Do not patch memory references in imported functions. BUG=v8:5860 R=rossberg@chromium.org ========== to ========== [wasm] Do not patch memory references in imported functions. BUG=v8:5860 R=rossberg@chromium.org Review-Url: https://codereview.chromium.org/2653533003 Cr-Commit-Position: refs/heads/master@{#42622} Committed: https://chromium.googlesource.com/v8/v8/+/e9b22dde28993cc116fbfc78e2ff3c836c8... ==========
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as https://chromium.googlesource.com/v8/v8/+/e9b22dde28993cc116fbfc78e2ff3c836c8... |