< prev index next >
test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp
Print this page
rev 51942 : [mq]: refactor
@@ -68,44 +68,40 @@
jbyte* elements;
int i;
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID);
NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array object: 0x%p\n", (void*)array);
- if (!NSK_JNI_VERIFY(jni, (*size =
- NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+ if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got array size: %d bytes\n", (int)*size);
{
jboolean isCopy;
- if (!NSK_JNI_VERIFY(jni, (elements =
- NSK_CPP_STUB3(GetByteArrayElements, jni, array,
- &isCopy)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
}
NSK_DISPLAY1(" ... got elements list: 0x%p\n", (void*)elements);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... created bytes array: 0x%p\n", (void*)*bytes);
@@ -113,11 +109,11 @@
(*bytes)[i] = (unsigned char)elements[i];
}
NSK_DISPLAY1(" ... copied bytecode: %d bytes\n", (int)*size);
NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
- NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+ NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
NSK_DISPLAY0(" ... released\n");
return NSK_TRUE;
}
@@ -128,27 +124,25 @@
jfieldID fieldID = NULL;
jobject obj = NULL;
NSK_DISPLAY1("Find static field: %s\n", fieldName);
if (!NSK_JNI_VERIFY(jni, (fieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+ jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID);
NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj);
NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
- if (!NSK_JNI_VERIFY(jni, (obj =
- NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
nsk_jvmti_setFailStatus();
return NULL;
}
NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj);
@@ -163,12 +157,11 @@
classDef.klass = klass;
classDef.class_byte_count = size;
classDef.class_bytes = bytes;
NSK_DISPLAY1("Redefine class: %s\n", className);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY1(" ... redefined with bytecode: %d bytes\n", (int)size);
@@ -190,11 +183,11 @@
jclass debugeeClass = NULL;
NSK_DISPLAY0(">>> Obtain debuggee class\n");
NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+ jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)debugeeClass);
@@ -256,15 +249,14 @@
}
NSK_DISPLAY0(">>> Clean used data\n");
{
NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
- NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+ jni->DeleteGlobalRef(testedClass);
NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
nsk_jvmti_setFailStatus();
}
}
}
@@ -357,12 +349,11 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_generate_all_class_hook_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
}
NSK_DISPLAY0(" ... added\n");
@@ -371,12 +362,11 @@
jvmtiEventCallbacks callbacks;
jint size = (jint)sizeof(callbacks);
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
NSK_DISPLAY0(" ... set\n");
< prev index next >