8210182: Remove macros for C compilation from vmTestBase but non jvmti
Summary: Remove the macros and update the code
Reviewed-by: sspitsyn, cjplummer, amenkov
--- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -31,24 +31,10 @@
#define REFERENCES_ARRAY_SIZE 10000000
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x, y) x , y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
#ifndef _Included_gc_g1_unloading_unloading_classloaders_JNIClassloader
#define _Included_gc_g1_unloading_unloading_classloaders_JNIClassloader
-#ifdef __cplusplus
extern "C" {
-#endif
/*
* Class: gc_g1_unloading_unloading_classloaders_JNIClassloader
@@ -58,10 +44,10 @@
JNIEXPORT jclass JNICALL Java_gc_g1_unloading_classloaders_JNIClassloader_loadThroughJNI0 (JNIEnv * env,
jclass clazz, jstring className, jobject classLoader, jbyteArray bytecode) {
- const char * classNameChar = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, className), NULL);
- jbyte * arrayContent = JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytecode), NULL);
- jsize bytecodeLength = JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytecode));
- jclass returnValue = JNI_ENV_PTR(env)->DefineClass(JNI_ENV_ARG(env, classNameChar), classLoader, arrayContent, bytecodeLength);
+ const char * classNameChar = env->GetStringUTFChars(className, NULL);
+ jbyte * arrayContent = env->GetByteArrayElements(bytecode, NULL);
+ jsize bytecodeLength = env->GetArrayLength(bytecode);
+ jclass returnValue = env->DefineClass(classNameChar, classLoader, arrayContent, bytecodeLength);
if (!returnValue) {
printf("ERROR: DefineClass call returned NULL by some reason. Classloading failed.\n");
}
@@ -81,25 +67,25 @@
jvmtiError err;
jvmtiCapabilities caps;
jvmtiClassDefinition classDef;
- jint jint_err = JNI_ENV_PTR(env)->GetJavaVM(JNI_ENV_ARG(env, &jvm));
+ jint jint_err = env->GetJavaVM(&jvm);
if (jint_err) {
printf("GetJavaVM returned nonzero: %d", jint_err);
return STATUS_FAILED;
}
- jint_err = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **)&jvmti), JVMTI_VERSION_1_0);
+ jint_err = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_0);
if (jint_err) {
printf("GetEnv returned nonzero: %d", jint_err);
return STATUS_FAILED;
}
- err = JNI_ENV_PTR(jvmti)->GetPotentialCapabilities(JNI_ENV_ARG(jvmti, &caps));
+ err = jvmti->GetPotentialCapabilities(&caps);
if (err != JVMTI_ERROR_NONE) {
printf("(GetPotentialCapabilities) unexpected error: %d\n",err);
return JNI_ERR;
}
- err = JNI_ENV_PTR(jvmti)->AddCapabilities(JNI_ENV_ARG(jvmti, &caps));
+ err = jvmti->AddCapabilities(&caps);
if (err != JVMTI_ERROR_NONE) {
printf("(AddCapabilities) unexpected error: %d\n", err);
return JNI_ERR;
@@ -112,16 +98,16 @@
classDef.klass = redefCls;
classDef.class_byte_count =
- JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
+ env->GetArrayLength(classBytes);
classDef.class_bytes = (unsigned char *)
- JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes),
+ env->GetByteArrayElements(classBytes,
NULL);
if (fl == 2) {
printf(">>>>>>>> Invoke RedefineClasses():\n");
printf("\tnew class byte count=%d\n", classDef.class_byte_count);
}
- err = JNI_ENV_PTR(jvmti)->RedefineClasses(JNI_ENV_ARG(jvmti, 1), &classDef);
+ err = jvmti->RedefineClasses(1, &classDef);
if (err != JVMTI_ERROR_NONE) {
printf("%s: Failed to call RedefineClasses():\n", __FILE__);
printf("\tthe function returned error %d\n", err);
@@ -145,7 +131,7 @@
JNIEXPORT jint JNICALL Java_gc_g1_unloading_keepref_JNIGlobalRefHolder_keepGlobalJNIReference
(JNIEnv * env, jclass clazz, jobject obj) {
int returnValue;
- referencesArray[firstFreeIndex] = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, obj));
+ referencesArray[firstFreeIndex] = env->NewGlobalRef(obj);
printf("checkpoint1 %d \n", firstFreeIndex);
returnValue = firstFreeIndex;
firstFreeIndex++;
@@ -159,7 +145,7 @@
*/
JNIEXPORT void JNICALL Java_gc_g1_unloading_keepref_JNIGlobalRefHolder_deleteGlobalJNIReference
(JNIEnv * env, jclass clazz, jint index) {
- JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG(env, referencesArray[index]));
+ env->DeleteGlobalRef(referencesArray[index]);
}
@@ -185,10 +171,6 @@
waitMethod = env->GetMethodID(objectClazz, "wait", "()V");
env->CallVoidMethod(syncObject, waitMethod);
printf("checkpoint2 \n");
- }
-
-
-#ifdef __cplusplus
+}
}
#endif
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/libforceEarlyReturn004a.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/libforceEarlyReturn004a.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -23,25 +23,8 @@
#include "jni.h"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x, y, z) y, z
-#define JNI_ENV_ARG_4(x, y, z, a) y, z, a
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x, y, z) x, y, z
-#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
int always_true = 1;
@@ -50,9 +33,9 @@
{
int dummy_counter = 0;
// notify another thread that thread in native method
- jclass klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, object));
- jfieldID field = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG_4(env, klass, "threadInNative", "Z"));
- JNI_ENV_PTR(env)->SetBooleanField(JNI_ENV_ARG_4(env, object, field, 1));
+ jclass klass = env->GetObjectClass(object);
+ jfieldID field = env->GetFieldID(klass, "threadInNative", "Z");
+ env->SetBooleanField(object, field, 1);
// execute infinite loop to be sure that thread in native method
while(always_true)
@@ -66,6 +49,4 @@
return dummy_counter >= 0 ? 0 : 1;
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/libforceEarlyReturn005a.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn005/libforceEarlyReturn005a.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -24,37 +24,22 @@
#include "jni.h"
#include "nsk_tools.cpp"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x,y,z) y, z
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x,y,z) x, y, z
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
JNIEXPORT void JNICALL
Java_nsk_jdi_ThreadReference_forceEarlyReturn_forceEarlyReturn005_forceEarlyReturn005a_nativeJNIMonitorEnter(JNIEnv *env, jobject classObject, jobject object)
{
- jint success = JNI_ENV_PTR(env)->MonitorEnter(JNI_ENV_ARG_2(env, object));
+ jint success = env->MonitorEnter(object);
if(success != 0)
{
NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorEnter return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorEnter return non-zero");
}
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -23,25 +23,8 @@
#include "jni.h"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x, y, z) y, z
-#define JNI_ENV_ARG_4(x, y, z, a) y, z, a
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x, y, z) x, y, z
-#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
int always_true = 1;
@@ -50,9 +33,9 @@
{
int dummy_counter = 0;
// notify another thread that thread in native method
- jclass klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, object));
- jfieldID field = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG_4(env, klass, "threadInNative", "Z"));
- JNI_ENV_PTR(env)->SetBooleanField(JNI_ENV_ARG_4(env, object, field, 1));
+ jclass klass = env->GetObjectClass(object);
+ jfieldID field = env->GetFieldID(klass, "threadInNative", "Z");
+ env->SetBooleanField(object, field, 1);
// execute infinite loop to be sure that thread in native method
while(always_true)
@@ -66,6 +49,4 @@
return dummy_counter >= 0 ? 0 : 1;
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -23,45 +23,34 @@
#include "jni.h"
#include "nsk_tools.h"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x,y, z) y, z
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x,y, z) x, y, z
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
JNIEXPORT void JNICALL
Java_nsk_share_jdi_MonitorEnterExecutor_nativeJNIMonitorEnter(JNIEnv *env, jobject thisObject)
{
jint success;
- success = JNI_ENV_PTR(env)->MonitorEnter(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorEnter(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorEnter return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorEnter return non-zero");
}
- success = JNI_ENV_PTR(env)->MonitorExit(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorExit(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorExit return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorExit return non-zero");
}
}
@@ -70,22 +59,26 @@
{
jint success;
- success = JNI_ENV_PTR(env)->MonitorEnter(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorEnter(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorEnter return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorEnter return non-zero");
}
- success = JNI_ENV_PTR(env)->MonitorExit(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorExit(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorExit return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorExit return non-zero");
}
}
@@ -94,25 +87,27 @@
{
jint success;
- success = JNI_ENV_PTR(env)->MonitorEnter(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorEnter(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorEnter return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorEnter return non-zero");
}
- success = JNI_ENV_PTR(env)->MonitorExit(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorExit(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorExit return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorExit return non-zero");
}
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -24,25 +24,8 @@
#include <stdlib.h>
#include "nsk_tools.h"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x, y, z) y, z
-#define JNI_ENV_ARG_4(x, y, z, a) y, z, a
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x, y, z) x, y, z
-#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
static jobject* globalReferences = NULL;
static jweak* weakReferences = NULL;
@@ -76,13 +59,15 @@
if(reference == NULL)
{
- reference = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG_2(env, object));
+ reference = env->NewGlobalRef(object);
if(reference == NULL)
{
NSK_COMPLAIN0("NewGlobalRef return NULL\n");
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "NewGlobalRef return NULL"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "NewGlobalRef return NULL");
}
globalReferences[i] = reference;
@@ -106,10 +91,12 @@
{
NSK_COMPLAIN1("globalReferences[%d] = NULL, possible wrong index is passed\n", index);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestBug")), "Requested globalReferences[] element is NULL, possible wrong index is passed"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestBug"),
+ "Requested globalReferences[] element is NULL, possible wrong index is passed");
}
- JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG_2(env, reference));
+ env->DeleteGlobalRef(reference);
globalReferences[index] = NULL;
}
@@ -119,23 +106,27 @@
Java_nsk_share_ReferringObject_createJNILocalReferenceNative(JNIEnv *env,
jobject thisObject, jobject object, jobject createWicket, jobject deleteWicket)
{
- jobject reference = JNI_ENV_PTR(env)->NewLocalRef(JNI_ENV_ARG_2(env, object));
+ jobject reference = env->NewLocalRef(object);
jclass klass;
if(reference == NULL)
{
NSK_COMPLAIN0("NewLocalRef return NULL\n");
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "NewLocalRef return NULL"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "NewLocalRef return NULL");
}
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, createWicket));
+ klass = env->GetObjectClass(createWicket);
// notify another thread that JNI local reference has been created
- JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG_3(env, createWicket, JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, klass, "unlock", "()V"))));
+ env->CallVoidMethod(createWicket,
+ env->GetMethodID(klass, "unlock", "()V"));
// wait till JNI local reference can be released (it will heppen then we will leave the method)
- JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG_3(env, deleteWicket, JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, klass, "waitFor", "()V"))));
+ env->CallVoidMethod(deleteWicket,
+ env->GetMethodID(klass, "waitFor", "()V"));
}
JNIEXPORT jint JNICALL
@@ -168,13 +159,15 @@
if(reference == NULL)
{
- reference = JNI_ENV_PTR(env)->NewWeakGlobalRef(JNI_ENV_ARG_2(env, object));
+ reference = env->NewWeakGlobalRef(object);
if(reference == NULL)
{
NSK_COMPLAIN0("NewWeakGlobalRef return NULL\n");
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "NewWeakGlobalRef return NULL"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "NewWeakGlobalRef return NULL");
}
weakReferences[i] = reference;
@@ -198,21 +191,23 @@
{
NSK_COMPLAIN1("weakReferences[%d] = NULL, possible wrong index is passed\n", index);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestBug")), "Requested weakReferences[] element is NULL, possible wrong index is passed"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestBug"),
+ "Requested weakReferences[] element is NULL, possible wrong index is passed");
}
- if(JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG_3(env, reference, NULL)) == JNI_TRUE)
+ if(env->IsSameObject(reference, NULL) == JNI_TRUE)
{
NSK_COMPLAIN0("TEST BUG: Weak reference was collected\n");
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestBug")), "TEST BUG: Weak reference was collected"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestBug"),
+ "TEST BUG: Weak reference was collected");
}
- JNI_ENV_PTR(env)->DeleteWeakGlobalRef(JNI_ENV_ARG_2(env, reference));
+ env->DeleteWeakGlobalRef(reference);
weakReferences[index] = NULL;
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/libNativeMethodsTestThread.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/libNativeMethodsTestThread.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -23,36 +23,16 @@
#include "jni.h"
#include <stdlib.h>
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x, y, z) y, z
-#define JNI_ENV_ARG_4(x, y, z, a) y, z, a
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x, y, z) x, y, z
-#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
static void logMessage(JNIEnv *env, jobject thisObject, jstring message)
{
jclass klass;
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
- JNI_ENV_PTR(env)->CallVoidMethod(
- JNI_ENV_ARG_4(
- env,
- thisObject,
- JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, klass, "log", "(Ljava/lang/String;)V")),
- message));
+ klass = env->GetObjectClass(thisObject);
+ env->CallVoidMethod(thisObject,
+ env->GetMethodID(klass, "log", "(Ljava/lang/String;)V"),
+ message);
}
JNIEXPORT void JNICALL
@@ -71,15 +51,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedBooleanValue",
- "Z"));
+ valueField = env->GetStaticFieldID(klass, "expectedBooleanValue", "Z");
- return JNI_ENV_PTR(env)->GetStaticBooleanField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticBooleanField(klass, valueField);
}
JNIEXPORT jbyte JNICALL
@@ -91,15 +67,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedByteValue",
- "B"));
+ valueField = env->GetStaticFieldID(klass, "expectedByteValue", "B");
- return JNI_ENV_PTR(env)->GetStaticByteField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticByteField(klass, valueField);
}
JNIEXPORT jshort JNICALL
@@ -111,15 +83,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedShortValue",
- "S"));
+ valueField = env->GetStaticFieldID(klass, "expectedShortValue", "S");
- return JNI_ENV_PTR(env)->GetStaticShortField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticShortField(klass, valueField);
}
JNIEXPORT jchar JNICALL
@@ -131,15 +99,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedCharValue",
- "C"));
+ valueField = env->GetStaticFieldID(klass, "expectedCharValue", "C");
- return JNI_ENV_PTR(env)->GetStaticCharField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticCharField(klass, valueField);
}
JNIEXPORT jint JNICALL
@@ -151,15 +115,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedIntValue",
- "I"));
+ valueField = env->GetStaticFieldID(klass, "expectedIntValue", "I");
- return JNI_ENV_PTR(env)->GetStaticIntField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticIntField(klass, valueField);
}
JNIEXPORT jlong JNICALL
@@ -171,15 +131,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedLongValue",
- "J"));
+ valueField = env->GetStaticFieldID(klass, "expectedLongValue", "J");
- return JNI_ENV_PTR(env)->GetStaticLongField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticLongField(klass, valueField);
}
JNIEXPORT jfloat JNICALL
@@ -191,15 +147,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedFloatValue",
- "F"));
+ valueField = env->GetStaticFieldID(klass, "expectedFloatValue", "F");
- return JNI_ENV_PTR(env)->GetStaticFloatField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticFloatField(klass, valueField);
}
JNIEXPORT jdouble JNICALL
@@ -211,15 +163,11 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedDoubleValue",
- "D"));
+ valueField = env->GetStaticFieldID(klass, "expectedDoubleValue", "D");
- return JNI_ENV_PTR(env)->GetStaticDoubleField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticDoubleField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -231,15 +179,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedObjectArrayValue",
- "[Ljava/lang/Object;"));
+ valueField = env->GetStaticFieldID(klass, "expectedObjectArrayValue",
+ "[Ljava/lang/Object;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -251,15 +196,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedStringValue",
- "Ljava/lang/String;"));
+ valueField = env->GetStaticFieldID(klass, "expectedStringValue",
+ "Ljava/lang/String;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -271,15 +213,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedThreadValue",
- "Ljava/lang/Thread;"));
+ valueField = env->GetStaticFieldID(klass, "expectedThreadValue",
+ "Ljava/lang/Thread;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -291,15 +230,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedThreadGroupValue",
- "Ljava/lang/ThreadGroup;"));
+ valueField = env->GetStaticFieldID(klass, "expectedThreadGroupValue",
+ "Ljava/lang/ThreadGroup;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -311,15 +247,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedClassObjectValue",
- "Ljava/lang/Class;"));
+ valueField = env->GetStaticFieldID(klass, "expectedClassObjectValue",
+ "Ljava/lang/Class;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -331,15 +264,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedClassLoaderValue",
- "Ljava/lang/ClassLoader;"));
+ valueField = env->GetStaticFieldID(klass, "expectedClassLoaderValue",
+ "Ljava/lang/ClassLoader;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -351,15 +281,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedObjectValue",
- "Ljava/lang/Object;"));
+ valueField = env->GetStaticFieldID(klass, "expectedObjectValue",
+ "Ljava/lang/Object;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -371,15 +298,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedBooleanWrapperValue",
- "Ljava/lang/Boolean;"));
+ valueField = env->GetStaticFieldID(klass, "expectedBooleanWrapperValue",
+ "Ljava/lang/Boolean;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -391,15 +315,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedByteWrapperValue",
- "Ljava/lang/Byte;"));
+ valueField = env->GetStaticFieldID(klass, "expectedByteWrapperValue",
+ "Ljava/lang/Byte;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -411,15 +332,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedShortWrapperValue",
- "Ljava/lang/Short;"));
+ valueField = env->GetStaticFieldID(klass, "expectedShortWrapperValue",
+ "Ljava/lang/Short;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -431,15 +349,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedCharWrapperValue",
- "Ljava/lang/Character;"));
+ valueField = env->GetStaticFieldID(klass, "expectedCharWrapperValue",
+ "Ljava/lang/Character;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -451,15 +366,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedIntWrapperValue",
- "Ljava/lang/Integer;"));
+ valueField = env->GetStaticFieldID(klass, "expectedIntWrapperValue",
+ "Ljava/lang/Integer;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -471,15 +383,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedLongWrapperValue",
- "Ljava/lang/Long;"));
+ valueField = env->GetStaticFieldID(klass, "expectedLongWrapperValue",
+ "Ljava/lang/Long;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -491,15 +400,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedFloatWrapperValue",
- "Ljava/lang/Float;"));
+ valueField = env->GetStaticFieldID(klass, "expectedFloatWrapperValue",
+ "Ljava/lang/Float;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
JNIEXPORT jobject JNICALL
@@ -511,17 +417,12 @@
logMessage(env, thisObject, message);
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- valueField = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG_4(
- env,
- klass,
- "expectedDoubleWrapperValue",
- "Ljava/lang/Double;"));
+ valueField = env->GetStaticFieldID(klass, "expectedDoubleWrapperValue",
+ "Ljava/lang/Double;");
- return JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG_3(env, klass, valueField));
+ return env->GetStaticObjectField(klass, valueField);
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -23,25 +23,8 @@
#include "jni.h"
#include "nsk_tools.h"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x, y, z) y, z
-#define JNI_ENV_ARG_4(x, y, z, a) y, z, a
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x, y, z) x, y, z
-#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
JNIEXPORT void JNICALL
Java_nsk_share_locks_JNIMonitorLocker_doLock(JNIEnv *env, jobject thisObject)
@@ -74,54 +57,60 @@
// class for field 'inner'
jclass deadlockLockerClass;
- success = JNI_ENV_PTR(env)->MonitorEnter(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorEnter(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorEnter return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorEnter return non-zero");
}
- thisObjectClass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ thisObjectClass = env->GetObjectClass(thisObject);
// step1.unlockAll()
- field = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG_4(env, thisObjectClass, "step1", "Lnsk/share/Wicket;"));
+ field = env->GetFieldID(thisObjectClass, "step1", "Lnsk/share/Wicket;");
- wicketObject = JNI_ENV_PTR(env)->GetObjectField(JNI_ENV_ARG_3(env, thisObject, field));
- wicketClass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, wicketObject));
+ wicketObject = env->GetObjectField(thisObject, field);
+ wicketClass = env->GetObjectClass(wicketObject);
- JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG_3(env, wicketObject, JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, wicketClass, "unlockAll", "()V"))));
+ env->CallVoidMethod(wicketObject,
+ env->GetMethodID(wicketClass, "unlockAll", "()V"));
// step2.waitFor()
- field = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG_4(env, thisObjectClass, "step2", "Lnsk/share/Wicket;"));
- wicketObject = JNI_ENV_PTR(env)->GetObjectField(JNI_ENV_ARG_3(env, thisObject, field));
+ field = env->GetFieldID(thisObjectClass, "step2", "Lnsk/share/Wicket;");
+ wicketObject = env->GetObjectField(thisObject, field);
- JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG_3(env, wicketObject, JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, wicketClass, "waitFor", "()V"))));
+ env->CallVoidMethod(wicketObject,
+ env->GetMethodID(wicketClass, "waitFor", "()V"));
// readyWicket.unlock()
- field = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG_4(env, thisObjectClass, "readyWicket", "Lnsk/share/Wicket;"));
- wicketObject = JNI_ENV_PTR(env)->GetObjectField(JNI_ENV_ARG_3(env, thisObject, field));
+ field = env->GetFieldID(thisObjectClass, "readyWicket", "Lnsk/share/Wicket;");
+ wicketObject = env->GetObjectField(thisObject, field);
- JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG_3(env, wicketObject, JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, wicketClass, "unlock", "()V"))));
+ env->CallVoidMethod(wicketObject,
+ env->GetMethodID(wicketClass, "unlock", "()V"));
// inner.lock()
- field = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG_4(env, thisObjectClass, "inner", "Lnsk/share/locks/DeadlockLocker;"));
- innerObject = JNI_ENV_PTR(env)->GetObjectField(JNI_ENV_ARG_3(env, thisObject, field));
- deadlockLockerClass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, innerObject));
+ field = env->GetFieldID(thisObjectClass, "inner", "Lnsk/share/locks/DeadlockLocker;");
+ innerObject = env->GetObjectField(thisObject, field);
+ deadlockLockerClass = env->GetObjectClass(innerObject);
- JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG_3(env, innerObject, JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, deadlockLockerClass, "lock", "()V"))));
+ env->CallVoidMethod(innerObject,
+ env->GetMethodID(deadlockLockerClass, "lock", "()V"));
- success = JNI_ENV_PTR(env)->MonitorExit(JNI_ENV_ARG_2(env, thisObject));
+ success = env->MonitorExit(thisObject);
if(success != 0)
{
NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorExit return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorExit return non-zero");
}
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -23,25 +23,8 @@
#include "jni.h"
#include "nsk_tools.h"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_PTR
-#ifdef __cplusplus
-#define JNI_ENV_ARG_2(x, y) y
-#define JNI_ENV_ARG_3(x, y, z) y, z
-#define JNI_ENV_ARG_4(x, y, z, a) y, z, a
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG_2(x,y) x, y
-#define JNI_ENV_ARG_3(x, y, z) x, y, z
-#define JNI_ENV_ARG_4(x, y, z, a) x, y, z, a
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
JNIEXPORT void JNICALL
Java_nsk_share_locks_LockingThread_nativeJNIMonitorEnter(JNIEnv *env, jobject thisObject, jobject object)
@@ -49,29 +32,32 @@
jint success;
jclass klass;
- success = JNI_ENV_PTR(env)->MonitorEnter(JNI_ENV_ARG_2(env, object));
+ success = env->MonitorEnter(object);
if(success != 0)
{
NSK_COMPLAIN1("MonitorEnter return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorEnter return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorEnter return non-zero");
}
- klass = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG_2(env, thisObject));
+ klass = env->GetObjectClass(thisObject);
- JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG_3(env, thisObject, JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG_4(env, klass, "createStackFrame", "()V"))));
+ env->CallVoidMethod(thisObject,
+ env->GetMethodID(klass, "createStackFrame", "()V"));
- success = JNI_ENV_PTR(env)->MonitorExit(JNI_ENV_ARG_2(env, object));
+ success = env->MonitorExit(object);
if(success != 0)
{
NSK_COMPLAIN1("MonitorExit return non-zero: %d\n", success);
- JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG_3(env, JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG_2(env, "nsk/share/TestJNIError")), "MonitorExit return non-zero"));
+ env->ThrowNew(
+ env->FindClass("nsk/share/TestJNIError"),
+ "MonitorExit return non-zero");
}
}
-#ifdef __cplusplus
}
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp Tue Sep 04 12:44:02 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp Fri Aug 31 22:55:34 2018 -0700
@@ -30,21 +30,8 @@
#include "JVMTITools.h"
#include "jvmti_tools.h"
-#ifdef __cplusplus
extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
static jvmtiEnv *test_jvmti = NULL;
static jvmtiCapabilities caps;
@@ -126,6 +113,4 @@
return Agent_Initialize(jvm, options, reserved);
}
-#ifdef __cplusplus
}
-#endif