comparison src/share/vm/prims/jvmtiImpl.cpp @ 13086:096c224171c4

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 20 Nov 2013 00:10:38 +0100
parents cefad50507d8 910026b800b8
children 6b2d8d20ecbd
comparison
equal deleted inserted replaced
12782:92b7ec34ddfa 13086:096c224171c4
208 GrowableElement *e = _elements->at(i); 208 GrowableElement *e = _elements->at(i);
209 e->oops_do(f); 209 e->oops_do(f);
210 } 210 }
211 } 211 }
212 212
213 void GrowableCache::metadata_do(void f(Metadata*)) {
214 int len = _elements->length();
215 for (int i=0; i<len; i++) {
216 GrowableElement *e = _elements->at(i);
217 e->metadata_do(f);
218 }
219 }
220
213 void GrowableCache::gc_epilogue() { 221 void GrowableCache::gc_epilogue() {
214 int len = _elements->length(); 222 int len = _elements->length();
215 for (int i=0; i<len; i++) { 223 for (int i=0; i<len; i++) {
216 _cache[i] = _elements->at(i)->getCacheValue(); 224 _cache[i] = _elements->at(i)->getCacheValue();
217 } 225 }
222 // 230 //
223 231
224 JvmtiBreakpoint::JvmtiBreakpoint() { 232 JvmtiBreakpoint::JvmtiBreakpoint() {
225 _method = NULL; 233 _method = NULL;
226 _bci = 0; 234 _bci = 0;
227 _class_loader = NULL; 235 _class_holder = NULL;
228 #ifdef CHECK_UNHANDLED_OOPS
229 // This one is always allocated with new, but check it just in case.
230 Thread *thread = Thread::current();
231 if (thread->is_in_stack((address)&_method)) {
232 thread->allow_unhandled_oop((oop*)&_method);
233 }
234 #endif // CHECK_UNHANDLED_OOPS
235 } 236 }
236 237
237 JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) { 238 JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) {
238 _method = m_method; 239 _method = m_method;
239 _class_loader = _method->method_holder()->class_loader_data()->class_loader(); 240 _class_holder = _method->method_holder()->klass_holder();
241 #ifdef CHECK_UNHANDLED_OOPS
242 // _class_holder can't be wrapped in a Handle, because JvmtiBreakpoints are
243 // sometimes allocated on the heap.
244 //
245 // The code handling JvmtiBreakpoints allocated on the stack can't be
246 // interrupted by a GC until _class_holder is reachable by the GC via the
247 // oops_do method.
248 Thread::current()->allow_unhandled_oop(&_class_holder);
249 #endif // CHECK_UNHANDLED_OOPS
240 assert(_method != NULL, "_method != NULL"); 250 assert(_method != NULL, "_method != NULL");
241 _bci = (int) location; 251 _bci = (int) location;
242 assert(_bci >= 0, "_bci >= 0"); 252 assert(_bci >= 0, "_bci >= 0");
243 } 253 }
244 254
245 void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) { 255 void JvmtiBreakpoint::copy(JvmtiBreakpoint& bp) {
246 _method = bp._method; 256 _method = bp._method;
247 _bci = bp._bci; 257 _bci = bp._bci;
248 _class_loader = bp._class_loader; 258 _class_holder = bp._class_holder;
249 } 259 }
250 260
251 bool JvmtiBreakpoint::lessThan(JvmtiBreakpoint& bp) { 261 bool JvmtiBreakpoint::lessThan(JvmtiBreakpoint& bp) {
252 Unimplemented(); 262 Unimplemented();
253 return false; 263 return false;
361 if (_bp != NULL) { 371 if (_bp != NULL) {
362 _bp->oops_do(f); 372 _bp->oops_do(f);
363 } 373 }
364 } 374 }
365 375
376 void VM_ChangeBreakpoints::metadata_do(void f(Metadata*)) {
377 // Walk metadata in breakpoints to keep from being deallocated with RedefineClasses
378 if (_bp != NULL) {
379 _bp->metadata_do(f);
380 }
381 }
382
366 // 383 //
367 // class JvmtiBreakpoints 384 // class JvmtiBreakpoints
368 // 385 //
369 // a JVMTI internal collection of JvmtiBreakpoint 386 // a JVMTI internal collection of JvmtiBreakpoint
370 // 387 //
375 392
376 JvmtiBreakpoints:: ~JvmtiBreakpoints() {} 393 JvmtiBreakpoints:: ~JvmtiBreakpoints() {}
377 394
378 void JvmtiBreakpoints::oops_do(OopClosure* f) { 395 void JvmtiBreakpoints::oops_do(OopClosure* f) {
379 _bps.oops_do(f); 396 _bps.oops_do(f);
397 }
398
399 void JvmtiBreakpoints::metadata_do(void f(Metadata*)) {
400 _bps.metadata_do(f);
380 } 401 }
381 402
382 void JvmtiBreakpoints::gc_epilogue() { 403 void JvmtiBreakpoints::gc_epilogue() {
383 _bps.gc_epilogue(); 404 _bps.gc_epilogue();
384 } 405 }
495 if (_jvmti_breakpoints != NULL) { 516 if (_jvmti_breakpoints != NULL) {
496 _jvmti_breakpoints->oops_do(f); 517 _jvmti_breakpoints->oops_do(f);
497 } 518 }
498 } 519 }
499 520
521 void JvmtiCurrentBreakpoints::metadata_do(void f(Metadata*)) {
522 if (_jvmti_breakpoints != NULL) {
523 _jvmti_breakpoints->metadata_do(f);
524 }
525 }
526
500 void JvmtiCurrentBreakpoints::gc_epilogue() { 527 void JvmtiCurrentBreakpoints::gc_epilogue() {
501 if (_jvmti_breakpoints != NULL) { 528 if (_jvmti_breakpoints != NULL) {
502 _jvmti_breakpoints->gc_epilogue(); 529 _jvmti_breakpoints->gc_epilogue();
503 } 530 }
504 } 531 }