test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC01/libnativeGC01.cpp
changeset 52221 27ba7cc31f9f
parent 51774 79dc492c00ab
equal deleted inserted replaced
52220:9c260a6b6471 52221:27ba7cc31f9f
    25 #include <stdio.h>
    25 #include <stdio.h>
    26 
    26 
    27 extern "C" {
    27 extern "C" {
    28 
    28 
    29 /*
    29 /*
    30  * A C function that takes a reference to java Object( a circular Linked list)
    30  * A C function that takes a reference to java Object (a circular Linked list)
    31  * and utilizes this reference to do a java method callback to determine the
    31  * and utilizes this reference to do a java method callback to determine the
    32  * number of elements in the linked list
    32  * number of elements in the linked list
    33  */
    33  */
    34 JNIEXPORT jint JNICALL
    34 JNIEXPORT jint JNICALL
    35 Java_gc_gctests_nativeGC01_nativeGC01_nativeMethod01
    35 Java_gc_gctests_nativeGC01_nativeGC01_nativeMethod01
    53            that counts the number of elements in the
    53            that counts the number of elements in the
    54            circular linked list
    54            circular linked list
    55            */
    55            */
    56 
    56 
    57         clss = env->GetObjectClass(linked_list);
    57         clss = env->GetObjectClass(linked_list);
    58         mid2 = env->GetMethodID(clss, "getLength", "()I" );
    58         mid2 = env->GetMethodID(clss, "getLength", "()I");
    59         if (mid2  == 0) {
    59         if (mid2 == 0) {
    60                 printf("couldnt locate method getLength()");
    60                 printf("couldnt locate method getLength()");
    61                 return -1;
    61                 return -1;
    62         }
    62         }
    63         elementCount  = env->CallIntMethod(linked_list, mid2);
    63         elementCount  = env->CallIntMethod(linked_list, mid2);
    64         return elementCount;
    64         return elementCount;