summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2017-07-10 15:31:30 +0100
committer Vladimir Marko <vmarko@google.com> 2017-07-10 16:45:30 +0100
commit2b0dfe7b2d6539a8dded06104b11f5ddca3e277c (patch)
tree1afb090cb2211e4f0aaae5d5782d5f950c3a0627
parent6375a04cae864416499865453fecd2b50706b3b2 (diff)
Fix over-allocation of DexCache field array.
Fix a facepalm in DexCacheArraysLayout that causes over-allocation of the DexCache fields array. We should not waste valuable flash storage and virtual address space with all these zeros. Total boot*.art size for aosp_angler-userdebug: - arm: - before: 13316096 - after: 11603968 (1.6MiB, -13%) - arm64: - before: 9486336 - after: 8626176 (-0.8MiB, 9%) We should have saved half of this with the original change rather than regressing the other half. Test: m test-art-host-gtest Test: testrunner.py --host --interp-ac Test: testtunner.py --host --interpreter Bug: 30627598 Change-Id: Ied2ffc4fc8e569141fd6db45841163f7f071ddd0
-rw-r--r--runtime/image.cc2
-rw-r--r--runtime/utils/dex_cache_arrays_layout-inl.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/runtime/image.cc b/runtime/image.cc
index 489a53b35c..ac36d7ca20 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', '4', '4', '\0' }; // Thread.interrupted
+const uint8_t ImageHeader::kImageVersion[] = { '0', '4', '5', '\0' }; // Fix DexCache fields.
ImageHeader::ImageHeader(uint32_t image_begin,
uint32_t image_size,
diff --git a/runtime/utils/dex_cache_arrays_layout-inl.h b/runtime/utils/dex_cache_arrays_layout-inl.h
index 95904af011..72f63c6c07 100644
--- a/runtime/utils/dex_cache_arrays_layout-inl.h
+++ b/runtime/utils/dex_cache_arrays_layout-inl.h
@@ -132,7 +132,7 @@ inline size_t DexCacheArraysLayout::FieldsSize(size_t num_elements) const {
if (num_elements < cache_size) {
cache_size = num_elements;
}
- return 2u * static_cast<size_t>(pointer_size_) * num_elements;
+ return 2u * static_cast<size_t>(pointer_size_) * cache_size;
}
inline size_t DexCacheArraysLayout::FieldsAlignment() const {