Remove MIPS support from dex2oat.
Test: aosp_taimen-userdebug boots.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 147346243
Change-Id: Id29631ca0344d5bd4fcc8df7605580c9ed628f72
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py
index f2e2734..fca1f15 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -772,9 +772,6 @@
self._checker.check_art_test_executable('verifier_deps_test')
# These tests depend on a specific code generator and are conditionally included.
self._checker.check_optional_art_test_executable('relative_patcher_arm64_test')
- self._checker.check_optional_art_test_executable('relative_patcher_mips32r6_test')
- self._checker.check_optional_art_test_executable('relative_patcher_mips64_test')
- self._checker.check_optional_art_test_executable('relative_patcher_mips_test')
self._checker.check_optional_art_test_executable('relative_patcher_thumb2_test')
self._checker.check_optional_art_test_executable('relative_patcher_x86_64_test')
self._checker.check_optional_art_test_executable('relative_patcher_x86_test')
diff --git a/cmdline/cmdline.h b/cmdline/cmdline.h
index c02e91b..5821496 100644
--- a/cmdline/cmdline.h
+++ b/cmdline/cmdline.h
@@ -221,7 +221,7 @@
" (specifies /system/framework/<arch>/boot.art as the image file)\n"
"\n";
usage += android::base::StringPrintf( // Optional.
- " --instruction-set=(arm|arm64|mips|mips64|x86|x86_64): for locating the image\n"
+ " --instruction-set=(arm|arm64|x86|x86_64): for locating the image\n"
" file based on the image location set.\n"
" Example: --instruction-set=x86\n"
" Default: %s\n"
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index e3320fe..8f84b2e 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -42,16 +42,6 @@
"linker/arm64/relative_patcher_arm64.cc",
],
},
- mips: {
- srcs: [
- "linker/mips/relative_patcher_mips.cc",
- ],
- },
- mips64: {
- srcs: [
- "linker/mips64/relative_patcher_mips64.cc",
- ],
- },
x86: {
srcs: [
"linker/x86/relative_patcher_x86.cc",
@@ -232,16 +222,6 @@
profile_file: "art/dex2oat_x86_x86_64.profdata",
},
},
- android_mips64: {
- pgo: {
- profile_file: "art/dex2oat_mips_mips64.profdata",
- },
- },
- android_mips: {
- pgo: {
- profile_file: "art/dex2oat_mips_mips64.profdata",
- },
- },
},
}
@@ -455,17 +435,6 @@
"linker/arm64/relative_patcher_arm64_test.cc",
],
},
- mips: {
- srcs: [
- "linker/mips/relative_patcher_mips_test.cc",
- "linker/mips/relative_patcher_mips32r6_test.cc",
- ],
- },
- mips64: {
- srcs: [
- "linker/mips64/relative_patcher_mips64_test.cc",
- ],
- },
x86: {
srcs: [
"linker/x86/relative_patcher_x86_test.cc",
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 3073f5f..1338bcf 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -42,7 +42,6 @@
#include "android-base/strings.h"
#include "arch/instruction_set_features.h"
-#include "arch/mips/instruction_set_features_mips.h"
#include "art_method-inl.h"
#include "base/callee_save_type.h"
#include "base/dumpable.h"
@@ -310,7 +309,7 @@
UsageError(" Example: --android-root=out/host/linux-x86");
UsageError(" Default: $ANDROID_ROOT");
UsageError("");
- UsageError(" --instruction-set=(arm|arm64|mips|mips64|x86|x86_64): compile for a particular");
+ UsageError(" --instruction-set=(arm|arm64|x86|x86_64): compile for a particular");
UsageError(" instruction set.");
UsageError(" Example: --instruction-set=x86");
UsageError(" Default: arm");
@@ -1011,8 +1010,6 @@
case InstructionSet::kArm64:
case InstructionSet::kX86:
case InstructionSet::kX86_64:
- case InstructionSet::kMips:
- case InstructionSet::kMips64:
compiler_options_->implicit_null_checks_ = true;
compiler_options_->implicit_so_checks_ = true;
break;
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index c0d1999..365edd6 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -405,8 +405,6 @@
case InstructionSet::kArm:
case InstructionSet::kArm64:
case InstructionSet::kThumb2:
- case InstructionSet::kMips:
- case InstructionSet::kMips64:
case InstructionSet::kX86:
case InstructionSet::kX86_64: return true;
default: return false;
diff --git a/dex2oat/linker/mips/relative_patcher_mips.cc b/dex2oat/linker/mips/relative_patcher_mips.cc
deleted file mode 100644
index 4f4dc48..0000000
--- a/dex2oat/linker/mips/relative_patcher_mips.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "linker/mips/relative_patcher_mips.h"
-
-#include "compiled_method.h"
-#include "debug/method_debug_info.h"
-#include "linker/linker_patch.h"
-
-namespace art {
-namespace linker {
-
-uint32_t MipsRelativePatcher::ReserveSpace(
- uint32_t offset,
- const CompiledMethod* compiled_method ATTRIBUTE_UNUSED,
- MethodReference method_ref ATTRIBUTE_UNUSED) {
- return offset; // No space reserved; no limit on relative call distance.
-}
-
-uint32_t MipsRelativePatcher::ReserveSpaceEnd(uint32_t offset) {
- return offset; // No space reserved; no limit on relative call distance.
-}
-
-uint32_t MipsRelativePatcher::WriteThunks(OutputStream* out ATTRIBUTE_UNUSED, uint32_t offset) {
- return offset; // No thunks added; no limit on relative call distance.
-}
-
-void MipsRelativePatcher::PatchCall(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
- uint32_t literal_offset ATTRIBUTE_UNUSED,
- uint32_t patch_offset ATTRIBUTE_UNUSED,
- uint32_t target_offset ATTRIBUTE_UNUSED) {
- UNIMPLEMENTED(FATAL) << "PatchCall unimplemented on MIPS";
-}
-
-void MipsRelativePatcher::PatchPcRelativeReference(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset,
- uint32_t target_offset) {
- uint32_t anchor_literal_offset = patch.PcInsnOffset();
- uint32_t literal_offset = patch.LiteralOffset();
- bool high_patch = ((*code)[literal_offset + 0] == 0x34) && ((*code)[literal_offset + 1] == 0x12);
-
- // Perform basic sanity checks.
- if (high_patch) {
- if (is_r6) {
- // auipc reg, offset_high
- DCHECK_EQ(((*code)[literal_offset + 2] & 0x1F), 0x1E);
- DCHECK_EQ(((*code)[literal_offset + 3] & 0xFC), 0xEC);
- } else {
- // lui reg, offset_high
- DCHECK_EQ(((*code)[literal_offset + 2] & 0xE0), 0x00);
- DCHECK_EQ((*code)[literal_offset + 3], 0x3C);
- }
- } else {
- // instr reg(s), offset_low
- CHECK_EQ((*code)[literal_offset + 0], 0x78);
- CHECK_EQ((*code)[literal_offset + 1], 0x56);
- }
-
- // Apply patch.
- uint32_t anchor_offset = patch_offset - literal_offset + anchor_literal_offset;
- uint32_t diff = target_offset - anchor_offset;
- diff += (diff & 0x8000) << 1; // Account for sign extension in "instr reg(s), offset_low".
-
- if (high_patch) {
- // lui reg, offset_high / auipc reg, offset_high
- (*code)[literal_offset + 0] = static_cast<uint8_t>(diff >> 16);
- (*code)[literal_offset + 1] = static_cast<uint8_t>(diff >> 24);
- } else {
- // instr reg(s), offset_low
- (*code)[literal_offset + 0] = static_cast<uint8_t>(diff >> 0);
- (*code)[literal_offset + 1] = static_cast<uint8_t>(diff >> 8);
- }
-}
-
-void MipsRelativePatcher::PatchEntrypointCall(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
- const LinkerPatch& patch ATTRIBUTE_UNUSED,
- uint32_t patch_offset ATTRIBUTE_UNUSED) {
- LOG(FATAL) << "UNIMPLEMENTED";
-}
-
-void MipsRelativePatcher::PatchBakerReadBarrierBranch(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
- const LinkerPatch& patch ATTRIBUTE_UNUSED,
- uint32_t patch_offset ATTRIBUTE_UNUSED) {
- LOG(FATAL) << "UNIMPLEMENTED";
-}
-
-std::vector<debug::MethodDebugInfo> MipsRelativePatcher::GenerateThunkDebugInfo(
- uint32_t executable_offset ATTRIBUTE_UNUSED) {
- return std::vector<debug::MethodDebugInfo>(); // No thunks added.
-}
-
-} // namespace linker
-} // namespace art
diff --git a/dex2oat/linker/mips/relative_patcher_mips.h b/dex2oat/linker/mips/relative_patcher_mips.h
deleted file mode 100644
index 7cdac45..0000000
--- a/dex2oat/linker/mips/relative_patcher_mips.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_DEX2OAT_LINKER_MIPS_RELATIVE_PATCHER_MIPS_H_
-#define ART_DEX2OAT_LINKER_MIPS_RELATIVE_PATCHER_MIPS_H_
-
-#include "arch/mips/instruction_set_features_mips.h"
-#include "linker/relative_patcher.h"
-
-namespace art {
-namespace linker {
-
-class MipsRelativePatcher final : public RelativePatcher {
- public:
- explicit MipsRelativePatcher(const MipsInstructionSetFeatures* features)
- : is_r6(features->IsR6()) {}
-
- uint32_t ReserveSpace(uint32_t offset,
- const CompiledMethod* compiled_method,
- MethodReference method_ref) override;
- uint32_t ReserveSpaceEnd(uint32_t offset) override;
- uint32_t WriteThunks(OutputStream* out, uint32_t offset) override;
- void PatchCall(std::vector<uint8_t>* code,
- uint32_t literal_offset,
- uint32_t patch_offset,
- uint32_t target_offset) override;
- void PatchPcRelativeReference(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset,
- uint32_t target_offset) override;
- void PatchEntrypointCall(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset) override;
- void PatchBakerReadBarrierBranch(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset) override;
- std::vector<debug::MethodDebugInfo> GenerateThunkDebugInfo(uint32_t executable_offset) override;
-
- private:
- bool is_r6;
-
- DISALLOW_COPY_AND_ASSIGN(MipsRelativePatcher);
-};
-
-} // namespace linker
-} // namespace art
-
-#endif // ART_DEX2OAT_LINKER_MIPS_RELATIVE_PATCHER_MIPS_H_
diff --git a/dex2oat/linker/mips/relative_patcher_mips32r6_test.cc b/dex2oat/linker/mips/relative_patcher_mips32r6_test.cc
deleted file mode 100644
index 629fdd5..0000000
--- a/dex2oat/linker/mips/relative_patcher_mips32r6_test.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "linker/mips/relative_patcher_mips.h"
-#include "linker/relative_patcher_test.h"
-
-namespace art {
-namespace linker {
-
-class Mips32r6RelativePatcherTest : public RelativePatcherTest {
- public:
- Mips32r6RelativePatcherTest() : RelativePatcherTest(InstructionSet::kMips, "mips32r6") {}
-
- protected:
- static const uint8_t kUnpatchedPcRelativeRawCode[];
- static const uint32_t kLiteralOffsetHigh;
- static const uint32_t kLiteralOffsetLow1;
- static const uint32_t kLiteralOffsetLow2;
- static const uint32_t kAnchorOffset;
- static const ArrayRef<const uint8_t> kUnpatchedPcRelativeCode;
-
- uint32_t GetMethodOffset(uint32_t method_idx) {
- auto result = method_offset_map_.FindMethodOffset(MethodRef(method_idx));
- CHECK(result.first);
- return result.second;
- }
-
- void CheckPcRelativePatch(const ArrayRef<const LinkerPatch>& patches, uint32_t target_offset);
- void TestStringBssEntry(uint32_t bss_begin, uint32_t string_entry_offset);
- void TestStringReference(uint32_t string_offset);
-};
-
-const uint8_t Mips32r6RelativePatcherTest::kUnpatchedPcRelativeRawCode[] = {
- 0x34, 0x12, 0x5E, 0xEE, // auipc s2, high(diff); placeholder = 0x1234
- 0x78, 0x56, 0x52, 0x26, // addiu s2, s2, low(diff); placeholder = 0x5678
- 0x78, 0x56, 0x52, 0x8E, // lw s2, (low(diff))(s2) ; placeholder = 0x5678
-};
-const uint32_t Mips32r6RelativePatcherTest::kLiteralOffsetHigh = 0; // At auipc.
-const uint32_t Mips32r6RelativePatcherTest::kLiteralOffsetLow1 = 4; // At addiu.
-const uint32_t Mips32r6RelativePatcherTest::kLiteralOffsetLow2 = 8; // At lw.
-const uint32_t Mips32r6RelativePatcherTest::kAnchorOffset = 0; // At auipc (where PC+0 points).
-const ArrayRef<const uint8_t> Mips32r6RelativePatcherTest::kUnpatchedPcRelativeCode(
- kUnpatchedPcRelativeRawCode);
-
-void Mips32r6RelativePatcherTest::CheckPcRelativePatch(const ArrayRef<const LinkerPatch>& patches,
- uint32_t target_offset) {
- AddCompiledMethod(MethodRef(1u), kUnpatchedPcRelativeCode, ArrayRef<const LinkerPatch>(patches));
- Link();
-
- auto result = method_offset_map_.FindMethodOffset(MethodRef(1u));
- ASSERT_TRUE(result.first);
-
- uint32_t diff = target_offset - (result.second + kAnchorOffset);
- diff += (diff & 0x8000) << 1; // Account for sign extension in addiu/lw.
-
- const uint8_t expected_code[] = {
- static_cast<uint8_t>(diff >> 16), static_cast<uint8_t>(diff >> 24), 0x5E, 0xEE,
- static_cast<uint8_t>(diff), static_cast<uint8_t>(diff >> 8), 0x52, 0x26,
- static_cast<uint8_t>(diff), static_cast<uint8_t>(diff >> 8), 0x52, 0x8E,
- };
- EXPECT_TRUE(CheckLinkedMethod(MethodRef(1u), ArrayRef<const uint8_t>(expected_code)));
-}
-
-void Mips32r6RelativePatcherTest::TestStringBssEntry(uint32_t bss_begin,
- uint32_t string_entry_offset) {
- constexpr uint32_t kStringIndex = 1u;
- string_index_to_offset_map_.Put(kStringIndex, string_entry_offset);
- bss_begin_ = bss_begin;
- LinkerPatch patches[] = {
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetHigh, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetLow1, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetLow2, nullptr, kAnchorOffset, kStringIndex)
- };
- CheckPcRelativePatch(ArrayRef<const LinkerPatch>(patches), bss_begin_ + string_entry_offset);
-}
-
-void Mips32r6RelativePatcherTest::TestStringReference(uint32_t string_offset) {
- constexpr uint32_t kStringIndex = 1u;
- string_index_to_offset_map_.Put(kStringIndex, string_offset);
- LinkerPatch patches[] = {
- LinkerPatch::RelativeStringPatch(kLiteralOffsetHigh, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::RelativeStringPatch(kLiteralOffsetLow1, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::RelativeStringPatch(kLiteralOffsetLow2, nullptr, kAnchorOffset, kStringIndex)
- };
- CheckPcRelativePatch(ArrayRef<const LinkerPatch>(patches), string_offset);
-}
-
-TEST_F(Mips32r6RelativePatcherTest, StringBssEntry) {
- TestStringBssEntry(/* bss_begin */ 0x12345678, /* string_entry_offset */ 0x1234);
-}
-
-TEST_F(Mips32r6RelativePatcherTest, StringReference) {
- TestStringReference(/* string_offset*/ 0x87651234);
-}
-
-} // namespace linker
-} // namespace art
diff --git a/dex2oat/linker/mips/relative_patcher_mips_test.cc b/dex2oat/linker/mips/relative_patcher_mips_test.cc
deleted file mode 100644
index d876c76..0000000
--- a/dex2oat/linker/mips/relative_patcher_mips_test.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "linker/mips/relative_patcher_mips.h"
-
-#include "linker/relative_patcher_test.h"
-
-namespace art {
-namespace linker {
-
-class MipsRelativePatcherTest : public RelativePatcherTest {
- public:
- MipsRelativePatcherTest() : RelativePatcherTest(InstructionSet::kMips, "mips32r2") {}
-
- protected:
- static const uint8_t kUnpatchedPcRelativeRawCode[];
- static const uint32_t kLiteralOffsetHigh;
- static const uint32_t kLiteralOffsetLow1;
- static const uint32_t kLiteralOffsetLow2;
- static const uint32_t kAnchorOffset;
- static const ArrayRef<const uint8_t> kUnpatchedPcRelativeCode;
-
- uint32_t GetMethodOffset(uint32_t method_idx) {
- auto result = method_offset_map_.FindMethodOffset(MethodRef(method_idx));
- CHECK(result.first);
- return result.second;
- }
-
- void CheckPcRelativePatch(const ArrayRef<const LinkerPatch>& patches, uint32_t target_offset);
- void TestStringBssEntry(uint32_t bss_begin, uint32_t string_entry_offset);
- void TestStringReference(uint32_t string_offset);
-};
-
-const uint8_t MipsRelativePatcherTest::kUnpatchedPcRelativeRawCode[] = {
- 0x00, 0x00, 0x10, 0x04, // nal
- 0x34, 0x12, 0x12, 0x3C, // lui s2, high(diff); placeholder = 0x1234
- 0x21, 0x90, 0x5F, 0x02, // addu s2, s2, ra
- 0x78, 0x56, 0x52, 0x26, // addiu s2, s2, low(diff); placeholder = 0x5678
- 0x78, 0x56, 0x52, 0x8E, // lw s2, (low(diff))(s2) ; placeholder = 0x5678
-};
-const uint32_t MipsRelativePatcherTest::kLiteralOffsetHigh = 4; // At lui.
-const uint32_t MipsRelativePatcherTest::kLiteralOffsetLow1 = 12; // At addiu.
-const uint32_t MipsRelativePatcherTest::kLiteralOffsetLow2 = 16; // At lw.
-const uint32_t MipsRelativePatcherTest::kAnchorOffset = 8; // At addu (where PC+0 points).
-const ArrayRef<const uint8_t> MipsRelativePatcherTest::kUnpatchedPcRelativeCode(
- kUnpatchedPcRelativeRawCode);
-
-void MipsRelativePatcherTest::CheckPcRelativePatch(const ArrayRef<const LinkerPatch>& patches,
- uint32_t target_offset) {
- AddCompiledMethod(MethodRef(1u), kUnpatchedPcRelativeCode, ArrayRef<const LinkerPatch>(patches));
- Link();
-
- auto result = method_offset_map_.FindMethodOffset(MethodRef(1u));
- ASSERT_TRUE(result.first);
-
- uint32_t diff = target_offset - (result.second + kAnchorOffset);
- diff += (diff & 0x8000) << 1; // Account for sign extension in addiu/lw.
-
- const uint8_t expected_code[] = {
- 0x00, 0x00, 0x10, 0x04,
- static_cast<uint8_t>(diff >> 16), static_cast<uint8_t>(diff >> 24), 0x12, 0x3C,
- 0x21, 0x90, 0x5F, 0x02,
- static_cast<uint8_t>(diff), static_cast<uint8_t>(diff >> 8), 0x52, 0x26,
- static_cast<uint8_t>(diff), static_cast<uint8_t>(diff >> 8), 0x52, 0x8E,
- };
- EXPECT_TRUE(CheckLinkedMethod(MethodRef(1u), ArrayRef<const uint8_t>(expected_code)));
-}
-
-void MipsRelativePatcherTest::TestStringBssEntry(uint32_t bss_begin,
- uint32_t string_entry_offset) {
- constexpr uint32_t kStringIndex = 1u;
- string_index_to_offset_map_.Put(kStringIndex, string_entry_offset);
- bss_begin_ = bss_begin;
- LinkerPatch patches[] = {
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetHigh, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetLow1, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetLow2, nullptr, kAnchorOffset, kStringIndex)
- };
- CheckPcRelativePatch(ArrayRef<const LinkerPatch>(patches), bss_begin_ + string_entry_offset);
-}
-
-void MipsRelativePatcherTest::TestStringReference(uint32_t string_offset) {
- constexpr uint32_t kStringIndex = 1u;
- string_index_to_offset_map_.Put(kStringIndex, string_offset);
- LinkerPatch patches[] = {
- LinkerPatch::RelativeStringPatch(kLiteralOffsetHigh, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::RelativeStringPatch(kLiteralOffsetLow1, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::RelativeStringPatch(kLiteralOffsetLow2, nullptr, kAnchorOffset, kStringIndex)
- };
- CheckPcRelativePatch(ArrayRef<const LinkerPatch>(patches), string_offset);
-}
-
-TEST_F(MipsRelativePatcherTest, StringBssEntry) {
- TestStringBssEntry(/* bss_begin */ 0x12345678, /* string_entry_offset */ 0x1234);
-}
-
-TEST_F(MipsRelativePatcherTest, StringReference) {
- TestStringReference(/* string_offset*/ 0x87651234);
-}
-
-} // namespace linker
-} // namespace art
diff --git a/dex2oat/linker/mips64/relative_patcher_mips64.cc b/dex2oat/linker/mips64/relative_patcher_mips64.cc
deleted file mode 100644
index 2992487..0000000
--- a/dex2oat/linker/mips64/relative_patcher_mips64.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "linker/mips64/relative_patcher_mips64.h"
-
-#include "compiled_method.h"
-#include "debug/method_debug_info.h"
-#include "linker/linker_patch.h"
-
-namespace art {
-namespace linker {
-
-uint32_t Mips64RelativePatcher::ReserveSpace(
- uint32_t offset,
- const CompiledMethod* compiled_method ATTRIBUTE_UNUSED,
- MethodReference method_ref ATTRIBUTE_UNUSED) {
- return offset; // No space reserved; no limit on relative call distance.
-}
-
-uint32_t Mips64RelativePatcher::ReserveSpaceEnd(uint32_t offset) {
- return offset; // No space reserved; no limit on relative call distance.
-}
-
-uint32_t Mips64RelativePatcher::WriteThunks(OutputStream* out ATTRIBUTE_UNUSED, uint32_t offset) {
- return offset; // No thunks added; no limit on relative call distance.
-}
-
-void Mips64RelativePatcher::PatchCall(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
- uint32_t literal_offset ATTRIBUTE_UNUSED,
- uint32_t patch_offset ATTRIBUTE_UNUSED,
- uint32_t target_offset ATTRIBUTE_UNUSED) {
- UNIMPLEMENTED(FATAL) << "PatchCall unimplemented on MIPS64";
-}
-
-void Mips64RelativePatcher::PatchPcRelativeReference(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset,
- uint32_t target_offset) {
- uint32_t anchor_literal_offset = patch.PcInsnOffset();
- uint32_t literal_offset = patch.LiteralOffset();
- bool high_patch = ((*code)[literal_offset + 0] == 0x34) && ((*code)[literal_offset + 1] == 0x12);
-
- // Perform basic sanity checks.
- if (high_patch) {
- // auipc reg, offset_high
- DCHECK_EQ(((*code)[literal_offset + 2] & 0x1F), 0x1E);
- DCHECK_EQ(((*code)[literal_offset + 3] & 0xFC), 0xEC);
- } else {
- // instr reg(s), offset_low
- CHECK_EQ((*code)[literal_offset + 0], 0x78);
- CHECK_EQ((*code)[literal_offset + 1], 0x56);
- }
-
- // Apply patch.
- uint32_t anchor_offset = patch_offset - literal_offset + anchor_literal_offset;
- uint32_t diff = target_offset - anchor_offset;
- // Note that a combination of auipc with an instruction that adds a sign-extended
- // 16-bit immediate operand (e.g. ld) provides a PC-relative range of
- // PC-0x80000000 to PC+0x7FFF7FFF on MIPS64, that is, short of 2GB on one end
- // by 32KB.
- diff += (diff & 0x8000) << 1; // Account for sign extension in "instr reg(s), offset_low".
-
- if (high_patch) {
- // auipc reg, offset_high
- (*code)[literal_offset + 0] = static_cast<uint8_t>(diff >> 16);
- (*code)[literal_offset + 1] = static_cast<uint8_t>(diff >> 24);
- } else {
- // instr reg(s), offset_low
- (*code)[literal_offset + 0] = static_cast<uint8_t>(diff >> 0);
- (*code)[literal_offset + 1] = static_cast<uint8_t>(diff >> 8);
- }
-}
-
-void Mips64RelativePatcher::PatchEntrypointCall(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
- const LinkerPatch& patch ATTRIBUTE_UNUSED,
- uint32_t patch_offset ATTRIBUTE_UNUSED) {
- LOG(FATAL) << "UNIMPLEMENTED";
-}
-
-void Mips64RelativePatcher::PatchBakerReadBarrierBranch(std::vector<uint8_t>* code ATTRIBUTE_UNUSED,
- const LinkerPatch& patch ATTRIBUTE_UNUSED,
- uint32_t patch_offset ATTRIBUTE_UNUSED) {
- LOG(FATAL) << "UNIMPLEMENTED";
-}
-
-std::vector<debug::MethodDebugInfo> Mips64RelativePatcher::GenerateThunkDebugInfo(
- uint32_t executable_offset ATTRIBUTE_UNUSED) {
- return std::vector<debug::MethodDebugInfo>(); // No thunks added.
-}
-
-} // namespace linker
-} // namespace art
diff --git a/dex2oat/linker/mips64/relative_patcher_mips64.h b/dex2oat/linker/mips64/relative_patcher_mips64.h
deleted file mode 100644
index 9d27b87..0000000
--- a/dex2oat/linker/mips64/relative_patcher_mips64.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_DEX2OAT_LINKER_MIPS64_RELATIVE_PATCHER_MIPS64_H_
-#define ART_DEX2OAT_LINKER_MIPS64_RELATIVE_PATCHER_MIPS64_H_
-
-#include "linker/relative_patcher.h"
-
-namespace art {
-namespace linker {
-
-class Mips64RelativePatcher final : public RelativePatcher {
- public:
- Mips64RelativePatcher() {}
-
- uint32_t ReserveSpace(uint32_t offset,
- const CompiledMethod* compiled_method,
- MethodReference method_ref) override;
- uint32_t ReserveSpaceEnd(uint32_t offset) override;
- uint32_t WriteThunks(OutputStream* out, uint32_t offset) override;
- void PatchCall(std::vector<uint8_t>* code,
- uint32_t literal_offset,
- uint32_t patch_offset,
- uint32_t target_offset) override;
- void PatchPcRelativeReference(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset,
- uint32_t target_offset) override;
- void PatchEntrypointCall(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset) override;
- void PatchBakerReadBarrierBranch(std::vector<uint8_t>* code,
- const LinkerPatch& patch,
- uint32_t patch_offset) override;
- std::vector<debug::MethodDebugInfo> GenerateThunkDebugInfo(uint32_t executable_offset) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Mips64RelativePatcher);
-};
-
-} // namespace linker
-} // namespace art
-
-#endif // ART_DEX2OAT_LINKER_MIPS64_RELATIVE_PATCHER_MIPS64_H_
diff --git a/dex2oat/linker/mips64/relative_patcher_mips64_test.cc b/dex2oat/linker/mips64/relative_patcher_mips64_test.cc
deleted file mode 100644
index a02f500..0000000
--- a/dex2oat/linker/mips64/relative_patcher_mips64_test.cc
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "linker/mips64/relative_patcher_mips64.h"
-
-#include "linker/relative_patcher_test.h"
-
-namespace art {
-namespace linker {
-
-class Mips64RelativePatcherTest : public RelativePatcherTest {
- public:
- Mips64RelativePatcherTest() : RelativePatcherTest(InstructionSet::kMips64, "default") {}
-
- protected:
- static const uint8_t kUnpatchedPcRelativeRawCode[];
- static const uint8_t kUnpatchedPcRelativeCallRawCode[];
- static const uint32_t kLiteralOffsetHigh;
- static const uint32_t kLiteralOffsetLow1;
- static const uint32_t kLiteralOffsetLow2;
- static const uint32_t kAnchorOffset;
- static const ArrayRef<const uint8_t> kUnpatchedPcRelativeCode;
-
- uint32_t GetMethodOffset(uint32_t method_idx) {
- auto result = method_offset_map_.FindMethodOffset(MethodRef(method_idx));
- CHECK(result.first);
- return result.second;
- }
-
- void CheckPcRelativePatch(const ArrayRef<const LinkerPatch>& patches, uint32_t target_offset);
- void TestStringBssEntry(uint32_t bss_begin, uint32_t string_entry_offset);
- void TestStringReference(uint32_t string_offset);
-};
-
-const uint8_t Mips64RelativePatcherTest::kUnpatchedPcRelativeRawCode[] = {
- 0x34, 0x12, 0x5E, 0xEE, // auipc s2, high(diff); placeholder = 0x1234
- 0x78, 0x56, 0x52, 0x66, // daddiu s2, s2, low(diff); placeholder = 0x5678
- 0x78, 0x56, 0x52, 0x9E, // lwu s2, (low(diff))(s2) ; placeholder = 0x5678
-};
-const uint32_t Mips64RelativePatcherTest::kLiteralOffsetHigh = 0; // At auipc.
-const uint32_t Mips64RelativePatcherTest::kLiteralOffsetLow1 = 4; // At daddiu.
-const uint32_t Mips64RelativePatcherTest::kLiteralOffsetLow2 = 8; // At lwu.
-const uint32_t Mips64RelativePatcherTest::kAnchorOffset = 0; // At auipc (where PC+0 points).
-const ArrayRef<const uint8_t> Mips64RelativePatcherTest::kUnpatchedPcRelativeCode(
- kUnpatchedPcRelativeRawCode);
-
-void Mips64RelativePatcherTest::CheckPcRelativePatch(const ArrayRef<const LinkerPatch>& patches,
- uint32_t target_offset) {
- AddCompiledMethod(MethodRef(1u), kUnpatchedPcRelativeCode, ArrayRef<const LinkerPatch>(patches));
- Link();
-
- auto result = method_offset_map_.FindMethodOffset(MethodRef(1u));
- ASSERT_TRUE(result.first);
-
- uint32_t diff = target_offset - (result.second + kAnchorOffset);
- diff += (diff & 0x8000) << 1; // Account for sign extension in daddiu/lwu.
-
- const uint8_t expected_code[] = {
- static_cast<uint8_t>(diff >> 16), static_cast<uint8_t>(diff >> 24), 0x5E, 0xEE,
- static_cast<uint8_t>(diff), static_cast<uint8_t>(diff >> 8), 0x52, 0x66,
- static_cast<uint8_t>(diff), static_cast<uint8_t>(diff >> 8), 0x52, 0x9E,
- };
- EXPECT_TRUE(CheckLinkedMethod(MethodRef(1u), ArrayRef<const uint8_t>(expected_code)));
-}
-
-void Mips64RelativePatcherTest::TestStringBssEntry(uint32_t bss_begin,
- uint32_t string_entry_offset) {
- constexpr uint32_t kStringIndex = 1u;
- string_index_to_offset_map_.Put(kStringIndex, string_entry_offset);
- bss_begin_ = bss_begin;
- LinkerPatch patches[] = {
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetHigh, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetLow1, nullptr, kAnchorOffset, kStringIndex),
- LinkerPatch::StringBssEntryPatch(kLiteralOffsetLow2, nullptr, kAnchorOffset, kStringIndex)
- };
- CheckPcRelativePatch(ArrayRef<const LinkerPatch>(patches), bss_begin_ + string_entry_offset);
-}
-
-TEST_F(Mips64RelativePatcherTest, StringBssEntry) {
- TestStringBssEntry(/* bss_begin */ 0x12345678, /* string_entry_offset */ 0x1234);
-}
-
-} // namespace linker
-} // namespace art
diff --git a/dex2oat/linker/relative_patcher.cc b/dex2oat/linker/relative_patcher.cc
index f746cfb..40acb0b 100644
--- a/dex2oat/linker/relative_patcher.cc
+++ b/dex2oat/linker/relative_patcher.cc
@@ -23,12 +23,6 @@
#ifdef ART_ENABLE_CODEGEN_arm64
#include "linker/arm64/relative_patcher_arm64.h"
#endif
-#ifdef ART_ENABLE_CODEGEN_mips
-#include "linker/mips/relative_patcher_mips.h"
-#endif
-#ifdef ART_ENABLE_CODEGEN_mips64
-#include "linker/mips64/relative_patcher_mips64.h"
-#endif
#ifdef ART_ENABLE_CODEGEN_x86
#include "linker/x86/relative_patcher_x86.h"
#endif
@@ -124,15 +118,6 @@
target_provider,
features->AsArm64InstructionSetFeatures()));
#endif
-#ifdef ART_ENABLE_CODEGEN_mips
- case InstructionSet::kMips:
- return std::unique_ptr<RelativePatcher>(
- new MipsRelativePatcher(features->AsMipsInstructionSetFeatures()));
-#endif
-#ifdef ART_ENABLE_CODEGEN_mips64
- case InstructionSet::kMips64:
- return std::unique_ptr<RelativePatcher>(new Mips64RelativePatcher());
-#endif
default:
return std::unique_ptr<RelativePatcher>(new RelativePatcherNone);
}
diff --git a/oatdump/oatdump_image_test.cc b/oatdump/oatdump_image_test.cc
index 0a076f0..6270105 100644
--- a/oatdump/oatdump_image_test.cc
+++ b/oatdump/oatdump_image_test.cc
@@ -18,32 +18,30 @@
namespace art {
-// Disable tests on arm and mips as they are taking too long to run. b/27824283.
-#define TEST_DISABLED_FOR_ARM_AND_MIPS() \
+// Disable tests on arm and arm64 as they are taking too long to run. b/27824283.
+#define TEST_DISABLED_FOR_ARM_AND_ARM64() \
TEST_DISABLED_FOR_ARM(); \
TEST_DISABLED_FOR_ARM64(); \
- TEST_DISABLED_FOR_MIPS(); \
- TEST_DISABLED_FOR_MIPS64(); \
TEST_F(OatDumpTest, TestImage) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
std::string error_msg;
ASSERT_TRUE(Exec(kDynamic, kModeArt, {}, kListAndCode));
}
TEST_F(OatDumpTest, TestImageStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(Exec(kStatic, kModeArt, {}, kListAndCode));
}
TEST_F(OatDumpTest, TestOatImage) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
std::string error_msg;
ASSERT_TRUE(Exec(kDynamic, kModeCoreOat, {}, kListAndCode));
}
TEST_F(OatDumpTest, TestOatImageStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(Exec(kStatic, kModeCoreOat, {}, kListAndCode));
diff --git a/oatdump/oatdump_test.cc b/oatdump/oatdump_test.cc
index 506fde7..5a91013 100644
--- a/oatdump/oatdump_test.cc
+++ b/oatdump/oatdump_test.cc
@@ -20,75 +20,73 @@
namespace art {
-// Disable tests on arm and mips as they are taking too long to run. b/27824283.
-#define TEST_DISABLED_FOR_ARM_AND_MIPS() \
+// Disable tests on arm and arm64 as they are taking too long to run. b/27824283.
+#define TEST_DISABLED_FOR_ARM_AND_ARM64() \
TEST_DISABLED_FOR_ARM(); \
TEST_DISABLED_FOR_ARM64(); \
- TEST_DISABLED_FOR_MIPS(); \
- TEST_DISABLED_FOR_MIPS64(); \
TEST_F(OatDumpTest, TestNoDumpVmap) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
std::string error_msg;
ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--no-dump:vmap"}, kListAndCode));
}
TEST_F(OatDumpTest, TestNoDumpVmapStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(Exec(kStatic, kModeArt, {"--no-dump:vmap"}, kListAndCode));
}
TEST_F(OatDumpTest, TestNoDisassemble) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
std::string error_msg;
ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--no-disassemble"}, kListAndCode));
}
TEST_F(OatDumpTest, TestNoDisassembleStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(Exec(kStatic, kModeArt, {"--no-disassemble"}, kListAndCode));
}
TEST_F(OatDumpTest, TestListClasses) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
std::string error_msg;
ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--list-classes"}, kListOnly));
}
TEST_F(OatDumpTest, TestListClassesStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(Exec(kStatic, kModeArt, {"--list-classes"}, kListOnly));
}
TEST_F(OatDumpTest, TestListMethods) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
std::string error_msg;
ASSERT_TRUE(Exec(kDynamic, kModeArt, {"--list-methods"}, kListOnly));
}
TEST_F(OatDumpTest, TestListMethodsStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(Exec(kStatic, kModeArt, {"--list-methods"}, kListOnly));
}
TEST_F(OatDumpTest, TestSymbolize) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
std::string error_msg;
ASSERT_TRUE(Exec(kDynamic, kModeSymbolize, {}, kListOnly));
}
TEST_F(OatDumpTest, TestSymbolizeStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(Exec(kStatic, kModeSymbolize, {}, kListOnly));
}
TEST_F(OatDumpTest, TestExportDex) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
// Test is failing on target, b/77469384.
TEST_DISABLED_FOR_TARGET();
std::string error_msg;
@@ -106,7 +104,7 @@
ASSERT_TRUE(res.StandardSuccess());
}
TEST_F(OatDumpTest, TestExportDexStatic) {
- TEST_DISABLED_FOR_ARM_AND_MIPS();
+ TEST_DISABLED_FOR_ARM_AND_ARM64();
TEST_DISABLED_FOR_NON_STATIC_HOST_BUILDS();
std::string error_msg;
ASSERT_TRUE(GenerateAppOdexFile(kStatic, {"--runtime-arg", "-Xmx64M"}));