< prev index next >
test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC02/libnativeGC02.cpp
Print this page
rev 52200 : [mq]: spaces
*** 23,33 ****
#include <jni.h>
#include <stdio.h>
extern "C" {
! /* A C function that takes a reference to java Object( a circular Linked list)
and utilizes this reference to do a java method callback to determine the
number of elements in the linked list */
JNIEXPORT jint JNICALL
Java_gc_gctests_nativeGC02_nativeGC02_nativeMethod02
(JNIEnv *env, jobject obj, jobject linked_list) {
--- 23,33 ----
#include <jni.h>
#include <stdio.h>
extern "C" {
! /* A C function that takes a reference to java Object(a circular Linked list)
and utilizes this reference to do a java method callback to determine the
number of elements in the linked list */
JNIEXPORT jint JNICALL
Java_gc_gctests_nativeGC02_nativeGC02_nativeMethod02
(JNIEnv *env, jobject obj, jobject linked_list) {
*** 49,61 ****
llist = env->GetObjectField(obj, fid);
/* force a GC by invoking a callback where System.gc() is called
*/
! cls = env->GetObjectClass(obj);
mid = env->GetMethodID(cls, "callbackGC", "()V");
! if (mid == 0){
printf("couldnt locate method callbackGC()\n");
return -1;
}
env->CallVoidMethod(obj,mid);
--- 49,61 ----
llist = env->GetObjectField(obj, fid);
/* force a GC by invoking a callback where System.gc() is called
*/
! cls = env->GetObjectClass(obj);
mid = env->GetMethodID(cls, "callbackGC", "()V");
! if (mid == 0) {
printf("couldnt locate method callbackGC()\n");
return -1;
}
env->CallVoidMethod(obj,mid);
*** 63,77 ****
that counts the number of elements in the
circular linked list
*/
clss = env->GetObjectClass(linked_list);
! mid2 = env->GetMethodID(clss, "getLength", "(Lnsk/share/gc/CircularLinkedList;)I" );
! if (mid2 == 0 ){
printf("couldnt locate method getLength(CircularLinkedList)\n");
return -1;
}
! elementCount = env->CallIntMethod(linked_list, mid2, llist);
return elementCount;
}
}
--- 63,77 ----
that counts the number of elements in the
circular linked list
*/
clss = env->GetObjectClass(linked_list);
! mid2 = env->GetMethodID(clss, "getLength", "(Lnsk/share/gc/CircularLinkedList;)I");
! if (mid2 == 0) {
printf("couldnt locate method getLength(CircularLinkedList)\n");
return -1;
}
! elementCount = env->CallIntMethod(linked_list, mid2, llist);
return elementCount;
}
}
< prev index next >