45 static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP07/ap07t001;"; |
45 static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP07/ap07t001;"; |
46 static const jlong IGNORE_TAG = (jlong)10l; |
46 static const jlong IGNORE_TAG = (jlong)10l; |
47 |
47 |
48 /* jvmtiHeapRootCallback */ |
48 /* jvmtiHeapRootCallback */ |
49 jvmtiIterationControl JNICALL |
49 jvmtiIterationControl JNICALL |
50 heapRootCallback( jvmtiHeapRootKind root_kind, |
50 heapRootCallback(jvmtiHeapRootKind root_kind, |
51 jlong class_tag, |
51 jlong class_tag, |
52 jlong size, |
52 jlong size, |
53 jlong* tag_ptr, |
53 jlong* tag_ptr, |
54 void* user_data) { |
54 void* user_data) { |
55 |
55 |
56 if (*tag_ptr > 0) { |
56 if (*tag_ptr > 0) { |
57 NSK_DISPLAY2("heapRootCallback: root kind=%s, tag=%d\n", TranslateRootKind(root_kind), (long)*tag_ptr); |
57 NSK_DISPLAY2("heapRootCallback: root kind=%s, tag=%d\n", TranslateRootKind(root_kind), (long)*tag_ptr); |
58 } |
58 } |
59 return JVMTI_ITERATION_CONTINUE; |
59 return JVMTI_ITERATION_CONTINUE; |
60 } |
60 } |
61 |
61 |
62 /* jvmtiStackReferenceCallback */ |
62 /* jvmtiStackReferenceCallback */ |
63 jvmtiIterationControl JNICALL |
63 jvmtiIterationControl JNICALL |
64 stackReferenceCallback( jvmtiHeapRootKind root_kind, |
64 stackReferenceCallback(jvmtiHeapRootKind root_kind, |
65 jlong class_tag, |
65 jlong class_tag, |
66 jlong size, |
66 jlong size, |
67 jlong* tag_ptr, |
67 jlong* tag_ptr, |
68 jlong thread_tag, |
68 jlong thread_tag, |
69 jint depth, |
69 jint depth, |
70 jmethodID method, |
70 jmethodID method, |
71 jint slot, |
71 jint slot, |
72 void* user_data) { |
72 void* user_data) { |
73 |
73 |
74 if (*tag_ptr > 0) { |
74 if (*tag_ptr > 0) { |
75 NSK_DISPLAY2("stackReferenceCallback: root kind=%s, tag=%d\n", TranslateRootKind(root_kind), (long)*tag_ptr); |
75 NSK_DISPLAY2("stackReferenceCallback: root kind=%s, tag=%d\n", TranslateRootKind(root_kind), (long)*tag_ptr); |
76 } |
76 } |
77 return JVMTI_ITERATION_CONTINUE; |
77 return JVMTI_ITERATION_CONTINUE; |
78 } |
78 } |
79 |
79 |
80 |
80 |
81 /* jvmtiObjectReferenceCallback */ |
81 /* jvmtiObjectReferenceCallback */ |
82 jvmtiIterationControl JNICALL |
82 jvmtiIterationControl JNICALL |
83 objectReferenceCallback( jvmtiObjectReferenceKind reference_kind, |
83 objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, |
84 jlong class_tag, |
84 jlong class_tag, |
85 jlong size, |
85 jlong size, |
86 jlong* tag_ptr, |
86 jlong* tag_ptr, |
87 jlong referrer_tag, |
87 jlong referrer_tag, |
88 jint referrer_index, |
88 jint referrer_index, |
89 void* user_data) { |
89 void* user_data) { |
90 |
90 |
91 if (*tag_ptr > 0) { |
91 if (*tag_ptr > 0) { |
92 NSK_DISPLAY2("objectReferenceCallback: reference kind=%s, tag=%d\n", TranslateObjectRefKind(reference_kind), (long)*tag_ptr); |
92 NSK_DISPLAY2("objectReferenceCallback: reference kind=%s, tag=%d\n", TranslateObjectRefKind(reference_kind), (long)*tag_ptr); |
93 } |
93 } |
94 if (*tag_ptr > IGNORE_TAG) { |
94 if (*tag_ptr > IGNORE_TAG) { |
104 |
104 |
105 |
105 |
106 /************************/ |
106 /************************/ |
107 |
107 |
108 JNIEXPORT void JNICALL |
108 JNIEXPORT void JNICALL |
109 Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setTag( JNIEnv* jni, |
109 Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setTag(JNIEnv* jni, |
110 jobject obj, |
110 jobject obj, |
111 jobject target, |
111 jobject target, |
112 jlong tag ) { |
112 jlong tag) { |
113 |
113 |
114 if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) { |
114 if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) { |
115 nsk_jvmti_setFailStatus(); |
115 nsk_jvmti_setFailStatus(); |
116 } |
116 } |
117 } |
117 } |
118 |
118 |
119 JNIEXPORT void JNICALL |
119 JNIEXPORT void JNICALL |
120 Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setRoot( JNIEnv* jni, jobject obj) { |
120 Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setRoot(JNIEnv* jni, jobject obj) { |
121 if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != NULL)) |
121 if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != NULL)) |
122 nsk_jvmti_setFailStatus(); |
122 nsk_jvmti_setFailStatus(); |
123 } |
123 } |
124 |
124 |
125 static void JNICALL |
125 static void JNICALL |