diff options
author | Vladimir Marko <vmarko@google.com> | 2014-02-04 18:04:58 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-02-04 18:04:59 +0000 |
commit | 9e64cabda36bd7b30f2fd873750fdc17e5931358 (patch) | |
tree | 79d721ac99e8b66e60ee1b6194156e742ce55d51 | |
parent | c293218e89bb53ce34c022e97437c18fcbf3b609 (diff) | |
parent | 64cffee929a1782622015fd18beebc86d0afb1da (diff) | |
download | art-9e64cabda36bd7b30f2fd873750fdc17e5931358.zip art-9e64cabda36bd7b30f2fd873750fdc17e5931358.tar.gz art-9e64cabda36bd7b30f2fd873750fdc17e5931358.tar.bz2 |
Merge "Make DexCache references const."
-rw-r--r-- | runtime/mirror/class-inl.h | 12 | ||||
-rw-r--r-- | runtime/mirror/class.h | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h index 8aa8333..8ddaeb2 100644 --- a/runtime/mirror/class-inl.h +++ b/runtime/mirror/class-inl.h @@ -205,13 +205,13 @@ inline bool Class::IsAssignableFromArray(const Class* src) const { template <bool throw_on_failure, bool use_referrers_cache> inline bool Class::ResolvedFieldAccessTest(Class* access_to, ArtField* field, - uint32_t field_idx, DexCache* dex_cache) { + uint32_t field_idx, const DexCache* dex_cache) { DCHECK_EQ(use_referrers_cache, dex_cache == nullptr); if (UNLIKELY(!this->CanAccess(access_to))) { // The referrer class can't access the field's declaring class but may still be able // to access the field if the FieldId specifies an accessible subclass of the declaring // class rather than the declaring class itself. - DexCache* referrer_dex_cache = use_referrers_cache ? this->GetDexCache() : dex_cache; + const DexCache* referrer_dex_cache = use_referrers_cache ? this->GetDexCache() : dex_cache; uint32_t class_idx = referrer_dex_cache->GetDexFile()->GetFieldId(field_idx).class_idx_; // The referenced class has already been resolved with the field, get it from the dex cache. Class* dex_access_to = referrer_dex_cache->GetResolvedType(class_idx); @@ -236,14 +236,14 @@ inline bool Class::ResolvedFieldAccessTest(Class* access_to, ArtField* field, template <bool throw_on_failure, bool use_referrers_cache, InvokeType throw_invoke_type> inline bool Class::ResolvedMethodAccessTest(Class* access_to, ArtMethod* method, - uint32_t method_idx, DexCache* dex_cache) { + uint32_t method_idx, const DexCache* dex_cache) { COMPILE_ASSERT(throw_on_failure || throw_invoke_type == kStatic, non_default_throw_invoke_type); DCHECK_EQ(use_referrers_cache, dex_cache == nullptr); if (UNLIKELY(!this->CanAccess(access_to))) { // The referrer class can't access the method's declaring class but may still be able // to access the method if the MethodId specifies an accessible subclass of the declaring // class rather than the declaring class itself. - DexCache* referrer_dex_cache = use_referrers_cache ? this->GetDexCache() : dex_cache; + const DexCache* referrer_dex_cache = use_referrers_cache ? this->GetDexCache() : dex_cache; uint32_t class_idx = referrer_dex_cache->GetDexFile()->GetMethodId(method_idx).class_idx_; // The referenced class has already been resolved with the method, get it from the dex cache. Class* dex_access_to = referrer_dex_cache->GetResolvedType(class_idx); @@ -268,7 +268,7 @@ inline bool Class::ResolvedMethodAccessTest(Class* access_to, ArtMethod* method, } inline bool Class::CanAccessResolvedField(Class* access_to, ArtField* field, - DexCache& dex_cache, uint32_t field_idx) { + const DexCache& dex_cache, uint32_t field_idx) { return ResolvedFieldAccessTest<false, false>(access_to, field, field_idx, &dex_cache); } @@ -278,7 +278,7 @@ inline bool Class::CheckResolvedFieldAccess(Class* access_to, ArtField* field, } inline bool Class::CanAccessResolvedMethod(Class* access_to, ArtMethod* method, - DexCache& dex_cache, uint32_t method_idx) { + const DexCache& dex_cache, uint32_t method_idx) { return ResolvedMethodAccessTest<false, false, kStatic>(access_to, method, method_idx, &dex_cache); } diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h index 8071d79..a692381 100644 --- a/runtime/mirror/class.h +++ b/runtime/mirror/class.h @@ -454,7 +454,7 @@ class MANAGED Class : public Object { // Note that access to field's class is checked and this may require looking up the class // referenced by the FieldId in the DexFile in case the declaring class is inaccessible. bool CanAccessResolvedField(Class* access_to, ArtField* field, - DexCache& dex_cache, uint32_t field_idx) + const DexCache& dex_cache, uint32_t field_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool CheckResolvedFieldAccess(Class* access_to, ArtField* field, uint32_t field_idx) @@ -464,7 +464,7 @@ class MANAGED Class : public Object { // Note that access to methods's class is checked and this may require looking up the class // referenced by the MethodId in the DexFile in case the declaring class is inaccessible. bool CanAccessResolvedMethod(Class* access_to, ArtMethod* resolved_method, - DexCache& dex_cache, uint32_t method_idx) + const DexCache& dex_cache, uint32_t method_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); template <InvokeType throw_invoke_type> bool CheckResolvedMethodAccess(Class* access_to, ArtMethod* resolved_method, @@ -817,11 +817,11 @@ class MANAGED Class : public Object { template <bool throw_on_failure, bool use_referrers_cache> bool ResolvedFieldAccessTest(Class* access_to, ArtField* field, - uint32_t field_idx, DexCache* dex_cache) + uint32_t field_idx, const DexCache* dex_cache) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); template <bool throw_on_failure, bool use_referrers_cache, InvokeType throw_invoke_type> bool ResolvedMethodAccessTest(Class* access_to, ArtMethod* resolved_method, - uint32_t method_idx, DexCache* dex_cache) + uint32_t method_idx, const DexCache* dex_cache) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); bool Implements(const Class* klass) const |