diff options
author | Dmitrii Ishcheikin <ishcheikin@google.com> | 2024-01-17 01:48:16 +0000 |
---|---|---|
committer | Dmitrii Ishcheikin <ishcheikin@google.com> | 2024-01-17 13:46:11 +0000 |
commit | 53aa2b4ff60c144dfa92d62a0379ad5f5b9735f2 (patch) | |
tree | 07b23a011ee14b909e734579c934662a64cbf89d | |
parent | bf4f61e6f7ceea1a00494d543e8cc13b20dd443f (diff) | |
download | art-53aa2b4ff60c144dfa92d62a0379ad5f5b9735f2.tar.gz |
Add visibility attributes in runtime/verifier
Bug: 260881207
Test: art/test.py -b --host
Test: presubmit
Test: abtd app_compat_drm
Test: abtd app_compat_top_100
Test: abtd app_compat_banking
Change-Id: I7fe3bef35482aaa87ec41d0525118eaf2e22a52c
23 files changed, 75 insertions, 65 deletions
diff --git a/runtime/verifier/class_verifier.cc b/runtime/verifier/class_verifier.cc index 084e714b42..d1b882f9f4 100644 --- a/runtime/verifier/class_verifier.cc +++ b/runtime/verifier/class_verifier.cc @@ -42,7 +42,7 @@ #include "verifier/method_verifier.h" #include "verifier/reg_type_cache.h" -namespace art { +namespace art HIDDEN { namespace verifier { using android::base::StringPrintf; diff --git a/runtime/verifier/class_verifier.h b/runtime/verifier/class_verifier.h index 65bc28c299..75a5a35b7e 100644 --- a/runtime/verifier/class_verifier.h +++ b/runtime/verifier/class_verifier.h @@ -23,13 +23,14 @@ #include <android-base/thread_annotations.h> #include "base/locks.h" +#include "base/macros.h" #include "handle.h" #include "obj_ptr.h" #include "verifier/method_verifier.h" #include "verifier/reg_type_cache.h" #include "verifier_enums.h" -namespace art { +namespace art HIDDEN { class ClassLinker; class CompilerCallbacks; @@ -55,18 +56,17 @@ class ClassVerifier { public: // The main entrypoint for class verification. During AOT, `klass` can be // null. - static FailureKind VerifyClass(Thread* self, - VerifierDeps* verifier_deps, - const DexFile* dex_file, - Handle<mirror::Class> klass, - Handle<mirror::DexCache> dex_cache, - Handle<mirror::ClassLoader> class_loader, - const dex::ClassDef& class_def, - CompilerCallbacks* callbacks, - HardFailLogMode log_level, - uint32_t api_level, - std::string* error) - REQUIRES_SHARED(Locks::mutator_lock_); + EXPORT static FailureKind VerifyClass(Thread* self, + VerifierDeps* verifier_deps, + const DexFile* dex_file, + Handle<mirror::Class> klass, + Handle<mirror::DexCache> dex_cache, + Handle<mirror::ClassLoader> class_loader, + const dex::ClassDef& class_def, + CompilerCallbacks* callbacks, + HardFailLogMode log_level, + uint32_t api_level, + std::string* error) REQUIRES_SHARED(Locks::mutator_lock_); private: DISALLOW_COPY_AND_ASSIGN(ClassVerifier); diff --git a/runtime/verifier/instruction_flags.cc b/runtime/verifier/instruction_flags.cc index ca3c68796d..73fb375731 100644 --- a/runtime/verifier/instruction_flags.cc +++ b/runtime/verifier/instruction_flags.cc @@ -18,7 +18,7 @@ #include <string.h> -namespace art { +namespace art HIDDEN { namespace verifier { std::string InstructionFlags::ToString() const { diff --git a/runtime/verifier/instruction_flags.h b/runtime/verifier/instruction_flags.h index 6cd2865f25..da5e2cd178 100644 --- a/runtime/verifier/instruction_flags.h +++ b/runtime/verifier/instruction_flags.h @@ -22,7 +22,7 @@ #include "base/macros.h" -namespace art { +namespace art HIDDEN { namespace verifier { class InstructionFlags final { diff --git a/runtime/verifier/method_verifier-inl.h b/runtime/verifier/method_verifier-inl.h index a9fb1a0773..a13a58eede 100644 --- a/runtime/verifier/method_verifier-inl.h +++ b/runtime/verifier/method_verifier-inl.h @@ -19,7 +19,7 @@ #include "method_verifier.h" -namespace art { +namespace art HIDDEN { namespace verifier { inline RegisterLine* MethodVerifier::GetRegLine(uint32_t dex_pc) { diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index 9830bfc8d7..fc5a57ed26 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -65,7 +65,7 @@ #include "verifier/method_verifier.h" #include "verifier_deps.h" -namespace art { +namespace art HIDDEN { namespace verifier { using android::base::StringPrintf; diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h index 649a24526c..288043610e 100644 --- a/runtime/verifier/method_verifier.h +++ b/runtime/verifier/method_verifier.h @@ -36,7 +36,7 @@ #include "register_line.h" #include "verifier_enums.h" -namespace art { +namespace art HIDDEN { class ClassLinker; class DexFile; @@ -97,25 +97,25 @@ class PcToRegisterLineTable { // The verifier class MethodVerifier { public: - static MethodVerifier* VerifyMethodAndDump(Thread* self, - VariableIndentationOutputStream* vios, - uint32_t method_idx, - const DexFile* dex_file, - Handle<mirror::DexCache> dex_cache, - Handle<mirror::ClassLoader> class_loader, - const dex::ClassDef& class_def, - const dex::CodeItem* code_item, - uint32_t method_access_flags, - uint32_t api_level) + EXPORT static MethodVerifier* VerifyMethodAndDump(Thread* self, + VariableIndentationOutputStream* vios, + uint32_t method_idx, + const DexFile* dex_file, + Handle<mirror::DexCache> dex_cache, + Handle<mirror::ClassLoader> class_loader, + const dex::ClassDef& class_def, + const dex::CodeItem* code_item, + uint32_t method_access_flags, + uint32_t api_level) REQUIRES_SHARED(Locks::mutator_lock_); // Calculates the type information at the given `dex_pc`. // No classes will be loaded. - static MethodVerifier* CalculateVerificationInfo(Thread* self, - ArtMethod* method, - Handle<mirror::DexCache> dex_cache, - Handle<mirror::ClassLoader> class_loader, - uint32_t dex_pc) + EXPORT static MethodVerifier* CalculateVerificationInfo(Thread* self, + ArtMethod* method, + Handle<mirror::DexCache> dex_cache, + Handle<mirror::ClassLoader> class_loader, + uint32_t dex_pc) REQUIRES_SHARED(Locks::mutator_lock_); const DexFile& GetDexFile() const { diff --git a/runtime/verifier/method_verifier_test.cc b/runtime/verifier/method_verifier_test.cc index 0f0fd17905..1c6ed7c9b0 100644 --- a/runtime/verifier/method_verifier_test.cc +++ b/runtime/verifier/method_verifier_test.cc @@ -30,7 +30,7 @@ #include "scoped_thread_state_change-inl.h" #include "verifier_enums.h" -namespace art { +namespace art HIDDEN { namespace verifier { using metrics::test::CounterValue; diff --git a/runtime/verifier/reg_type-inl.h b/runtime/verifier/reg_type-inl.h index 7fb24b2602..8db2fe669a 100644 --- a/runtime/verifier/reg_type-inl.h +++ b/runtime/verifier/reg_type-inl.h @@ -25,7 +25,7 @@ #include "mirror/class.h" #include "verifier_deps.h" -namespace art { +namespace art HIDDEN { namespace verifier { inline bool RegType::CanAccess(const RegType& other) const { diff --git a/runtime/verifier/reg_type.cc b/runtime/verifier/reg_type.cc index 0433c6dcc5..845bcdc087 100644 --- a/runtime/verifier/reg_type.cc +++ b/runtime/verifier/reg_type.cc @@ -35,7 +35,7 @@ #include <limits> #include <sstream> -namespace art { +namespace art HIDDEN { namespace verifier { using android::base::StringPrintf; diff --git a/runtime/verifier/reg_type.h b/runtime/verifier/reg_type.h index 6cc9880f8c..66f075e73f 100644 --- a/runtime/verifier/reg_type.h +++ b/runtime/verifier/reg_type.h @@ -33,7 +33,7 @@ #include "handle_scope.h" #include "obj_ptr.h" -namespace art { +namespace art HIDDEN { namespace mirror { class Class; class ClassLoader; diff --git a/runtime/verifier/reg_type_cache-inl.h b/runtime/verifier/reg_type_cache-inl.h index b987c2c59c..b619694714 100644 --- a/runtime/verifier/reg_type_cache-inl.h +++ b/runtime/verifier/reg_type_cache-inl.h @@ -28,7 +28,7 @@ #include "reg_type.h" #include "reg_type_cache.h" -namespace art { +namespace art HIDDEN { namespace verifier { inline const art::verifier::RegType& RegTypeCache::GetFromId(uint16_t id) const { diff --git a/runtime/verifier/reg_type_cache.cc b/runtime/verifier/reg_type_cache.cc index 55b37338cf..e57290c418 100644 --- a/runtime/verifier/reg_type_cache.cc +++ b/runtime/verifier/reg_type_cache.cc @@ -32,7 +32,7 @@ #include "mirror/object-inl.h" #include "reg_type-inl.h" -namespace art { +namespace art HIDDEN { namespace verifier { ALWAYS_INLINE static inline bool MatchingPrecisionForClass(const RegType* entry, bool precise) diff --git a/runtime/verifier/reg_type_cache.h b/runtime/verifier/reg_type_cache.h index d88d4db177..ae8b904ecd 100644 --- a/runtime/verifier/reg_type_cache.h +++ b/runtime/verifier/reg_type_cache.h @@ -28,7 +28,7 @@ #include "gc_root.h" #include "handle_scope.h" -namespace art { +namespace art HIDDEN { namespace mirror { class Class; diff --git a/runtime/verifier/reg_type_test.cc b/runtime/verifier/reg_type_test.cc index 8ab7fc8cae..ec4c23ee59 100644 --- a/runtime/verifier/reg_type_test.cc +++ b/runtime/verifier/reg_type_test.cc @@ -28,7 +28,7 @@ #include "scoped_thread_state_change-inl.h" #include "thread-current-inl.h" -namespace art { +namespace art HIDDEN { namespace verifier { class RegTypeTest : public CommonRuntimeTest { diff --git a/runtime/verifier/register_line-inl.h b/runtime/verifier/register_line-inl.h index 6fa87c6fec..3967aaa88e 100644 --- a/runtime/verifier/register_line-inl.h +++ b/runtime/verifier/register_line-inl.h @@ -23,7 +23,7 @@ #include "method_verifier.h" #include "reg_type_cache-inl.h" -namespace art { +namespace art HIDDEN { namespace verifier { // Should we dump a warning on failures to verify balanced locking? That would be an indication to diff --git a/runtime/verifier/register_line.cc b/runtime/verifier/register_line.cc index 0e9e0d4a52..62f2eb3ec0 100644 --- a/runtime/verifier/register_line.cc +++ b/runtime/verifier/register_line.cc @@ -23,7 +23,7 @@ #include "reg_type-inl.h" #include "register_line-inl.h" -namespace art { +namespace art HIDDEN { namespace verifier { using android::base::StringPrintf; diff --git a/runtime/verifier/register_line.h b/runtime/verifier/register_line.h index 3db1efb38e..fc8c4cbc6c 100644 --- a/runtime/verifier/register_line.h +++ b/runtime/verifier/register_line.h @@ -24,10 +24,11 @@ #include <android-base/logging.h> #include "base/locks.h" +#include "base/macros.h" #include "base/safe_map.h" #include "base/scoped_arena_containers.h" -namespace art { +namespace art HIDDEN { class Instruction; diff --git a/runtime/verifier/scoped_newline.h b/runtime/verifier/scoped_newline.h index fb29e3ece8..ef2fc92154 100644 --- a/runtime/verifier/scoped_newline.h +++ b/runtime/verifier/scoped_newline.h @@ -21,7 +21,9 @@ #include <android-base/logging.h> -namespace art { +#include "base/macros.h" + +namespace art HIDDEN { namespace verifier { // RAII to inject a newline after a message. diff --git a/runtime/verifier/verifier_compiler_binding.h b/runtime/verifier/verifier_compiler_binding.h index 2266d50171..f94ea02109 100644 --- a/runtime/verifier/verifier_compiler_binding.h +++ b/runtime/verifier/verifier_compiler_binding.h @@ -22,7 +22,7 @@ #include "base/macros.h" #include "verifier_enums.h" -namespace art { +namespace art HIDDEN { namespace verifier { ALWAYS_INLINE diff --git a/runtime/verifier/verifier_deps.cc b/runtime/verifier/verifier_deps.cc index 3286a605e8..6740446c3d 100644 --- a/runtime/verifier/verifier_deps.cc +++ b/runtime/verifier/verifier_deps.cc @@ -35,7 +35,7 @@ #include "reg_type_cache-inl.h" #include "runtime.h" -namespace art { +namespace art HIDDEN { namespace verifier { VerifierDeps::VerifierDeps(const std::vector<const DexFile*>& dex_files, bool output_only) diff --git a/runtime/verifier/verifier_deps.h b/runtime/verifier/verifier_deps.h index 46b35545cf..dfa13ea112 100644 --- a/runtime/verifier/verifier_deps.h +++ b/runtime/verifier/verifier_deps.h @@ -23,6 +23,7 @@ #include "base/array_ref.h" #include "base/locks.h" +#include "base/macros.h" #include "dex/dex_file_structs.h" #include "dex/dex_file_types.h" #include "handle.h" @@ -30,7 +31,7 @@ #include "thread.h" #include "verifier_enums.h" // For MethodVerifier::FailureKind. -namespace art { +namespace art HIDDEN { class ArtField; class ArtMethod; @@ -60,18 +61,21 @@ class RegType; // changes in the classpath. class VerifierDeps { public: - explicit VerifierDeps(const std::vector<const DexFile*>& dex_files, bool output_only = true); + EXPORT explicit VerifierDeps(const std::vector<const DexFile*>& dex_files, + bool output_only = true); // Marker to know whether a class is verified. A non-verified class will have // this marker as its offset entry in the encoded data. static uint32_t constexpr kNotVerifiedMarker = std::numeric_limits<uint32_t>::max(); // Fill dependencies from stored data. Returns true on success, false on failure. - bool ParseStoredData(const std::vector<const DexFile*>& dex_files, ArrayRef<const uint8_t> data); + EXPORT bool ParseStoredData(const std::vector<const DexFile*>& dex_files, + ArrayRef<const uint8_t> data); // Merge `other` into this `VerifierDeps`'. `other` and `this` must be for the // same set of dex files. - void MergeWith(std::unique_ptr<VerifierDeps> other, const std::vector<const DexFile*>& dex_files); + EXPORT void MergeWith(std::unique_ptr<VerifierDeps> other, + const std::vector<const DexFile*>& dex_files); // Record information that a class was verified. // Note that this function is different from MaybeRecordVerificationStatus() which @@ -80,10 +84,10 @@ class VerifierDeps { REQUIRES(!Locks::verifier_deps_lock_); // Record the verification status of the class defined in `class_def`. - static void MaybeRecordVerificationStatus(VerifierDeps* verifier_deps, - const DexFile& dex_file, - const dex::ClassDef& class_def, - FailureKind failure_kind) + EXPORT static void MaybeRecordVerificationStatus(VerifierDeps* verifier_deps, + const DexFile& dex_file, + const dex::ClassDef& class_def, + FailureKind failure_kind) REQUIRES(!Locks::verifier_deps_lock_); // Record the outcome `is_assignable` of type assignability test from `source` @@ -110,15 +114,16 @@ class VerifierDeps { // Serialize the recorded dependencies and store the data into `buffer`. // `dex_files` provides the order of the dex files in which the dependencies // should be emitted. - void Encode(const std::vector<const DexFile*>& dex_files, std::vector<uint8_t>* buffer) const; + EXPORT void Encode(const std::vector<const DexFile*>& dex_files, + std::vector<uint8_t>* buffer) const; - void Dump(VariableIndentationOutputStream* vios) const; + EXPORT void Dump(VariableIndentationOutputStream* vios) const; // Verify the encoded dependencies of this `VerifierDeps` are still valid. - bool ValidateDependencies(Thread* self, - Handle<mirror::ClassLoader> class_loader, - const std::vector<const DexFile*>& dex_files, - /* out */ std::string* error_msg) const + EXPORT bool ValidateDependencies(Thread* self, + Handle<mirror::ClassLoader> class_loader, + const std::vector<const DexFile*>& dex_files, + /* out */ std::string* error_msg) const REQUIRES_SHARED(Locks::mutator_lock_); const std::vector<bool>& GetVerifiedClasses(const DexFile& dex_file) const { @@ -138,7 +143,7 @@ class VerifierDeps { } // Resets the data related to the given dex files. - void ClearData(const std::vector<const DexFile*>& dex_files); + EXPORT void ClearData(const std::vector<const DexFile*>& dex_files); // Parses raw VerifierDeps data to extract bitvectors of which class def indices // were verified or not. The given `dex_files` must match the order and count of @@ -195,7 +200,7 @@ class VerifierDeps { // `dex_file` is not reported as being compiled. DexFileDeps* GetDexFileDeps(const DexFile& dex_file); - const DexFileDeps* GetDexFileDeps(const DexFile& dex_file) const; + EXPORT const DexFileDeps* GetDexFileDeps(const DexFile& dex_file) const; // Returns the index of `str`. If it is defined in `dex_file_`, this is the dex // string ID. If not, an ID is assigned to the string and cached in `strings_` diff --git a/runtime/verifier/verifier_enums.h b/runtime/verifier/verifier_enums.h index 9c55e99206..57994581db 100644 --- a/runtime/verifier/verifier_enums.h +++ b/runtime/verifier/verifier_enums.h @@ -19,7 +19,9 @@ #include <stdint.h> -namespace art { +#include "base/macros.h" + +namespace art HIDDEN { namespace verifier { // The mode that the verifier should run as. |