diff options
| author | David Brazdil <dbrazdil@google.com> | 2018-10-30 17:26:20 +0000 |
|---|---|---|
| committer | David Brazdil <dbrazdil@google.com> | 2018-11-16 11:11:20 +0000 |
| commit | 85865697ff9fabede3d64ff64cde72727c3fc4c1 (patch) | |
| tree | 0c67639c4c286149fa3f06f5f412683e39014790 /libdexfile | |
| parent | b321ac28f726a7ed41f277382d85702ffdfbe00f (diff) | |
| download | art-85865697ff9fabede3d64ff64cde72727c3fc4c1.tar.gz art-85865697ff9fabede3d64ff64cde72727c3fc4c1.tar.bz2 art-85865697ff9fabede3d64ff64cde72727c3fc4c1.zip | |
Runtime flags only for fast/slow hiddenapi path
With more flags being supported in the dex file, stop copying all of
them into ArtField/ArtMethod access flags. Instead, store the
information needed to figure out whether to enter the slow path and
retrieve full access flags from dex or not.
At the moment, the only runtime flag is kAccPublicApi assigned to all
class members on the whitelist.
The CL also moves hardcoded API membership of intrinsics out of
ArtMethod and into hidden_api.h, and moves ArtMethod::SetIntrinsic
into the .cc file.
Test: m test-art
Change-Id: Ia1cc05060dbc22341768161dfd8697c6158e803a
Diffstat (limited to 'libdexfile')
| -rw-r--r-- | libdexfile/dex/hidden_api_access_flags.h | 21 | ||||
| -rw-r--r-- | libdexfile/dex/modifiers.h | 7 |
2 files changed, 4 insertions, 24 deletions
diff --git a/libdexfile/dex/hidden_api_access_flags.h b/libdexfile/dex/hidden_api_access_flags.h index fd5c8654c3..77bfbc99b3 100644 --- a/libdexfile/dex/hidden_api_access_flags.h +++ b/libdexfile/dex/hidden_api_access_flags.h @@ -48,27 +48,6 @@ enum class ApiList { kNoList, }; -static const int kAccFlagsShift = CTZ(kAccHiddenApiBits); -static_assert(IsPowerOfTwo((kAccHiddenApiBits >> kAccFlagsShift) + 1), - "kAccHiddenApiBits are not continuous"); - -inline ApiList DecodeFromRuntime(uint32_t runtime_access_flags) { - // This is used in the fast path, only DCHECK here. - DCHECK_EQ(runtime_access_flags & kAccIntrinsic, 0u); - uint32_t int_value = (runtime_access_flags & kAccHiddenApiBits) >> kAccFlagsShift; - return static_cast<ApiList>(int_value); -} - -inline uint32_t EncodeForRuntime(uint32_t runtime_access_flags, ApiList value) { - CHECK_EQ(runtime_access_flags & kAccIntrinsic, 0u); - - uint32_t hidden_api_flags = static_cast<uint32_t>(value) << kAccFlagsShift; - CHECK_EQ(hidden_api_flags & ~kAccHiddenApiBits, 0u); - - runtime_access_flags &= ~kAccHiddenApiBits; - return runtime_access_flags | hidden_api_flags; -} - inline bool AreValidFlags(uint32_t flags) { return flags <= static_cast<uint32_t>(ApiList::kBlacklist); } diff --git a/libdexfile/dex/modifiers.h b/libdexfile/dex/modifiers.h index c4ea2d39b4..114c8e63e3 100644 --- a/libdexfile/dex/modifiers.h +++ b/libdexfile/dex/modifiers.h @@ -52,7 +52,7 @@ static constexpr uint32_t kAccObsoleteMethod = 0x00040000; // method (ru static constexpr uint32_t kAccSkipAccessChecks = 0x00080000; // method (runtime, not native) // Used by a class to denote that the verifier has attempted to check it at least once. static constexpr uint32_t kAccVerificationAttempted = 0x00080000; // class (runtime) -static constexpr uint32_t kAccSkipHiddenApiChecks = 0x00100000; // class (runtime) +static constexpr uint32_t kAccSkipHiddenapiChecks = 0x00100000; // class (runtime) // This is set by the class linker during LinkInterfaceMethods. It is used by a method to represent // that it was copied from its declaring class into another class. All methods marked kAccMiranda // and kAccDefaultConflict will have this bit set. Any kAccDefault method contained in the methods_ @@ -84,7 +84,8 @@ static constexpr uint32_t kAccMustCountLocks = 0x04000000; // method (ru // virtual call. static constexpr uint32_t kAccSingleImplementation = 0x08000000; // method (runtime) -static constexpr uint32_t kAccHiddenApiBits = 0x30000000; // field, method +static constexpr uint32_t kAccPublicApi = 0x10000000; // field, method +static constexpr uint32_t kAccHiddenapiBits = 0x30000000; // field, method // Non-intrinsics: Caches whether we can use fast-path in the interpreter invokes. // Intrinsics: These bits are part of the intrinsic ordinal. @@ -103,7 +104,7 @@ static constexpr uint32_t kAccClassIsFinalizable = 0x80000000; // Continuous sequence of bits used to hold the ordinal of an intrinsic method. Flags // which overlap are not valid when kAccIntrinsic is set. -static constexpr uint32_t kAccIntrinsicBits = kAccHiddenApiBits | +static constexpr uint32_t kAccIntrinsicBits = kAccHiddenapiBits | kAccSingleImplementation | kAccMustCountLocks | kAccCompileDontBother | kAccDefaultConflict | kAccPreviouslyWarm | kAccFastInterpreterToInterpreterInvoke; |
