summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitrii Ishcheikin <ishcheikin@google.com>2024-01-10 22:23:57 +0000
committerDmitrii Ishcheikin <ishcheikin@google.com>2024-01-17 10:08:11 +0000
commit0d088da1de83025cd0e078da3a4ec2a721bb8361 (patch)
tree380999649240a5b4a7b681ff13618ca07d8f1d03
parent35c76e8563ee700faaa403de71999e6b5b622591 (diff)
downloadart-0d088da1de83025cd0e078da3a4ec2a721bb8361.tar.gz
Add visibility attributes in runtime/jit
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: Ifa91cf97088b2fe97b12346ae39602712001a60f
-rw-r--r--runtime/jit/debugger_interface.cc8
-rw-r--r--runtime/jit/debugger_interface.h4
-rw-r--r--runtime/jit/jit-inl.h2
-rw-r--r--runtime/jit/jit.cc2
-rw-r--r--runtime/jit/jit.h24
-rw-r--r--runtime/jit/jit_code_cache.cc2
-rw-r--r--runtime/jit/jit_code_cache.h30
-rw-r--r--runtime/jit/jit_memory_region.cc2
-rw-r--r--runtime/jit/jit_memory_region.h2
-rw-r--r--runtime/jit/jit_memory_region_test.cc2
-rw-r--r--runtime/jit/jit_scoped_code_cache_write.h2
-rw-r--r--runtime/jit/profile_saver.cc2
-rw-r--r--runtime/jit/profile_saver.h4
-rw-r--r--runtime/jit/profile_saver_options.h2
-rw-r--r--runtime/jit/profile_saver_test.cc2
-rw-r--r--runtime/jit/profiling_info.cc2
-rw-r--r--runtime/jit/profiling_info.h8
-rw-r--r--runtime/jit/profiling_info_test.cc2
18 files changed, 55 insertions, 47 deletions
diff --git a/runtime/jit/debugger_interface.cc b/runtime/jit/debugger_interface.cc
index 112746e2fe..8c9fb4c999 100644
--- a/runtime/jit/debugger_interface.cc
+++ b/runtime/jit/debugger_interface.cc
@@ -93,7 +93,7 @@
// attempting to run TSAN on this code.
//
-namespace art {
+namespace art HIDDEN {
static Mutex g_jit_debug_lock("JIT native debug entries", kNativeDebugInterfaceLock);
static Mutex g_dex_debug_lock("DEX native debug entries", kNativeDebugInterfaceLock);
@@ -108,8 +108,11 @@ constexpr uint32_t kJitRepackGroupSize = 64 * KB;
// Automatically call the repack method every 'n' new entries.
constexpr uint32_t kJitRepackFrequency = 64;
+} // namespace art
+
// Public binary interface between ART and native tools (gdb, libunwind, etc).
// The fields below need to be exported and have special names as per the gdb api.
+namespace art EXPORT {
extern "C" {
enum JITAction {
JIT_NOACTION = 0,
@@ -198,6 +201,9 @@ extern "C" {
void (*__dex_debug_register_code_ptr)() = __dex_debug_register_code;
JITDescriptor __dex_debug_descriptor GUARDED_BY(g_dex_debug_lock) {};
}
+} // namespace art
+
+namespace art HIDDEN {
// The fields below are internal, but we keep them here anyway for consistency.
// Their state is related to the static state above and it must be kept in sync.
diff --git a/runtime/jit/debugger_interface.h b/runtime/jit/debugger_interface.h
index 62288de8cf..da7e90749e 100644
--- a/runtime/jit/debugger_interface.h
+++ b/runtime/jit/debugger_interface.h
@@ -25,7 +25,7 @@
#include "base/array_ref.h"
#include "base/locks.h"
-namespace art {
+namespace art HIDDEN {
class DexFile;
class Mutex;
@@ -70,7 +70,7 @@ size_t GetJitMiniDebugInfoMemUsage() REQUIRES_SHARED(Locks::jit_lock_);
// Get the lock which protects the native debug info.
// Used only in tests to unwind while the JIT thread is running.
// TODO: Unwinding should be race-free. Remove this.
-Mutex* GetNativeDebugInfoLock();
+EXPORT Mutex* GetNativeDebugInfoLock();
// Call given callback for every non-zygote symbol.
// The callback parameters are (address, size, name).
diff --git a/runtime/jit/jit-inl.h b/runtime/jit/jit-inl.h
index 237f63ce97..52099c2e1d 100644
--- a/runtime/jit/jit-inl.h
+++ b/runtime/jit/jit-inl.h
@@ -24,7 +24,7 @@
#include "thread.h"
#include "runtime-inl.h"
-namespace art {
+namespace art HIDDEN {
namespace jit {
inline void Jit::AddSamples(Thread* self, ArtMethod* method) {
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 0ee138fa06..4d4a1ed79c 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -58,7 +58,7 @@
using android::base::unique_fd;
-namespace art {
+namespace art HIDDEN {
namespace jit {
static constexpr bool kEnableOnStackReplacement = true;
diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h
index e335c6111f..ddf408fb33 100644
--- a/runtime/jit/jit.h
+++ b/runtime/jit/jit.h
@@ -35,7 +35,7 @@
#include "obj_ptr.h"
#include "thread_pool.h"
-namespace art {
+namespace art HIDDEN {
class ArtMethod;
class ClassLinker;
@@ -308,8 +308,10 @@ class Jit {
// Create JIT itself.
static std::unique_ptr<Jit> Create(JitCodeCache* code_cache, JitOptions* options);
- bool CompileMethod(ArtMethod* method, Thread* self, CompilationKind compilation_kind, bool prejit)
- REQUIRES_SHARED(Locks::mutator_lock_);
+ EXPORT bool CompileMethod(ArtMethod* method,
+ Thread* self,
+ CompilationKind compilation_kind,
+ bool prejit) REQUIRES_SHARED(Locks::mutator_lock_);
void VisitRoots(RootVisitor* visitor);
@@ -370,7 +372,7 @@ class Jit {
}
// Wait until there is no more pending compilation tasks.
- void WaitForCompilationToFinish(Thread* self);
+ EXPORT void WaitForCompilationToFinish(Thread* self);
// Profiling methods.
void MethodEntered(Thread* thread, ArtMethod* method)
@@ -411,7 +413,7 @@ class Jit {
void DumpTypeInfoForLoadedTypes(ClassLinker* linker);
// Return whether we should try to JIT compiled code as soon as an ArtMethod is invoked.
- bool JitAtFirstUse();
+ EXPORT bool JitAtFirstUse();
// Return whether we can invoke JIT code for `method`.
bool CanInvokeCompiledCode(ArtMethod* method);
@@ -437,16 +439,16 @@ class Jit {
}
// Stop the JIT by waiting for all current compilations and enqueued compilations to finish.
- void Stop();
+ EXPORT void Stop();
// Start JIT threads.
- void Start();
+ EXPORT void Start();
// Transition to a child state.
- void PostForkChildAction(bool is_system_server, bool is_zygote);
+ EXPORT void PostForkChildAction(bool is_system_server, bool is_zygote);
// Prepare for forking.
- void PreZygoteFork();
+ EXPORT void PreZygoteFork();
// Adjust state after forking.
void PostZygoteFork();
@@ -539,7 +541,7 @@ class Jit {
REQUIRES_SHARED(Locks::mutator_lock_);
// JIT compiler
- static JitCompilerInterface* jit_compiler_;
+ EXPORT static JitCompilerInterface* jit_compiler_;
// JIT resources owned by runtime.
jit::JitCodeCache* const code_cache_;
@@ -587,7 +589,7 @@ class Jit {
};
// Helper class to stop the JIT for a given scope. This will wait for the JIT to quiesce.
-class ScopedJitSuspend {
+class EXPORT ScopedJitSuspend {
public:
ScopedJitSuspend();
~ScopedJitSuspend();
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index e8d8b3b663..f44b822bb1 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -60,7 +60,7 @@
#include "thread-inl.h"
#include "thread_list.h"
-namespace art {
+namespace art HIDDEN {
namespace jit {
static constexpr size_t kCodeSizeLogThreshold = 50 * KB;
diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h
index e61ae7963d..96fc7e2706 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -37,7 +37,7 @@
#include "jit_memory_region.h"
#include "profiling_info.h"
-namespace art {
+namespace art HIDDEN {
class ArtMethod;
template<class T> class Handle;
@@ -211,7 +211,7 @@ class JitCodeCache {
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::jit_lock_);
- void NotifyMethodRedefined(ArtMethod* method)
+ EXPORT void NotifyMethodRedefined(ArtMethod* method)
REQUIRES(Locks::mutator_lock_)
REQUIRES(!Locks::jit_lock_);
@@ -232,13 +232,13 @@ class JitCodeCache {
REQUIRES(!Locks::jit_lock_);
// Return true if the code cache contains this pc.
- bool ContainsPc(const void* pc) const;
+ EXPORT bool ContainsPc(const void* pc) const;
// Return true if the code cache contains this pc in the private region (i.e. not from zygote).
bool PrivateRegionContainsPc(const void* pc) const;
// Return true if the code cache contains this method.
- bool ContainsMethod(ArtMethod* method)
+ EXPORT bool ContainsMethod(ArtMethod* method)
REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Locks::jit_lock_);
// Return the code pointer for a JNI-compiled stub if the method is in the cache, null otherwise.
@@ -289,7 +289,7 @@ class JitCodeCache {
REQUIRES(Locks::jit_lock_);
// Perform a collection on the code cache.
- void GarbageCollectCache(Thread* self)
+ EXPORT void GarbageCollectCache(Thread* self)
REQUIRES(!Locks::jit_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
@@ -300,14 +300,14 @@ class JitCodeCache {
REQUIRES(!Locks::jit_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
- OatQuickMethodHeader* LookupOsrMethodHeader(ArtMethod* method)
+ EXPORT OatQuickMethodHeader* LookupOsrMethodHeader(ArtMethod* method)
REQUIRES(!Locks::jit_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
// Removes method from the cache for testing purposes. The caller
// must ensure that all threads are suspended and the method should
// not be in any thread's stack.
- bool RemoveMethod(ArtMethod* method, bool release_memory)
+ EXPORT bool RemoveMethod(ArtMethod* method, bool release_memory)
REQUIRES(!Locks::jit_lock_)
REQUIRES(Locks::mutator_lock_);
@@ -338,12 +338,12 @@ class JitCodeCache {
// Adds to `methods` all profiled methods which are part of any of the given dex locations.
// Saves inline caches for a method if its hotness meets `inline_cache_threshold` after being
// baseline compiled.
- void GetProfiledMethods(const std::set<std::string>& dex_base_locations,
- std::vector<ProfileMethodInfo>& methods,
- uint16_t inline_cache_threshold) REQUIRES(!Locks::jit_lock_)
+ EXPORT void GetProfiledMethods(const std::set<std::string>& dex_base_locations,
+ std::vector<ProfileMethodInfo>& methods,
+ uint16_t inline_cache_threshold) REQUIRES(!Locks::jit_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
- void InvalidateAllCompiledCode()
+ EXPORT void InvalidateAllCompiledCode()
REQUIRES(!Locks::jit_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
@@ -370,11 +370,11 @@ class JitCodeCache {
// Notify the code cache that the method at the pointer 'old_method' is being moved to the pointer
// 'new_method' since it is being made obsolete.
- void MoveObsoleteMethod(ArtMethod* old_method, ArtMethod* new_method)
+ EXPORT void MoveObsoleteMethod(ArtMethod* old_method, ArtMethod* new_method)
REQUIRES(!Locks::jit_lock_) REQUIRES(Locks::mutator_lock_);
// Dynamically change whether we want to garbage collect code.
- void SetGarbageCollectCode(bool value) REQUIRES(!Locks::jit_lock_);
+ EXPORT void SetGarbageCollectCode(bool value) REQUIRES(!Locks::jit_lock_);
bool GetGarbageCollectCode() REQUIRES(!Locks::jit_lock_);
@@ -392,13 +392,13 @@ class JitCodeCache {
REQUIRES(!Locks::jit_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
- void PostForkChildAction(bool is_system_server, bool is_zygote);
+ EXPORT void PostForkChildAction(bool is_system_server, bool is_zygote);
// Clear the entrypoints of JIT compiled methods that belong in the zygote space.
// This is used for removing non-debuggable JIT code at the point we realize the runtime
// is debuggable. Also clear the Precompiled flag from all methods so the non-debuggable code
// doesn't come back.
- void TransitionToDebuggable() REQUIRES(!Locks::jit_lock_) REQUIRES(Locks::mutator_lock_);
+ EXPORT void TransitionToDebuggable() REQUIRES(!Locks::jit_lock_) REQUIRES(Locks::mutator_lock_);
JitMemoryRegion* GetCurrentRegion();
bool IsSharedRegion(const JitMemoryRegion& region) const { return &region == &shared_region_; }
diff --git a/runtime/jit/jit_memory_region.cc b/runtime/jit/jit_memory_region.cc
index 911b7d7aca..3a4ef973eb 100644
--- a/runtime/jit/jit_memory_region.cc
+++ b/runtime/jit/jit_memory_region.cc
@@ -34,7 +34,7 @@
using android::base::unique_fd;
-namespace art {
+namespace art HIDDEN {
namespace jit {
// Data cache will be half of the capacity
diff --git a/runtime/jit/jit_memory_region.h b/runtime/jit/jit_memory_region.h
index 8a3d6c3e55..7391541f07 100644
--- a/runtime/jit/jit_memory_region.h
+++ b/runtime/jit/jit_memory_region.h
@@ -26,7 +26,7 @@
#include "gc_root-inl.h"
#include "handle.h"
-namespace art {
+namespace art HIDDEN {
namespace mirror {
class Object;
diff --git a/runtime/jit/jit_memory_region_test.cc b/runtime/jit/jit_memory_region_test.cc
index bf943f9981..449255a7f7 100644
--- a/runtime/jit/jit_memory_region_test.cc
+++ b/runtime/jit/jit_memory_region_test.cc
@@ -29,7 +29,7 @@
#include "base/utils.h"
#include "common_runtime_test.h"
-namespace art {
+namespace art HIDDEN {
namespace jit {
// These tests only run on bionic.
diff --git a/runtime/jit/jit_scoped_code_cache_write.h b/runtime/jit/jit_scoped_code_cache_write.h
index e2adebfb1b..ed21cf9fbd 100644
--- a/runtime/jit/jit_scoped_code_cache_write.h
+++ b/runtime/jit/jit_scoped_code_cache_write.h
@@ -22,7 +22,7 @@
#include "base/systrace.h"
#include "base/utils.h" // For CheckedCall
-namespace art {
+namespace art HIDDEN {
namespace jit {
class JitMemoryRegion;
diff --git a/runtime/jit/profile_saver.cc b/runtime/jit/profile_saver.cc
index af5f561d8c..91b011bce8 100644
--- a/runtime/jit/profile_saver.cc
+++ b/runtime/jit/profile_saver.cc
@@ -43,7 +43,7 @@
#include "profile/profile_compilation_info.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
using Hotness = ProfileCompilationInfo::MethodHotness;
diff --git a/runtime/jit/profile_saver.h b/runtime/jit/profile_saver.h
index b5fb1e6c26..1042db9a89 100644
--- a/runtime/jit/profile_saver.h
+++ b/runtime/jit/profile_saver.h
@@ -24,7 +24,7 @@
#include "profile/profile_compilation_info.h"
#include "profile_saver_options.h"
-namespace art {
+namespace art HIDDEN {
class ProfileSaver {
public:
@@ -53,7 +53,7 @@ class ProfileSaver {
static void NotifyJitActivity() REQUIRES(!Locks::profiler_lock_, !instance_->wait_lock_);
// For testing or manual purposes (SIGUSR1).
- static void ForceProcessProfiles() REQUIRES(!Locks::profiler_lock_, !Locks::mutator_lock_);
+ EXPORT static void ForceProcessProfiles() REQUIRES(!Locks::profiler_lock_, !Locks::mutator_lock_);
// Notify that startup has completed.
static void NotifyStartupCompleted() REQUIRES(!Locks::profiler_lock_, !instance_->wait_lock_);
diff --git a/runtime/jit/profile_saver_options.h b/runtime/jit/profile_saver_options.h
index f53b5fcfcc..f6d928ff6b 100644
--- a/runtime/jit/profile_saver_options.h
+++ b/runtime/jit/profile_saver_options.h
@@ -17,7 +17,7 @@
#include <ostream>
#include <string>
-namespace art {
+namespace art HIDDEN {
struct ProfileSaverOptions {
public:
diff --git a/runtime/jit/profile_saver_test.cc b/runtime/jit/profile_saver_test.cc
index e737b7c8ee..e522677eca 100644
--- a/runtime/jit/profile_saver_test.cc
+++ b/runtime/jit/profile_saver_test.cc
@@ -22,7 +22,7 @@
#include "profile_saver.h"
#include "profile/profile_compilation_info.h"
-namespace art {
+namespace art HIDDEN {
using Hotness = ProfileCompilationInfo::MethodHotness;
diff --git a/runtime/jit/profiling_info.cc b/runtime/jit/profiling_info.cc
index 2e94a41093..395e175d7c 100644
--- a/runtime/jit/profiling_info.cc
+++ b/runtime/jit/profiling_info.cc
@@ -23,7 +23,7 @@
#include "scoped_thread_state_change-inl.h"
#include "thread.h"
-namespace art {
+namespace art HIDDEN {
ProfilingInfo::ProfilingInfo(ArtMethod* method,
const std::vector<uint32_t>& inline_cache_entries,
diff --git a/runtime/jit/profiling_info.h b/runtime/jit/profiling_info.h
index 62b431d7a2..05420fd904 100644
--- a/runtime/jit/profiling_info.h
+++ b/runtime/jit/profiling_info.h
@@ -25,7 +25,7 @@
#include "interpreter/mterp/nterp.h"
#include "offsets.h"
-namespace art {
+namespace art HIDDEN {
class ArtMethod;
class ProfilingInfo;
@@ -99,9 +99,9 @@ class BranchCache {
class ProfilingInfo {
public:
// Create a ProfilingInfo for 'method'.
- static ProfilingInfo* Create(Thread* self,
- ArtMethod* method,
- const std::vector<uint32_t>& inline_cache_entries)
+ EXPORT static ProfilingInfo* Create(Thread* self,
+ ArtMethod* method,
+ const std::vector<uint32_t>& inline_cache_entries)
REQUIRES_SHARED(Locks::mutator_lock_);
// Add information from an executed INVOKE instruction to the profile.
diff --git a/runtime/jit/profiling_info_test.cc b/runtime/jit/profiling_info_test.cc
index 021bebfe4e..a8a95774d8 100644
--- a/runtime/jit/profiling_info_test.cc
+++ b/runtime/jit/profiling_info_test.cc
@@ -33,7 +33,7 @@
#include "profile/profile_test_helper.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
using Hotness = ProfileCompilationInfo::MethodHotness;