< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp

Print this page
rev 52200 : [mq]: spaces


  27 #include "jni_tools.h"
  28 #include "jvmti_tools.h"
  29 
  30 extern "C" {
  31 
  32 /* ============================================================================= */
  33 
  34 static jlong timeout = 0;
  35 
  36 static long objCounter = 0;
  37 static int userData = 0;
  38 static jvmtiEnv* st_jvmti = NULL;
  39 
  40 /* ============================================================================= */
  41 
  42 /* ============================================================================= */
  43 
  44 
  45 /* jvmtiHeapRootCallback */
  46 jvmtiIterationControl JNICALL
  47 heapRootCallback( jvmtiHeapRootKind root_kind,
  48                   jlong class_tag,
  49                   jlong size,
  50                   jlong* tag_ptr,
  51                   void* user_data) {
  52 
  53     jrawMonitorID monitor_ptr = NULL;
  54 
  55     *tag_ptr = (jlong)++objCounter;
  56 
  57     if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("heapRootMonitor", &monitor_ptr))) {
  58         nsk_jvmti_setFailStatus();
  59         return JVMTI_ITERATION_ABORT;
  60     }
  61 
  62     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
  63         nsk_jvmti_setFailStatus();
  64         return JVMTI_ITERATION_ABORT;
  65     }
  66 
  67     /* Enter second time */
  68     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
  69         nsk_jvmti_setFailStatus();
  70         return JVMTI_ITERATION_ABORT;
  71     }


  87         return JVMTI_ITERATION_ABORT;
  88     }
  89 
  90     /* Exit second time */
  91     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
  92         nsk_jvmti_setFailStatus();
  93         return JVMTI_ITERATION_ABORT;
  94     }
  95 
  96     if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
  97         nsk_jvmti_setFailStatus();
  98     }
  99 /*
 100     NSK_DISPLAY1("heapRootCallback: %d\n", objCounter);
 101 */
 102     return JVMTI_ITERATION_CONTINUE;
 103 }
 104 
 105 /* jvmtiStackReferenceCallback */
 106 jvmtiIterationControl JNICALL
 107 stackReferenceCallback( jvmtiHeapRootKind root_kind,
 108                         jlong     class_tag,
 109                         jlong     size,
 110                         jlong*    tag_ptr,
 111                         jlong     thread_tag,
 112                         jint      depth,
 113                         jmethodID method,
 114                         jint      slot,
 115                         void*     user_data) {
 116 
 117     jrawMonitorID monitor_ptr = NULL;
 118 
 119     *tag_ptr = (jlong)++objCounter;
 120 
 121     if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("stackRefMonitor", &monitor_ptr))) {
 122         nsk_jvmti_setFailStatus();
 123         return JVMTI_ITERATION_ABORT;
 124     }
 125 
 126     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 127         nsk_jvmti_setFailStatus();
 128         return JVMTI_ITERATION_ABORT;
 129     }
 130 
 131     /* Enter second time */
 132     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 133         nsk_jvmti_setFailStatus();
 134         return JVMTI_ITERATION_ABORT;
 135     }


 152     }
 153 
 154     /* Exit second time */
 155     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
 156         nsk_jvmti_setFailStatus();
 157         return JVMTI_ITERATION_ABORT;
 158     }
 159 
 160     if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
 161         nsk_jvmti_setFailStatus();
 162     }
 163 /*
 164     NSK_DISPLAY1("stackRefenceCallback: %d\n", objCounter);
 165 */
 166     return JVMTI_ITERATION_CONTINUE;
 167 }
 168 
 169 
 170 /* jvmtiObjectReferenceCallback */
 171 jvmtiIterationControl JNICALL
 172 objectReferenceCallback( jvmtiObjectReferenceKind reference_kind,
 173                          jlong  class_tag,
 174                          jlong  size,
 175                          jlong* tag_ptr,
 176                          jlong  referrer_tag,
 177                          jint   referrer_index,
 178                          void*  user_data) {
 179 
 180     jrawMonitorID monitor_ptr = NULL;
 181 
 182     *tag_ptr = (jlong)++objCounter;
 183 
 184     if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("objRefMonitor", &monitor_ptr))) {
 185         nsk_jvmti_setFailStatus();
 186         return JVMTI_ITERATION_ABORT;
 187     }
 188 
 189     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 190         nsk_jvmti_setFailStatus();
 191         return JVMTI_ITERATION_ABORT;
 192     }
 193 
 194     /* Enter second time */
 195     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 196         nsk_jvmti_setFailStatus();
 197         return JVMTI_ITERATION_ABORT;
 198     }




  27 #include "jni_tools.h"
  28 #include "jvmti_tools.h"
  29 
  30 extern "C" {
  31 
  32 /* ============================================================================= */
  33 
  34 static jlong timeout = 0;
  35 
  36 static long objCounter = 0;
  37 static int userData = 0;
  38 static jvmtiEnv* st_jvmti = NULL;
  39 
  40 /* ============================================================================= */
  41 
  42 /* ============================================================================= */
  43 
  44 
  45 /* jvmtiHeapRootCallback */
  46 jvmtiIterationControl JNICALL
  47 heapRootCallback(jvmtiHeapRootKind root_kind,
  48                  jlong class_tag,
  49                  jlong size,
  50                  jlong* tag_ptr,
  51                  void* user_data) {
  52 
  53     jrawMonitorID monitor_ptr = NULL;
  54 
  55     *tag_ptr = (jlong)++objCounter;
  56 
  57     if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("heapRootMonitor", &monitor_ptr))) {
  58         nsk_jvmti_setFailStatus();
  59         return JVMTI_ITERATION_ABORT;
  60     }
  61 
  62     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
  63         nsk_jvmti_setFailStatus();
  64         return JVMTI_ITERATION_ABORT;
  65     }
  66 
  67     /* Enter second time */
  68     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
  69         nsk_jvmti_setFailStatus();
  70         return JVMTI_ITERATION_ABORT;
  71     }


  87         return JVMTI_ITERATION_ABORT;
  88     }
  89 
  90     /* Exit second time */
  91     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
  92         nsk_jvmti_setFailStatus();
  93         return JVMTI_ITERATION_ABORT;
  94     }
  95 
  96     if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
  97         nsk_jvmti_setFailStatus();
  98     }
  99 /*
 100     NSK_DISPLAY1("heapRootCallback: %d\n", objCounter);
 101 */
 102     return JVMTI_ITERATION_CONTINUE;
 103 }
 104 
 105 /* jvmtiStackReferenceCallback */
 106 jvmtiIterationControl JNICALL
 107 stackReferenceCallback(jvmtiHeapRootKind root_kind,
 108                        jlong     class_tag,
 109                        jlong     size,
 110                        jlong*    tag_ptr,
 111                        jlong     thread_tag,
 112                        jint      depth,
 113                        jmethodID method,
 114                        jint      slot,
 115                        void*     user_data) {
 116 
 117     jrawMonitorID monitor_ptr = NULL;
 118 
 119     *tag_ptr = (jlong)++objCounter;
 120 
 121     if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("stackRefMonitor", &monitor_ptr))) {
 122         nsk_jvmti_setFailStatus();
 123         return JVMTI_ITERATION_ABORT;
 124     }
 125 
 126     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 127         nsk_jvmti_setFailStatus();
 128         return JVMTI_ITERATION_ABORT;
 129     }
 130 
 131     /* Enter second time */
 132     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 133         nsk_jvmti_setFailStatus();
 134         return JVMTI_ITERATION_ABORT;
 135     }


 152     }
 153 
 154     /* Exit second time */
 155     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
 156         nsk_jvmti_setFailStatus();
 157         return JVMTI_ITERATION_ABORT;
 158     }
 159 
 160     if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
 161         nsk_jvmti_setFailStatus();
 162     }
 163 /*
 164     NSK_DISPLAY1("stackRefenceCallback: %d\n", objCounter);
 165 */
 166     return JVMTI_ITERATION_CONTINUE;
 167 }
 168 
 169 
 170 /* jvmtiObjectReferenceCallback */
 171 jvmtiIterationControl JNICALL
 172 objectReferenceCallback(jvmtiObjectReferenceKind reference_kind,
 173                         jlong  class_tag,
 174                         jlong  size,
 175                         jlong* tag_ptr,
 176                         jlong  referrer_tag,
 177                         jint   referrer_index,
 178                         void*  user_data) {
 179 
 180     jrawMonitorID monitor_ptr = NULL;
 181 
 182     *tag_ptr = (jlong)++objCounter;
 183 
 184     if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("objRefMonitor", &monitor_ptr))) {
 185         nsk_jvmti_setFailStatus();
 186         return JVMTI_ITERATION_ABORT;
 187     }
 188 
 189     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 190         nsk_jvmti_setFailStatus();
 191         return JVMTI_ITERATION_ABORT;
 192     }
 193 
 194     /* Enter second time */
 195     if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
 196         nsk_jvmti_setFailStatus();
 197         return JVMTI_ITERATION_ABORT;
 198     }


< prev index next >