comparison src/share/vm/prims/jvmtiImpl.cpp @ 10405:f2110083203d

8005849: JEP 167: Event-Based JVM Tracing Reviewed-by: acorn, coleenp, sla Contributed-by: Karen Kinnear <karen.kinnear@oracle.com>, Bengt Rutisson <bengt.rutisson@oracle.com>, Calvin Cheung <calvin.cheung@oracle.com>, Erik Gahlin <erik.gahlin@oracle.com>, Erik Helin <erik.helin@oracle.com>, Jesper Wilhelmsson <jesper.wilhelmsson@oracle.com>, Keith McGuigan <keith.mcguigan@oracle.com>, Mattias Tobiasson <mattias.tobiasson@oracle.com>, Markus Gronlund <markus.gronlund@oracle.com>, Mikael Auno <mikael.auno@oracle.com>, Nils Eliasson <nils.eliasson@oracle.com>, Nils Loodin <nils.loodin@oracle.com>, Rickard Backman <rickard.backman@oracle.com>, Staffan Larsen <staffan.larsen@oracle.com>, Stefan Karlsson <stefan.karlsson@oracle.com>, Yekaterina Kantserova <yekaterina.kantserova@oracle.com>
author sla
date Mon, 10 Jun 2013 11:30:51 +0200
parents 47bc9800972c
children 836a62f43af9 4f9a42c33738
comparison
equal deleted inserted replaced
10404:d0add7016434 10405:f2110083203d
358 _breakpoints->set_at_safepoint(*_bp); 358 _breakpoints->set_at_safepoint(*_bp);
359 break; 359 break;
360 case CLEAR_BREAKPOINT: 360 case CLEAR_BREAKPOINT:
361 _breakpoints->clear_at_safepoint(*_bp); 361 _breakpoints->clear_at_safepoint(*_bp);
362 break; 362 break;
363 case CLEAR_ALL_BREAKPOINT:
364 _breakpoints->clearall_at_safepoint();
365 break;
366 default: 363 default:
367 assert(false, "Unknown operation"); 364 assert(false, "Unknown operation");
368 } 365 }
369 } 366 }
370 367
371 void VM_ChangeBreakpoints::oops_do(OopClosure* f) { 368 void VM_ChangeBreakpoints::oops_do(OopClosure* f) {
372 // This operation keeps breakpoints alive 369 // The JvmtiBreakpoints in _breakpoints will be visited via
373 if (_breakpoints != NULL) { 370 // JvmtiExport::oops_do.
374 _breakpoints->oops_do(f);
375 }
376 if (_bp != NULL) { 371 if (_bp != NULL) {
377 _bp->oops_do(f); 372 _bp->oops_do(f);
378 } 373 }
379 } 374 }
380 375
431 _bps.remove(i); 426 _bps.remove(i);
432 bp.clear(); 427 bp.clear();
433 } 428 }
434 } 429 }
435 430
436 void JvmtiBreakpoints::clearall_at_safepoint() {
437 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
438
439 int len = _bps.length();
440 for (int i=0; i<len; i++) {
441 _bps.at(i).clear();
442 }
443 _bps.clear();
444 }
445
446 int JvmtiBreakpoints::length() { return _bps.length(); } 431 int JvmtiBreakpoints::length() { return _bps.length(); }
447 432
448 int JvmtiBreakpoints::set(JvmtiBreakpoint& bp) { 433 int JvmtiBreakpoints::set(JvmtiBreakpoint& bp) {
449 if ( _bps.find(bp) != -1) { 434 if ( _bps.find(bp) != -1) {
450 return JVMTI_ERROR_DUPLICATE; 435 return JVMTI_ERROR_DUPLICATE;
451 } 436 }
452 VM_ChangeBreakpoints set_breakpoint(this,VM_ChangeBreakpoints::SET_BREAKPOINT, &bp); 437 VM_ChangeBreakpoints set_breakpoint(VM_ChangeBreakpoints::SET_BREAKPOINT, &bp);
453 VMThread::execute(&set_breakpoint); 438 VMThread::execute(&set_breakpoint);
454 return JVMTI_ERROR_NONE; 439 return JVMTI_ERROR_NONE;
455 } 440 }
456 441
457 int JvmtiBreakpoints::clear(JvmtiBreakpoint& bp) { 442 int JvmtiBreakpoints::clear(JvmtiBreakpoint& bp) {
458 if ( _bps.find(bp) == -1) { 443 if ( _bps.find(bp) == -1) {
459 return JVMTI_ERROR_NOT_FOUND; 444 return JVMTI_ERROR_NOT_FOUND;
460 } 445 }
461 446
462 VM_ChangeBreakpoints clear_breakpoint(this,VM_ChangeBreakpoints::CLEAR_BREAKPOINT, &bp); 447 VM_ChangeBreakpoints clear_breakpoint(VM_ChangeBreakpoints::CLEAR_BREAKPOINT, &bp);
463 VMThread::execute(&clear_breakpoint); 448 VMThread::execute(&clear_breakpoint);
464 return JVMTI_ERROR_NONE; 449 return JVMTI_ERROR_NONE;
465 } 450 }
466 451
467 void JvmtiBreakpoints::clearall_in_class_at_safepoint(Klass* klass) { 452 void JvmtiBreakpoints::clearall_in_class_at_safepoint(Klass* klass) {
488 } 473 }
489 } 474 }
490 } 475 }
491 } 476 }
492 477
493 void JvmtiBreakpoints::clearall() {
494 VM_ChangeBreakpoints clearall_breakpoint(this,VM_ChangeBreakpoints::CLEAR_ALL_BREAKPOINT);
495 VMThread::execute(&clearall_breakpoint);
496 }
497
498 // 478 //
499 // class JvmtiCurrentBreakpoints 479 // class JvmtiCurrentBreakpoints
500 // 480 //
501 481
502 JvmtiBreakpoints *JvmtiCurrentBreakpoints::_jvmti_breakpoints = NULL; 482 JvmtiBreakpoints *JvmtiCurrentBreakpoints::_jvmti_breakpoints = NULL;