summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dex2oat/linker/image_test.cc16
-rw-r--r--dex2oat/linker/image_writer.cc4
-rw-r--r--oatdump/oatdump.cc4
-rw-r--r--runtime/gc/collector/immune_spaces_test.cc16
-rw-r--r--runtime/gc/space/image_space.cc39
-rw-r--r--runtime/image.cc6
-rw-r--r--runtime/image.h18
7 files changed, 28 insertions, 75 deletions
diff --git a/dex2oat/linker/image_test.cc b/dex2oat/linker/image_test.cc
index 69dac19df9..64b98cdb37 100644
--- a/dex2oat/linker/image_test.cc
+++ b/dex2oat/linker/image_test.cc
@@ -74,13 +74,11 @@ TEST_F(ImageTest, ImageHeaderIsValid) {
oat_data_begin,
oat_data_end,
oat_file_end,
- /*boot_image_begin*/0U,
- /*boot_image_size*/0U,
- /*boot_oat_begin*/0U,
- /*boot_oat_size_*/0U,
+ /*boot_image_begin=*/ 0u,
+ /*boot_image_size=*/ 0u,
sizeof(void*),
ImageHeader::kDefaultStorageMode,
- /*data_size*/0u);
+ /*data_size=*/ 0u);
ASSERT_TRUE(image_header.IsValid());
ASSERT_TRUE(!image_header.IsAppImage());
@@ -110,7 +108,7 @@ TEST_F(ImageTest, TestDefaultMethods) {
// Test the pointer to quick code is the same in origin method
// and in the copied method form the same oat file.
ObjPtr<mirror::Class> iface_klass =
- class_linker_->LookupClass(self, "LIface;", /* class_loader */ nullptr);
+ class_linker_->LookupClass(self, "LIface;", /*class_loader=*/ nullptr);
ASSERT_NE(nullptr, iface_klass);
ArtMethod* origin = iface_klass->FindInterfaceMethod("defaultMethod", "()V", pointer_size);
ASSERT_NE(nullptr, origin);
@@ -120,7 +118,7 @@ TEST_F(ImageTest, TestDefaultMethods) {
ASSERT_NE(nullptr, code);
ASSERT_FALSE(class_linker_->IsQuickToInterpreterBridge(code));
ObjPtr<mirror::Class> impl_klass =
- class_linker_->LookupClass(self, "LImpl;", /* class_loader */ nullptr);
+ class_linker_->LookupClass(self, "LImpl;", /*class_loader=*/ nullptr);
ASSERT_NE(nullptr, impl_klass);
ArtMethod* copied = FindCopiedMethod(origin, impl_klass);
ASSERT_NE(nullptr, copied);
@@ -131,7 +129,7 @@ TEST_F(ImageTest, TestDefaultMethods) {
// but the copied method has pointer to interpreter
// because these methods are in different oat files.
ObjPtr<mirror::Class> iterable_klass =
- class_linker_->LookupClass(self, "Ljava/lang/Iterable;", /* class_loader */ nullptr);
+ class_linker_->LookupClass(self, "Ljava/lang/Iterable;", /*class_loader=*/ nullptr);
ASSERT_NE(nullptr, iterable_klass);
origin = iterable_klass->FindClassMethod(
"forEach", "(Ljava/util/function/Consumer;)V", pointer_size);
@@ -143,7 +141,7 @@ TEST_F(ImageTest, TestDefaultMethods) {
ASSERT_NE(nullptr, code);
ASSERT_FALSE(class_linker_->IsQuickToInterpreterBridge(code));
ObjPtr<mirror::Class> iterablebase_klass =
- class_linker_->LookupClass(self, "LIterableBase;", /* class_loader */ nullptr);
+ class_linker_->LookupClass(self, "LIterableBase;", /*class_loader=*/ nullptr);
ASSERT_NE(nullptr, iterablebase_klass);
copied = FindCopiedMethod(origin, iterablebase_klass);
ASSERT_NE(nullptr, copied);
diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc
index 248a4414dc..5de9806795 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -2589,9 +2589,7 @@ void ImageWriter::CreateHeader(size_t oat_index) {
PointerToLowMemUInt32(oat_data_end),
PointerToLowMemUInt32(oat_file_end),
boot_image_begin,
- boot_image_end - boot_image_begin,
- boot_oat_begin,
- boot_oat_end - boot_oat_begin,
+ boot_oat_end - boot_image_begin,
static_cast<uint32_t>(target_ptr_size_),
image_storage_mode_,
/*data_size*/0u);
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index dd1ff2a49d..51f60084a1 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -1783,9 +1783,7 @@ class ImageDumper {
os << "BOOT IMAGE BEGIN: " << reinterpret_cast<void*>(image_header_.GetBootImageBegin())
<< "\n";
- os << "BOOT IMAGE SIZE: " << image_header_.GetBootImageSize() << "\n";
- os << "BOOT OAT BEGIN: " << reinterpret_cast<void*>(image_header_.GetBootOatBegin()) << "\n";
- os << "BOOT OAT SIZE: " << image_header_.GetBootOatSize() << "\n\n";
+ os << "BOOT IMAGE SIZE: " << image_header_.GetBootImageSize() << "\n\n";
for (size_t i = 0; i < ImageHeader::kSectionCount; ++i) {
auto section = static_cast<ImageHeader::ImageSections>(i);
diff --git a/runtime/gc/collector/immune_spaces_test.cc b/runtime/gc/collector/immune_spaces_test.cc
index c2a67bf9f6..fad3f0bee2 100644
--- a/runtime/gc/collector/immune_spaces_test.cc
+++ b/runtime/gc/collector/immune_spaces_test.cc
@@ -119,16 +119,14 @@ class ImmuneSpacesTest : public CommonRuntimeTest {
/*oat_checksum=*/ 0u,
// The oat file data in the header is always right after the image space.
/*oat_file_begin=*/ PointerToLowMemUInt32(oat_map.Begin()),
- /*oat_data_begin=*/PointerToLowMemUInt32(oat_map.Begin()),
- /*oat_data_end=*/PointerToLowMemUInt32(oat_map.Begin() + oat_size),
- /*oat_file_end=*/PointerToLowMemUInt32(oat_map.Begin() + oat_size),
- /*boot_image_begin=*/0u,
- /*boot_image_size=*/0u,
- /*boot_oat_begin=*/0u,
- /*boot_oat_size=*/0u,
- /*pointer_size=*/sizeof(void*),
+ /*oat_data_begin=*/ PointerToLowMemUInt32(oat_map.Begin()),
+ /*oat_data_end=*/ PointerToLowMemUInt32(oat_map.Begin() + oat_size),
+ /*oat_file_end=*/ PointerToLowMemUInt32(oat_map.Begin() + oat_size),
+ /*boot_image_begin=*/ 0u,
+ /*boot_image_size=*/ 0u,
+ /*pointer_size=*/ sizeof(void*),
ImageHeader::kStorageModeUncompressed,
- /*data_size=*/0u);
+ /*data_size=*/ 0u);
return new DummyImageSpace(std::move(image_map),
std::move(live_bitmap),
std::move(oat_file),
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index 0766999c02..51b5ace027 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -700,11 +700,9 @@ class ImageSpace::Loader {
class FixupVisitor : public ValueObject {
public:
FixupVisitor(const RelocationRange& boot_image,
- const RelocationRange& boot_oat,
const RelocationRange& app_image,
const RelocationRange& app_oat)
: boot_image_(boot_image),
- boot_oat_(boot_oat),
app_image_(app_image),
app_oat_(app_oat) {}
@@ -727,8 +725,8 @@ class ImageSpace::Loader {
// Return the relocated address of a code pointer (contained by an oat file).
ALWAYS_INLINE const void* ForwardCode(const void* src) const {
const uintptr_t uint_src = reinterpret_cast<uintptr_t>(src);
- if (boot_oat_.InSource(uint_src)) {
- return reinterpret_cast<const void*>(boot_oat_.ToDest(uint_src));
+ if (boot_image_.InSource(uint_src)) {
+ return reinterpret_cast<const void*>(boot_image_.ToDest(uint_src));
}
if (app_oat_.InSource(uint_src)) {
return reinterpret_cast<const void*>(app_oat_.ToDest(uint_src));
@@ -745,7 +743,6 @@ class ImageSpace::Loader {
protected:
// Source section.
const RelocationRange boot_image_;
- const RelocationRange boot_oat_;
const RelocationRange app_image_;
const RelocationRange app_oat_;
};
@@ -893,7 +890,7 @@ class ImageSpace::Loader {
// We want to use our own class loader and not the one in the image.
if (obj->IsClass<kVerifyNone>()) {
mirror::Class* as_klass = obj->AsClass<kVerifyNone>();
- FixupObjectAdapter visitor(boot_image_, boot_oat_, app_image_, app_oat_);
+ FixupObjectAdapter visitor(boot_image_, app_image_, app_oat_);
as_klass->FixupNativePointers<kVerifyNone>(as_klass, pointer_size_, visitor);
// Deal with the pointer arrays. Use the helper function since multiple classes can reference
// the same arrays.
@@ -1025,10 +1022,8 @@ class ImageSpace::Loader {
*error_msg = "Can not relocate app image without boot oat file";
return false;
}
- const uint32_t boot_image_size = boot_image_end - boot_image_begin;
- const uint32_t boot_oat_size = boot_oat_end - boot_oat_begin;
+ const uint32_t boot_image_size = boot_oat_end - boot_image_begin;
const uint32_t image_header_boot_image_size = image_header.GetBootImageSize();
- const uint32_t image_header_boot_oat_size = image_header.GetBootOatSize();
if (boot_image_size != image_header_boot_image_size) {
*error_msg = StringPrintf("Boot image size %" PRIu64 " does not match expected size %"
PRIu64,
@@ -1036,20 +1031,10 @@ class ImageSpace::Loader {
static_cast<uint64_t>(image_header_boot_image_size));
return false;
}
- if (boot_oat_size != image_header_boot_oat_size) {
- *error_msg = StringPrintf("Boot oat size %" PRIu64 " does not match expected size %"
- PRIu64,
- static_cast<uint64_t>(boot_oat_size),
- static_cast<uint64_t>(image_header_boot_oat_size));
- return false;
- }
TimingLogger logger(__FUNCTION__, true, false);
RelocationRange boot_image(image_header.GetBootImageBegin(),
boot_image_begin,
boot_image_size);
- RelocationRange boot_oat(image_header.GetBootOatBegin(),
- boot_oat_begin,
- boot_oat_size);
RelocationRange app_image(reinterpret_cast<uintptr_t>(image_header.GetImageBegin()),
reinterpret_cast<uintptr_t>(target_base),
image_header.GetImageSize());
@@ -1061,11 +1046,9 @@ class ImageSpace::Loader {
VLOG(image) << "App image " << app_image;
VLOG(image) << "App oat " << app_oat;
VLOG(image) << "Boot image " << boot_image;
- VLOG(image) << "Boot oat " << boot_oat;
- // True if we need to fixup any heap pointers, otherwise only code pointers.
+ // True if we need to fixup any heap pointers.
const bool fixup_image = boot_image.Delta() != 0 || app_image.Delta() != 0;
- const bool fixup_code = boot_oat.Delta() != 0 || app_oat.Delta() != 0;
- if (!fixup_image && !fixup_code) {
+ if (!fixup_image) {
// Nothing to fix up.
return true;
}
@@ -1074,7 +1057,7 @@ class ImageSpace::Loader {
const ImageSection& objects_section = image_header.GetObjectsSection();
uintptr_t objects_begin = reinterpret_cast<uintptr_t>(target_base + objects_section.Offset());
uintptr_t objects_end = reinterpret_cast<uintptr_t>(target_base + objects_section.End());
- FixupObjectAdapter fixup_adapter(boot_image, boot_oat, app_image, app_oat);
+ FixupObjectAdapter fixup_adapter(boot_image, app_image, app_oat);
if (fixup_image) {
// Two pass approach, fix up all classes first, then fix up non class-objects.
// The visited bitmap is used to ensure that pointer arrays are not forwarded twice.
@@ -1085,7 +1068,6 @@ class ImageSpace::Loader {
FixupObjectVisitor fixup_object_visitor(visited_bitmap.get(),
pointer_size,
boot_image,
- boot_oat,
app_image,
app_oat);
TimingLogger::ScopedTiming timing("Fixup classes", &logger);
@@ -1191,7 +1173,6 @@ class ImageSpace::Loader {
FixupArtMethodVisitor method_visitor(fixup_image,
pointer_size,
boot_image,
- boot_oat,
app_image,
app_oat);
image_header.VisitPackedArtMethods(&method_visitor, target_base, pointer_size);
@@ -1200,7 +1181,7 @@ class ImageSpace::Loader {
{
// Only touches objects in the app image, no need for mutator lock.
TimingLogger::ScopedTiming timing("Fixup fields", &logger);
- FixupArtFieldVisitor field_visitor(boot_image, boot_oat, app_image, app_oat);
+ FixupArtFieldVisitor field_visitor(boot_image, app_image, app_oat);
image_header.VisitPackedArtFields(&field_visitor, target_base);
}
{
@@ -1222,7 +1203,7 @@ class ImageSpace::Loader {
WriterMutexLock mu(Thread::Current(), *Locks::classlinker_classes_lock_);
ClassTable temp_table;
temp_table.ReadFromMemory(target_base + class_table_section.Offset());
- FixupRootVisitor root_visitor(boot_image, boot_oat, app_image, app_oat);
+ FixupRootVisitor root_visitor(boot_image, app_image, app_oat);
temp_table.VisitRoots(root_visitor);
}
// Fix up the intern table.
@@ -1234,7 +1215,7 @@ class ImageSpace::Loader {
InternTable temp_intern_table;
// Note that we require that ReadFromMemory does not make an internal copy of the elements
// so that the VisitRoots() will update the memory directly rather than the copies.
- FixupRootVisitor root_visitor(boot_image, boot_oat, app_image, app_oat);
+ FixupRootVisitor root_visitor(boot_image, app_image, app_oat);
temp_intern_table.AddTableFromMemory(target_base + intern_table_section.Offset(),
[&](InternTable::UnorderedSet& strings)
REQUIRES_SHARED(Locks::mutator_lock_) {
diff --git a/runtime/image.cc b/runtime/image.cc
index f4c3fea8e1..3023cefd66 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -26,7 +26,7 @@
namespace art {
const uint8_t ImageHeader::kImageMagic[] = { 'a', 'r', 't', '\n' };
-const uint8_t ImageHeader::kImageVersion[] = { '0', '6', '8', '\0' }; // Image checksums.
+const uint8_t ImageHeader::kImageVersion[] = { '0', '6', '9', '\0' }; // Remove boot oat extents.
ImageHeader::ImageHeader(uint32_t image_begin,
uint32_t image_size,
@@ -39,8 +39,6 @@ ImageHeader::ImageHeader(uint32_t image_begin,
uint32_t oat_file_end,
uint32_t boot_image_begin,
uint32_t boot_image_size,
- uint32_t boot_oat_begin,
- uint32_t boot_oat_size,
uint32_t pointer_size,
StorageMode storage_mode,
size_t data_size)
@@ -54,8 +52,6 @@ ImageHeader::ImageHeader(uint32_t image_begin,
oat_file_end_(oat_file_end),
boot_image_begin_(boot_image_begin),
boot_image_size_(boot_image_size),
- boot_oat_begin_(boot_oat_begin),
- boot_oat_size_(boot_oat_size),
image_roots_(image_roots),
pointer_size_(pointer_size),
storage_mode_(storage_mode),
diff --git a/runtime/image.h b/runtime/image.h
index 5245cea091..87050ecb52 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -104,8 +104,6 @@ class PACKED(4) ImageHeader {
oat_file_end_(0U),
boot_image_begin_(0U),
boot_image_size_(0U),
- boot_oat_begin_(0U),
- boot_oat_size_(0U),
image_roots_(0U),
pointer_size_(0U),
storage_mode_(kDefaultStorageMode),
@@ -122,8 +120,6 @@ class PACKED(4) ImageHeader {
uint32_t oat_file_end,
uint32_t boot_image_begin,
uint32_t boot_image_size,
- uint32_t boot_oat_begin,
- uint32_t boot_oat_size,
uint32_t pointer_size,
StorageMode storage_mode,
size_t data_size);
@@ -322,14 +318,6 @@ class PACKED(4) ImageHeader {
return boot_image_size_;
}
- uint32_t GetBootOatBegin() const {
- return boot_oat_begin_;
- }
-
- uint32_t GetBootOatSize() const {
- return boot_oat_size_;
- }
-
StorageMode GetStorageMode() const {
return storage_mode_;
}
@@ -416,11 +404,7 @@ class PACKED(4) ImageHeader {
// Boot image begin and end (app image headers only).
uint32_t boot_image_begin_;
- uint32_t boot_image_size_;
-
- // Boot oat begin and end (app image headers only).
- uint32_t boot_oat_begin_;
- uint32_t boot_oat_size_;
+ uint32_t boot_image_size_; // Includes heap (*.art) and code (.oat).
// Absolute address of an Object[] of objects needed to reinitialize from an image.
uint32_t image_roots_;