Small changes in ARM and x86-64 SystemArrayCopy intrinsics.
Have these intrinsics share a more uniform style with the
ARM64 SystemArrayCopy intrinsic.
Also make some changes/improvements in:
- art::IntrinsicOptimizations
- art::arm64::GenSystemArrayCopyAddresses
Change-Id: Ieeb224795229580f8e5f7219c586d04786d8c705
diff --git a/compiler/optimizing/intrinsics.h b/compiler/optimizing/intrinsics.h
index 3da8285..863dd1c 100644
--- a/compiler/optimizing/intrinsics.h
+++ b/compiler/optimizing/intrinsics.h
@@ -124,11 +124,12 @@
void Set##name() { SetBit(k##name); } \
bool Get##name() const { return IsBitSet(k##name); } \
private: \
-static constexpr int k##name = bit
+static constexpr size_t k##name = bit
class IntrinsicOptimizations : public ValueObject {
public:
- explicit IntrinsicOptimizations(HInvoke* invoke) : value_(invoke->GetIntrinsicOptimizations()) {}
+ explicit IntrinsicOptimizations(HInvoke* invoke)
+ : value_(invoke->GetIntrinsicOptimizations()) {}
explicit IntrinsicOptimizations(const HInvoke& invoke)
: value_(invoke.GetIntrinsicOptimizations()) {}
@@ -138,15 +139,17 @@
protected:
bool IsBitSet(uint32_t bit) const {
+ DCHECK_LT(bit, sizeof(uint32_t) * kBitsPerByte);
return (*value_ & (1 << bit)) != 0u;
}
void SetBit(uint32_t bit) {
- *(const_cast<uint32_t*>(value_)) |= (1 << bit);
+ DCHECK_LT(bit, sizeof(uint32_t) * kBitsPerByte);
+ *(const_cast<uint32_t* const>(value_)) |= (1 << bit);
}
private:
- const uint32_t *value_;
+ const uint32_t* const value_;
DISALLOW_COPY_AND_ASSIGN(IntrinsicOptimizations);
};
@@ -158,7 +161,7 @@
void Set##name() { SetBit(k##name); } \
bool Get##name() const { return IsBitSet(k##name); } \
private: \
-static constexpr int k##name = bit + kNumberOfGenericOptimizations
+static constexpr size_t k##name = bit + kNumberOfGenericOptimizations
class StringEqualsOptimizations : public IntrinsicOptimizations {
public: