Skip to content
Permalink
Browse files
8211801: Remove the NSK_CPP_STUB macros from vmTestbase for jvmti/sce…
…narios/[A-E]

Remove the NSK_CPP_STUB macros

Backport-of: efa175f
  • Loading branch information
GoeLin committed Nov 25, 2021
1 parent 84a3397 commit 87c04f25fd7ff4ad504dc3cc60e655286a0dba38
Showing 50 changed files with 1,986 additions and 2,636 deletions.
@@ -124,7 +124,7 @@ objectReferenceCallback( jvmtiObjectReferenceKind reference_kind,
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP06_ap06t001Thread_setTag( JNIEnv* jni, jobject obj) {

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, obj, threadTag))) {
if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, threadTag))) {
nsk_jvmti_setFailStatus();
} else {
NSK_DISPLAY0("setTag: the tag was set for checked thread.");
@@ -153,34 +153,26 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
}

if (!NSK_JNI_VERIFY(jni, (fid =
NSK_CPP_STUB4(GetStaticFieldID, jni,
debugeeClass,
"thread",
THREAD_CLS_SIGNATURE)) != NULL )) {
jni->GetStaticFieldID(debugeeClass, "thread", THREAD_CLS_SIGNATURE)) != NULL)) {
nsk_jvmti_setFailStatus();
break;
}

if (!NSK_JNI_VERIFY(jni, (localRefThread =
NSK_CPP_STUB3(GetStaticObjectField, jni,
debugeeClass,
fid )) != NULL )) {
jni->GetStaticObjectField(debugeeClass, fid)) != NULL)) {
NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'thread' field value\n\n");
nsk_jvmti_setFailStatus();
break;
}

if (!NSK_JNI_VERIFY(jni, (globalRefThread =
NSK_CPP_STUB2(NewGlobalRef, jni, localRefThread)) != NULL))
if (!NSK_JNI_VERIFY(jni, (globalRefThread = jni->NewGlobalRef(localRefThread)) != NULL))
return;

NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
heapRootCallback,
stackReferenceCallback,
objectReferenceCallback,
NULL /*user_data*/))) {
if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
stackReferenceCallback,
objectReferenceCallback,
NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -234,12 +226,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;

if (!caps.can_tag_objects)
@@ -111,15 +111,14 @@ Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setTag( JNIEnv* jni,
jobject target,
jlong tag ) {

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}

JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setRoot( JNIEnv* jni, jobject obj) {
if (!NSK_JNI_VERIFY(jni, (root =
NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL))
if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != NULL))
nsk_jvmti_setFailStatus();
}

@@ -135,30 +134,24 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
do {

NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
heapRootCallback,
stackReferenceCallback,
objectReferenceCallback,
NULL /*user_data*/))) {
if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
stackReferenceCallback,
objectReferenceCallback,
NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}

NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject\n");
{
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
jvmti,
root,
objectReferenceCallback,
NULL /*user_data*/))) {
if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
root, objectReferenceCallback, NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
}

NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, root));
NSK_TRACE(jni->DeleteGlobalRef(root));

} while (0);

@@ -191,12 +184,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;

if (!caps.can_tag_objects)
@@ -111,7 +111,7 @@ Java_nsk_jvmti_scenarios_allocation_AP07_ap07t002_setTag( JNIEnv* jni,
jobject target,
jlong tag ) {

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}
@@ -128,12 +128,10 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
do {

NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
heapRootCallback,
stackReferenceCallback,
objectReferenceCallback,
NULL /*user_data*/))) {
if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
stackReferenceCallback,
objectReferenceCallback,
NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
break;
}
@@ -169,12 +167,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;

if (!caps.can_tag_objects)
@@ -132,15 +132,14 @@ Java_nsk_jvmti_scenarios_allocation_AP09_ap09t001_setTag( JNIEnv* jni,
jobject target,
jlong tag ) {

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
nsk_jvmti_setFailStatus();
}
}

JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_allocation_AP09_ap09t001_setReferrer( JNIEnv* jni, jclass klass, jobject ref) {
if (!NSK_JNI_VERIFY(jni, (referrer =
NSK_CPP_STUB2(NewGlobalRef, jni, ref)) != NULL))
if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL))
nsk_jvmti_setFailStatus();
}

@@ -155,12 +154,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {

do {
NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n");
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
jvmti,
referrer,
objectReferenceCallback,
NULL /*user_data*/))) {
if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer,
objectReferenceCallback,
NULL /*user_data*/))) {
nsk_jvmti_setFailStatus();
}
if (!classFound) {
@@ -192,7 +188,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
nsk_jvmti_setFailStatus();
}

NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
NSK_TRACE(jni->DeleteGlobalRef(referrer));
} while (0);

NSK_DISPLAY0("Let debugee to finish\n");
@@ -224,12 +220,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
memset(&caps, 0, sizeof(jvmtiCapabilities));
caps.can_tag_objects = 1;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;

if (!caps.can_tag_objects) {
@@ -61,8 +61,7 @@ static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) {

NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n",
msg, (void*) &stor);
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SetEnvironmentLocalStorage,
jvmti_env, (const void*) &stor))) {
if (!NSK_JVMTI_VERIFY(jvmti_env->SetEnvironmentLocalStorage((const void*) &stor))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: unable to set an environment local storage\n\n",
msg);
@@ -71,8 +70,7 @@ static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) {

NSK_DISPLAY1("%s: getting an environment local storage ...\n",
msg);
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetEnvironmentLocalStorage,
jvmti_env, (void**) &obtainedData))) {
if (!NSK_JVMTI_VERIFY(jvmti_env->GetEnvironmentLocalStorage((void**) &obtainedData))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: unable to get an environment local storage\n\n",
msg);
@@ -90,8 +88,7 @@ static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) {
}

static void timerFunc(jvmtiEnv *jvmti_env, const char *msg) {
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti_env, &timer_info1 ))) {
if (!NSK_JVMTI_VERIFY(jvmti_env->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetCurrentThreadCpuTimerInfo returned unexpected error code\n\n",
msg);
@@ -114,17 +111,15 @@ static void timerFunc(jvmtiEnv *jvmti_env, const char *msg) {
}
/* ---------------------------------------------------------------------- */

if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti_env, &nanos ))) {
if (!NSK_JVMTI_VERIFY(jvmti_env->GetCurrentThreadCpuTime(&nanos))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetCurrentThreadCpuTime returned unexpected error code\n\n",
msg);
}
/* ---------------------------------------------------------------------- */


if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB2(GetTimerInfo, jvmti_env, &timer_info2 ))) {
if (!NSK_JVMTI_VERIFY(jvmti_env->GetTimerInfo(&timer_info2))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetTimerInfo returned unexpected error code\n\n",
msg);
@@ -148,8 +143,7 @@ static void timerFunc(jvmtiEnv *jvmti_env, const char *msg) {
/* ---------------------------------------------------------------------- */

nanos = 0;
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB2(GetTime, jvmti_env, &nanos ))) {
if (!NSK_JVMTI_VERIFY(jvmti_env->GetTime(&nanos))) {
nsk_jvmti_setFailStatus();
NSK_COMPLAIN1("%s: GetTime returned unexpected error code\n\n",
msg);
@@ -223,10 +217,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {

NSK_DISPLAY0("Call IterateOverHeap to tag random objects for ObjectFree evnts\n\n");
{
if (!NSK_JVMTI_VERIFY(
NSK_CPP_STUB4(IterateOverHeap, jvmti,
JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback,
&user_data))) {
if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED,
heapObjectCallback,
&user_data))) {
nsk_jvmti_setFailStatus();
}
}
@@ -276,12 +269,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
caps.can_get_thread_cpu_time = 1;
caps.can_generate_object_free_events = 1;
caps.can_generate_garbage_collection_events = 1;
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
jvmti, &caps)))
if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
return JNI_ERR;

if (!caps.can_generate_garbage_collection_events)
@@ -299,19 +290,21 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
callbacks.ObjectFree = &ObjectFree;

if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
jvmti, &callbacks, sizeof(callbacks))))
if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;

NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
JVMTI_EVENT_GARBAGE_COLLECTION_START,
NULL)))
return JNI_ERR;
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
JVMTI_EVENT_GARBAGE_COLLECTION_FINISH,
NULL)))
return JNI_ERR;
if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
JVMTI_EVENT_OBJECT_FREE,
NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling the events done\n\n");

1 comment on commit 87c04f2

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 87c04f2 Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.