diff options
author | 2017-01-23 15:08:01 +0000 | |
---|---|---|
committer | 2017-01-23 15:08:02 +0000 | |
commit | b0dde4397fa5b0756312b46bd18477a2c1f6a7da (patch) | |
tree | 6a76cc50a8b2746aefaaefe5c8e1c6eee3d3d7a8 /compiler | |
parent | 17aba3529161ddd6f351608da383fdedb985ba44 (diff) | |
parent | 6ad2f6d0e17b8cd1fd20aeb1958196e856475e80 (diff) |
Merge "Fix inserting classes to initiating loader's class table."
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/image_writer.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc index 4109345f80..459aca3b38 100644 --- a/compiler/image_writer.cc +++ b/compiler/image_writer.cc @@ -1166,9 +1166,9 @@ mirror::Object* ImageWriter::TryAssignBinSlot(WorkStack& work_stack, // belongs. oat_index = GetOatIndexForDexCache(dex_cache); ImageInfo& image_info = GetImageInfo(oat_index); - { - // Note: This table is only accessed from the image writer, avoid locking to prevent lock - // order violations from root visiting. + if (!compile_app_image_) { + // Note: Avoid locking to prevent lock order violations from root visiting; + // image_info.class_table_ is only accessed from the image writer. image_info.class_table_->InsertWithoutLocks(as_klass); } for (LengthPrefixedArray<ArtField>* cur_fields : fields) { @@ -1265,7 +1265,14 @@ mirror::Object* ImageWriter::TryAssignBinSlot(WorkStack& work_stack, // class loader. mirror::ClassLoader* class_loader = obj->AsClassLoader(); if (class_loader->GetClassTable() != nullptr) { + DCHECK(compile_app_image_); + DCHECK(class_loaders_.empty()); class_loaders_.insert(class_loader); + ImageInfo& image_info = GetImageInfo(oat_index); + // Note: Avoid locking to prevent lock order violations from root visiting; + // image_info.class_table_ table is only accessed from the image writer + // and class_loader->GetClassTable() is iterated but not modified. + image_info.class_table_->CopyWithoutLocks(*class_loader->GetClassTable()); } } AssignImageBinSlot(obj, oat_index); |