diff options
author | 2016-07-15 15:28:35 +0100 | |
---|---|---|
committer | 2016-09-30 10:44:31 +0100 | |
commit | 762869dee6e0eadab5be1c606792d6693bbabf4e (patch) | |
tree | 8c986c621e8a5f3cf4e4e3b2cc13b400401ad89b /runtime/art_method.h | |
parent | b4cf427734c6839b46d0d6037e3189a5e8aa1bdb (diff) |
Simplify our intrinsic recognizer.
- Use the modifiers for storing the intrinsic kind.
- Delete dex_file_method_inliner and its associated map.
This work was also motivated by the fact that the inline
method analyzer leaks intrinsic tables, and even worse, might re-use
a table from one dex file to another unrelated dex file in the presence
of class unloading and the unlikely event of the dex files getting
the same address.
test: m test-art-host m test-art-target
Change-Id: Ia653d2c72df13889dc85dd8c84997582c034ea4b
Diffstat (limited to 'runtime/art_method.h')
-rw-r--r-- | runtime/art_method.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/runtime/art_method.h b/runtime/art_method.h index 3d2db690a7..7a8f479d19 100644 --- a/runtime/art_method.h +++ b/runtime/art_method.h @@ -137,7 +137,52 @@ class ArtMethod FINAL { return (GetAccessFlags() & kAccFinal) != 0; } + bool IsIntrinsic() { + return (GetAccessFlags() & kAccIntrinsic) != 0; + } + + void SetIntrinsic(uint32_t intrinsic) { + DCHECK(IsUint<8>(intrinsic)); + uint32_t new_value = (GetAccessFlags() & kAccFlagsNotUsedByIntrinsic) | + kAccIntrinsic | + (intrinsic << POPCOUNT(kAccFlagsNotUsedByIntrinsic)); + if (kIsDebugBuild) { + uint32_t java_flags = (GetAccessFlags() & kAccJavaFlagsMask); + bool is_constructor = IsConstructor(); + bool is_synchronized = IsSynchronized(); + bool skip_access_checks = SkipAccessChecks(); + bool is_fast_native = IsFastNative(); + bool is_copied = IsCopied(); + bool is_miranda = IsMiranda(); + bool is_default = IsDefault(); + bool is_default_conflict = IsDefaultConflicting(); + bool is_compilable = IsCompilable(); + bool must_count_locks = MustCountLocks(); + SetAccessFlags(new_value); + DCHECK_EQ(java_flags, (GetAccessFlags() & kAccJavaFlagsMask)); + DCHECK_EQ(is_constructor, IsConstructor()); + DCHECK_EQ(is_synchronized, IsSynchronized()); + DCHECK_EQ(skip_access_checks, SkipAccessChecks()); + DCHECK_EQ(is_fast_native, IsFastNative()); + DCHECK_EQ(is_copied, IsCopied()); + DCHECK_EQ(is_miranda, IsMiranda()); + DCHECK_EQ(is_default, IsDefault()); + DCHECK_EQ(is_default_conflict, IsDefaultConflicting()); + DCHECK_EQ(is_compilable, IsCompilable()); + DCHECK_EQ(must_count_locks, MustCountLocks()); + } else { + SetAccessFlags(new_value); + } + } + + uint32_t GetIntrinsic() { + DCHECK(IsIntrinsic()); + return (GetAccessFlags() >> POPCOUNT(kAccFlagsNotUsedByIntrinsic)) & kAccMaxIntrinsic; + } + bool IsCopied() { + static_assert((kAccCopied & kAccFlagsNotUsedByIntrinsic) == kAccCopied, + "kAccCopied conflicts with intrinsic modifier"); const bool copied = (GetAccessFlags() & kAccCopied) != 0; // (IsMiranda() || IsDefaultConflicting()) implies copied DCHECK(!(IsMiranda() || IsDefaultConflicting()) || copied) @@ -146,6 +191,8 @@ class ArtMethod FINAL { } bool IsMiranda() { + static_assert((kAccMiranda & kAccFlagsNotUsedByIntrinsic) == kAccMiranda, + "kAccMiranda conflicts with intrinsic modifier"); return (GetAccessFlags() & kAccMiranda) != 0; } @@ -156,6 +203,9 @@ class ArtMethod FINAL { } bool IsCompilable() { + if (IsIntrinsic()) { + return true; + } return (GetAccessFlags() & kAccCompileDontBother) == 0; } @@ -163,11 +213,16 @@ class ArtMethod FINAL { // multiple default methods. It cannot be invoked, throwing an IncompatibleClassChangeError if one // attempts to do so. bool IsDefaultConflicting() { + if (IsIntrinsic()) { + return false; + } return (GetAccessFlags() & kAccDefaultConflict) != 0u; } // This is set by the class linker. bool IsDefault() { + static_assert((kAccDefault & kAccFlagsNotUsedByIntrinsic) == kAccDefault, + "kAccDefault conflicts with intrinsic modifier"); return (GetAccessFlags() & kAccDefault) != 0; } @@ -204,6 +259,9 @@ class ArtMethod FINAL { // Should this method be run in the interpreter and count locks (e.g., failed structured- // locking verification)? bool MustCountLocks() { + if (IsIntrinsic()) { + return false; + } return (GetAccessFlags() & kAccMustCountLocks) != 0; } |