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

Issue 2006793002: VM: Fix race between background compiler and guarded cid update. (Closed)

Created:
4 years, 7 months ago by Vyacheslav Egorov (Google)
Modified:
4 years, 7 months ago
Reviewers:
Florian Schneider
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Base URL:
git@github.com:dart-lang/sdk.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

VM: Fix race between background compiler and guarded cid update. Rework how we check guarded state consistency in background compiler. Background compiler was storing original fields inside guarded fields list. This caused a race during inlining when inliner would copy guarded fields one by one from the callee function into the caller, because ParsedFunction::AddToGuardedFields looks at the guarded_cid to filter out those fields that should not be guarded. As a result if some guarded field transitioned to unguarded (kDynamicCid) after callee graph construction but before list of guarded fields were copied then AddToGuardedFields would simply skip that field because it now has guarded_cid() == kDynamicCid. We fix this race by always placing copies into the list of guarded fields and unwrapping them only in FinalizeCode. Placing the copies also allows us to simplify a lot of code that was trying to verify guarded state consistency before committing the generated optimized code - now that we store copies in the list we can just compare their state to the originals and abort if the state is different. Additionally fix deduplication check that was comparing original fields with copies - resulting in adding the same field into the list multiple times. Add an assertion that verifies that we are not trying to access guarded_cid of original field from background compiler. R=fschneider@google.com BUG= Committed: https://github.com/dart-lang/sdk/commit/65f2e015ca6da96589ef97441efa14ff6ff163a5

Patch Set 1 #

Total comments: 2

Patch Set 2 : rework how we invalidate background compiled code #

Unified diffs Side-by-side diffs Delta from patch set Stats (+62 lines, -132 lines) Patch
M runtime/vm/compiler.cc View 1 5 chunks +15 lines, -40 lines 0 comments Download
M runtime/vm/isolate.h View 1 3 chunks +1 line, -21 lines 0 comments Download
M runtime/vm/isolate.cc View 1 3 chunks +0 lines, -52 lines 0 comments Download
M runtime/vm/jit_optimizer.cc View 2 chunks +4 lines, -2 lines 0 comments Download
M runtime/vm/object.h View 1 2 chunks +15 lines, -2 lines 0 comments Download
M runtime/vm/object.cc View 1 4 chunks +8 lines, -11 lines 0 comments Download
M runtime/vm/parser.cc View 1 1 chunk +19 lines, -2 lines 0 comments Download
M runtime/vm/weak_code.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M runtime/vm/weak_code.cc View 1 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 7 (2 generated)
Vyacheslav Egorov (Google)
4 years, 7 months ago (2016-05-23 18:11:06 UTC) #1
Florian Schneider
LGTM https://codereview.chromium.org/2006793002/diff/1/runtime/vm/object.h File runtime/vm/object.h (right): https://codereview.chromium.org/2006793002/diff/1/runtime/vm/object.h#newcode3136 runtime/vm/object.h:3136: void set_guarded_cid(intptr_t cid) const { Add the same ...
4 years, 7 months ago (2016-05-23 19:26:32 UTC) #2
Vyacheslav Egorov (Google)
Please take another look. I reworked how background compiler validates the background compiled code with ...
4 years, 7 months ago (2016-05-24 10:57:49 UTC) #3
Florian Schneider
lgtm
4 years, 7 months ago (2016-05-24 12:35:51 UTC) #4
Vyacheslav Egorov (Google)
4 years, 7 months ago (2016-05-24 12:52:09 UTC) #7
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
65f2e015ca6da96589ef97441efa14ff6ff163a5 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698