summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrion Hodson <oth@google.com>2020-07-27 18:18:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-27 18:18:39 +0000
commit7cfba3cc05fa0b485b4627a059f0869ddc20bc8b (patch)
tree03cf90d27f69f1479f7f14b8a66cea574a67e14a
parent0eeaac1ad230e111e1234bddd69415de2d68fc97 (diff)
parentba359650a3bdaca5ae998cc41aac3555c1ab126c (diff)
runtime/jni: inclusive language fixes am: 0740eeb24d am: 2198d2dee5 am: 80806c8d6d am: 7640dd7401 am: ba359650a3
Original change: https://android-review.googlesource.com/c/platform/art/+/1373039 Change-Id: Ibf9e0fb7a5bdf86438ed21918d84ab5e99bbaf46
-rw-r--r--runtime/jni/check_jni.cc8
-rw-r--r--runtime/jni/java_vm_ext.cc6
-rw-r--r--runtime/jni/java_vm_ext_test.cc2
-rw-r--r--runtime/jni/jni_env_ext.cc2
-rw-r--r--runtime/jni/jni_env_ext.h2
5 files changed, 11 insertions, 9 deletions
diff --git a/runtime/jni/check_jni.cc b/runtime/jni/check_jni.cc
index 32060117e7..1626357709 100644
--- a/runtime/jni/check_jni.cc
+++ b/runtime/jni/check_jni.cc
@@ -2729,8 +2729,8 @@ class CheckJNI {
JniValueType args[2] = {{.E = env}, {.L = buf}};
if (sc.Check(soa, true, "EL", args)) {
JniValueType result;
- // Note: this is implemented in the base environment by a GetLongField which will sanity
- // check the type of buf in GetLongField above.
+ // Note: this is implemented in the base environment by a GetLongField which will check the
+ // type of buf in GetLongField above.
result.p = baseEnv(env)->GetDirectBufferAddress(env, buf);
if (sc.Check(soa, false, "p", &result)) {
return const_cast<void*>(result.p);
@@ -2746,8 +2746,8 @@ class CheckJNI {
JniValueType args[2] = {{.E = env}, {.L = buf}};
if (sc.Check(soa, true, "EL", args)) {
JniValueType result;
- // Note: this is implemented in the base environment by a GetIntField which will sanity
- // check the type of buf in GetIntField above.
+ // Note: this is implemented in the base environment by a GetIntField which will check the
+ // type of buf in GetIntField above.
result.J = baseEnv(env)->GetDirectBufferCapacity(env, buf);
if (sc.Check(soa, false, "J", &result)) {
return result.J;
diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc
index e5b3d4de42..e085cd98cb 100644
--- a/runtime/jni/java_vm_ext.cc
+++ b/runtime/jni/java_vm_ext.cc
@@ -59,9 +59,11 @@ namespace art {
using android::base::StringAppendF;
using android::base::StringAppendV;
-static constexpr size_t kGlobalsMax = 51200; // Arbitrary sanity check. (Must fit in 16 bits.)
+// Maximum number of global references (must fit in 16 bits).
+static constexpr size_t kGlobalsMax = 51200;
-static constexpr size_t kWeakGlobalsMax = 51200; // Arbitrary sanity check. (Must fit in 16 bits.)
+// Maximum number of weak global references (must fit in 16 bits).
+static constexpr size_t kWeakGlobalsMax = 51200;
bool JavaVMExt::IsBadJniVersion(int version) {
// We don't support JNI_VERSION_1_1. These are the only other valid versions.
diff --git a/runtime/jni/java_vm_ext_test.cc b/runtime/jni/java_vm_ext_test.cc
index 4a7b1ca6ef..0363cdb345 100644
--- a/runtime/jni/java_vm_ext_test.cc
+++ b/runtime/jni/java_vm_ext_test.cc
@@ -151,7 +151,7 @@ TEST_F(JavaVmExtStackTraceTest, TestEnableDisable) {
ASSERT_EQ(JNI_OK, ok);
std::vector<jobject> global_refs_;
- jobject local_ref = env->NewStringUTF("Dummy");
+ jobject local_ref = env->NewStringUTF("Hello");
for (size_t i = 0; i < 2000; ++i) {
global_refs_.push_back(env->NewGlobalRef(local_ref));
}
diff --git a/runtime/jni/jni_env_ext.cc b/runtime/jni/jni_env_ext.cc
index cf6a22ce9a..6e46c24744 100644
--- a/runtime/jni/jni_env_ext.cc
+++ b/runtime/jni/jni_env_ext.cc
@@ -40,7 +40,7 @@ namespace art {
using android::base::StringPrintf;
static constexpr size_t kMonitorsInitial = 32; // Arbitrary.
-static constexpr size_t kMonitorsMax = 4096; // Arbitrary sanity check.
+static constexpr size_t kMonitorsMax = 4096; // Maximum number of monitors held by JNI code.
const JNINativeInterface* JNIEnvExt::table_override_ = nullptr;
diff --git a/runtime/jni/jni_env_ext.h b/runtime/jni/jni_env_ext.h
index 2c7ba3be02..5d4304d508 100644
--- a/runtime/jni/jni_env_ext.h
+++ b/runtime/jni/jni_env_ext.h
@@ -37,7 +37,7 @@ class Object;
} // namespace mirror
// Number of local references in the indirect reference table. The value is arbitrary but
-// low enough that it forces sanity checks.
+// low enough that it forces integrity checks.
static constexpr size_t kLocalsInitial = 512;
class JNIEnvExt : public JNIEnv {