diff options
author | Vladimir Marko <vmarko@google.com> | 2015-10-01 20:57:57 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2015-10-08 11:10:18 +0100 |
commit | ec7802a102d49ab5c17495118d4fe0bcc7287beb (patch) | |
tree | 08649609604b9c96bc48ca071c48b0af5abb1a3f /compiler/linker | |
parent | b2e436ffcda1d7a87e7bf9133d8ed878388c73c2 (diff) | |
download | art-ec7802a102d49ab5c17495118d4fe0bcc7287beb.tar.gz art-ec7802a102d49ab5c17495118d4fe0bcc7287beb.tar.bz2 art-ec7802a102d49ab5c17495118d4fe0bcc7287beb.zip |
Add DCHECKs to ArenaVector and ScopedArenaVector.
Implement dchecked_vector<> template that DCHECK()s element
access and insert()/emplace()/erase() positions. Change the
ArenaVector<> and ScopedArenaVector<> aliases to use the new
template instead of std::vector<>. Remove DCHECK()s that
have now become unnecessary from the Optimizing compiler.
Change-Id: Ib8506bd30d223f68f52bd4476c76d9991acacadc
Diffstat (limited to 'compiler/linker')
-rw-r--r-- | compiler/linker/arm/relative_patcher_thumb2.cc | 5 | ||||
-rw-r--r-- | compiler/linker/arm/relative_patcher_thumb2.h | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/compiler/linker/arm/relative_patcher_thumb2.cc b/compiler/linker/arm/relative_patcher_thumb2.cc index a3e889f0f6..5f4f760c14 100644 --- a/compiler/linker/arm/relative_patcher_thumb2.cc +++ b/compiler/linker/arm/relative_patcher_thumb2.cc @@ -110,8 +110,9 @@ uint32_t Thumb2RelativePatcher::GetInsn32(ArrayRef<const uint8_t> code, uint32_t (static_cast<uint32_t>(addr[3]) << 8); } -template <typename Alloc> -uint32_t Thumb2RelativePatcher::GetInsn32(std::vector<uint8_t, Alloc>* code, uint32_t offset) { +template <typename Vector> +uint32_t Thumb2RelativePatcher::GetInsn32(Vector* code, uint32_t offset) { + static_assert(std::is_same<typename Vector::value_type, uint8_t>::value, "Invalid value type"); return GetInsn32(ArrayRef<const uint8_t>(*code), offset); } diff --git a/compiler/linker/arm/relative_patcher_thumb2.h b/compiler/linker/arm/relative_patcher_thumb2.h index 2d474c2db0..006d6fb9d5 100644 --- a/compiler/linker/arm/relative_patcher_thumb2.h +++ b/compiler/linker/arm/relative_patcher_thumb2.h @@ -37,8 +37,8 @@ class Thumb2RelativePatcher FINAL : public ArmBaseRelativePatcher { void SetInsn32(std::vector<uint8_t>* code, uint32_t offset, uint32_t value); static uint32_t GetInsn32(ArrayRef<const uint8_t> code, uint32_t offset); - template <typename Alloc> - static uint32_t GetInsn32(std::vector<uint8_t, Alloc>* code, uint32_t offset); + template <typename Vector> + static uint32_t GetInsn32(Vector* code, uint32_t offset); // PC displacement from patch location; Thumb2 PC is always at instruction address + 4. static constexpr int32_t kPcDisplacement = 4; |