diff options
author | 2024-01-17 14:53:20 +0000 | |
---|---|---|
committer | 2024-01-24 22:27:01 +0000 | |
commit | f63924e44576bc46b788595865232ec28f2c0bd8 (patch) | |
tree | d646dee1367db7af7362b90e4d047c9305facdfa | |
parent | 1ba3516e8c3e2b86c73084893dd297f468469181 (diff) |
Add visibility attributes in runtime/c*
Bug: 260881207
Test: presubmit
Test: abtd app_compat_drm
Test: abtd app_compat_top_100
Test: abtd app_compat_banking
Change-Id: Id729aca1d8b6d003ff3e9755112f3283e9f2b507
29 files changed, 62 insertions, 50 deletions
diff --git a/runtime/cha.cc b/runtime/cha.cc index 0c548d384a..da355b7e22 100644 --- a/runtime/cha.cc +++ b/runtime/cha.cc @@ -30,7 +30,7 @@ #include "thread_list.h" #include "thread_pool.h" -namespace art { +namespace art HIDDEN { void ClassHierarchyAnalysis::AddDependency(ArtMethod* method, ArtMethod* dependent_method, diff --git a/runtime/cha.h b/runtime/cha.h index 8d4c3c5a92..ffdf00a411 100644 --- a/runtime/cha.h +++ b/runtime/cha.h @@ -22,11 +22,12 @@ #include "base/enums.h" #include "base/locks.h" +#include "base/macros.h" #include "handle.h" #include "mirror/class.h" #include "oat/oat_quick_method_header.h" -namespace art { +namespace art HIDDEN { class ArtMethod; class LinearAlloc; diff --git a/runtime/cha_test.cc b/runtime/cha_test.cc index 48fd06d165..47633a3218 100644 --- a/runtime/cha_test.cc +++ b/runtime/cha_test.cc @@ -19,7 +19,7 @@ #include "base/common_art_test.h" #include "thread-current-inl.h" -namespace art { +namespace art HIDDEN { class CHATest : public CommonArtTest {}; diff --git a/runtime/check_reference_map_visitor.h b/runtime/check_reference_map_visitor.h index de4986cb16..a4196e6abf 100644 --- a/runtime/check_reference_map_visitor.h +++ b/runtime/check_reference_map_visitor.h @@ -18,6 +18,7 @@ #define ART_RUNTIME_CHECK_REFERENCE_MAP_VISITOR_H_ #include "art_method-inl.h" +#include "base/macros.h" #include "dex/code_item_accessors-inl.h" #include "dex/dex_file_types.h" #include "oat/oat_quick_method_header.h" @@ -25,7 +26,7 @@ #include "scoped_thread_state_change-inl.h" #include "stack.h" -namespace art { +namespace art HIDDEN { // Helper class for tests checking that the compiler keeps track of dex registers // holding references. diff --git a/runtime/class_linker-inl.h b/runtime/class_linker-inl.h index e22387f7f2..e771341d5a 100644 --- a/runtime/class_linker-inl.h +++ b/runtime/class_linker-inl.h @@ -37,7 +37,7 @@ #include "obj_ptr-inl.h" #include "scoped_thread_state_change-inl.h" -namespace art { +namespace art HIDDEN { inline ObjPtr<mirror::Class> ClassLinker::FindArrayClass(Thread* self, ObjPtr<mirror::Class> element_class) { diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 0e8bfb0223..57dbd6d259 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -158,7 +158,7 @@ #include "verifier/verifier_deps.h" #include "well_known_classes.h" -namespace art { +namespace art HIDDEN { using android::base::StringPrintf; diff --git a/runtime/class_linker.h b/runtime/class_linker.h index 9fc937f08a..5597149178 100644 --- a/runtime/class_linker.h +++ b/runtime/class_linker.h @@ -44,7 +44,7 @@ #include "oat/oat_file.h" #include "verifier/verifier_enums.h" -namespace art { +namespace art HIDDEN { class ArtField; class ArtMethod; @@ -158,7 +158,7 @@ class AllocatorVisitor { REQUIRES_SHARED(Locks::classlinker_classes_lock_, Locks::mutator_lock_) = 0; }; -class ClassLinker { +class EXPORT ClassLinker { public: static constexpr bool kAppImageMayContainStrings = true; diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index 605b1c4ef6..97f79b7af7 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -59,7 +59,7 @@ #include "scoped_thread_state_change-inl.h" #include "thread-current-inl.h" -namespace art { +namespace art HIDDEN { class ClassLinkerTest : public CommonRuntimeTest { protected: diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc index 81eb11c1d3..988955c098 100644 --- a/runtime/class_loader_context.cc +++ b/runtime/class_loader_context.cc @@ -47,7 +47,7 @@ #include "thread.h" #include "well_known_classes-inl.h" -namespace art { +namespace art HIDDEN { static constexpr char kPathClassLoaderString[] = "PCL"; static constexpr char kDelegateLastClassLoaderString[] = "DLC"; diff --git a/runtime/class_loader_context.h b/runtime/class_loader_context.h index cfb04578e3..6b819f4779 100644 --- a/runtime/class_loader_context.h +++ b/runtime/class_loader_context.h @@ -23,19 +23,20 @@ #include "arch/instruction_set.h" #include "base/dchecked_vector.h" +#include "base/macros.h" #include "dex/dex_file.h" #include "handle_scope.h" #include "mirror/class_loader.h" #include "oat/oat_file.h" #include "scoped_thread_state_change.h" -namespace art { +namespace art HIDDEN { class DexFile; class OatFile; // Utility class which holds the class loader context used during compilation/verification. -class ClassLoaderContext { +class EXPORT ClassLoaderContext { public: enum class VerificationResult { kVerifies, diff --git a/runtime/class_loader_context_test.cc b/runtime/class_loader_context_test.cc index 1744e4ed1b..ec7abb75ac 100644 --- a/runtime/class_loader_context_test.cc +++ b/runtime/class_loader_context_test.cc @@ -46,7 +46,7 @@ #include "thread.h" #include "well_known_classes-inl.h" -namespace art { +namespace art HIDDEN { class ClassLoaderContextTest : public CommonRuntimeTest { public: diff --git a/runtime/class_loader_utils.h b/runtime/class_loader_utils.h index 6868b3f38a..54662bf3c0 100644 --- a/runtime/class_loader_utils.h +++ b/runtime/class_loader_utils.h @@ -19,6 +19,7 @@ #include "art_field-inl.h" #include "base/locks.h" +#include "base/macros.h" #include "handle_scope.h" #include "jni/jni_internal.h" #include "mirror/class_loader.h" @@ -28,7 +29,7 @@ #include "scoped_thread_state_change-inl.h" #include "well_known_classes-inl.h" -namespace art { +namespace art HIDDEN { // Returns true if the given class loader derives from BaseDexClassLoader. inline bool IsInstanceOfBaseDexClassLoader(Handle<mirror::ClassLoader> class_loader) diff --git a/runtime/class_root-inl.h b/runtime/class_root-inl.h index d88b8e1710..871f5f37ef 100644 --- a/runtime/class_root-inl.h +++ b/runtime/class_root-inl.h @@ -25,7 +25,7 @@ #include "obj_ptr-inl.h" #include "runtime.h" -namespace art { +namespace art HIDDEN { template <ReadBarrierOption kReadBarrierOption> inline ObjPtr<mirror::Class> GetClassRoot(ClassRoot class_root, diff --git a/runtime/class_root.cc b/runtime/class_root.cc index 6a6fd26ecd..f0eb7611c8 100644 --- a/runtime/class_root.cc +++ b/runtime/class_root.cc @@ -18,7 +18,7 @@ #include "base/logging.h" -namespace art { +namespace art HIDDEN { const char* GetClassRootDescriptor(ClassRoot class_root) { static const char* const class_roots_descriptors[] = { diff --git a/runtime/class_root.h b/runtime/class_root.h index baa21286a8..67e369fd9b 100644 --- a/runtime/class_root.h +++ b/runtime/class_root.h @@ -20,9 +20,10 @@ #include <stdint.h> #include "base/locks.h" +#include "base/macros.h" #include "read_barrier_option.h" -namespace art { +namespace art HIDDEN { class ClassLinker; template<class MirrorType> class ObjPtr; diff --git a/runtime/class_status.h b/runtime/class_status.h index 6c686a4876..fc41b1cf37 100644 --- a/runtime/class_status.h +++ b/runtime/class_status.h @@ -20,7 +20,9 @@ #include <iosfwd> #include <stdint.h> -namespace art { +#include "base/macros.h" + +namespace art HIDDEN { // Class Status // @@ -99,7 +101,7 @@ enum class ClassStatus : uint8_t { kLast = kVisiblyInitialized }; -std::ostream& operator<<(std::ostream& os, ClassStatus rhs); +EXPORT std::ostream& operator<<(std::ostream& os, ClassStatus rhs); } // namespace art diff --git a/runtime/class_table-inl.h b/runtime/class_table-inl.h index 55ecb78931..8a8487c412 100644 --- a/runtime/class_table-inl.h +++ b/runtime/class_table-inl.h @@ -26,7 +26,7 @@ #include "oat/oat_file.h" #include "obj_ptr-inl.h" -namespace art { +namespace art HIDDEN { inline ClassTable::TableSlot::TableSlot(ObjPtr<mirror::Class> klass) : TableSlot(klass, klass->DescriptorHash()) {} diff --git a/runtime/class_table.cc b/runtime/class_table.cc index 12d0697e7b..f66bd1e7ad 100644 --- a/runtime/class_table.cc +++ b/runtime/class_table.cc @@ -21,7 +21,7 @@ #include "mirror/string-inl.h" #include "oat/oat_file.h" -namespace art { +namespace art HIDDEN { ClassTable::ClassTable() : lock_("Class loader classes", kClassLoaderClassesLock) { Runtime* const runtime = Runtime::Current(); diff --git a/runtime/class_table.h b/runtime/class_table.h index 54e066a18c..1c9b0ce2e9 100644 --- a/runtime/class_table.h +++ b/runtime/class_table.h @@ -28,7 +28,7 @@ #include "gc_root.h" #include "obj_ptr.h" -namespace art { +namespace art HIDDEN { class OatFile; @@ -153,7 +153,7 @@ class ClassTable { ClassDescriptorEquals, GcRootArenaAllocator<TableSlot, kAllocatorTagClassTable>>; - ClassTable(); + EXPORT ClassTable(); // Freeze the current class tables by allocating a new table and never updating or modifying the // existing table. This helps prevents dirty pages after caused by inserting after zygote fork. @@ -172,7 +172,7 @@ class ClassTable { REQUIRES_SHARED(Locks::mutator_lock_); // Returns the number of classes in previous snapshots no matter the defining loader. - size_t NumReferencedZygoteClasses() const + EXPORT size_t NumReferencedZygoteClasses() const REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); @@ -252,7 +252,7 @@ class ClassTable { REQUIRES_SHARED(Locks::mutator_lock_); // Read a table from ptr and put it at the front of the class set. - size_t ReadFromMemory(uint8_t* ptr) + EXPORT size_t ReadFromMemory(uint8_t* ptr) REQUIRES(!lock_) REQUIRES_SHARED(Locks::mutator_lock_); diff --git a/runtime/class_table_test.cc b/runtime/class_table_test.cc index 14c5d70207..15cca6dda9 100644 --- a/runtime/class_table_test.cc +++ b/runtime/class_table_test.cc @@ -28,7 +28,7 @@ #include "obj_ptr.h" #include "scoped_thread_state_change-inl.h" -namespace art { +namespace art HIDDEN { namespace mirror { class CollectRootVisitor { diff --git a/runtime/common_dex_operations.h b/runtime/common_dex_operations.h index ce2090c2a5..58b54af078 100644 --- a/runtime/common_dex_operations.h +++ b/runtime/common_dex_operations.h @@ -42,7 +42,7 @@ #include "stack.h" #include "thread.h" -namespace art { +namespace art HIDDEN { namespace interpreter { void ArtInterpreterToInterpreterBridge(Thread* self, diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc index ee574bca62..922d678920 100644 --- a/runtime/common_runtime_test.cc +++ b/runtime/common_runtime_test.cc @@ -65,7 +65,7 @@ #include "thread.h" #include "well_known_classes-inl.h" -namespace art { +namespace art HIDDEN { using android::base::StringPrintf; diff --git a/runtime/common_runtime_test.h b/runtime/common_runtime_test.h index e82db84a71..0f164a7d07 100644 --- a/runtime/common_runtime_test.h +++ b/runtime/common_runtime_test.h @@ -28,6 +28,7 @@ #include "arch/instruction_set.h" #include "base/common_art_test.h" #include "base/locks.h" +#include "base/macros.h" #include "base/os.h" #include "base/unix_file/fd_file.h" #include "dex/art_dex_file_loader.h" @@ -37,7 +38,7 @@ #include "runtime_globals.h" #include "scoped_thread_state_change-inl.h" -namespace art { +namespace art HIDDEN { class MethodReference; class TypeReference; diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc index 5182689d86..3724866556 100644 --- a/runtime/common_throws.cc +++ b/runtime/common_throws.cc @@ -38,7 +38,7 @@ #include "thread.h" #include "well_known_classes-inl.h" -namespace art { +namespace art HIDDEN { using android::base::StringAppendV; using android::base::StringPrintf; diff --git a/runtime/common_throws.h b/runtime/common_throws.h index d9620df0b9..aeba3bb1bb 100644 --- a/runtime/common_throws.h +++ b/runtime/common_throws.h @@ -20,9 +20,10 @@ #include <string_view> #include "base/locks.h" +#include "base/macros.h" #include "obj_ptr.h" -namespace art { +namespace art HIDDEN { namespace mirror { class Class; class Object; @@ -83,13 +84,13 @@ void ThrowClassCastException(const char* msg) // ClassFormatError -void ThrowClassFormatError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) - __attribute__((__format__(__printf__, 2, 3))) - REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; +EXPORT void ThrowClassFormatError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) + __attribute__((__format__(__printf__, 2, 3))) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; // IllegalAccessError -void ThrowIllegalAccessErrorClass(ObjPtr<mirror::Class> referrer, ObjPtr<mirror::Class> accessed) +EXPORT void ThrowIllegalAccessErrorClass(ObjPtr<mirror::Class> referrer, + ObjPtr<mirror::Class> accessed) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; void ThrowIllegalAccessErrorClassForMethodDispatch(ObjPtr<mirror::Class> referrer, @@ -101,10 +102,10 @@ void ThrowIllegalAccessErrorClassForMethodDispatch(ObjPtr<mirror::Class> referre void ThrowIllegalAccessErrorMethod(ObjPtr<mirror::Class> referrer, ArtMethod* accessed) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; -void ThrowIllegalAccessErrorField(ObjPtr<mirror::Class> referrer, ArtField* accessed) +EXPORT void ThrowIllegalAccessErrorField(ObjPtr<mirror::Class> referrer, ArtField* accessed) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; -void ThrowIllegalAccessErrorFinalField(ArtMethod* referrer, ArtField* accessed) +EXPORT void ThrowIllegalAccessErrorFinalField(ArtMethod* referrer, ArtField* accessed) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; void ThrowIllegalAccessError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) @@ -128,7 +129,7 @@ void ThrowIllegalArgumentException(const char* msg) // IllegalAccessException -void ThrowIllegalStateException(const char* msg) +EXPORT void ThrowIllegalStateException(const char* msg) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; // IncompatibleClassChangeError @@ -144,9 +145,9 @@ void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(ArtMethod* inter ArtMethod* referrer) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; -void ThrowIncompatibleClassChangeErrorField(ArtField* resolved_field, - bool is_static, - ArtMethod* referrer) +EXPORT void ThrowIncompatibleClassChangeErrorField(ArtField* resolved_field, + bool is_static, + ArtMethod* referrer) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; void ThrowIncompatibleClassChangeError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) @@ -196,10 +197,10 @@ void ThrowNegativeArraySizeException(const char* msg) // NoSuchFieldError -void ThrowNoSuchFieldError(std::string_view scope, - ObjPtr<mirror::Class> c, - std::string_view type, - std::string_view name) +EXPORT void ThrowNoSuchFieldError(std::string_view scope, + ObjPtr<mirror::Class> c, + std::string_view type, + std::string_view name) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; void ThrowNoSuchFieldException(ObjPtr<mirror::Class> c, std::string_view name) @@ -229,7 +230,7 @@ void ThrowNullPointerExceptionForMethodAccess(ArtMethod* method, void ThrowNullPointerExceptionFromDexPC(bool check_address = false, uintptr_t addr = 0) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; -void ThrowNullPointerException(const char* msg) +EXPORT void ThrowNullPointerException(const char* msg) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; void ThrowNullPointerException() diff --git a/runtime/compat_framework.cc b/runtime/compat_framework.cc index 17d423bbed..e693508f42 100644 --- a/runtime/compat_framework.cc +++ b/runtime/compat_framework.cc @@ -22,7 +22,7 @@ #include "android-base/logging.h" #include "thread-current-inl.h" -namespace art { +namespace art HIDDEN { // Compat change states as strings. static constexpr char kUnknownChangeState[] = "UNKNOWN"; diff --git a/runtime/compat_framework.h b/runtime/compat_framework.h index 99a92151a7..1e71362b5a 100644 --- a/runtime/compat_framework.h +++ b/runtime/compat_framework.h @@ -23,7 +23,7 @@ #include "base/mutex.h" #include "base/string_view_cpp20.h" -namespace art { +namespace art HIDDEN { // ART counterpart of the compat framework (go/compat-framework). // Created in order to avoid repeated up-calls to Java. diff --git a/runtime/compilation_kind.h b/runtime/compilation_kind.h index c289e984d8..08c5025be0 100644 --- a/runtime/compilation_kind.h +++ b/runtime/compilation_kind.h @@ -20,7 +20,9 @@ #include <iosfwd> #include <stdint.h> -namespace art { +#include "base/macros.h" + +namespace art HIDDEN { enum class CompilationKind { kOsr, diff --git a/runtime/compiler_callbacks.h b/runtime/compiler_callbacks.h index 3fa2fa3022..cd6f6b893b 100644 --- a/runtime/compiler_callbacks.h +++ b/runtime/compiler_callbacks.h @@ -18,11 +18,12 @@ #define ART_RUNTIME_COMPILER_CALLBACKS_H_ #include "base/locks.h" +#include "base/macros.h" #include "class_status.h" #include "dex/class_reference.h" #include "dex/method_reference.h" -namespace art { +namespace art HIDDEN { class CompilerDriver; |