ART: Added DCHECKS to find alignment breakage.
Change-Id: I47aed866ec3c3858dc3ee27cb84cfaddf44009d1
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 9b0fb7d..1a3bba5 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2096,8 +2096,12 @@
if (dex_file.NumStringIds() < num_strings) {
num_strings = dex_file.NumStringIds();
}
+ DCHECK_ALIGNED(raw_arrays, alignof(mirror::StringDexCacheType)) <<
+ "Expected raw_arrays to align to StringDexCacheType.";
+ DCHECK_ALIGNED(layout.StringsOffset(), alignof(mirror::StringDexCacheType)) <<
+ "Expected StringsOffset() to align to StringDexCacheType.";
DCHECK_ALIGNED(strings, alignof(mirror::StringDexCacheType)) <<
- "Expected strings to align to StringDexCacheType.";
+ "Expected strings to align to StringDexCacheType.";
static_assert(alignof(mirror::StringDexCacheType) == 8u,
"Expected StringDexCacheType to have align of 8.");
if (kIsDebugBuild) {
diff --git a/runtime/utils/dex_cache_arrays_layout-inl.h b/runtime/utils/dex_cache_arrays_layout-inl.h
index c2b2f65..4c63156 100644
--- a/runtime/utils/dex_cache_arrays_layout-inl.h
+++ b/runtime/utils/dex_cache_arrays_layout-inl.h
@@ -100,6 +100,8 @@
}
inline size_t DexCacheArraysLayout::StringsAlignment() const {
+ static_assert(alignof(mirror::StringDexCacheType) == 8,
+ "Expecting alignof(StringDexCacheType) == 8");
return alignof(mirror::StringDexCacheType);
}