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

Unified Diff: runtime/vm/parser.cc

Issue 2006793002: VM: Fix race between background compiler and guarded cid update. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rework how we invalidate background compiled code Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/weak_code.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 7819cd780ac26f66bf7a1621d56cd8d5c8611bac..bd63ed5ea9ff023a5c58fb771a5fa148ea980a6a 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -161,12 +161,29 @@ void ParsedFunction::AddToGuardedFields(const Field* field) const {
(field->guarded_cid() == kIllegalCid)) {
return;
}
+
for (intptr_t j = 0; j < guarded_fields_->length(); j++) {
- if ((*guarded_fields_)[j]->raw() == field->raw()) {
+ const Field* other = (*guarded_fields_)[j];
+ if (field->Original() == other->Original()) {
+ // Abort background compilation early if the guarded state of this field
+ // has changed during compilation. We will not be able to commit
+ // the resulting code anyway.
+ if (Compiler::IsBackgroundCompilation()) {
+ if (!other->IsConsistentWith(*field)) {
+ Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId,
+ "Field's guarded state changed during compilation");
+ }
+ }
return;
}
}
- guarded_fields_->Add(&Field::ZoneHandle(Z, field->Original()));
+
+ // Note: the list of guarded fields must contain copies during background
+ // compilation because we will look at their guarded_cid when copying
+ // the array of guarded fields from callee into the caller during
+ // inlining.
+ ASSERT(!field->IsOriginal() || Thread::Current()->IsMutatorThread());
+ guarded_fields_->Add(&Field::ZoneHandle(Z, field->raw()));
}
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/weak_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698