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
diff --git a/runtime/image.cc b/runtime/image.cc
index 489a53b..ac36d7c 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 95904af..72f63c6 100644
--- a/runtime/utils/dex_cache_arrays_layout-inl.h
+++ b/runtime/utils/dex_cache_arrays_layout-inl.h
@@ -132,7 +132,7 @@
   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 {