summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2018-12-13 23:30:25 +0000
committerAndreas Gampe <agampe@google.com>2018-12-13 23:30:25 +0000
commitfb83d76a8b186df05f874216b535f5ad57e7bd02 (patch)
treef3db51fcd564929652433e7182eda9ebc7a9bc29
parent4433c4351aab98005e12a6b53905678758b74665 (diff)
downloadart-fb83d76a8b186df05f874216b535f5ad57e7bd02.tar.gz
art-fb83d76a8b186df05f874216b535f5ad57e7bd02.tar.bz2
art-fb83d76a8b186df05f874216b535f5ad57e7bd02.zip
Revert "Allow boot image for a part of the boot classpath."
This reverts commit 4433c4351aab98005e12a6b53905678758b74665. Reason for revert: May be breaking tests. Change-Id: I3b690dbb06278dc1adce5a389fff938a692bdebd
-rw-r--r--build/Android.common_path.mk18
-rw-r--r--build/Android.oat.mk18
-rw-r--r--dex2oat/dex2oat.cc19
-rw-r--r--dex2oat/linker/image_test.h3
-rw-r--r--dex2oat/linker/image_writer.cc44
-rw-r--r--dex2oat/linker/image_writer.h7
-rw-r--r--dex2oat/linker/oat_writer.cc4
-rw-r--r--dex2oat/linker/oat_writer.h2
-rw-r--r--dex2oat/linker/oat_writer_test.cc8
-rw-r--r--libartbase/base/common_art_test.cc7
-rw-r--r--oatdump/oatdump.cc3
-rw-r--r--runtime/class_linker.cc20
-rw-r--r--runtime/class_linker.h6
-rw-r--r--runtime/dexopt_test.cc16
-rw-r--r--runtime/gc/space/image_space.cc120
-rw-r--r--runtime/gc/space/image_space.h20
-rw-r--r--runtime/oat.cc13
-rw-r--r--runtime/oat.h10
-rw-r--r--runtime/oat_file_assistant.cc18
-rw-r--r--runtime/oat_file_assistant.h4
-rw-r--r--runtime/runtime.cc23
-rwxr-xr-xtest/etc/run-test-jar5
-rwxr-xr-xtools/bootjars.sh6
-rwxr-xr-xtools/run-jdwp-tests.sh5
-rwxr-xr-xtools/run-libcore-tests.sh5
25 files changed, 103 insertions, 301 deletions
diff --git a/build/Android.common_path.mk b/build/Android.common_path.mk
index 1880726f13..03e68ae93c 100644
--- a/build/Android.common_path.mk
+++ b/build/Android.common_path.mk
@@ -73,21 +73,8 @@ TARGET_CORE_IMG_OUTS :=
HOST_CORE_IMG_LOCATION := $(HOST_OUT_JAVA_LIBRARIES)/core.art
TARGET_CORE_IMG_LOCATION := $(ART_TARGET_TEST_OUT)/core.art
-# Modules to compile for core.art.
-CORE_IMG_JARS := core-oj core-libart core-simple okhttp bouncycastle
-HOST_CORE_IMG_JARS := $(addsuffix -hostdex,$(CORE_IMG_JARS))
-TARGET_CORE_IMG_JARS := $(addsuffix -testdex,$(CORE_IMG_JARS))
-HOST_CORE_IMG_DEX_LOCATIONS := $(foreach jar,$(HOST_CORE_IMG_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
-ifeq ($(ART_TEST_ANDROID_ROOT),)
-TARGET_CORE_IMG_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_IMG_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
-else
-TARGET_CORE_IMG_DEX_LOCATIONS := $(foreach jar,$(TARGET_CORE_IMG_JARS),$(ART_TEST_ANDROID_ROOT)/$(jar).jar)
-endif
-HOST_CORE_IMG_DEX_FILES := $(foreach jar,$(HOST_CORE_IMG_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar)
-TARGET_CORE_IMG_DEX_FILES := $(foreach jar,$(TARGET_CORE_IMG_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar)
-
-# Jar files for the boot class path for testing. Must start with CORE_IMG_JARS.
-TEST_CORE_JARS := $(CORE_IMG_JARS) conscrypt
+# Jar files for core.art.
+TEST_CORE_JARS := core-oj core-libart core-simple conscrypt okhttp bouncycastle
HOST_TEST_CORE_JARS := $(addsuffix -hostdex,$(TEST_CORE_JARS))
TARGET_TEST_CORE_JARS := $(addsuffix -testdex,$(TEST_CORE_JARS))
HOST_CORE_DEX_LOCATIONS := $(foreach jar,$(HOST_TEST_CORE_JARS), $(HOST_OUT_JAVA_LIBRARIES)/$(jar).jar)
@@ -96,6 +83,7 @@ TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_TEST_CORE_JARS),/$(DEXPREOPT
else
TARGET_CORE_DEX_LOCATIONS := $(foreach jar,$(TARGET_TEST_CORE_JARS),$(ART_TEST_ANDROID_ROOT)/framework/$(jar).jar)
endif
+
HOST_CORE_DEX_FILES := $(foreach jar,$(HOST_TEST_CORE_JARS), $(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),t,COMMON)/javalib.jar)
TARGET_CORE_DEX_FILES := $(foreach jar,$(TARGET_TEST_CORE_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar), ,COMMON)/javalib.jar)
diff --git a/build/Android.oat.mk b/build/Android.oat.mk
index 2ad11432d7..e2adac1660 100644
--- a/build/Android.oat.mk
+++ b/build/Android.oat.mk
@@ -39,6 +39,8 @@ endif
# Use dex2oat debug version for better error reporting
# $(1): compiler - optimizing, interpreter or interp-ac (interpreter-access-checks).
# $(2): 2ND_ or undefined, 2ND_ for 32-bit host builds.
+# NB depending on HOST_CORE_DEX_LOCATIONS so we are sure to have the dex files in frameworks for
+# run-test --no-image
define create-core-oat-host-rules
core_compile_options :=
core_image_name :=
@@ -78,15 +80,13 @@ define create-core-oat-host-rules
$$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options)
$$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name)
$$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name)
-$$(core_image_name): $$(HOST_CORE_IMG_DEX_LOCATIONS) $$(core_dex2oat_dependency)
+$$(core_image_name): $$(HOST_CORE_DEX_LOCATIONS) $$(core_dex2oat_dependency)
@echo "host dex2oat: $$@"
@mkdir -p $$(dir $$@)
$$(hide) ANDROID_LOG_TAGS="*:e" $$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
- --image-classes=$$(PRELOADED_CLASSES) \
- $$(addprefix --dex-file=,$$(HOST_CORE_IMG_DEX_FILES)) \
- $$(addprefix --dex-location=,$$(HOST_CORE_IMG_DEX_LOCATIONS)) \
- --oat-file=$$(PRIVATE_CORE_OAT_NAME) \
+ --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(HOST_CORE_DEX_FILES)) \
+ $$(addprefix --dex-location=,$$(HOST_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \
--oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \
--base=$$(LIBART_IMG_HOST_BASE_ADDRESS) --instruction-set=$$($(2)ART_HOST_ARCH) \
$$(LOCAL_$(2)DEX2OAT_HOST_INSTRUCTION_SET_FEATURES_OPTION) \
@@ -169,15 +169,13 @@ define create-core-oat-target-rules
$$(core_image_name): PRIVATE_CORE_COMPILE_OPTIONS := $$(core_compile_options)
$$(core_image_name): PRIVATE_CORE_IMG_NAME := $$(core_image_name)
$$(core_image_name): PRIVATE_CORE_OAT_NAME := $$(core_oat_name)
-$$(core_image_name): $$(TARGET_CORE_IMG_DEX_FILES) $$(core_dex2oat_dependency)
+$$(core_image_name): $$(TARGET_CORE_DEX_FILES) $$(core_dex2oat_dependency)
@echo "target dex2oat: $$@"
@mkdir -p $$(dir $$@)
$$(hide) $$(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
- --image-classes=$$(PRELOADED_CLASSES) \
- $$(addprefix --dex-file=,$$(TARGET_CORE_IMG_DEX_FILES)) \
- $$(addprefix --dex-location=,$$(TARGET_CORE_IMG_DEX_LOCATIONS)) \
- --oat-file=$$(PRIVATE_CORE_OAT_NAME) \
+ --image-classes=$$(PRELOADED_CLASSES) $$(addprefix --dex-file=,$$(TARGET_CORE_DEX_FILES)) \
+ $$(addprefix --dex-location=,$$(TARGET_CORE_DEX_LOCATIONS)) --oat-file=$$(PRIVATE_CORE_OAT_NAME) \
--oat-location=$$(PRIVATE_CORE_OAT_NAME) --image=$$(PRIVATE_CORE_IMG_NAME) \
--base=$$(LIBART_IMG_TARGET_BASE_ADDRESS) --instruction-set=$$($(2)TARGET_ARCH) \
--instruction-set-variant=$$($(2)DEX2OAT_TARGET_CPU_VARIANT) \
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 872fab3768..a5bba9bb97 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -624,6 +624,7 @@ class Dex2Oat final {
explicit Dex2Oat(TimingLogger* timings) :
compiler_kind_(Compiler::kOptimizing),
// Take the default set of instruction features from the build.
+ boot_image_checksum_(0),
key_value_store_(nullptr),
verification_results_(nullptr),
runtime_(nullptr),
@@ -1436,22 +1437,17 @@ class Dex2Oat final {
if (!IsBootImage()) {
// When compiling an app, create the runtime early to retrieve
- // the boot image checksums needed for the oat header.
+ // the image location key needed for the oat header.
if (!CreateRuntime(std::move(runtime_options))) {
return dex2oat::ReturnCode::kCreateRuntime;
}
if (CompilerFilter::DependsOnImageChecksum(compiler_options_->GetCompilerFilter())) {
TimingLogger::ScopedTiming t3("Loading image checksum", timings_);
- Runtime* runtime = Runtime::Current();
- key_value_store_->Put(OatHeader::kBootClassPathKey,
- android::base::Join(runtime->GetBootClassPathLocations(), ':'));
- std::vector<ImageSpace*> image_spaces = runtime->GetHeap()->GetBootImageSpaces();
- const std::vector<const DexFile*>& bcp_dex_files =
- runtime->GetClassLinker()->GetBootClassPath();
- key_value_store_->Put(
- OatHeader::kBootClassPathChecksumsKey,
- gc::space::ImageSpace::GetBootClassPathChecksums(image_spaces, bcp_dex_files));
+ std::vector<ImageSpace*> image_spaces = Runtime::Current()->GetHeap()->GetBootImageSpaces();
+ boot_image_checksum_ = image_spaces[0]->GetImageHeader().GetImageChecksum();
+ } else {
+ boot_image_checksum_ = 0u;
}
// Open dex files for class path.
@@ -2019,7 +2015,7 @@ class Dex2Oat final {
elf_writer->EndDataBimgRelRo(data_bimg_rel_ro);
}
- if (!oat_writer->WriteHeader(elf_writer->GetStream())) {
+ if (!oat_writer->WriteHeader(elf_writer->GetStream(), boot_image_checksum_)) {
LOG(ERROR) << "Failed to write oat header to the ELF file " << oat_file->GetPath();
return false;
}
@@ -2650,6 +2646,7 @@ class Dex2Oat final {
std::unique_ptr<CompilerOptions> compiler_options_;
Compiler::Kind compiler_kind_;
+ uint32_t boot_image_checksum_;
std::unique_ptr<SafeMap<std::string, std::string> > key_value_store_;
std::unique_ptr<VerificationResults> verification_results_;
diff --git a/dex2oat/linker/image_test.h b/dex2oat/linker/image_test.h
index fa0a3d4ac9..bd8cf5ad56 100644
--- a/dex2oat/linker/image_test.h
+++ b/dex2oat/linker/image_test.h
@@ -326,7 +326,8 @@ inline void ImageTest::DoCompile(ImageHeader::StorageMode storage_mode,
elf_writer->EndDataBimgRelRo(data_bimg_rel_ro);
}
- bool header_ok = oat_writer->WriteHeader(elf_writer->GetStream());
+ bool header_ok = oat_writer->WriteHeader(elf_writer->GetStream(),
+ /*boot_image_checksum=*/ 0u);
ASSERT_TRUE(header_ok);
writer->UpdateOatFileHeader(i, oat_writer->GetOatHeader());
diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc
index e4e4b13458..61d105f5cd 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -32,7 +32,6 @@
#include "base/enums.h"
#include "base/globals.h"
#include "base/logging.h" // For VLOG.
-#include "base/stl_util.h"
#include "base/unix_file/fd_file.h"
#include "class_linker-inl.h"
#include "class_root.h"
@@ -154,26 +153,6 @@ ObjPtr<mirror::ClassLoader> ImageWriter::GetAppClassLoader() const
: nullptr;
}
-bool ImageWriter::IsImageObject(ObjPtr<mirror::Object> obj) const {
- // For boot image, we keep all objects remaining after the GC in PrepareImageAddressSpace().
- if (compiler_options_.IsBootImage()) {
- return true;
- }
- // Objects already in the boot image do not belong to the image being written.
- if (IsInBootImage(obj.Ptr())) {
- return false;
- }
- // DexCaches for the boot class path components that are not a part of the boot image
- // cannot be garbage collected in PrepareImageAddressSpace() but we do not want to
- // include them in the app image. So make sure we include only the app DexCaches.
- if (obj->IsDexCache() &&
- !ContainsElement(compiler_options_.GetDexFilesForOatFile(),
- obj->AsDexCache()->GetDexFile())) {
- return false;
- }
- return true;
-}
-
// Return true if an object is already in an image space.
bool ImageWriter::IsInBootImage(const void* obj) const {
gc::Heap* const heap = Runtime::Current()->GetHeap();
@@ -458,7 +437,7 @@ std::vector<ImageWriter::HeapReferencePointerInfo> ImageWriter::CollectStringRef
*/
heap->VisitObjects([this, &visitor](ObjPtr<mirror::Object> object)
REQUIRES_SHARED(Locks::mutator_lock_) {
- if (IsImageObject(object)) {
+ if (!IsInBootImage(object.Ptr())) {
visitor.SetObject(object);
if (object->IsDexCache()) {
@@ -701,7 +680,7 @@ bool ImageWriter::Write(int image_fd,
ObjPtr<mirror::ClassLoader> class_loader = GetAppClassLoader();
std::vector<ObjPtr<mirror::DexCache>> dex_caches = FindDexCaches(self);
for (ObjPtr<mirror::DexCache> dex_cache : dex_caches) {
- if (!IsImageObject(dex_cache)) {
+ if (IsInBootImage(dex_cache.Ptr())) {
continue; // Boot image DexCache is not written to the app image.
}
PreloadDexCache(dex_cache, class_loader);
@@ -1010,7 +989,7 @@ void ImageWriter::PrepareDexCacheArraySlots() {
for (const ClassLinker::DexCacheData& data : class_linker->GetDexCachesData()) {
ObjPtr<mirror::DexCache> dex_cache =
ObjPtr<mirror::DexCache>::DownCast(self->DecodeJObject(data.weak_root));
- if (dex_cache == nullptr || !IsImageObject(dex_cache)) {
+ if (dex_cache == nullptr || IsInBootImage(dex_cache.Ptr())) {
continue;
}
const DexFile* dex_file = dex_cache->GetDexFile();
@@ -1779,8 +1758,7 @@ void ImageWriter::PruneNonImageClasses() {
for (ObjPtr<mirror::DexCache> dex_cache : dex_caches) {
// Pass the class loader associated with the DexCache. This can either be
// the app's `class_loader` or `nullptr` if boot class loader.
- bool is_app_image_dex_cache = compiler_options_.IsAppImage() && IsImageObject(dex_cache);
- PruneDexCache(dex_cache, is_app_image_dex_cache ? GetAppClassLoader() : nullptr);
+ PruneDexCache(dex_cache, IsInBootImage(dex_cache.Ptr()) ? nullptr : GetAppClassLoader());
}
// Drop the array class cache in the ClassLinker, as these are roots holding those classes live.
@@ -1878,7 +1856,7 @@ ObjPtr<mirror::ObjectArray<mirror::Object>> ImageWriter::CollectDexCaches(Thread
continue;
}
const DexFile* dex_file = dex_cache->GetDexFile();
- if (IsImageObject(dex_cache)) {
+ if (!IsInBootImage(dex_cache.Ptr())) {
dex_cache_count += image_dex_files.find(dex_file) != image_dex_files.end() ? 1u : 0u;
}
}
@@ -1897,7 +1875,7 @@ ObjPtr<mirror::ObjectArray<mirror::Object>> ImageWriter::CollectDexCaches(Thread
continue;
}
const DexFile* dex_file = dex_cache->GetDexFile();
- if (IsImageObject(dex_cache)) {
+ if (!IsInBootImage(dex_cache.Ptr())) {
non_image_dex_caches += image_dex_files.find(dex_file) != image_dex_files.end() ? 1u : 0u;
}
}
@@ -1911,7 +1889,7 @@ ObjPtr<mirror::ObjectArray<mirror::Object>> ImageWriter::CollectDexCaches(Thread
continue;
}
const DexFile* dex_file = dex_cache->GetDexFile();
- if (IsImageObject(dex_cache) &&
+ if (!IsInBootImage(dex_cache.Ptr()) &&
image_dex_files.find(dex_file) != image_dex_files.end()) {
dex_caches->Set<false>(i, dex_cache.Ptr());
++i;
@@ -1964,7 +1942,7 @@ ObjPtr<ObjectArray<Object>> ImageWriter::CreateImageRoots(
mirror::Object* ImageWriter::TryAssignBinSlot(WorkStack& work_stack,
mirror::Object* obj,
size_t oat_index) {
- if (obj == nullptr || !IsImageObject(obj)) {
+ if (obj == nullptr || IsInBootImage(obj)) {
// Object is null or already in the image, there is no work to do.
return obj;
}
@@ -2395,7 +2373,7 @@ void ImageWriter::CalculateNewObjectOffsets() {
{
auto ensure_bin_slots_assigned = [&](mirror::Object* obj)
REQUIRES_SHARED(Locks::mutator_lock_) {
- if (IsImageObject(obj)) {
+ if (!Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(obj)) {
CHECK(IsImageBinSlotAssigned(obj)) << mirror::Object::PrettyTypeOf(obj) << " " << obj;
}
};
@@ -2466,7 +2444,7 @@ void ImageWriter::CalculateNewObjectOffsets() {
{
auto unbin_objects_into_offset = [&](mirror::Object* obj)
REQUIRES_SHARED(Locks::mutator_lock_) {
- if (IsImageObject(obj)) {
+ if (!IsInBootImage(obj)) {
UnbinObjectsIntoOffset(obj);
}
};
@@ -2931,7 +2909,7 @@ void ImageWriter::FixupPointerArray(mirror::Object* dst,
}
void ImageWriter::CopyAndFixupObject(Object* obj) {
- if (!IsImageObject(obj)) {
+ if (IsInBootImage(obj)) {
return;
}
size_t offset = GetImageOffset(obj);
diff --git a/dex2oat/linker/image_writer.h b/dex2oat/linker/image_writer.h
index b680265ff1..33bacf8c1b 100644
--- a/dex2oat/linker/image_writer.h
+++ b/dex2oat/linker/image_writer.h
@@ -674,12 +674,7 @@ class ImageWriter final {
template <typename T>
T* NativeCopyLocation(T* obj) REQUIRES_SHARED(Locks::mutator_lock_);
- // Return true if `obj` belongs to the image we're writing.
- // For a boot image, this is true for all objects.
- // For an app image, boot image objects and boot class path dex caches are excluded.
- bool IsImageObject(ObjPtr<mirror::Object> obj) const REQUIRES_SHARED(Locks::mutator_lock_);
-
- // Return true if `obj` is inside of the boot image space. This may only return true if we are
+ // Return true of obj is inside of the boot image space. This may only return true if we are
// compiling an app image.
bool IsInBootImage(const void* obj) const;
diff --git a/dex2oat/linker/oat_writer.cc b/dex2oat/linker/oat_writer.cc
index e2a9ac2a8f..d045698d07 100644
--- a/dex2oat/linker/oat_writer.cc
+++ b/dex2oat/linker/oat_writer.cc
@@ -2808,9 +2808,11 @@ bool OatWriter::CheckOatSize(OutputStream* out, size_t file_offset, size_t relat
return true;
}
-bool OatWriter::WriteHeader(OutputStream* out) {
+bool OatWriter::WriteHeader(OutputStream* out, uint32_t boot_image_checksum) {
CHECK(write_state_ == WriteState::kWriteHeader);
+ oat_header_->SetBootImageChecksum(boot_image_checksum);
+
// Update checksum with header data.
DCHECK_EQ(oat_header_->GetChecksum(), 0u); // For checksum calculation.
const uint8_t* header_begin = reinterpret_cast<const uint8_t*>(oat_header_.get());
diff --git a/dex2oat/linker/oat_writer.h b/dex2oat/linker/oat_writer.h
index cc0e83a0e5..9cd2fd04ea 100644
--- a/dex2oat/linker/oat_writer.h
+++ b/dex2oat/linker/oat_writer.h
@@ -198,7 +198,7 @@ class OatWriter {
// Check the size of the written oat file.
bool CheckOatSize(OutputStream* out, size_t file_offset, size_t relative_offset);
// Write the oat header. This finalizes the oat file.
- bool WriteHeader(OutputStream* out);
+ bool WriteHeader(OutputStream* out, uint32_t boot_image_checksum);
// Returns whether the oat file has an associated image.
bool HasImage() const {
diff --git a/dex2oat/linker/oat_writer_test.cc b/dex2oat/linker/oat_writer_test.cc
index ecf9db8867..5de1540839 100644
--- a/dex2oat/linker/oat_writer_test.cc
+++ b/dex2oat/linker/oat_writer_test.cc
@@ -240,7 +240,7 @@ class OatTest : public CommonCompilerTest {
elf_writer->EndDataBimgRelRo(data_bimg_rel_ro);
}
- if (!oat_writer.WriteHeader(elf_writer->GetStream())) {
+ if (!oat_writer.WriteHeader(elf_writer->GetStream(), /*boot_image_checksum=*/ 42u)) {
return false;
}
@@ -396,7 +396,6 @@ TEST_F(OatTest, WriteRead) {
ScratchFile tmp_base, tmp_oat(tmp_base, ".oat"), tmp_vdex(tmp_base, ".vdex");
SafeMap<std::string, std::string> key_value_store;
- key_value_store.Put(OatHeader::kBootClassPathChecksumsKey, "testkey");
bool success = WriteElf(tmp_vdex.GetFile(),
tmp_oat.GetFile(),
class_linker->GetBootClassPath(),
@@ -419,8 +418,7 @@ TEST_F(OatTest, WriteRead) {
const OatHeader& oat_header = oat_file->GetOatHeader();
ASSERT_TRUE(oat_header.IsValid());
ASSERT_EQ(class_linker->GetBootClassPath().size(), oat_header.GetDexFileCount()); // core
- ASSERT_TRUE(oat_header.GetStoreValueByKey(OatHeader::kBootClassPathChecksumsKey) != nullptr);
- ASSERT_STREQ("testkey", oat_header.GetStoreValueByKey(OatHeader::kBootClassPathChecksumsKey));
+ ASSERT_EQ(42u, oat_header.GetBootImageChecksum());
ASSERT_TRUE(java_lang_dex_file_ != nullptr);
const DexFile& dex_file = *java_lang_dex_file_;
@@ -466,7 +464,7 @@ TEST_F(OatTest, WriteRead) {
TEST_F(OatTest, OatHeaderSizeCheck) {
// If this test is failing and you have to update these constants,
// it is time to update OatHeader::kOatVersion
- EXPECT_EQ(64U, sizeof(OatHeader));
+ EXPECT_EQ(68U, sizeof(OatHeader));
EXPECT_EQ(4U, sizeof(OatMethodOffsets));
EXPECT_EQ(8U, sizeof(OatQuickMethodHeader));
EXPECT_EQ(166 * static_cast<size_t>(GetInstructionSetPointerSize(kRuntimeISA)),
diff --git a/libartbase/base/common_art_test.cc b/libartbase/base/common_art_test.cc
index 4e38490dc6..278203da23 100644
--- a/libartbase/base/common_art_test.cc
+++ b/libartbase/base/common_art_test.cc
@@ -329,18 +329,15 @@ static std::string GetDexFileName(const std::string& jar_prefix, bool host) {
}
std::vector<std::string> CommonArtTestImpl::GetLibCoreDexFileNames() {
- // Note: This must start with the CORE_IMG_JARS in Android.common_path.mk
+ // Note: This must match the TEST_CORE_JARS in Android.common_path.mk
// because that's what we use for compiling the core.art image.
- // It may contain additional modules from TEST_CORE_JARS.
static const char* const kLibcoreModules[] = {
- // CORE_IMG_JARS modules.
"core-oj",
"core-libart",
"core-simple",
+ "conscrypt",
"okhttp",
"bouncycastle",
- // Additional modules.
- "conscrypt",
};
std::vector<std::string> result;
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index d2a5bb87f8..1c74a923e6 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -473,6 +473,9 @@ class OatDumper {
GetQuickToInterpreterBridgeOffset);
#undef DUMP_OAT_HEADER_OFFSET
+ os << "BOOT IMAGE CHECKSUM:\n";
+ os << StringPrintf("0x%08x\n\n", oat_header.GetBootImageChecksum());
+
// Print the key-value store.
{
os << "KEY VALUE STORE:\n";
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 7f6e15eb3e..e31fe6315b 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1037,15 +1037,20 @@ bool ClassLinker::InitFromBootImage(std::string* error_msg) {
runtime->SetSentinel(heap->AllocNonMovableObject<true>(
self, java_lang_Object, java_lang_Object->GetObjectSize(), VoidFunctor()));
- const std::vector<std::string>& boot_class_path_locations = runtime->GetBootClassPathLocations();
- CHECK_LE(spaces.size(), boot_class_path_locations.size());
+ const std::vector<std::string>& boot_class_path = runtime->GetBootClassPath();
+ if (boot_class_path.size() != spaces.size()) {
+ *error_msg = StringPrintf("Boot class path has %zu components but there are %zu image spaces.",
+ boot_class_path.size(),
+ spaces.size());
+ return false;
+ }
for (size_t i = 0u, size = spaces.size(); i != size; ++i) {
// Boot class loader, use a null handle.
std::vector<std::unique_ptr<const DexFile>> dex_files;
if (!AddImageSpace(spaces[i],
ScopedNullHandle<mirror::ClassLoader>(),
/*dex_elements=*/ nullptr,
- /*dex_location=*/ boot_class_path_locations[i].c_str(),
+ /*dex_location=*/ boot_class_path[i].c_str(),
/*out*/&dex_files,
error_msg)) {
return false;
@@ -1064,15 +1069,6 @@ bool ClassLinker::InitFromBootImage(std::string* error_msg) {
return true;
}
-void ClassLinker::AddExtraBootDexFiles(
- Thread* self,
- std::vector<std::unique_ptr<const DexFile>>&& additional_dex_files) {
- for (std::unique_ptr<const DexFile>& dex_file : additional_dex_files) {
- AppendToBootClassPath(self, *dex_file);
- boot_dex_files_.push_back(std::move(dex_file));
- }
-}
-
bool ClassLinker::IsBootClassLoader(ScopedObjectAccessAlreadyRunnable& soa,
ObjPtr<mirror::ClassLoader> class_loader) {
return class_loader == nullptr ||
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index d0a7c9b846..d3eab7cb1d 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -127,12 +127,6 @@ class ClassLinker {
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::dex_lock_);
- // Add boot class path dex files that were not included in the boot image.
- // ClassLinker takes ownership of these dex files.
- void AddExtraBootDexFiles(Thread* self,
- std::vector<std::unique_ptr<const DexFile>>&& additional_dex_files)
- REQUIRES_SHARED(Locks::mutator_lock_);
-
// Add an image space to the class linker, may fix up classloader fields and dex cache fields.
// The dex files that were newly opened for the space are placed in the out argument
// out_dex_files. Returns true if the operation succeeded.
diff --git a/runtime/dexopt_test.cc b/runtime/dexopt_test.cc
index 7f697d1eb8..b46c93383e 100644
--- a/runtime/dexopt_test.cc
+++ b/runtime/dexopt_test.cc
@@ -116,19 +116,19 @@ void DexoptTest::GenerateOatForTest(const std::string& dex_location,
ASSERT_TRUE(odex_file.get() != nullptr) << error_msg;
EXPECT_EQ(filter, odex_file->GetCompilerFilter());
- std::string boot_image_checksums = gc::space::ImageSpace::GetBootClassPathChecksums(
- Runtime::Current()->GetBootClassPath(), image_location, kRuntimeISA, &error_msg);
- ASSERT_FALSE(boot_image_checksums.empty()) << error_msg;
-
+ std::unique_ptr<ImageHeader> image_header(
+ gc::space::ImageSpace::ReadImageHeader(image_location.c_str(),
+ kRuntimeISA,
+ &error_msg));
+ ASSERT_TRUE(image_header != nullptr) << error_msg;
const OatHeader& oat_header = odex_file->GetOatHeader();
+ uint32_t boot_image_checksum = image_header->GetImageChecksum();
if (CompilerFilter::DependsOnImageChecksum(filter)) {
- const char* checksums = oat_header.GetStoreValueByKey(OatHeader::kBootClassPathChecksumsKey);
- ASSERT_TRUE(checksums != nullptr);
if (with_alternate_image) {
- EXPECT_NE(boot_image_checksums, checksums);
+ EXPECT_NE(boot_image_checksum, oat_header.GetBootImageChecksum());
} else {
- EXPECT_EQ(boot_image_checksums, checksums);
+ EXPECT_EQ(boot_image_checksum, oat_header.GetBootImageChecksum());
}
}
}
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 6af42b9921..4c2074dee2 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -28,7 +28,6 @@
#include "art_field-inl.h"
#include "art_method-inl.h"
-#include "base/array_ref.h"
#include "base/bit_memory_region.h"
#include "base/callee_save_type.h"
#include "base/enums.h"
@@ -60,7 +59,6 @@ namespace art {
namespace gc {
namespace space {
-using android::base::StringAppendF;
using android::base::StringPrintf;
Atomic<uint32_t> ImageSpace::bitmap_index_(0);
@@ -1656,10 +1654,8 @@ class ImageSpace::BootImageLoader {
*error_msg = StringPrintf("Cannot read header of %s", filename.c_str());
return false;
}
- if (system_hdr.GetComponentCount() == 0u ||
- system_hdr.GetComponentCount() > boot_class_path_.size()) {
- *error_msg = StringPrintf("Unexpected component count in %s, received %u, "
- "expected non-zero and <= %zu",
+ if (system_hdr.GetComponentCount() != boot_class_path_.size()) {
+ *error_msg = StringPrintf("Unexpected component count in %s, received %u, expected %zu",
filename.c_str(),
system_hdr.GetComponentCount(),
boot_class_path_.size());
@@ -1676,12 +1672,10 @@ class ImageSpace::BootImageLoader {
return false;
}
- ArrayRef<const std::string> provided_locations(boot_class_path_locations_.data(),
- system_hdr.GetComponentCount());
std::vector<std::string> locations =
- ExpandMultiImageLocations(provided_locations, image_location_);
+ ExpandMultiImageLocations(boot_class_path_locations_, image_location_);
std::vector<std::string> filenames =
- ExpandMultiImageLocations(provided_locations, filename);
+ ExpandMultiImageLocations(boot_class_path_locations_, filename);
DCHECK_EQ(locations.size(), filenames.size());
std::vector<std::unique_ptr<ImageSpace>> spaces;
spaces.reserve(locations.size());
@@ -1700,7 +1694,7 @@ class ImageSpace::BootImageLoader {
}
for (size_t i = 0u, size = spaces.size(); i != size; ++i) {
std::string expected_boot_class_path =
- (i == 0u) ? android::base::Join(provided_locations, ':') : std::string();
+ (i == 0u) ? android::base::Join(boot_class_path_locations_, ':') : std::string();
if (!OpenOatFile(spaces[i].get(),
boot_class_path_[i],
expected_boot_class_path,
@@ -2450,113 +2444,9 @@ bool ImageSpace::ValidateOatFile(const OatFile& oat_file, std::string* error_msg
return true;
}
-std::string ImageSpace::GetBootClassPathChecksums(const std::vector<std::string>& boot_class_path,
- const std::string& image_location,
- InstructionSet image_isa,
- /*out*/std::string* error_msg) {
- std::string system_filename;
- bool has_system = false;
- std::string cache_filename;
- bool has_cache = false;
- bool dalvik_cache_exists = false;
- bool is_global_cache = false;
- if (!FindImageFilename(image_location.c_str(),
- image_isa,
- &system_filename,
- &has_system,
- &cache_filename,
- &dalvik_cache_exists,
- &has_cache,
- &is_global_cache)) {
- *error_msg = StringPrintf("Unable to find image file for %s and %s",
- image_location.c_str(),
- GetInstructionSetString(image_isa));
- return std::string();
- }
-
- DCHECK(has_system || has_cache);
- const std::string& filename = has_system ? system_filename : cache_filename;
- std::unique_ptr<ImageHeader> header = ReadSpecificImageHeader(filename.c_str(), error_msg);
- if (header == nullptr) {
- return std::string();
- }
- if (header->GetComponentCount() == 0u || header->GetComponentCount() > boot_class_path.size()) {
- *error_msg = StringPrintf("Unexpected component count in %s, received %u, "
- "expected non-zero and <= %zu",
- filename.c_str(),
- header->GetComponentCount(),
- boot_class_path.size());
- return std::string();
- }
-
- std::string boot_image_checksum =
- StringPrintf("i;%d/%08x", header->GetComponentCount(), header->GetImageChecksum());
- ArrayRef<const std::string> boot_class_path_tail =
- ArrayRef<const std::string>(boot_class_path).SubArray(header->GetComponentCount());
- for (const std::string& bcp_filename : boot_class_path_tail) {
- std::vector<std::unique_ptr<const DexFile>> dex_files;
- const ArtDexFileLoader dex_file_loader;
- if (!dex_file_loader.Open(bcp_filename.c_str(),
- bcp_filename, // The location does not matter here.
- /*verify=*/ false,
- /*verify_checksum=*/ false,
- error_msg,
- &dex_files)) {
- return std::string();
- }
- DCHECK(!dex_files.empty());
- StringAppendF(&boot_image_checksum, ":d");
- for (const std::unique_ptr<const DexFile>& dex_file : dex_files) {
- StringAppendF(&boot_image_checksum, "/%08x", dex_file->GetLocationChecksum());
- }
- }
- return boot_image_checksum;
-}
-
-std::string ImageSpace::GetBootClassPathChecksums(
- const std::vector<ImageSpace*>& image_spaces,
- const std::vector<const DexFile*>& boot_class_path) {
- DCHECK(!image_spaces.empty());
- const ImageHeader& primary_header = image_spaces.front()->GetImageHeader();
- uint32_t component_count = primary_header.GetComponentCount();
- DCHECK_EQ(component_count, image_spaces.size());
- std::string boot_image_checksum =
- StringPrintf("i;%d/%08x", component_count, primary_header.GetImageChecksum());
- size_t pos = 0u;
- for (const ImageSpace* space : image_spaces) {
- size_t num_dex_files = space->oat_file_non_owned_->GetOatDexFiles().size();
- if (kIsDebugBuild) {
- CHECK_NE(num_dex_files, 0u);
- CHECK_LE(space->oat_file_non_owned_->GetOatDexFiles().size(), boot_class_path.size() - pos);
- for (size_t i = 0; i != num_dex_files; ++i) {
- CHECK_EQ(space->oat_file_non_owned_->GetOatDexFiles()[i]->GetDexFileLocation(),
- boot_class_path[pos + i]->GetLocation());
- }
- }
- pos += num_dex_files;
- }
- ArrayRef<const DexFile* const> boot_class_path_tail =
- ArrayRef<const DexFile* const>(boot_class_path).SubArray(pos);
- DCHECK(boot_class_path_tail.empty() ||
- !DexFileLoader::IsMultiDexLocation(boot_class_path_tail.front()->GetLocation().c_str()));
- for (const DexFile* dex_file : boot_class_path_tail) {
- if (!DexFileLoader::IsMultiDexLocation(dex_file->GetLocation().c_str())) {
- StringAppendF(&boot_image_checksum, ":d");
- }
- StringAppendF(&boot_image_checksum, "/%08x", dex_file->GetLocationChecksum());
- }
- return boot_image_checksum;
-}
-
std::vector<std::string> ImageSpace::ExpandMultiImageLocations(
const std::vector<std::string>& dex_locations,
const std::string& image_location) {
- return ExpandMultiImageLocations(ArrayRef<const std::string>(dex_locations), image_location);
-}
-
-std::vector<std::string> ImageSpace::ExpandMultiImageLocations(
- ArrayRef<const std::string> dex_locations,
- const std::string& image_location) {
DCHECK(!dex_locations.empty());
// Find the path.
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index 2eb27f0b0b..dbc12d103e 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -24,8 +24,6 @@
namespace art {
-template <typename T> class ArrayRef;
-class DexFile;
class OatFile;
namespace gc {
@@ -126,19 +124,6 @@ class ImageSpace : public MemMapSpace {
bool* has_data,
bool *is_global_cache);
- // Returns the checksums for the boot image and extra boot class path dex files,
- // based on the boot class path, image location and ISA (may differ from the ISA of an
- // initialized Runtime). The boot image and dex files do not need to be loaded in memory.
- static std::string GetBootClassPathChecksums(const std::vector<std::string>& boot_class_path,
- const std::string& image_location,
- InstructionSet image_isa,
- /*out*/std::string* error_msg);
-
- // Returns the checksums for the boot image and extra boot class path dex files,
- // based on the boot image and boot class path dex files loaded in memory.
- static std::string GetBootClassPathChecksums(const std::vector<ImageSpace*>& image_spaces,
- const std::vector<const DexFile*>& boot_class_path);
-
// Expand a single image location to multi-image locations based on the dex locations.
static std::vector<std::string> ExpandMultiImageLocations(
const std::vector<std::string>& dex_locations,
@@ -203,11 +188,6 @@ class ImageSpace : public MemMapSpace {
friend class Space;
private:
- // Internal overload that takes ArrayRef<> instead of vector<>.
- static std::vector<std::string> ExpandMultiImageLocations(
- ArrayRef<const std::string> dex_locations,
- const std::string& image_location);
-
class BootImageLoader;
class Loader;
template <typename PatchObjectVisitor>
diff --git a/runtime/oat.cc b/runtime/oat.cc
index d7c968f9d1..e931b28a31 100644
--- a/runtime/oat.cc
+++ b/runtime/oat.cc
@@ -79,7 +79,8 @@ OatHeader::OatHeader(InstructionSet instruction_set,
quick_generic_jni_trampoline_offset_(0),
quick_imt_conflict_trampoline_offset_(0),
quick_resolution_trampoline_offset_(0),
- quick_to_interpreter_bridge_offset_(0) {
+ quick_to_interpreter_bridge_offset_(0),
+ boot_image_checksum_(0) {
// Don't want asserts in header as they would be checked in each file that includes it. But the
// fields are private, so we check inside a method.
static_assert(sizeof(magic_) == sizeof(kOatMagic),
@@ -315,6 +316,16 @@ void OatHeader::SetQuickToInterpreterBridgeOffset(uint32_t offset) {
quick_to_interpreter_bridge_offset_ = offset;
}
+uint32_t OatHeader::GetBootImageChecksum() const {
+ CHECK(IsValid());
+ return boot_image_checksum_;
+}
+
+void OatHeader::SetBootImageChecksum(uint32_t boot_image_checksum) {
+ CHECK(IsValid());
+ boot_image_checksum_ = boot_image_checksum;
+}
+
uint32_t OatHeader::GetKeyValueStoreSize() const {
CHECK(IsValid());
return key_value_store_size_;
diff --git a/runtime/oat.h b/runtime/oat.h
index ded148914f..b09c81e3ad 100644
--- a/runtime/oat.h
+++ b/runtime/oat.h
@@ -31,8 +31,8 @@ class InstructionSetFeatures;
class PACKED(4) OatHeader {
public:
static constexpr uint8_t kOatMagic[] = { 'o', 'a', 't', '\n' };
- // Last oat version changed reason: Partial boot image.
- static constexpr uint8_t kOatVersion[] = { '1', '6', '6', '\0' };
+ // Last oat version changed reason: Pass boot class path to LoadBootImage.
+ static constexpr uint8_t kOatVersion[] = { '1', '6', '5', '\0' };
static constexpr const char* kDex2OatCmdLineKey = "dex2oat-cmdline";
static constexpr const char* kDebuggableKey = "debuggable";
@@ -40,7 +40,6 @@ class PACKED(4) OatHeader {
static constexpr const char* kCompilerFilter = "compiler-filter";
static constexpr const char* kClassPathKey = "classpath";
static constexpr const char* kBootClassPathKey = "bootclasspath";
- static constexpr const char* kBootClassPathChecksumsKey = "bootclasspath-checksums";
static constexpr const char* kConcurrentCopying = "concurrent-copying";
static constexpr const char* kCompilationReasonKey = "compilation-reason";
@@ -94,6 +93,9 @@ class PACKED(4) OatHeader {
InstructionSet GetInstructionSet() const;
uint32_t GetInstructionSetFeaturesBitmap() const;
+ uint32_t GetBootImageChecksum() const;
+ void SetBootImageChecksum(uint32_t boot_image_checksum);
+
uint32_t GetKeyValueStoreSize() const;
const uint8_t* GetKeyValueStore() const;
const char* GetStoreValueByKey(const char* key) const;
@@ -135,6 +137,8 @@ class PACKED(4) OatHeader {
uint32_t quick_resolution_trampoline_offset_;
uint32_t quick_to_interpreter_bridge_offset_;
+ uint32_t boot_image_checksum_;
+
uint32_t key_value_store_size_;
uint8_t key_value_store_[0]; // note variable width data at end
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index 8b81bb9bfc..6f32b98466 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -419,7 +419,7 @@ OatFileAssistant::OatStatus OatFileAssistant::GivenOatFileStatus(const OatFile&
// starts up.
LOG(WARNING) << "Dex location " << dex_location_ << " does not seem to include dex file. "
<< "Allow oat file use. This is potentially dangerous.";
- } else if (!image_info->ValidateBootClassPathChecksums(file)) {
+ } else if (file.GetOatHeader().GetBootImageChecksum() != image_info->boot_image_checksum) {
VLOG(oat) << "Oat image checksum does not match image checksum.";
return kOatBootImageOutOfDate;
}
@@ -560,13 +560,6 @@ const std::vector<uint32_t>* OatFileAssistant::GetRequiredDexChecksums() {
return required_dex_checksums_found_ ? &cached_required_dex_checksums_ : nullptr;
}
-bool OatFileAssistant::ImageInfo::ValidateBootClassPathChecksums(const OatFile& oat_file) const {
- const char* oat_boot_class_path_checksums =
- oat_file.GetOatHeader().GetStoreValueByKey(OatHeader::kBootClassPathChecksumsKey);
- return oat_boot_class_path_checksums != nullptr &&
- oat_boot_class_path_checksums == boot_class_path_checksums;
-}
-
std::unique_ptr<OatFileAssistant::ImageInfo>
OatFileAssistant::ImageInfo::GetRuntimeImageInfo(InstructionSet isa, std::string* error_msg) {
CHECK(error_msg != nullptr);
@@ -574,11 +567,14 @@ OatFileAssistant::ImageInfo::GetRuntimeImageInfo(InstructionSet isa, std::string
Runtime* runtime = Runtime::Current();
std::unique_ptr<ImageInfo> info(new ImageInfo());
info->location = runtime->GetImageLocation();
- info->boot_class_path_checksums = gc::space::ImageSpace::GetBootClassPathChecksums(
- runtime->GetBootClassPath(), info->location, isa, error_msg);
- if (info->boot_class_path_checksums.empty()) {
+
+ std::unique_ptr<ImageHeader> image_header(
+ gc::space::ImageSpace::ReadImageHeader(info->location.c_str(), isa, error_msg));
+ if (image_header == nullptr) {
return nullptr;
}
+
+ info->boot_image_checksum = image_header->GetImageChecksum();
return info;
}
diff --git a/runtime/oat_file_assistant.h b/runtime/oat_file_assistant.h
index def55b879a..09c9d3b3cb 100644
--- a/runtime/oat_file_assistant.h
+++ b/runtime/oat_file_assistant.h
@@ -246,10 +246,8 @@ class OatFileAssistant {
private:
struct ImageInfo {
- bool ValidateBootClassPathChecksums(const OatFile& oat_file) const;
-
+ uint32_t boot_image_checksum = 0;
std::string location;
- std::string boot_class_path_checksums;
static std::unique_ptr<ImageInfo> GetRuntimeImageInfo(InstructionSet isa,
std::string* error_msg);
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 0da0c7aa13..69ef2fb213 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -964,8 +964,8 @@ void Runtime::StartDaemonThreads() {
VLOG(startup) << "Runtime::StartDaemonThreads exiting";
}
-static size_t OpenDexFiles(ArrayRef<const std::string> dex_filenames,
- ArrayRef<const std::string> dex_locations,
+static size_t OpenDexFiles(const std::vector<std::string>& dex_filenames,
+ const std::vector<std::string>& dex_locations,
std::vector<std::unique_ptr<const DexFile>>* dex_files) {
DCHECK(dex_files != nullptr) << "OpenDexFiles: out-param is nullptr";
size_t failure_count = 0;
@@ -1422,21 +1422,6 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
GetInternTable()->AddImageStringsToTable(image_space, VoidFunctor());
}
}
- if (heap_->GetBootImageSpaces().size() != GetBootClassPath().size()) {
- // The boot image did not contain all boot class path components. Load the rest.
- DCHECK_LT(heap_->GetBootImageSpaces().size(), GetBootClassPath().size());
- size_t start = heap_->GetBootImageSpaces().size();
- DCHECK_LT(start, GetBootClassPath().size());
- std::vector<std::unique_ptr<const DexFile>> extra_boot_class_path;
- if (runtime_options.Exists(Opt::BootClassPathDexList)) {
- extra_boot_class_path.swap(*runtime_options.GetOrDefault(Opt::BootClassPathDexList));
- } else {
- OpenDexFiles(ArrayRef<const std::string>(GetBootClassPath()).SubArray(start),
- ArrayRef<const std::string>(GetBootClassPathLocations()).SubArray(start),
- &extra_boot_class_path);
- }
- class_linker_->AddExtraBootDexFiles(self, std::move(extra_boot_class_path));
- }
if (IsJavaDebuggable()) {
// Now that we have loaded the boot image, deoptimize its methods if we are running
// debuggable, as the code may have been compiled non-debuggable.
@@ -1447,9 +1432,7 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
if (runtime_options.Exists(Opt::BootClassPathDexList)) {
boot_class_path.swap(*runtime_options.GetOrDefault(Opt::BootClassPathDexList));
} else {
- OpenDexFiles(ArrayRef<const std::string>(GetBootClassPath()),
- ArrayRef<const std::string>(GetBootClassPathLocations()),
- &boot_class_path);
+ OpenDexFiles(GetBootClassPath(), GetBootClassPathLocations(), &boot_class_path);
}
if (!class_linker_->InitWithoutImage(std::move(boot_class_path), &error_msg)) {
LOG(ERROR) << "Could not initialize without image: " << error_msg;
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index d1d6e70303..4e5152b135 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -541,10 +541,7 @@ if [ "$USE_JVM" = "y" ]; then
exit
fi
-# Note: This must start with the CORE_IMG_JARS in Android.common_path.mk
-# because that's what we use for compiling the core.art image.
-# It may contain additional modules from TEST_CORE_JARS.
-bpath_modules="core-oj core-libart core-simple okhttp bouncycastle conscrypt"
+bpath_modules="core-oj core-libart core-simple conscrypt okhttp bouncycastle"
if [ "${HOST}" = "y" ]; then
framework="${ANDROID_HOST_OUT}/framework"
if [ "${ANDROID_HOST_OUT:0:${#ANDROID_BUILD_TOP}+1}" = "${ANDROID_BUILD_TOP}/" ]; then
diff --git a/tools/bootjars.sh b/tools/bootjars.sh
index 9f2282764e..ad6ee6b058 100755
--- a/tools/bootjars.sh
+++ b/tools/bootjars.sh
@@ -72,10 +72,8 @@ if [[ $core_jars_only == y ]]; then
# FIXME: The soong invocation we're using for getting the variables does not give us anything
# defined in Android.common_path.mk, otherwise we would just use HOST-/TARGET_TEST_CORE_JARS.
- # Note: This must start with the CORE_IMG_JARS in Android.common_path.mk
- # because that's what we use for compiling the core.art image.
- # It may contain additional modules from TEST_CORE_JARS.
- core_jars_list="core-oj core-libart core-simple"
+ # The core_jars_list must match the TEST_CORE_JARS variable in the Android.common_path.mk .
+ core_jars_list="core-oj core-libart core-simple conscrypt okhttp bouncycastle"
core_jars_suffix=
if [[ $mode == target ]]; then
core_jars_suffix=-testdex
diff --git a/tools/run-jdwp-tests.sh b/tools/run-jdwp-tests.sh
index c85a5ed643..f4a2dc1a6a 100755
--- a/tools/run-jdwp-tests.sh
+++ b/tools/run-jdwp-tests.sh
@@ -55,10 +55,9 @@ function boot_classpath_arg {
done
}
-# Note: This must start with the CORE_IMG_JARS in Android.common_path.mk
+# Note: This must match the TEST_CORE_JARS in Android.common_path.mk
# because that's what we use for compiling the core.art image.
-# It may contain additional modules from TEST_CORE_JARS.
-BOOT_CLASSPATH_JARS="core-oj core-libart core-simple okhttp bouncycastle conscrypt"
+BOOT_CLASSPATH_JARS="core-oj core-libart core-simple conscrypt okhttp bouncycastle"
vm_args=""
art="$android_root/bin/art"
diff --git a/tools/run-libcore-tests.sh b/tools/run-libcore-tests.sh
index 63fe81be6f..63f1fce13f 100755
--- a/tools/run-libcore-tests.sh
+++ b/tools/run-libcore-tests.sh
@@ -57,10 +57,9 @@ function boot_classpath_arg {
done
}
-# Note: This must start with the CORE_IMG_JARS in Android.common_path.mk
+# Note: This must match the TEST_CORE_JARS in Android.common_path.mk
# because that's what we use for compiling the core.art image.
-# It may contain additional modules from TEST_CORE_JARS.
-BOOT_CLASSPATH_JARS="core-oj core-libart core-simple okhttp bouncycastle conscrypt"
+BOOT_CLASSPATH_JARS="core-oj core-libart core-simple conscrypt okhttp bouncycastle"
DEPS="core-tests jsr166-tests mockito-target"