From ab2ce84d4995f05c38c5ebfefc6683b244a36260 Mon Sep 17 00:00:00 2001 From: Alexey Grebenkin Date: Thu, 1 Feb 2018 19:09:59 +0300 Subject: Fix dangling SingleImplementations left after class unloading Test: make test-art-host, manual using sample code bug: 73143991 (cherry picked from commit be4c2bd892bd167a50b4dfa7133e70a809197698) Change-Id: I5f4d726334a9ea306d93b967966c58111fd34fd1 --- runtime/art_method.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'runtime/art_method.h') diff --git a/runtime/art_method.h b/runtime/art_method.h index 5d9b729847..3c6f230d15 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -172,8 +172,9 @@ class ArtMethod FINAL { return (GetAccessFlags() & synchonized) != 0; } + template bool IsFinal() { - return (GetAccessFlags() & kAccFinal) != 0; + return (GetAccessFlags() & kAccFinal) != 0; } bool IsIntrinsic() { @@ -241,10 +242,11 @@ class ArtMethod FINAL { } // This is set by the class linker. + template bool IsDefault() { static_assert((kAccDefault & (kAccIntrinsic | kAccIntrinsicBits)) == 0, "kAccDefault conflicts with intrinsic modifier"); - return (GetAccessFlags() & kAccDefault) != 0; + return (GetAccessFlags() & kAccDefault) != 0; } template @@ -279,8 +281,9 @@ class ArtMethod FINAL { return (GetAccessFlags() & mask) == mask; } + template bool IsAbstract() { - return (GetAccessFlags() & kAccAbstract) != 0; + return (GetAccessFlags() & kAccAbstract) != 0; } bool IsSynthetic() { @@ -494,6 +497,7 @@ class ArtMethod FINAL { return DataOffset(kRuntimePointerSize); } + template ALWAYS_INLINE bool HasSingleImplementation() REQUIRES_SHARED(Locks::mutator_lock_); ALWAYS_INLINE void SetHasSingleImplementation(bool single_impl) { @@ -511,12 +515,15 @@ class ArtMethod FINAL { ArtMethod* GetCanonicalMethod(PointerSize pointer_size = kRuntimePointerSize) REQUIRES_SHARED(Locks::mutator_lock_); + template ArtMethod* GetSingleImplementation(PointerSize pointer_size) REQUIRES_SHARED(Locks::mutator_lock_); + template ALWAYS_INLINE void SetSingleImplementation(ArtMethod* method, PointerSize pointer_size) { - DCHECK(!IsNative()); - DCHECK(IsAbstract()); // Non-abstract method's single implementation is just itself. + DCHECK(!IsNative()); + // Non-abstract method's single implementation is just itself. + DCHECK(IsAbstract()); SetDataPtrSize(method, pointer_size); } -- cgit v1.2.3-59-g8ed1b