diff options
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/arm/jni_macro_assembler_arm_vixl.cc | 15 | ||||
-rw-r--r-- | compiler/utils/arm64/jni_macro_assembler_arm64.cc | 15 | ||||
-rw-r--r-- | compiler/utils/test_dex_file_builder.h | 9 |
3 files changed, 35 insertions, 4 deletions
diff --git a/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc b/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc index edb3292ea7..0bae4d4b69 100644 --- a/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc +++ b/compiler/utils/arm/jni_macro_assembler_arm_vixl.cc @@ -164,6 +164,21 @@ void ArmVIXLJNIMacroAssembler::RemoveFrame(size_t frame_size, // AAPCS calling convention. DCHECK_NE(core_spill_mask & (1 << MR), 0) << "core_spill_mask should contain Marking Register R" << MR; + + // The following condition is a compile-time one, so it does not have a run-time cost. + if (kIsDebugBuild) { + // The following condition is a run-time one; it is executed after the + // previous compile-time test, to avoid penalizing non-debug builds. + if (emit_run_time_checks_in_debug_mode_) { + // Emit a run-time check verifying that the Marking Register is up-to-date. + UseScratchRegisterScope temps(asm_.GetVIXLAssembler()); + vixl32::Register temp = temps.Acquire(); + // Ensure we are not clobbering a callee-save register that was restored before. + DCHECK_EQ(core_spill_mask & (1 << temp.GetCode()), 0) + << "core_spill_mask hould not contain scratch register R" << temp.GetCode(); + asm_.GenerateMarkingRegisterCheck(temp); + } + } } } diff --git a/compiler/utils/arm64/jni_macro_assembler_arm64.cc b/compiler/utils/arm64/jni_macro_assembler_arm64.cc index 43c0eff8fc..573bb6d4be 100644 --- a/compiler/utils/arm64/jni_macro_assembler_arm64.cc +++ b/compiler/utils/arm64/jni_macro_assembler_arm64.cc @@ -788,6 +788,21 @@ void Arm64JNIMacroAssembler::RemoveFrame(size_t frame_size, // AAPCS64 calling convention. DCHECK(core_reg_list.IncludesAliasOf(mr)) << "core_reg_list should contain Marking Register X" << mr.GetCode(); + + // The following condition is a compile-time one, so it does not have a run-time cost. + if (kIsDebugBuild) { + // The following condition is a run-time one; it is executed after the + // previous compile-time test, to avoid penalizing non-debug builds. + if (emit_run_time_checks_in_debug_mode_) { + // Emit a run-time check verifying that the Marking Register is up-to-date. + UseScratchRegisterScope temps(asm_.GetVIXLAssembler()); + Register temp = temps.AcquireW(); + // Ensure we are not clobbering a callee-save register that was restored before. + DCHECK(!core_reg_list.IncludesAliasOf(temp.X())) + << "core_reg_list should not contain scratch register X" << temp.GetCode(); + asm_.GenerateMarkingRegisterCheck(temp); + } + } } } diff --git a/compiler/utils/test_dex_file_builder.h b/compiler/utils/test_dex_file_builder.h index 9ba3903033..e6501e0b83 100644 --- a/compiler/utils/test_dex_file_builder.h +++ b/compiler/utils/test_dex_file_builder.h @@ -26,7 +26,8 @@ #include "base/bit_utils.h" #include "base/logging.h" -#include "dex_file.h" +#include "dex_file_loader.h" +#include "native_dex_file.h" namespace art { @@ -88,8 +89,8 @@ class TestDexFileBuilder { } header_data; std::memset(header_data.data, 0, sizeof(header_data.data)); DexFile::Header* header = reinterpret_cast<DexFile::Header*>(&header_data.data); - std::copy_n(DexFile::kDexMagic, 4u, header->magic_); - std::copy_n(DexFile::kDexMagicVersions[0], 4u, header->magic_ + 4u); + std::copy_n(NativeDexFile::kDexMagic, 4u, header->magic_); + std::copy_n(NativeDexFile::kDexMagicVersions[0], 4u, header->magic_ + 4u); header->header_size_ = sizeof(DexFile::Header); header->endian_tag_ = DexFile::kDexEndianConstant; header->link_size_ = 0u; // Unused. @@ -231,7 +232,7 @@ class TestDexFileBuilder { static constexpr bool kVerify = false; static constexpr bool kVerifyChecksum = false; std::string error_msg; - std::unique_ptr<const DexFile> dex_file(DexFile::Open( + std::unique_ptr<const DexFile> dex_file(DexFileLoader::Open( &dex_file_data_[0], dex_file_data_.size(), dex_location, |