diff options
| author | 2018-01-31 17:02:31 +0000 | |
|---|---|---|
| committer | 2018-01-31 17:02:31 +0000 | |
| commit | 02e33ab15593a5944e711f78f8f5e1d81a94c856 (patch) | |
| tree | bb0c6354518f21af959deae8b839f4b45e4efeaa | |
| parent | f346af51a5d44ee0a3cd26e7e0e1b28ec1c5579f (diff) | |
| parent | aa129ff1bffdd6cbfe159f9381ba0babf42dddbd (diff) | |
Merge "Do not DCHECK intrinsics with hidden API flags"
| -rw-r--r-- | runtime/art_method-inl.h | 28 | ||||
| -rw-r--r-- | runtime/art_method.h | 3 |
2 files changed, 27 insertions, 4 deletions
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h index 65bacd8237..7075ddbe9a 100644 --- a/runtime/art_method-inl.h +++ b/runtime/art_method-inl.h @@ -377,6 +377,22 @@ inline bool ArtMethod::HasSingleImplementation() { return (GetAccessFlags() & kAccSingleImplementation) != 0; } +inline bool ArtMethod::IsHiddenIntrinsic(uint32_t ordinal) { + switch (static_cast<Intrinsics>(ordinal)) { + case Intrinsics::kReferenceGetReferent: + case Intrinsics::kSystemArrayCopyChar: + case Intrinsics::kStringGetCharsNoCheck: + case Intrinsics::kVarHandleFullFence: + case Intrinsics::kVarHandleAcquireFence: + case Intrinsics::kVarHandleReleaseFence: + case Intrinsics::kVarHandleLoadLoadFence: + case Intrinsics::kVarHandleStoreStoreFence: + return true; + default: + return false; + } +} + inline void ArtMethod::SetIntrinsic(uint32_t intrinsic) { // Currently we only do intrinsics for static/final methods or methods of final // classes. We don't set kHasSingleImplementation for those methods. @@ -413,10 +429,14 @@ inline void ArtMethod::SetIntrinsic(uint32_t intrinsic) { DCHECK_EQ(is_default_conflict, IsDefaultConflicting()); DCHECK_EQ(is_compilable, IsCompilable()); DCHECK_EQ(must_count_locks, MustCountLocks()); - // We need to special case java.lang.ref.Reference.getRefererent. The Java method - // is hidden but we do not yet have a way of making intrinsics hidden. - if (intrinsic != static_cast<uint32_t>(Intrinsics::kReferenceGetReferent)) { - DCHECK_EQ(hidden_api_list, GetHiddenApiAccessFlags()); + if (kIsDebugBuild) { + if (IsHiddenIntrinsic(intrinsic)) { + // Special case some of our intrinsics because the access flags clash + // with the intrinsics ordinal. + DCHECK_EQ(HiddenApiAccessFlags::kWhitelist, GetHiddenApiAccessFlags()); + } else { + DCHECK_EQ(hidden_api_list, GetHiddenApiAccessFlags()); + } } } else { SetAccessFlags(new_value); diff --git a/runtime/art_method.h b/runtime/art_method.h index ce8e8ac612..e254720d65 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -846,6 +846,9 @@ class ArtMethod FINAL { } while (!access_flags_.compare_exchange_weak(old_access_flags, new_access_flags)); } + // Returns true if the given intrinsic is considered hidden. + bool IsHiddenIntrinsic(uint32_t ordinal); + DISALLOW_COPY_AND_ASSIGN(ArtMethod); // Need to use CopyFrom to deal with 32 vs 64 bits. }; |