Skip to content

Commit f5d6144

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[vm] Protect the library map with the program lock.
TEST=tsan Bug: #59626 Change-Id: I5cd12be5a54a519494ce168eaf1c10a45af71930 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/399626 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 810b842 commit f5d6144

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

runtime/vm/object.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15144,6 +15144,7 @@ LibraryPtr Library::LookupLibrary(Thread* thread, const String& url) {
1514415144

1514515145
// Use the libraries map to lookup the library by URL.
1514615146
Library& lib = Library::Handle(zone);
15147+
SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
1514715148
if (object_store->libraries_map() == Array::null()) {
1514815149
return Library::null();
1514915150
} else {
@@ -15276,6 +15277,7 @@ void Library::Register(Thread* thread) const {
1527615277
const String& lib_url = String::Handle(zone, url());
1527715278
ASSERT(Library::LookupLibrary(thread, lib_url) == Library::null());
1527815279
ASSERT(lib_url.HasHash());
15280+
SafepointWriteRwLocker ml(thread, isolate_group->program_lock());
1527915281
GrowableObjectArray& libs =
1528015282
GrowableObjectArray::Handle(zone, object_store->libraries());
1528115283
ASSERT(!libs.IsNull());

0 commit comments

Comments
 (0)