< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp

Print this page
rev 52200 : [mq]: spaces


  92 
  93 static int getCounter(volatile int* counterPtr) {
  94     int result;
  95 
  96     if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
  97         nsk_jvmti_setFailStatus();
  98     }
  99 
 100     result = *counterPtr;
 101 
 102     if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
 103         nsk_jvmti_setFailStatus();
 104     }
 105 
 106     return result;
 107 }
 108 
 109 /***********************************************************************/
 110 
 111 jvmtiIterationControl JNICALL
 112 heapObjectCallback( jlong  class_tag,
 113                     jlong  size,
 114                     jlong* tag_ptr,
 115                     void*  user_data) {
 116 
 117     int count = 0;
 118 
 119     /* clean eventCount on first iteration */
 120     if (getCounter(&iterationCount) == 0) {
 121         setCounter(&eventCount, 0);
 122     }
 123     increaseCounter(&iterationCount);
 124 
 125     /* check if eventCount is 0 for each iteration */
 126     count = getCounter(&eventCount);
 127     if (count > 0) {
 128         increaseCounter(&errorCount);
 129     }
 130 
 131     return JVMTI_ITERATION_CONTINUE;
 132 }
 133 
 134 /* jvmtiHeapRootCallback */
 135 jvmtiIterationControl JNICALL
 136 heapRootCallback( jvmtiHeapRootKind root_kind,
 137                   jlong class_tag,
 138                   jlong size,
 139                   jlong* tag_ptr,
 140                   void* user_data) {
 141 
 142     int count = 0;
 143 
 144     /* clean eventCount on first iteration */
 145     if (getCounter(&iterationCount) == 0) {
 146         setCounter(&eventCount, 0);
 147     }
 148     increaseCounter(&iterationCount);
 149 
 150     /* check if eventCount is 0 for each iteration */
 151     count = getCounter(&eventCount);
 152     if (count > 0) {
 153         increaseCounter(&errorCount);
 154     }
 155 
 156     return JVMTI_ITERATION_CONTINUE;
 157 }
 158 
 159 /* jvmtiStackReferenceCallback */
 160 jvmtiIterationControl JNICALL
 161 stackReferenceCallback( jvmtiHeapRootKind root_kind,
 162                         jlong     class_tag,
 163                         jlong     size,
 164                         jlong*    tag_ptr,
 165                         jlong     thread_tag,
 166                         jint      depth,
 167                         jmethodID method,
 168                         jint      slot,
 169                         void*     user_data) {
 170 
 171     int count = 0;
 172 
 173     /* clean eventCount on first iteration */
 174     if (getCounter(&iterationCount) == 0) {
 175         setCounter(&eventCount, 0);
 176     }
 177     increaseCounter(&iterationCount);
 178 
 179     /* check if eventCount is 0 for each iteration */
 180     count = getCounter(&eventCount);
 181     if (count > 0) {
 182         increaseCounter(&errorCount);
 183     }
 184 
 185     return JVMTI_ITERATION_CONTINUE;
 186 }
 187 
 188 
 189 /* jvmtiObjectReferenceCallback */
 190 jvmtiIterationControl JNICALL
 191 objectReferenceCallback( jvmtiObjectReferenceKind reference_kind,
 192                          jlong  class_tag,
 193                          jlong  size,
 194                          jlong* tag_ptr,
 195                          jlong  referrer_tag,
 196                          jint   referrer_index,
 197                          void*  user_data) {
 198 
 199     int count = 0;
 200 
 201     /* clean eventCount on first iteration */
 202     if (getCounter(&iterationCount) == 0) {
 203         setCounter(&eventCount, 0);
 204     }
 205     increaseCounter(&iterationCount);
 206 
 207     /* check if eventCount is 0 for each iteration */
 208     count = getCounter(&eventCount);
 209     if (count > 0) {
 210         increaseCounter(&errorCount);
 211     }
 212 
 213     return JVMTI_ITERATION_CONTINUE;
 214 }
 215 
 216 
 217 /***********************************************************************/


 220 ObjectFree(jvmtiEnv *jvmti_env, jlong tag) {
 221     increaseCounter(&eventCount);
 222 //    NSK_DISPLAY0("  event: ObjectFree\n");
 223 }
 224 
 225 void JNICALL
 226 GarbageCollectionStart(jvmtiEnv *jvmti_env) {
 227     increaseCounter(&eventCount);
 228     NSK_DISPLAY0("  event: GarbageCollectionStart\n");
 229 }
 230 
 231 void JNICALL
 232 GarbageCollectionFinish(jvmtiEnv *jvmti_env) {
 233     increaseCounter(&eventCount);
 234     NSK_DISPLAY0("  event: GarbageCollectionFinish\n");
 235 }
 236 
 237 /***********************************************************************/
 238 
 239 JNIEXPORT void JNICALL
 240 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_setTag( JNIEnv* jni,
 241                                                           jclass  klass,
 242                                                           jobject target, /* object to be tagged */
 243                                                           jlong   tag ) {
 244 
 245     if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
 246         nsk_jvmti_setFailStatus();
 247     }
 248 }
 249 
 250 JNIEXPORT void JNICALL
 251 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_forceGC( JNIEnv* jni,
 252                                                           jclass  klass) {
 253 
 254 NSK_DISPLAY0("  run: ForceGarbageCollection\n");
 255     if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
 256         nsk_jvmti_setFailStatus();
 257     }
 258 }
 259 
 260 JNIEXPORT void JNICALL
 261 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverHeap( JNIEnv* jni,
 262                                                                       jclass  klass ) {
 263     int count = 0;
 264 
 265     setCounter(&errorCount, 0);
 266     setCounter(&eventCount, 0);
 267     setCounter(&iterationCount, 0);
 268 
 269     NSK_DISPLAY0("Calling IterateOverHeap...\n");
 270     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
 271                                                  heapObjectCallback,
 272                                                  NULL /*user_data*/))) {
 273         nsk_jvmti_setFailStatus();
 274     }
 275     NSK_DISPLAY0("IterateOverHeap finished.\n");
 276 
 277     NSK_DISPLAY1("Iterations count: %d\n", getCounter(&iterationCount));
 278     NSK_DISPLAY1("Events count: %d\n", getCounter(&eventCount));
 279 
 280     count = getCounter(&errorCount);
 281     NSK_DISPLAY1("Errors detected: %d\n", count);
 282     if (count > 0) {
 283         NSK_COMPLAIN1("Events detected during heap iteration: %d\n", count);
 284         nsk_jvmti_setFailStatus();
 285     }
 286 }
 287 
 288 JNIEXPORT void JNICALL
 289 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverReachableObjects( JNIEnv* jni,
 290                                                                                   jclass  klass ) {
 291     int count = 0;
 292 
 293     setCounter(&errorCount, 0);
 294     setCounter(&eventCount, 0);
 295     setCounter(&iterationCount, 0);
 296 
 297     NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
 298     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
 299                                                              stackReferenceCallback,
 300                                                              objectReferenceCallback,
 301                                                              NULL /*user_data*/))) {
 302         nsk_jvmti_setFailStatus();
 303     }
 304     NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
 305 
 306     NSK_DISPLAY1("Iterations count: %d\n", getCounter(&iterationCount));
 307     NSK_DISPLAY1("Events count: %d\n", getCounter(&eventCount));
 308 
 309     count = getCounter(&errorCount);
 310     NSK_DISPLAY1("Errors detected: %d\n", count);
 311     if (count > 0) {
 312         NSK_COMPLAIN1("Events detected during heap iteration: %d\n", count);
 313         nsk_jvmti_setFailStatus();
 314     }
 315 }
 316 
 317 JNIEXPORT void JNICALL
 318 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverInstancesOfClass( JNIEnv* jni,
 319                                                                                   jclass  klass ) {
 320     int count = 0;
 321 
 322     setCounter(&errorCount, 0);
 323     setCounter(&eventCount, 0);
 324     setCounter(&iterationCount, 0);
 325 
 326     NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
 327     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
 328                                                              JVMTI_HEAP_OBJECT_TAGGED,
 329                                                              heapObjectCallback,
 330                                                              NULL /*user_data*/))) {
 331         nsk_jvmti_setFailStatus();
 332     }
 333     NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
 334 
 335     NSK_DISPLAY1("Iterations count: %d\n", getCounter(&iterationCount));
 336     NSK_DISPLAY1("Events count: %d\n", getCounter(&eventCount));
 337 
 338     count = getCounter(&errorCount);
 339     NSK_DISPLAY1("Errors detected: %d\n", count);
 340     if (count > 0) {
 341         NSK_COMPLAIN1("Events detected during heap iteration: %d\n", count);
 342         nsk_jvmti_setFailStatus();
 343     }
 344 }
 345 
 346 JNIEXPORT void JNICALL
 347 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverObjectsReachableFromObject( JNIEnv* jni,
 348                                                                                             jclass  klass ) {
 349 
 350     jobject root = NULL;
 351     int count = 0;
 352 
 353     if (!NSK_JNI_VERIFY(jni, (root =
 354             jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL )) {
 355         NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
 356         nsk_jvmti_setFailStatus();
 357         return;
 358     }
 359 
 360     // release secondary lock
 361     jni->CallStaticVoidMethod(debugeeClass, unlockSecondaryID);
 362 
 363     setCounter(&errorCount, 0);
 364     setCounter(&eventCount, 0);
 365     setCounter(&iterationCount, 0);
 366 
 367     NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
 368     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
 369                                                                        objectReferenceCallback,
 370                                                                        NULL /*user_data*/))) {
 371         nsk_jvmti_setFailStatus();
 372     }
 373     NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
 374 


 385 
 386 static void JNICALL
 387 agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
 388 
 389     NSK_DISPLAY0("Wait for debugee start\n\n");
 390     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
 391         return;
 392 
 393     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE);
 394     debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE);
 395     if (debugeeClass == NULL) {
 396         nsk_jvmti_setFailStatus();
 397         return;
 398     }
 399 
 400     if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
 401         return;
 402 
 403     NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
 404     if (!NSK_JNI_VERIFY(jni, (rootFieldID =
 405             jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL )) {
 406         nsk_jvmti_setFailStatus();
 407         return;
 408     }
 409 
 410     NSK_DISPLAY1("Find ID of 'unlockSecondary' method: %s\n", ROOT_SIGNATURE);
 411     if (!NSK_JNI_VERIFY(jni, (unlockSecondaryID =
 412             jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != NULL )) {
 413         nsk_jvmti_setFailStatus();
 414         return;
 415     }
 416 
 417 
 418     NSK_DISPLAY0("Let debugee to run test cases\n");
 419     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
 420         return;
 421 
 422     NSK_DISPLAY0("Wait for completion of test cases\n\n");
 423     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
 424         return;
 425 
 426     nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, NULL);
 427 
 428     NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
 429     NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
 430 
 431     NSK_DISPLAY0("Let debugee to finish\n");
 432     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))




  92 
  93 static int getCounter(volatile int* counterPtr) {
  94     int result;
  95 
  96     if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
  97         nsk_jvmti_setFailStatus();
  98     }
  99 
 100     result = *counterPtr;
 101 
 102     if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
 103         nsk_jvmti_setFailStatus();
 104     }
 105 
 106     return result;
 107 }
 108 
 109 /***********************************************************************/
 110 
 111 jvmtiIterationControl JNICALL
 112 heapObjectCallback(jlong  class_tag,
 113                    jlong  size,
 114                    jlong* tag_ptr,
 115                    void*  user_data) {
 116 
 117     int count = 0;
 118 
 119     /* clean eventCount on first iteration */
 120     if (getCounter(&iterationCount) == 0) {
 121         setCounter(&eventCount, 0);
 122     }
 123     increaseCounter(&iterationCount);
 124 
 125     /* check if eventCount is 0 for each iteration */
 126     count = getCounter(&eventCount);
 127     if (count > 0) {
 128         increaseCounter(&errorCount);
 129     }
 130 
 131     return JVMTI_ITERATION_CONTINUE;
 132 }
 133 
 134 /* jvmtiHeapRootCallback */
 135 jvmtiIterationControl JNICALL
 136 heapRootCallback(jvmtiHeapRootKind root_kind,
 137                  jlong class_tag,
 138                  jlong size,
 139                  jlong* tag_ptr,
 140                  void* user_data) {
 141 
 142     int count = 0;
 143 
 144     /* clean eventCount on first iteration */
 145     if (getCounter(&iterationCount) == 0) {
 146         setCounter(&eventCount, 0);
 147     }
 148     increaseCounter(&iterationCount);
 149 
 150     /* check if eventCount is 0 for each iteration */
 151     count = getCounter(&eventCount);
 152     if (count > 0) {
 153         increaseCounter(&errorCount);
 154     }
 155 
 156     return JVMTI_ITERATION_CONTINUE;
 157 }
 158 
 159 /* jvmtiStackReferenceCallback */
 160 jvmtiIterationControl JNICALL
 161 stackReferenceCallback(jvmtiHeapRootKind root_kind,
 162                        jlong     class_tag,
 163                        jlong     size,
 164                        jlong*    tag_ptr,
 165                        jlong     thread_tag,
 166                        jint      depth,
 167                        jmethodID method,
 168                        jint      slot,
 169                        void*     user_data) {
 170 
 171     int count = 0;
 172 
 173     /* clean eventCount on first iteration */
 174     if (getCounter(&iterationCount) == 0) {
 175         setCounter(&eventCount, 0);
 176     }
 177     increaseCounter(&iterationCount);
 178 
 179     /* check if eventCount is 0 for each iteration */
 180     count = getCounter(&eventCount);
 181     if (count > 0) {
 182         increaseCounter(&errorCount);
 183     }
 184 
 185     return JVMTI_ITERATION_CONTINUE;
 186 }
 187 
 188 
 189 /* jvmtiObjectReferenceCallback */
 190 jvmtiIterationControl JNICALL
 191 objectReferenceCallback(jvmtiObjectReferenceKind reference_kind,
 192                         jlong  class_tag,
 193                         jlong  size,
 194                         jlong* tag_ptr,
 195                         jlong  referrer_tag,
 196                         jint   referrer_index,
 197                         void*  user_data) {
 198 
 199     int count = 0;
 200 
 201     /* clean eventCount on first iteration */
 202     if (getCounter(&iterationCount) == 0) {
 203         setCounter(&eventCount, 0);
 204     }
 205     increaseCounter(&iterationCount);
 206 
 207     /* check if eventCount is 0 for each iteration */
 208     count = getCounter(&eventCount);
 209     if (count > 0) {
 210         increaseCounter(&errorCount);
 211     }
 212 
 213     return JVMTI_ITERATION_CONTINUE;
 214 }
 215 
 216 
 217 /***********************************************************************/


 220 ObjectFree(jvmtiEnv *jvmti_env, jlong tag) {
 221     increaseCounter(&eventCount);
 222 //    NSK_DISPLAY0("  event: ObjectFree\n");
 223 }
 224 
 225 void JNICALL
 226 GarbageCollectionStart(jvmtiEnv *jvmti_env) {
 227     increaseCounter(&eventCount);
 228     NSK_DISPLAY0("  event: GarbageCollectionStart\n");
 229 }
 230 
 231 void JNICALL
 232 GarbageCollectionFinish(jvmtiEnv *jvmti_env) {
 233     increaseCounter(&eventCount);
 234     NSK_DISPLAY0("  event: GarbageCollectionFinish\n");
 235 }
 236 
 237 /***********************************************************************/
 238 
 239 JNIEXPORT void JNICALL
 240 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_setTag(JNIEnv* jni,
 241                                                          jclass  klass,
 242                                                          jobject target, /* object to be tagged */
 243                                                          jlong   tag) {
 244 
 245     if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
 246         nsk_jvmti_setFailStatus();
 247     }
 248 }
 249 
 250 JNIEXPORT void JNICALL
 251 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_forceGC(JNIEnv* jni,
 252                                                           jclass  klass) {
 253 
 254 NSK_DISPLAY0("  run: ForceGarbageCollection\n");
 255     if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
 256         nsk_jvmti_setFailStatus();
 257     }
 258 }
 259 
 260 JNIEXPORT void JNICALL
 261 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverHeap(JNIEnv* jni,
 262                                                                      jclass  klass) {
 263     int count = 0;
 264 
 265     setCounter(&errorCount, 0);
 266     setCounter(&eventCount, 0);
 267     setCounter(&iterationCount, 0);
 268 
 269     NSK_DISPLAY0("Calling IterateOverHeap...\n");
 270     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
 271                                                  heapObjectCallback,
 272                                                  NULL /*user_data*/))) {
 273         nsk_jvmti_setFailStatus();
 274     }
 275     NSK_DISPLAY0("IterateOverHeap finished.\n");
 276 
 277     NSK_DISPLAY1("Iterations count: %d\n", getCounter(&iterationCount));
 278     NSK_DISPLAY1("Events count: %d\n", getCounter(&eventCount));
 279 
 280     count = getCounter(&errorCount);
 281     NSK_DISPLAY1("Errors detected: %d\n", count);
 282     if (count > 0) {
 283         NSK_COMPLAIN1("Events detected during heap iteration: %d\n", count);
 284         nsk_jvmti_setFailStatus();
 285     }
 286 }
 287 
 288 JNIEXPORT void JNICALL
 289 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverReachableObjects(JNIEnv* jni,
 290                                                                                  jclass  klass) {
 291     int count = 0;
 292 
 293     setCounter(&errorCount, 0);
 294     setCounter(&eventCount, 0);
 295     setCounter(&iterationCount, 0);
 296 
 297     NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
 298     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
 299                                                              stackReferenceCallback,
 300                                                              objectReferenceCallback,
 301                                                              NULL /*user_data*/))) {
 302         nsk_jvmti_setFailStatus();
 303     }
 304     NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
 305 
 306     NSK_DISPLAY1("Iterations count: %d\n", getCounter(&iterationCount));
 307     NSK_DISPLAY1("Events count: %d\n", getCounter(&eventCount));
 308 
 309     count = getCounter(&errorCount);
 310     NSK_DISPLAY1("Errors detected: %d\n", count);
 311     if (count > 0) {
 312         NSK_COMPLAIN1("Events detected during heap iteration: %d\n", count);
 313         nsk_jvmti_setFailStatus();
 314     }
 315 }
 316 
 317 JNIEXPORT void JNICALL
 318 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverInstancesOfClass(JNIEnv* jni,
 319                                                                                  jclass  klass) {
 320     int count = 0;
 321 
 322     setCounter(&errorCount, 0);
 323     setCounter(&eventCount, 0);
 324     setCounter(&iterationCount, 0);
 325 
 326     NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
 327     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
 328                                                              JVMTI_HEAP_OBJECT_TAGGED,
 329                                                              heapObjectCallback,
 330                                                              NULL /*user_data*/))) {
 331         nsk_jvmti_setFailStatus();
 332     }
 333     NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
 334 
 335     NSK_DISPLAY1("Iterations count: %d\n", getCounter(&iterationCount));
 336     NSK_DISPLAY1("Events count: %d\n", getCounter(&eventCount));
 337 
 338     count = getCounter(&errorCount);
 339     NSK_DISPLAY1("Errors detected: %d\n", count);
 340     if (count > 0) {
 341         NSK_COMPLAIN1("Events detected during heap iteration: %d\n", count);
 342         nsk_jvmti_setFailStatus();
 343     }
 344 }
 345 
 346 JNIEXPORT void JNICALL
 347 Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverObjectsReachableFromObject(JNIEnv* jni,
 348                                                                                            jclass  klass) {
 349 
 350     jobject root = NULL;
 351     int count = 0;
 352 
 353     if (!NSK_JNI_VERIFY(jni, (root =
 354             jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL)) {
 355         NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
 356         nsk_jvmti_setFailStatus();
 357         return;
 358     }
 359 
 360     // release secondary lock
 361     jni->CallStaticVoidMethod(debugeeClass, unlockSecondaryID);
 362 
 363     setCounter(&errorCount, 0);
 364     setCounter(&eventCount, 0);
 365     setCounter(&iterationCount, 0);
 366 
 367     NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
 368     if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
 369                                                                        objectReferenceCallback,
 370                                                                        NULL /*user_data*/))) {
 371         nsk_jvmti_setFailStatus();
 372     }
 373     NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
 374 


 385 
 386 static void JNICALL
 387 agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
 388 
 389     NSK_DISPLAY0("Wait for debugee start\n\n");
 390     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
 391         return;
 392 
 393     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE);
 394     debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE);
 395     if (debugeeClass == NULL) {
 396         nsk_jvmti_setFailStatus();
 397         return;
 398     }
 399 
 400     if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
 401         return;
 402 
 403     NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
 404     if (!NSK_JNI_VERIFY(jni, (rootFieldID =
 405             jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL)) {
 406         nsk_jvmti_setFailStatus();
 407         return;
 408     }
 409 
 410     NSK_DISPLAY1("Find ID of 'unlockSecondary' method: %s\n", ROOT_SIGNATURE);
 411     if (!NSK_JNI_VERIFY(jni, (unlockSecondaryID =
 412             jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != NULL)) {
 413         nsk_jvmti_setFailStatus();
 414         return;
 415     }
 416 
 417 
 418     NSK_DISPLAY0("Let debugee to run test cases\n");
 419     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
 420         return;
 421 
 422     NSK_DISPLAY0("Wait for completion of test cases\n\n");
 423     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
 424         return;
 425 
 426     nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, NULL);
 427 
 428     NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
 429     NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
 430 
 431     NSK_DISPLAY0("Let debugee to finish\n");
 432     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))


< prev index next >