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

Unified Diff: runtime/vm/object.cc

Issue 2054833002: Fix library private key stability during reload (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/isolate_reload.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 5003e7e1123010340703167e50e3252ce2356933..9b59bcb80b9f43accbde84511898107e10f4da56 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -10551,6 +10551,18 @@ void Library::AllocatePrivateKey() const {
Zone* zone = thread->zone();
Isolate* isolate = thread->isolate();
+ if (isolate->IsReloading()) {
+ // When reloading, we need to make sure we use the original private key
+ // if this library previously existed.
+ IsolateReloadContext* reload_context = isolate->reload_context();
+ const String& original_key =
+ String::Handle(reload_context->FindLibraryPrivateKey(*this));
+ if (!original_key.IsNull()) {
+ StorePointer(&raw_ptr()->private_key_, original_key.raw());
siva 2016/06/13 19:49:56 How do you ensure that there is no collision betwe
Cutch 2016/06/13 19:55:38 Presently we don't. I wonder if we should go back
+ return;
+ }
+ }
+
// Format of the private key is: "@<sequence number><6 digits of hash>
const intptr_t hash_mask = 0x7FFFF;
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698