Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Issue 2395063002: [wasm] Fix wasm instantiation flakes (Closed)

Created:
4 years, 2 months ago by Mircea Trofin
Modified:
4 years, 2 months ago
Reviewers:
titzer, bradnelson
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[wasm] Fix wasm instantiation flakes The spurious failures were caused by the compiled module template and its corresponding owning object getting out of sync due to memory allocations (which may trigger GC) between the points each were fetched. Specifically, the {original} was first obtained; then a GC may happen when cloning the {code_table}. At this point, the {original}'s owner may have been collected, getting us down the path of not cloning. When time comes to patch up globals, we incorrectly try to patch them assuming the global start is at 0 (nullptr), which in fact it isn't. This change roots early, in a GC-free area, both objects. Additionally, it avoids publishing to the instances chain the new instance until the very end. This way: - the objects used to create the new instance offer a consistent view - the instances chain does not see the object we try to form. If something fails, we can safely retry. - since the owner is rooted, the state of the front of the instances chain stays unchanged - with the same compiled module we started from. So the early belief that we needed to clone is not invalidated by any interspersed GC. This situation suffers from a sub-optimality discussed in the design document, in that, in a memory constrained system, the following snippet may surprisingly fail: var m = new WebAssembly.Module(...); var i1 = new WebAssembly.Instance(m); i1 = null; var i2 = new WebAssembly.Instance(m); //may fail. This will be addressed subsequently. BUG=v8:5451 Committed: https://crrev.com/b75a0c4a555278de8c59695e55f26a4e2ea6c862 Cr-Commit-Position: refs/heads/master@{#40126}

Patch Set 1 #

Total comments: 5

Patch Set 2 : better fix #

Patch Set 3 : better fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+53 lines, -56 lines) Patch
M src/wasm/wasm-module.cc View 1 4 chunks +53 lines, -43 lines 0 comments Download
M test/mjsunit/mjsunit.status View 1 2 5 chunks +0 lines, -13 lines 0 comments Download

Messages

Total messages: 37 (26 generated)
titzer
https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc File src/wasm/wasm-module.cc (right): https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc#newcode1215 src/wasm/wasm-module.cc:1215: WeakCell* tmp = original->ptr_to_weak_owning_instance(); Why do we have a ...
4 years, 2 months ago (2016-10-07 12:40:32 UTC) #8
Mircea Trofin
https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc File src/wasm/wasm-module.cc (right): https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc#newcode1215 src/wasm/wasm-module.cc:1215: WeakCell* tmp = original->ptr_to_weak_owning_instance(); On 2016/10/07 12:40:32, titzer wrote: ...
4 years, 2 months ago (2016-10-07 14:44:24 UTC) #9
titzer
https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc File src/wasm/wasm-module.cc (right): https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc#newcode1221 src/wasm/wasm-module.cc:1221: code_table = factory->CopyFixedArray(old_code_table); On 2016/10/07 14:44:23, Mircea Trofin wrote: ...
4 years, 2 months ago (2016-10-07 15:37:42 UTC) #10
Mircea Trofin
On 2016/10/07 15:37:42, titzer wrote: > https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc > File src/wasm/wasm-module.cc (right): > > https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc#newcode1221 > ...
4 years, 2 months ago (2016-10-07 15:49:43 UTC) #11
Mircea Trofin
4 years, 2 months ago (2016-10-07 21:00:27 UTC) #21
titzer
On 2016/10/07 15:49:43, Mircea Trofin wrote: > On 2016/10/07 15:37:42, titzer wrote: > > https://codereview.chromium.org/2395063002/diff/1/src/wasm/wasm-module.cc ...
4 years, 2 months ago (2016-10-08 09:39:57 UTC) #29
Mircea Trofin
Gentle reminder - ptal. I re-ran the stress tests a few times. All green, consistently, ...
4 years, 2 months ago (2016-10-10 06:09:20 UTC) #30
titzer
lgtm
4 years, 2 months ago (2016-10-10 08:34:35 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2395063002/60001
4 years, 2 months ago (2016-10-10 14:25:54 UTC) #33
commit-bot: I haz the power
Committed patchset #3 (id:60001)
4 years, 2 months ago (2016-10-10 14:53:53 UTC) #35
commit-bot: I haz the power
4 years, 2 months ago (2016-10-10 14:54:03 UTC) #37
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/b75a0c4a555278de8c59695e55f26a4e2ea6c862
Cr-Commit-Position: refs/heads/master@{#40126}

Powered by Google App Engine
This is Rietveld 408576698