test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp
changeset 51775 dfed97156841
parent 51551 e409244ce72e
equal deleted inserted replaced
51774:79dc492c00ab 51775:dfed97156841
    27 #include "jvmti.h"
    27 #include "jvmti.h"
    28 #include "jni_tools.h"
    28 #include "jni_tools.h"
    29 #include "agent_common.h"
    29 #include "agent_common.h"
    30 #include "JVMTITools.h"
    30 #include "JVMTITools.h"
    31 
    31 
    32 #ifdef __cplusplus
       
    33 extern "C" {
    32 extern "C" {
    34 #endif
    33 
    35 
       
    36 #ifndef JNI_ENV_ARG
       
    37 
       
    38 #ifdef __cplusplus
       
    39 #define JNI_ENV_ARG(x, y) y
       
    40 #define JNI_ENV_PTR(x) x
       
    41 #else
       
    42 #define JNI_ENV_ARG(x,y) x, y
       
    43 #define JNI_ENV_PTR(x) (*x)
       
    44 #endif
       
    45 
       
    46 #endif
       
    47 
    34 
    48 #define PASSED 0
    35 #define PASSED 0
    49 #define STATUS_FAILED 2
    36 #define STATUS_FAILED 2
    50 
    37 
    51 static jvmtiEnv *jvmti = NULL;
    38 static jvmtiEnv *jvmti = NULL;
   273 
   260 
   274   if (options != NULL && strcmp(options, "printdump") == 0) {
   261   if (options != NULL && strcmp(options, "printdump") == 0) {
   275     printdump = JNI_TRUE;
   262     printdump = JNI_TRUE;
   276   }
   263   }
   277 
   264 
   278   res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
   265   res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
   279                                  JVMTI_VERSION_1_1);
       
   280   if (res != JNI_OK || jvmti == NULL) {
   266   if (res != JNI_OK || jvmti == NULL) {
   281     printf("Wrong result of a valid call to GetEnv!\n");
   267     printf("Wrong result of a valid call to GetEnv!\n");
   282     return JNI_ERR;
   268     return JNI_ERR;
   283   }
   269   }
   284 
   270 
   485   }
   471   }
   486 
   472 
   487   return result;
   473   return result;
   488 }
   474 }
   489 
   475 
   490 #ifdef __cplusplus
   476 }
   491 }
       
   492 #endif