< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp

Print this page
rev 52215 : 8212770: Remove spaces before/after () for vmTestbase/jvmti/[s-u]
Summary:
Reviewed-by:


 451             referrer_index = reference_info->array.index;
 452             break;
 453         case JVMTI_HEAP_REFERENCE_STACK_LOCAL:
 454             referrer_index = reference_info->stack_local.slot;
 455             /* Fall through */
 456         case JVMTI_HEAP_REFERENCE_JNI_LOCAL:
 457             referrer_index |= reference_info->stack_local.depth << 16;
 458             break;
 459         default:
 460             // TODO: check that realy should be done w/ other jvmtiHeapReferenceKind
 461             break;
 462     }
 463 
 464     printf("     heapReferenceCallback: ref=%s, class_tag=%-3ld, tag=%-3ld,"
 465            " size=%-3ld, ref_tag=%-3ld, ref_idx=%#x\n",
 466            ref_kind_str[reference_kind],
 467            (long) class_tag,
 468            (long) tag,
 469            (long) size,
 470            (long) ref_tag,
 471            (int ) referrer_index);
 472     fflush(0);
 473 
 474     if (tag_ptr == NULL) {
 475         NSK_COMPLAIN1("NULL tag_ptr is passed to heapReferenceCallback:"
 476                       " tag_ptr=0x%p\n", (void*)tag_ptr);
 477         nsk_jvmti_setFailStatus();
 478     }
 479 
 480     if (tag_ptr != NULL && *tag_ptr != 0) {
 481         int found = 0;
 482         int i;
 483 
 484         for (i = 0; i < objectsCount; i++) {
 485             if (*tag_ptr == objectDescList[i].tag) {
 486                 found++;
 487                 objectDescList[i].found++;
 488 
 489                 if (*tag_ptr < 0) {
 490                     NSK_COMPLAIN0("Unreachable tagged object is passed to heapReferenceCallback\n");
 491                     nsk_jvmti_setFailStatus();


 551         default:
 552             // TODO: check that realy should be done w/ other jvmtiHeapReferenceKind
 553             break;
 554     }
 555     return JVMTI_VISIT_OBJECTS;
 556 }
 557 
 558 jint JNICALL primitiveFieldCallback(
 559      jvmtiHeapReferenceKind        reference_kind,
 560      const jvmtiHeapReferenceInfo* reference_info,
 561      jlong                         class_tag,
 562      jlong*                        tag_ptr,
 563      jvalue                        value,
 564      jvmtiPrimitiveType            value_type,
 565      void*                         user_data)
 566 {
 567     printf(" primitiveFieldCallback: ref=%s, class_tag=%-3ld, tag=%-3ld, type=%c\n",
 568            ref_kind_str[reference_kind],
 569            (long) class_tag,
 570            (long) DEREF(tag_ptr),
 571            (int ) value_type);
 572     fflush(0);
 573     return 0;
 574 }
 575 
 576 jint JNICALL arrayPrimitiveValueCallback(
 577      jlong              class_tag,
 578      jlong              size,
 579      jlong*             tag_ptr,
 580      jint               element_count,
 581      jvmtiPrimitiveType element_type,
 582      const void*        elements,
 583      void*              user_data)
 584 {
 585     printf(" arrayPrimitiveValueCallback: class_tag=%-3ld, tag=%-3ld, len=%d, type=%c\n",
 586            (long) class_tag,
 587            (long) DEREF(tag_ptr),
 588            (int ) element_count,
 589            (int ) element_type);
 590     fflush(0);
 591     return 0;
 592 }
 593 
 594 jint JNICALL stringPrimitiveValueCallback(
 595      jlong        class_tag,
 596      jlong        size,
 597      jlong*       tag_ptr,
 598      const jchar* value,
 599      jint         value_length,
 600      void*        user_data)
 601 {
 602     printf("stringPrimitiveValueCallback: class_tag=%-3ld, tag=%-3ld, len=%d\n",
 603            (long) class_tag,
 604            (long) DEREF(tag_ptr),
 605            (int ) value_length);
 606     fflush(0);
 607     return 0;
 608 }
 609 
 610 /* ============================================================================= */
 611 
 612 /** Agent algorithm. */
 613 static void JNICALL
 614 agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
 615     jobject rootObject = NULL;
 616 
 617     printf("Wait for tested objects created\n");
 618     fflush(0);
 619     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
 620         return;
 621     }
 622 
 623     printf(">>> Obtain and tag tested objects from debugee class\n");
 624     fflush(0);
 625     {




 451             referrer_index = reference_info->array.index;
 452             break;
 453         case JVMTI_HEAP_REFERENCE_STACK_LOCAL:
 454             referrer_index = reference_info->stack_local.slot;
 455             /* Fall through */
 456         case JVMTI_HEAP_REFERENCE_JNI_LOCAL:
 457             referrer_index |= reference_info->stack_local.depth << 16;
 458             break;
 459         default:
 460             // TODO: check that realy should be done w/ other jvmtiHeapReferenceKind
 461             break;
 462     }
 463 
 464     printf("     heapReferenceCallback: ref=%s, class_tag=%-3ld, tag=%-3ld,"
 465            " size=%-3ld, ref_tag=%-3ld, ref_idx=%#x\n",
 466            ref_kind_str[reference_kind],
 467            (long) class_tag,
 468            (long) tag,
 469            (long) size,
 470            (long) ref_tag,
 471            (int) referrer_index);
 472     fflush(0);
 473 
 474     if (tag_ptr == NULL) {
 475         NSK_COMPLAIN1("NULL tag_ptr is passed to heapReferenceCallback:"
 476                       " tag_ptr=0x%p\n", (void*)tag_ptr);
 477         nsk_jvmti_setFailStatus();
 478     }
 479 
 480     if (tag_ptr != NULL && *tag_ptr != 0) {
 481         int found = 0;
 482         int i;
 483 
 484         for (i = 0; i < objectsCount; i++) {
 485             if (*tag_ptr == objectDescList[i].tag) {
 486                 found++;
 487                 objectDescList[i].found++;
 488 
 489                 if (*tag_ptr < 0) {
 490                     NSK_COMPLAIN0("Unreachable tagged object is passed to heapReferenceCallback\n");
 491                     nsk_jvmti_setFailStatus();


 551         default:
 552             // TODO: check that realy should be done w/ other jvmtiHeapReferenceKind
 553             break;
 554     }
 555     return JVMTI_VISIT_OBJECTS;
 556 }
 557 
 558 jint JNICALL primitiveFieldCallback(
 559      jvmtiHeapReferenceKind        reference_kind,
 560      const jvmtiHeapReferenceInfo* reference_info,
 561      jlong                         class_tag,
 562      jlong*                        tag_ptr,
 563      jvalue                        value,
 564      jvmtiPrimitiveType            value_type,
 565      void*                         user_data)
 566 {
 567     printf(" primitiveFieldCallback: ref=%s, class_tag=%-3ld, tag=%-3ld, type=%c\n",
 568            ref_kind_str[reference_kind],
 569            (long) class_tag,
 570            (long) DEREF(tag_ptr),
 571            (int) value_type);
 572     fflush(0);
 573     return 0;
 574 }
 575 
 576 jint JNICALL arrayPrimitiveValueCallback(
 577      jlong              class_tag,
 578      jlong              size,
 579      jlong*             tag_ptr,
 580      jint               element_count,
 581      jvmtiPrimitiveType element_type,
 582      const void*        elements,
 583      void*              user_data)
 584 {
 585     printf(" arrayPrimitiveValueCallback: class_tag=%-3ld, tag=%-3ld, len=%d, type=%c\n",
 586            (long) class_tag,
 587            (long) DEREF(tag_ptr),
 588            (int) element_count,
 589            (int) element_type);
 590     fflush(0);
 591     return 0;
 592 }
 593 
 594 jint JNICALL stringPrimitiveValueCallback(
 595      jlong        class_tag,
 596      jlong        size,
 597      jlong*       tag_ptr,
 598      const jchar* value,
 599      jint         value_length,
 600      void*        user_data)
 601 {
 602     printf("stringPrimitiveValueCallback: class_tag=%-3ld, tag=%-3ld, len=%d\n",
 603            (long) class_tag,
 604            (long) DEREF(tag_ptr),
 605            (int) value_length);
 606     fflush(0);
 607     return 0;
 608 }
 609 
 610 /* ============================================================================= */
 611 
 612 /** Agent algorithm. */
 613 static void JNICALL
 614 agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
 615     jobject rootObject = NULL;
 616 
 617     printf("Wait for tested objects created\n");
 618     fflush(0);
 619     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) {
 620         return;
 621     }
 622 
 623     printf(">>> Obtain and tag tested objects from debugee class\n");
 624     fflush(0);
 625     {


< prev index next >