summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitrii Ishcheikin <ishcheikin@google.com>2024-01-17 15:36:28 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-01-17 15:36:28 +0000
commit14158f44bbece1fbc1c29e92cd16e3307d035b4a (patch)
tree19ce960e76569ff3ea4d33ae1665f60ed1a54d2b
parent68634d6cb630d19f5145a9f61936ed29fe34b790 (diff)
parent0f62043c1670cd365aba1894ad8046cdfc1c905d (diff)
downloadart-14158f44bbece1fbc1c29e92cd16e3307d035b4a.tar.gz
Add visibility attributes in runtime/jni am: 0f62043c16
Original change: https://android-review.googlesource.com/c/platform/art/+/2904172 Change-Id: I327f9f84c0b1accdb6fd47069b78af4326839cba Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--runtime/jni/check_jni.cc2
-rw-r--r--runtime/jni/check_jni.h4
-rw-r--r--runtime/jni/java_vm_ext-inl.h2
-rw-r--r--runtime/jni/java_vm_ext.cc8
-rw-r--r--runtime/jni/java_vm_ext.h31
-rw-r--r--runtime/jni/java_vm_ext_test.cc2
-rw-r--r--runtime/jni/jni_env_ext-inl.h11
-rw-r--r--runtime/jni/jni_env_ext.cc2
-rw-r--r--runtime/jni/jni_env_ext.h10
-rw-r--r--runtime/jni/jni_id_manager.cc2
-rw-r--r--runtime/jni/jni_id_manager.h18
-rw-r--r--runtime/jni/jni_internal.cc2
-rw-r--r--runtime/jni/jni_internal.h4
-rw-r--r--runtime/jni/jni_internal_test.cc2
-rw-r--r--runtime/jni/local_reference_table-inl.h2
-rw-r--r--runtime/jni/local_reference_table.cc2
-rw-r--r--runtime/jni/local_reference_table.h7
-rw-r--r--runtime/jni/local_reference_table_test.cc2
18 files changed, 53 insertions, 60 deletions
diff --git a/runtime/jni/check_jni.cc b/runtime/jni/check_jni.cc
index 3dc9b9f475..db4205cdf8 100644
--- a/runtime/jni/check_jni.cc
+++ b/runtime/jni/check_jni.cc
@@ -51,7 +51,7 @@
#include "thread.h"
#include "well_known_classes.h"
-namespace art {
+namespace art HIDDEN {
// This helper cannot be in the anonymous namespace because it needs to be
// declared as a friend by JniVmExt and JniEnvExt.
diff --git a/runtime/jni/check_jni.h b/runtime/jni/check_jni.h
index 10fdfe859d..854aa20617 100644
--- a/runtime/jni/check_jni.h
+++ b/runtime/jni/check_jni.h
@@ -19,7 +19,9 @@
#include <jni.h>
-namespace art {
+#include "base/macros.h"
+
+namespace art HIDDEN {
const JNINativeInterface* GetCheckJniNativeInterface();
const JNIInvokeInterface* GetCheckJniInvokeInterface();
diff --git a/runtime/jni/java_vm_ext-inl.h b/runtime/jni/java_vm_ext-inl.h
index c98a5532f6..75cfabb588 100644
--- a/runtime/jni/java_vm_ext-inl.h
+++ b/runtime/jni/java_vm_ext-inl.h
@@ -22,7 +22,7 @@
#include "read_barrier_config.h"
#include "thread-inl.h"
-namespace art {
+namespace art HIDDEN {
inline bool JavaVMExt::MayAccessWeakGlobals(Thread* self) const {
DCHECK(self != nullptr);
diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc
index 18abd8b3ee..2a364f37b1 100644
--- a/runtime/jni/java_vm_ext.cc
+++ b/runtime/jni/java_vm_ext.cc
@@ -54,7 +54,7 @@
#include "ti/agent.h"
#include "well_known_classes-inl.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringAppendF;
using android::base::StringAppendV;
@@ -1210,7 +1210,7 @@ jstring JavaVMExt::GetLibrarySearchPath(JNIEnv* env, jobject class_loader) {
// JNI Invocation interface.
-extern "C" jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
+extern "C" EXPORT jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
ScopedTrace trace(__FUNCTION__);
const JavaVMInitArgs* args = static_cast<JavaVMInitArgs*>(vm_args);
if (JavaVMExt::IsBadJniVersion(args->version)) {
@@ -1252,7 +1252,7 @@ extern "C" jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
return JNI_OK;
}
-extern "C" jint JNI_GetCreatedJavaVMs(JavaVM** vms_buf, jsize buf_len, jsize* vm_count) {
+extern "C" EXPORT jint JNI_GetCreatedJavaVMs(JavaVM** vms_buf, jsize buf_len, jsize* vm_count) {
Runtime* runtime = Runtime::Current();
if (runtime == nullptr || buf_len == 0) {
*vm_count = 0;
@@ -1264,7 +1264,7 @@ extern "C" jint JNI_GetCreatedJavaVMs(JavaVM** vms_buf, jsize buf_len, jsize* vm
}
// Historically unsupported.
-extern "C" jint JNI_GetDefaultJavaVMInitArgs(void* /*vm_args*/) {
+extern "C" EXPORT jint JNI_GetDefaultJavaVMInitArgs(void* /*vm_args*/) {
return JNI_ERR;
}
diff --git a/runtime/jni/java_vm_ext.h b/runtime/jni/java_vm_ext.h
index 7f4f5485b6..c04bee7db1 100644
--- a/runtime/jni/java_vm_ext.h
+++ b/runtime/jni/java_vm_ext.h
@@ -25,7 +25,7 @@
#include "obj_ptr.h"
#include "reference_table.h"
-namespace art {
+namespace art HIDDEN {
namespace linker {
class ImageWriter;
@@ -103,11 +103,11 @@ class JavaVMExt : public JavaVM {
* Returns 'true' on success. On failure, sets 'error_msg' to a
* human-readable description of the error.
*/
- bool LoadNativeLibrary(JNIEnv* env,
- const std::string& path,
- jobject class_loader,
- jclass caller_class,
- std::string* error_msg);
+ EXPORT bool LoadNativeLibrary(JNIEnv* env,
+ const std::string& path,
+ jobject class_loader,
+ jclass caller_class,
+ std::string* error_msg);
// Unload native libraries with cleared class loaders.
void UnloadNativeLibraries()
@@ -139,7 +139,7 @@ class JavaVMExt : public JavaVM {
bool SetCheckJniEnabled(bool enabled);
- void VisitRoots(RootVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_)
+ EXPORT void VisitRoots(RootVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Locks::jni_globals_lock_);
void DisallowNewWeakGlobals()
@@ -151,17 +151,15 @@ class JavaVMExt : public JavaVM {
void BroadcastForNewWeakGlobals()
REQUIRES(!Locks::jni_weak_globals_lock_);
- jobject AddGlobalRef(Thread* self, ObjPtr<mirror::Object> obj)
- REQUIRES_SHARED(Locks::mutator_lock_)
- REQUIRES(!Locks::jni_globals_lock_);
+ EXPORT jobject AddGlobalRef(Thread* self, ObjPtr<mirror::Object> obj)
+ REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Locks::jni_globals_lock_);
- jweak AddWeakGlobalRef(Thread* self, ObjPtr<mirror::Object> obj)
- REQUIRES_SHARED(Locks::mutator_lock_)
- REQUIRES(!Locks::jni_weak_globals_lock_);
+ EXPORT jweak AddWeakGlobalRef(Thread* self, ObjPtr<mirror::Object> obj)
+ REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Locks::jni_weak_globals_lock_);
- void DeleteGlobalRef(Thread* self, jobject obj) REQUIRES(!Locks::jni_globals_lock_);
+ EXPORT void DeleteGlobalRef(Thread* self, jobject obj) REQUIRES(!Locks::jni_globals_lock_);
- void DeleteWeakGlobalRef(Thread* self, jweak obj) REQUIRES(!Locks::jni_weak_globals_lock_);
+ EXPORT void DeleteWeakGlobalRef(Thread* self, jweak obj) REQUIRES(!Locks::jni_weak_globals_lock_);
void SweepJniWeakGlobals(IsMarkedVisitor* visitor)
REQUIRES_SHARED(Locks::mutator_lock_)
@@ -214,8 +212,7 @@ class JavaVMExt : public JavaVM {
jint HandleGetEnv(/*out*/void** env, jint version)
REQUIRES(!env_hooks_lock_);
- void AddEnvironmentHook(GetEnvHook hook)
- REQUIRES(!env_hooks_lock_);
+ EXPORT void AddEnvironmentHook(GetEnvHook hook) REQUIRES(!env_hooks_lock_);
static bool IsBadJniVersion(int version);
diff --git a/runtime/jni/java_vm_ext_test.cc b/runtime/jni/java_vm_ext_test.cc
index e7295aaa62..f9176fc5c4 100644
--- a/runtime/jni/java_vm_ext_test.cc
+++ b/runtime/jni/java_vm_ext_test.cc
@@ -23,7 +23,7 @@
#include "java_vm_ext.h"
#include "runtime.h"
-namespace art {
+namespace art HIDDEN {
class JavaVmExtTest : public CommonRuntimeTest {
protected:
diff --git a/runtime/jni/jni_env_ext-inl.h b/runtime/jni/jni_env_ext-inl.h
index 0c04192958..9adb173e60 100644
--- a/runtime/jni/jni_env_ext-inl.h
+++ b/runtime/jni/jni_env_ext-inl.h
@@ -22,17 +22,12 @@
#include "local_reference_table-inl.h"
#include "mirror/object.h"
-namespace art {
+namespace art HIDDEN {
template<typename T>
inline T JNIEnvExt::AddLocalReference(ObjPtr<mirror::Object> obj) {
- std::string error_msg;
- IndirectRef ref = locals_.Add(local_ref_cookie_, obj, &error_msg);
- if (UNLIKELY(ref == nullptr)) {
- // This is really unexpected if we allow resizing local IRTs...
- LOG(FATAL) << error_msg;
- UNREACHABLE();
- }
+ DCHECK(obj != nullptr);
+ jobject ref = NewLocalRef(obj.Ptr());
// TODO: fix this to understand PushLocalFrame, so we can turn it on.
if (false) {
diff --git a/runtime/jni/jni_env_ext.cc b/runtime/jni/jni_env_ext.cc
index fcf38bafb0..a68df6f658 100644
--- a/runtime/jni/jni_env_ext.cc
+++ b/runtime/jni/jni_env_ext.cc
@@ -36,7 +36,7 @@
#include "thread-inl.h"
#include "thread_list.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringPrintf;
diff --git a/runtime/jni/jni_env_ext.h b/runtime/jni/jni_env_ext.h
index 1f57658c87..177c70d171 100644
--- a/runtime/jni/jni_env_ext.h
+++ b/runtime/jni/jni_env_ext.h
@@ -25,7 +25,7 @@
#include "obj_ptr.h"
#include "reference_table.h"
-namespace art {
+namespace art HIDDEN {
class ArtMethod;
class ArtField;
@@ -66,8 +66,8 @@ class JNIEnvExt : public JNIEnv {
void UpdateLocal(IndirectRef iref, ObjPtr<mirror::Object> obj)
REQUIRES_SHARED(Locks::mutator_lock_);
- jobject NewLocalRef(mirror::Object* obj) REQUIRES_SHARED(Locks::mutator_lock_);
- void DeleteLocalRef(jobject obj) REQUIRES_SHARED(Locks::mutator_lock_);
+ EXPORT jobject NewLocalRef(mirror::Object* obj) REQUIRES_SHARED(Locks::mutator_lock_);
+ EXPORT void DeleteLocalRef(jobject obj) REQUIRES_SHARED(Locks::mutator_lock_);
void TrimLocals() REQUIRES_SHARED(Locks::mutator_lock_) {
locals_.Trim();
@@ -138,12 +138,12 @@ class JNIEnvExt : public JNIEnv {
// to all threads.
// Note: JNI function table overrides are sensitive to the order of operations wrt/ CheckJNI.
// After overriding the JNI function table, CheckJNI toggling is ignored.
- static void SetTableOverride(const JNINativeInterface* table_override)
+ EXPORT static void SetTableOverride(const JNINativeInterface* table_override)
REQUIRES(!Locks::thread_list_lock_, !Locks::jni_function_table_lock_);
// Return either the regular, or the CheckJNI function table. Will return table_override_ instead
// if it is not null.
- static const JNINativeInterface* GetFunctionTable(bool check_jni)
+ EXPORT static const JNINativeInterface* GetFunctionTable(bool check_jni)
REQUIRES(Locks::jni_function_table_lock_);
static void ResetFunctionTable()
diff --git a/runtime/jni/jni_id_manager.cc b/runtime/jni/jni_id_manager.cc
index 5af1a78013..c7c2733951 100644
--- a/runtime/jni/jni_id_manager.cc
+++ b/runtime/jni/jni_id_manager.cc
@@ -46,7 +46,7 @@
#include "thread-inl.h"
#include "thread.h"
-namespace art {
+namespace art HIDDEN {
namespace jni {
constexpr bool kTraceIds = false;
diff --git a/runtime/jni/jni_id_manager.h b/runtime/jni/jni_id_manager.h
index c8ebfc331a..c7ebeb8abb 100644
--- a/runtime/jni/jni_id_manager.h
+++ b/runtime/jni/jni_id_manager.h
@@ -29,7 +29,7 @@
#include "jni_id_type.h"
#include "reflective_value_visitor.h"
-namespace art {
+namespace art HIDDEN {
namespace mirror {
class Object;
class ClassExt;
@@ -50,15 +50,15 @@ class JniIdManager {
void Init(Thread* self) REQUIRES_SHARED(Locks::mutator_lock_);
- ArtMethod* DecodeMethodId(jmethodID method) REQUIRES(!Locks::jni_id_lock_);
- ArtField* DecodeFieldId(jfieldID field) REQUIRES(!Locks::jni_id_lock_);
- jmethodID EncodeMethodId(ReflectiveHandle<ArtMethod> method) REQUIRES(!Locks::jni_id_lock_)
+ EXPORT ArtMethod* DecodeMethodId(jmethodID method) REQUIRES(!Locks::jni_id_lock_);
+ EXPORT ArtField* DecodeFieldId(jfieldID field) REQUIRES(!Locks::jni_id_lock_);
+ EXPORT jmethodID EncodeMethodId(ReflectiveHandle<ArtMethod> method) REQUIRES(!Locks::jni_id_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
- jmethodID EncodeMethodId(ArtMethod* method) REQUIRES(!Locks::jni_id_lock_)
+ EXPORT jmethodID EncodeMethodId(ArtMethod* method) REQUIRES(!Locks::jni_id_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
- jfieldID EncodeFieldId(ReflectiveHandle<ArtField> field) REQUIRES(!Locks::jni_id_lock_)
+ EXPORT jfieldID EncodeFieldId(ReflectiveHandle<ArtField> field) REQUIRES(!Locks::jni_id_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
- jfieldID EncodeFieldId(ArtField* field) REQUIRES(!Locks::jni_id_lock_)
+ EXPORT jfieldID EncodeFieldId(ArtField* field) REQUIRES(!Locks::jni_id_lock_)
REQUIRES_SHARED(Locks::mutator_lock_);
void VisitReflectiveTargets(ReflectiveValueVisitor* rvv)
@@ -66,7 +66,7 @@ class JniIdManager {
void VisitRoots(RootVisitor* visitor) REQUIRES_SHARED(Locks::mutator_lock_);
- ObjPtr<mirror::Object> GetPointerMarker() REQUIRES_SHARED(Locks::mutator_lock_);
+ EXPORT ObjPtr<mirror::Object> GetPointerMarker() REQUIRES_SHARED(Locks::mutator_lock_);
private:
template <typename ArtType>
@@ -113,7 +113,7 @@ class JniIdManager {
// This is required since normally we need to be able to allocate to encode new ids. This should
// only be used when absolutely required, for example to invoke user-callbacks during heap walking
// or similar.
-class ScopedEnableSuspendAllJniIdQueries {
+class EXPORT ScopedEnableSuspendAllJniIdQueries {
public:
ScopedEnableSuspendAllJniIdQueries() REQUIRES_SHARED(Locks::mutator_lock_);
~ScopedEnableSuspendAllJniIdQueries() REQUIRES_SHARED(Locks::mutator_lock_);
diff --git a/runtime/jni/jni_internal.cc b/runtime/jni/jni_internal.cc
index 71bed2e0be..50037ecbfd 100644
--- a/runtime/jni/jni_internal.cc
+++ b/runtime/jni/jni_internal.cc
@@ -66,7 +66,7 @@
#include "thread.h"
#include "well_known_classes-inl.h"
-namespace art {
+namespace art HIDDEN {
namespace {
diff --git a/runtime/jni/jni_internal.h b/runtime/jni/jni_internal.h
index cfe8208a11..10168b511d 100644
--- a/runtime/jni/jni_internal.h
+++ b/runtime/jni/jni_internal.h
@@ -27,14 +27,14 @@
#include "runtime.h"
#include "thread.h"
-namespace art {
+namespace art HIDDEN {
class ArtField;
class ArtMethod;
class ScopedObjectAccess;
const JNINativeInterface* GetJniNativeInterface();
-const JNINativeInterface* GetRuntimeShutdownNativeInterface();
+EXPORT const JNINativeInterface* GetRuntimeShutdownNativeInterface();
int ThrowNewException(JNIEnv* env, jclass exception_class, const char* msg, jobject cause);
diff --git a/runtime/jni/jni_internal_test.cc b/runtime/jni/jni_internal_test.cc
index 7f65925910..676bd59a55 100644
--- a/runtime/jni/jni_internal_test.cc
+++ b/runtime/jni/jni_internal_test.cc
@@ -28,7 +28,7 @@
#include "nativehelper/scoped_local_ref.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
using android::base::StringPrintf;
diff --git a/runtime/jni/local_reference_table-inl.h b/runtime/jni/local_reference_table-inl.h
index 8b4604976f..cc94e9c538 100644
--- a/runtime/jni/local_reference_table-inl.h
+++ b/runtime/jni/local_reference_table-inl.h
@@ -27,7 +27,7 @@
#include "mirror/object_reference.h"
#include "verify_object.h"
-namespace art {
+namespace art HIDDEN {
namespace jni {
inline void LrtEntry::SetReference(ObjPtr<mirror::Object> ref) {
diff --git a/runtime/jni/local_reference_table.cc b/runtime/jni/local_reference_table.cc
index bf55f0ec3e..b8c2efcd45 100644
--- a/runtime/jni/local_reference_table.cc
+++ b/runtime/jni/local_reference_table.cc
@@ -34,7 +34,7 @@
#include <cstdlib>
-namespace art {
+namespace art HIDDEN {
namespace jni {
static constexpr bool kDumpStackOnNonLocalReference = false;
diff --git a/runtime/jni/local_reference_table.h b/runtime/jni/local_reference_table.h
index df2b5075a5..85c7964103 100644
--- a/runtime/jni/local_reference_table.h
+++ b/runtime/jni/local_reference_table.h
@@ -39,7 +39,7 @@
#include "obj_ptr.h"
#include "offsets.h"
-namespace art {
+namespace art HIDDEN {
class RootInfo;
@@ -274,8 +274,7 @@ class LocalReferenceTable {
// will return null if an error happened (with an appropriate error message set).
IndirectRef Add(LRTSegmentState previous_state,
ObjPtr<mirror::Object> obj,
- std::string* error_msg)
- REQUIRES_SHARED(Locks::mutator_lock_);
+ std::string* error_msg) REQUIRES_SHARED(Locks::mutator_lock_);
// Given an `IndirectRef` in the table, return the `Object` it refers to.
//
@@ -330,7 +329,7 @@ class LocalReferenceTable {
// without recovering holes. Thus this is a conservative estimate.
size_t FreeCapacity() const;
- void VisitRoots(RootVisitor* visitor, const RootInfo& root_info)
+ EXPORT void VisitRoots(RootVisitor* visitor, const RootInfo& root_info)
REQUIRES_SHARED(Locks::mutator_lock_);
LRTSegmentState GetSegmentState() const {
diff --git a/runtime/jni/local_reference_table_test.cc b/runtime/jni/local_reference_table_test.cc
index 5839c60d0a..5063d728b2 100644
--- a/runtime/jni/local_reference_table_test.cc
+++ b/runtime/jni/local_reference_table_test.cc
@@ -24,7 +24,7 @@
#include "mirror/object-inl.h"
#include "scoped_thread_state_change-inl.h"
-namespace art {
+namespace art HIDDEN {
namespace jni {
using android::base::StringPrintf;