test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp
equal
deleted
inserted
replaced
62 /* ============================================================================= */ |
62 /* ============================================================================= */ |
63 |
63 |
64 |
64 |
65 /** jvmtiHeapRootCallback for first iteration. */ |
65 /** jvmtiHeapRootCallback for first iteration. */ |
66 jvmtiIterationControl JNICALL |
66 jvmtiIterationControl JNICALL |
67 heapRootCallbackForFirstObjectsIteration( jvmtiHeapRootKind root_kind, |
67 heapRootCallbackForFirstObjectsIteration(jvmtiHeapRootKind root_kind, |
68 jlong class_tag, |
68 jlong class_tag, |
69 jlong size, |
69 jlong size, |
70 jlong* tag_ptr, |
70 jlong* tag_ptr, |
71 void* user_data) { |
71 void* user_data) { |
72 |
72 |
73 if (*tag_ptr != 0) return JVMTI_ITERATION_CONTINUE; |
73 if (*tag_ptr != 0) return JVMTI_ITERATION_CONTINUE; |
74 |
74 |
75 /* Set tag */ |
75 /* Set tag */ |
76 *tag_ptr = (jlong)++objectCount; |
76 *tag_ptr = (jlong)++objectCount; |
92 return JVMTI_ITERATION_CONTINUE; |
92 return JVMTI_ITERATION_CONTINUE; |
93 } |
93 } |
94 |
94 |
95 /** jvmtiHeapRootCallback for second iteration. */ |
95 /** jvmtiHeapRootCallback for second iteration. */ |
96 jvmtiIterationControl JNICALL |
96 jvmtiIterationControl JNICALL |
97 heapRootCallbackForSecondObjectsIteration( jvmtiHeapRootKind root_kind, |
97 heapRootCallbackForSecondObjectsIteration(jvmtiHeapRootKind root_kind, |
98 jlong class_tag, |
98 jlong class_tag, |
99 jlong size, |
99 jlong size, |
100 jlong* tag_ptr, |
100 jlong* tag_ptr, |
101 void* user_data) { |
101 void* user_data) { |
102 |
102 |
103 long ind = (long)((*tag_ptr) - 1); |
103 long ind = (long)((*tag_ptr) - 1); |
104 |
104 |
105 if (*tag_ptr == 0) return JVMTI_ITERATION_CONTINUE; |
105 if (*tag_ptr == 0) return JVMTI_ITERATION_CONTINUE; |
106 |
106 |
107 /* |
107 /* |
108 ObjectDesc *objectDesc = objectDescArr[ind]; |
108 ObjectDesc *objectDesc = objectDescArr[ind]; |
109 jlong tag = (*objectDesc).tag; |
109 jlong tag = (*objectDesc).tag; |
110 */ |
110 */ |
111 if (ind < 0 || ind > objectCountMax ) { |
111 if (ind < 0 || ind > objectCountMax) { |
112 NSK_COMPLAIN1("heapRootCallbackForSecondObjectsIteration: invalid object tag value: %d\n", (long)*tag_ptr); |
112 NSK_COMPLAIN1("heapRootCallbackForSecondObjectsIteration: invalid object tag value: %d\n", (long)*tag_ptr); |
113 nsk_jvmti_setFailStatus(); |
113 nsk_jvmti_setFailStatus(); |
114 callbackAborted = 1; |
114 callbackAborted = 1; |
115 return JVMTI_ITERATION_ABORT; |
115 return JVMTI_ITERATION_ABORT; |
116 } |
116 } |
136 return JVMTI_ITERATION_CONTINUE; |
136 return JVMTI_ITERATION_CONTINUE; |
137 } |
137 } |
138 |
138 |
139 /** jvmtiStackReferenceCallback for first iteration. */ |
139 /** jvmtiStackReferenceCallback for first iteration. */ |
140 jvmtiIterationControl JNICALL |
140 jvmtiIterationControl JNICALL |
141 stackReferenceCallbackForFirstObjectsIteration( jvmtiHeapRootKind root_kind, |
141 stackReferenceCallbackForFirstObjectsIteration(jvmtiHeapRootKind root_kind, |
142 jlong class_tag, |
142 jlong class_tag, |
143 jlong size, |
143 jlong size, |
144 jlong* tag_ptr, |
144 jlong* tag_ptr, |
145 jlong thread_tag, |
145 jlong thread_tag, |
146 jint depth, |
146 jint depth, |
147 jmethodID method, |
147 jmethodID method, |
148 jint slot, |
148 jint slot, |
149 void* user_data) { |
149 void* user_data) { |
150 |
150 |
151 if (*tag_ptr != 0) return JVMTI_ITERATION_CONTINUE; |
151 if (*tag_ptr != 0) return JVMTI_ITERATION_CONTINUE; |
152 |
152 |
153 /* Set tag */ |
153 /* Set tag */ |
154 *tag_ptr = (jlong)++objectCount; |
154 *tag_ptr = (jlong)++objectCount; |
170 return JVMTI_ITERATION_CONTINUE; |
170 return JVMTI_ITERATION_CONTINUE; |
171 } |
171 } |
172 |
172 |
173 /** jvmtiStackReferenceCallback for second iteration. */ |
173 /** jvmtiStackReferenceCallback for second iteration. */ |
174 jvmtiIterationControl JNICALL |
174 jvmtiIterationControl JNICALL |
175 stackReferenceCallbackForSecondObjectsIteration( jvmtiHeapRootKind root_kind, |
175 stackReferenceCallbackForSecondObjectsIteration(jvmtiHeapRootKind root_kind, |
176 jlong class_tag, |
176 jlong class_tag, |
177 jlong size, |
177 jlong size, |
178 jlong* tag_ptr, |
178 jlong* tag_ptr, |
179 jlong thread_tag, |
179 jlong thread_tag, |
180 jint depth, |
180 jint depth, |
181 jmethodID method, |
181 jmethodID method, |
182 jint slot, |
182 jint slot, |
183 void* user_data) { |
183 void* user_data) { |
184 |
184 |
185 long ind = (long)((*tag_ptr) - 1); |
185 long ind = (long)((*tag_ptr) - 1); |
186 |
186 |
187 if (*tag_ptr == 0) return JVMTI_ITERATION_CONTINUE; |
187 if (*tag_ptr == 0) return JVMTI_ITERATION_CONTINUE; |
188 |
188 |
189 /* |
189 /* |
190 ObjectDesc *objectDesc = objectDescArr[ind]; |
190 ObjectDesc *objectDesc = objectDescArr[ind]; |
191 jlong tag = (*objectDesc).tag; |
191 jlong tag = (*objectDesc).tag; |
192 */ |
192 */ |
193 if (ind < 0 || ind > objectCountMax ) { |
193 if (ind < 0 || ind > objectCountMax) { |
194 NSK_COMPLAIN1("stackReferenceCallbackForSecondObjectsIteration: invalid object tag value: %d\n", (long)*tag_ptr); |
194 NSK_COMPLAIN1("stackReferenceCallbackForSecondObjectsIteration: invalid object tag value: %d\n", (long)*tag_ptr); |
195 nsk_jvmti_setFailStatus(); |
195 nsk_jvmti_setFailStatus(); |
196 callbackAborted = 1; |
196 callbackAborted = 1; |
197 return JVMTI_ITERATION_ABORT; |
197 return JVMTI_ITERATION_ABORT; |
198 } |
198 } |
218 return JVMTI_ITERATION_CONTINUE; |
218 return JVMTI_ITERATION_CONTINUE; |
219 } |
219 } |
220 |
220 |
221 /** jvmtiObjectReferenceCallback for first iteration. */ |
221 /** jvmtiObjectReferenceCallback for first iteration. */ |
222 jvmtiIterationControl JNICALL |
222 jvmtiIterationControl JNICALL |
223 objectReferenceCallbackForFirstObjectsIteration( jvmtiObjectReferenceKind reference_kind, |
223 objectReferenceCallbackForFirstObjectsIteration(jvmtiObjectReferenceKind reference_kind, |
224 jlong class_tag, |
224 jlong class_tag, |
225 jlong size, |
225 jlong size, |
226 jlong* tag_ptr, |
226 jlong* tag_ptr, |
227 jlong referrer_tag, |
227 jlong referrer_tag, |
228 jint referrer_index, |
228 jint referrer_index, |
229 void* user_data) { |
229 void* user_data) { |
230 |
230 |
231 if (*tag_ptr != 0) return JVMTI_ITERATION_CONTINUE; |
231 if (*tag_ptr != 0) return JVMTI_ITERATION_CONTINUE; |
232 |
232 |
233 /* Set tag */ |
233 /* Set tag */ |
234 *tag_ptr = (jlong)++objectCount; |
234 *tag_ptr = (jlong)++objectCount; |
250 return JVMTI_ITERATION_CONTINUE; |
250 return JVMTI_ITERATION_CONTINUE; |
251 } |
251 } |
252 |
252 |
253 /** jvmtiObjectReferenceCallback for second iteration. */ |
253 /** jvmtiObjectReferenceCallback for second iteration. */ |
254 jvmtiIterationControl JNICALL |
254 jvmtiIterationControl JNICALL |
255 objectReferenceCallbackForSecondObjectsIteration( jvmtiObjectReferenceKind reference_kind, |
255 objectReferenceCallbackForSecondObjectsIteration(jvmtiObjectReferenceKind reference_kind, |
256 jlong class_tag, |
256 jlong class_tag, |
257 jlong size, |
257 jlong size, |
258 jlong* tag_ptr, |
258 jlong* tag_ptr, |
259 jlong referrer_tag, |
259 jlong referrer_tag, |
260 jint referrer_index, |
260 jint referrer_index, |
261 void* user_data) { |
261 void* user_data) { |
262 |
262 |
263 long ind = (long)((*tag_ptr) - 1); |
263 long ind = (long)((*tag_ptr) - 1); |
264 |
264 |
265 if (*tag_ptr == 0) return JVMTI_ITERATION_CONTINUE; |
265 if (*tag_ptr == 0) return JVMTI_ITERATION_CONTINUE; |
266 |
266 |
267 /* |
267 /* |
268 ObjectDesc *objectDesc = objectDescArr[ind]; |
268 ObjectDesc *objectDesc = objectDescArr[ind]; |
269 jlong tag = (*objectDesc).tag; |
269 jlong tag = (*objectDesc).tag; |
270 */ |
270 */ |
271 if (ind < 0 || ind > objectCountMax ) { |
271 if (ind < 0 || ind > objectCountMax) { |
272 NSK_COMPLAIN1("objectReferenceCallbackForSecondObjectsIteration: invalid object tag value: %d\n", (long)*tag_ptr); |
272 NSK_COMPLAIN1("objectReferenceCallbackForSecondObjectsIteration: invalid object tag value: %d\n", (long)*tag_ptr); |
273 nsk_jvmti_setFailStatus(); |
273 nsk_jvmti_setFailStatus(); |
274 callbackAborted = 1; |
274 callbackAborted = 1; |
275 return JVMTI_ITERATION_ABORT; |
275 return JVMTI_ITERATION_ABORT; |
276 } |
276 } |