OSDN Git Service

ART: Compress LengthPrefixedArray on 32-bit targets.
authorVladimir Marko <vmarko@google.com>
Wed, 12 Aug 2015 18:27:26 +0000 (19:27 +0100)
committerVladimir Marko <vmarko@google.com>
Mon, 17 Aug 2015 09:04:42 +0000 (10:04 +0100)
commitcf36d493124d8048efa0bd6f67d817ce3cd6b725
treefac1336f54ea477ce1afe2e99a04b68db38c7ac8
parent1cad8c7c63b600a3da83bf05fb645e08ac8fafc0
ART: Compress LengthPrefixedArray on 32-bit targets.

Previously, the LengthPrefixedArray<ArtMethod> on 32-bit
targets contained a 64-bit length field followed by the
ArtMethod elements with size only a multiple of 4, not 8.
Consequently, an odd-length array broke the alignment for
the following array which would have the 64-bit length
placed at an unaligned address.

To fix that, we make the length field 32-bit and explicitly
pass the alignment information to the LengthPrefixedArray.
This also makes the 32-bit boot image a bit smaller.
On Nexus 5, AOSP, ToT, the field section is 11528B smaller
and the method section is 21036B smaller. 64-bit targets
should see the same savings for the field section but no
difference for the methods section.

Change-Id: I3e03e7b94129025c8a1c117c27645a34dec516d2
12 files changed:
compiler/image_writer.cc
compiler/image_writer.h
oatdump/oatdump.cc
patchoat/patchoat.cc
runtime/art_method.h
runtime/base/bit_utils.h
runtime/class_linker.cc
runtime/image.cc
runtime/image.h
runtime/length_prefixed_array.h
runtime/mirror/class-inl.h
runtime/native/java_lang_Class.cc