hotspot/src/share/vm/prims/jvmtiExport.cpp
changeset 7896 08aadd7aa3ee
parent 7413 59b978f8fbdf
child 7897 201a8b00ec91
equal deleted inserted replaced
7895:e71bad345f3a 7896:08aadd7aa3ee
  2356   }
  2356   }
  2357   return result;
  2357   return result;
  2358 }
  2358 }
  2359 #endif // SERVICES_KERNEL
  2359 #endif // SERVICES_KERNEL
  2360 
  2360 
  2361 // CMS has completed referencing processing so may need to update
       
  2362 // tag maps.
       
  2363 void JvmtiExport::cms_ref_processing_epilogue() {
       
  2364   if (JvmtiEnv::environments_might_exist()) {
       
  2365     JvmtiTagMap::cms_ref_processing_epilogue();
       
  2366   }
       
  2367 }
       
  2368 
       
  2369 
       
  2370 ////////////////////////////////////////////////////////////////////////////////////////////////
  2361 ////////////////////////////////////////////////////////////////////////////////////////////////
  2371 
  2362 
  2372 // Setup current current thread for event collection.
  2363 // Setup current current thread for event collection.
  2373 void JvmtiEventCollector::setup_jvmti_thread_state() {
  2364 void JvmtiEventCollector::setup_jvmti_thread_state() {
  2374   // set this event collector to be the current one.
  2365   // set this event collector to be the current one.
  2534   if (was_enabled()) {
  2525   if (was_enabled()) {
  2535     _collector->set_enabled(true);
  2526     _collector->set_enabled(true);
  2536   }
  2527   }
  2537 };
  2528 };
  2538 
  2529 
  2539 JvmtiGCMarker::JvmtiGCMarker(bool full) : _full(full), _invocation_count(0) {
  2530 JvmtiGCMarker::JvmtiGCMarker() {
  2540   assert(Thread::current()->is_VM_thread(), "wrong thread");
       
  2541 
       
  2542   // if there aren't any JVMTI environments then nothing to do
  2531   // if there aren't any JVMTI environments then nothing to do
  2543   if (!JvmtiEnv::environments_might_exist()) {
  2532   if (!JvmtiEnv::environments_might_exist()) {
  2544     return;
  2533     return;
  2545   }
  2534   }
  2546 
  2535 
  2547   if (ForceFullGCJVMTIEpilogues) {
       
  2548     // force 'Full GC' was done semantics for JVMTI GC epilogues
       
  2549     _full = true;
       
  2550   }
       
  2551 
       
  2552   // GarbageCollectionStart event posted from VM thread - okay because
       
  2553   // JVMTI is clear that the "world is stopped" and callback shouldn't
       
  2554   // try to call into the VM.
       
  2555   if (JvmtiExport::should_post_garbage_collection_start()) {
  2536   if (JvmtiExport::should_post_garbage_collection_start()) {
  2556     JvmtiExport::post_garbage_collection_start();
  2537     JvmtiExport::post_garbage_collection_start();
  2557   }
  2538   }
  2558 
  2539 
  2559   // if "full" is false it probably means this is a scavenge of the young
  2540   if (SafepointSynchronize::is_at_safepoint()) {
  2560   // generation. However it could turn out that a "full" GC is required
  2541     // Do clean up tasks that need to be done at a safepoint
  2561   // so we record the number of collections so that it can be checked in
  2542     JvmtiEnvBase::check_for_periodic_clean_up();
  2562   // the destructor.
  2543   }
  2563   if (!_full) {
       
  2564     _invocation_count = Universe::heap()->total_full_collections();
       
  2565   }
       
  2566 
       
  2567   // Do clean up tasks that need to be done at a safepoint
       
  2568   JvmtiEnvBase::check_for_periodic_clean_up();
       
  2569 }
  2544 }
  2570 
  2545 
  2571 JvmtiGCMarker::~JvmtiGCMarker() {
  2546 JvmtiGCMarker::~JvmtiGCMarker() {
  2572   // if there aren't any JVMTI environments then nothing to do
  2547   // if there aren't any JVMTI environments then nothing to do
  2573   if (!JvmtiEnv::environments_might_exist()) {
  2548   if (!JvmtiEnv::environments_might_exist()) {
  2576 
  2551 
  2577   // JVMTI notify gc finish
  2552   // JVMTI notify gc finish
  2578   if (JvmtiExport::should_post_garbage_collection_finish()) {
  2553   if (JvmtiExport::should_post_garbage_collection_finish()) {
  2579     JvmtiExport::post_garbage_collection_finish();
  2554     JvmtiExport::post_garbage_collection_finish();
  2580   }
  2555   }
  2581 
       
  2582   // we might have initially started out doing a scavenge of the young
       
  2583   // generation but could have ended up doing a "full" GC - check the
       
  2584   // GC count to see.
       
  2585   if (!_full) {
       
  2586     _full = (_invocation_count != Universe::heap()->total_full_collections());
       
  2587   }
       
  2588 
       
  2589   // Full collection probably means the perm generation has been GC'ed
       
  2590   // so we clear the breakpoint cache.
       
  2591   if (_full) {
       
  2592     JvmtiCurrentBreakpoints::gc_epilogue();
       
  2593   }
       
  2594 
       
  2595   // Notify heap/object tagging support
       
  2596   JvmtiTagMap::gc_epilogue(_full);
       
  2597 }
  2556 }
  2598 #endif // JVMTI_KERNEL
  2557 #endif // JVMTI_KERNEL