Skip to content

Commit 23801da

Browse files
committed
8259482: jni_Set/GetField_probe are the same as their _nh versions
Reviewed-by: hseigel, sspitsyn, dholmes
1 parent 01b2804 commit 23801da

File tree

3 files changed

+4
-37
lines changed

3 files changed

+4
-37
lines changed

src/hotspot/share/prims/jni.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ JNI_ENTRY_NO_PRESERVE(Return, jni_Get##Result##Field(JNIEnv *env, jobject obj, j
19421942
int offset = jfieldIDWorkaround::from_instance_jfieldID(k, fieldID); \
19431943
/* Keep JVMTI addition small and only check enabled flag here. */ \
19441944
if (JvmtiExport::should_post_field_access()) { \
1945-
o = JvmtiExport::jni_GetField_probe_nh(thread, obj, o, k, fieldID, false); \
1945+
o = JvmtiExport::jni_GetField_probe(thread, obj, o, k, fieldID, false); \
19461946
} \
19471947
ret = o->Fieldname##_field(offset); \
19481948
return ret; \
@@ -2009,7 +2009,7 @@ JNI_ENTRY_NO_PRESERVE(void, jni_SetObjectField(JNIEnv *env, jobject obj, jfieldI
20092009
if (JvmtiExport::should_post_field_modification()) {
20102010
jvalue field_value;
20112011
field_value.l = value;
2012-
o = JvmtiExport::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false, JVM_SIGNATURE_CLASS, (jvalue *)&field_value);
2012+
o = JvmtiExport::jni_SetField_probe(thread, obj, o, k, fieldID, false, JVM_SIGNATURE_CLASS, (jvalue *)&field_value);
20132013
}
20142014
HeapAccess<ON_UNKNOWN_OOP_REF>::oop_store_at(o, offset, JNIHandles::resolve(value));
20152015
HOTSPOT_JNI_SETOBJECTFIELD_RETURN();
@@ -2031,7 +2031,7 @@ JNI_ENTRY_NO_PRESERVE(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfi
20312031
if (JvmtiExport::should_post_field_modification()) { \
20322032
jvalue field_value; \
20332033
field_value.unionType = value; \
2034-
o = JvmtiExport::jni_SetField_probe_nh(thread, obj, o, k, fieldID, false, SigType, (jvalue *)&field_value); \
2034+
o = JvmtiExport::jni_SetField_probe(thread, obj, o, k, fieldID, false, SigType, (jvalue *)&field_value); \
20352035
} \
20362036
if (SigType == JVM_SIGNATURE_BOOLEAN) { value = ((jboolean)value) & 1; } \
20372037
o->Fieldname##_field_put(offset, value); \

src/hotspot/share/prims/jvmtiExport.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,19 +1872,6 @@ void JvmtiExport::notice_unwind_due_to_exception(JavaThread *thread, Method* met
18721872

18731873
oop JvmtiExport::jni_GetField_probe(JavaThread *thread, jobject jobj, oop obj,
18741874
Klass* klass, jfieldID fieldID, bool is_static) {
1875-
if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) {
1876-
// At least one field access watch is set so we have more work
1877-
// to do. This wrapper is used by entry points that allow us
1878-
// to create handles in post_field_access_by_jni().
1879-
post_field_access_by_jni(thread, obj, klass, fieldID, is_static);
1880-
// event posting can block so refetch oop if we were passed a jobj
1881-
if (jobj != NULL) return JNIHandles::resolve_non_null(jobj);
1882-
}
1883-
return obj;
1884-
}
1885-
1886-
oop JvmtiExport::jni_GetField_probe_nh(JavaThread *thread, jobject jobj, oop obj,
1887-
Klass* klass, jfieldID fieldID, bool is_static) {
18881875
if (*((int *)get_field_access_count_addr()) > 0 && thread->has_last_Java_frame()) {
18891876
// At least one field access watch is set so we have more work to do.
18901877
post_field_access_by_jni(thread, obj, klass, fieldID, is_static);
@@ -1962,20 +1949,6 @@ void JvmtiExport::post_field_access(JavaThread *thread, Method* method,
19621949
oop JvmtiExport::jni_SetField_probe(JavaThread *thread, jobject jobj, oop obj,
19631950
Klass* klass, jfieldID fieldID, bool is_static,
19641951
char sig_type, jvalue *value) {
1965-
if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) {
1966-
// At least one field modification watch is set so we have more work
1967-
// to do. This wrapper is used by entry points that allow us
1968-
// to create handles in post_field_modification_by_jni().
1969-
post_field_modification_by_jni(thread, obj, klass, fieldID, is_static, sig_type, value);
1970-
// event posting can block so refetch oop if we were passed a jobj
1971-
if (jobj != NULL) return JNIHandles::resolve_non_null(jobj);
1972-
}
1973-
return obj;
1974-
}
1975-
1976-
oop JvmtiExport::jni_SetField_probe_nh(JavaThread *thread, jobject jobj, oop obj,
1977-
Klass* klass, jfieldID fieldID, bool is_static,
1978-
char sig_type, jvalue *value) {
19791952
if (*((int *)get_field_modification_count_addr()) > 0 && thread->has_last_Java_frame()) {
19801953
// At least one field modification watch is set so we have more work to do.
19811954
post_field_modification_by_jni(thread, obj, klass, fieldID, is_static, sig_type, value);

src/hotspot/share/prims/jvmtiExport.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -310,19 +310,13 @@ class JvmtiExport : public AllStatic {
310310
static oop jni_GetField_probe (JavaThread *thread, jobject jobj,
311311
oop obj, Klass* klass, jfieldID fieldID, bool is_static)
312312
NOT_JVMTI_RETURN_(NULL);
313-
static oop jni_GetField_probe_nh (JavaThread *thread, jobject jobj,
314-
oop obj, Klass* klass, jfieldID fieldID, bool is_static)
315-
NOT_JVMTI_RETURN_(NULL);
316313
static void post_field_access_by_jni (JavaThread *thread, oop obj,
317314
Klass* klass, jfieldID fieldID, bool is_static) NOT_JVMTI_RETURN;
318315
static void post_field_access (JavaThread *thread, Method* method,
319316
address location, Klass* field_klass, Handle object, jfieldID field) NOT_JVMTI_RETURN;
320317
static oop jni_SetField_probe (JavaThread *thread, jobject jobj,
321318
oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
322319
jvalue *value) NOT_JVMTI_RETURN_(NULL);
323-
static oop jni_SetField_probe_nh (JavaThread *thread, jobject jobj,
324-
oop obj, Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
325-
jvalue *value) NOT_JVMTI_RETURN_(NULL);
326320
static void post_field_modification_by_jni(JavaThread *thread, oop obj,
327321
Klass* klass, jfieldID fieldID, bool is_static, char sig_type,
328322
jvalue *value);

0 commit comments

Comments
 (0)