summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2018-07-27 14:01:16 +0100
committerVladimir Marko <vmarko@google.com>2018-07-27 14:22:21 +0100
commitdda4e8b5f2ffed24a2dcdb99d2301d9fc0eb91e2 (patch)
treebe96957653014f962580a8b6868357d82e29b614
parentd61bd66a3c90c7da5949946e6fd18a270d63edc9 (diff)
downloadart-dda4e8b5f2ffed24a2dcdb99d2301d9fc0eb91e2.tar.gz
art-dda4e8b5f2ffed24a2dcdb99d2301d9fc0eb91e2.tar.bz2
art-dda4e8b5f2ffed24a2dcdb99d2301d9fc0eb91e2.zip
ARM64: Fix the CallOtherJustTooFarAfter test.
Fix ARM64 relative patcher test CallOtherJustTooFarAfter depending on the size of OatQuickMethodHeader being at least kArm64Alignment. This is needed for https://android-review.googlesource.com/708891 that removes some members from the OatQuickMethodHeader. Test: m test-art-host-gtest-relative_patcher_arm64_test Test: Cherry-pick the above CL PS5 and repeat the gtest. Change-Id: I01074aee41217f7aba10af13bcbc17dafcc03f43
-rw-r--r--dex2oat/linker/arm64/relative_patcher_arm64_test.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/dex2oat/linker/arm64/relative_patcher_arm64_test.cc b/dex2oat/linker/arm64/relative_patcher_arm64_test.cc
index 07e6860f9c..9e3bb978fb 100644
--- a/dex2oat/linker/arm64/relative_patcher_arm64_test.cc
+++ b/dex2oat/linker/arm64/relative_patcher_arm64_test.cc
@@ -726,15 +726,24 @@ TEST_F(Arm64RelativePatcherTestDefault, CallOtherJustTooFarAfter) {
ArrayRef<const LinkerPatch>(),
bl_offset_in_method1 + just_over_max_positive_disp);
ASSERT_EQ(expected_last_method_idx, last_method_idx);
+ uint32_t method_after_thunk_idx = last_method_idx;
+ if (sizeof(OatQuickMethodHeader) < kArm64Alignment) {
+ // The thunk needs to start on a kArm64Alignment-aligned address before the address where the
+ // last method would have been if there was no thunk. If the size of the OatQuickMethodHeader
+ // is at least kArm64Alignment, the thunk start shall fit between the previous filler method
+ // and that address. Otherwise, it shall be inserted before that filler method.
+ method_after_thunk_idx -= 1u;
+ }
uint32_t method1_offset = GetMethodOffset(1u);
- uint32_t last_method_offset = GetMethodOffset(last_method_idx);
- ASSERT_TRUE(IsAligned<kArm64Alignment>(last_method_offset));
- uint32_t last_method_header_offset = last_method_offset - sizeof(OatQuickMethodHeader);
+ uint32_t method_after_thunk_offset = GetMethodOffset(method_after_thunk_idx);
+ ASSERT_TRUE(IsAligned<kArm64Alignment>(method_after_thunk_offset));
+ uint32_t method_after_thunk_header_offset =
+ method_after_thunk_offset - sizeof(OatQuickMethodHeader);
uint32_t thunk_size = MethodCallThunkSize();
- uint32_t thunk_offset = RoundDown(last_method_header_offset - thunk_size, kArm64Alignment);
+ uint32_t thunk_offset = RoundDown(method_after_thunk_header_offset - thunk_size, kArm64Alignment);
DCHECK_EQ(thunk_offset + thunk_size + CodeAlignmentSize(thunk_offset + thunk_size),
- last_method_header_offset);
+ method_after_thunk_header_offset);
uint32_t diff = thunk_offset - (method1_offset + bl_offset_in_method1);
CHECK_ALIGNED(diff, 4u);
ASSERT_LT(diff, 128 * MB);