< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page
rev 47287 : Port 09.17.Thread_SMR_logging_update from JDK9 to JDK10
rev 47289 : eosterlund, stefank CR - refactor code into threadSMR.cpp and threadSMR.hpp
rev 47292 : stefank, coleenp CR - refactor most JavaThreadIterator usage to use JavaThreadIteratorWithHandle.


  62 #include "gc/shared/gcHeapSummary.hpp"
  63 #include "gc/shared/gcId.hpp"
  64 #include "gc/shared/gcLocker.inline.hpp"
  65 #include "gc/shared/gcTimer.hpp"
  66 #include "gc/shared/gcTrace.hpp"
  67 #include "gc/shared/gcTraceTime.inline.hpp"
  68 #include "gc/shared/generationSpec.hpp"
  69 #include "gc/shared/isGCActiveMark.hpp"
  70 #include "gc/shared/preservedMarks.inline.hpp"
  71 #include "gc/shared/referenceProcessor.inline.hpp"
  72 #include "gc/shared/taskqueue.inline.hpp"
  73 #include "logging/log.hpp"
  74 #include "memory/allocation.hpp"
  75 #include "memory/iterator.hpp"
  76 #include "memory/resourceArea.hpp"
  77 #include "oops/oop.inline.hpp"
  78 #include "prims/resolvedMethodTable.hpp"
  79 #include "runtime/atomic.hpp"
  80 #include "runtime/init.hpp"
  81 #include "runtime/orderAccess.inline.hpp"

  82 #include "runtime/vmThread.hpp"
  83 #include "utilities/align.hpp"
  84 #include "utilities/globalDefinitions.hpp"
  85 #include "utilities/stack.inline.hpp"
  86 
  87 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
  88 
  89 // INVARIANTS/NOTES
  90 //
  91 // All allocation activity covered by the G1CollectedHeap interface is
  92 // serialized by acquiring the HeapLock.  This happens in mem_allocate
  93 // and allocate_new_tlab, which are the "entry" points to the
  94 // allocation code from the rest of the JVM.  (Note that this does not
  95 // apply to TLAB allocation, which is not part of this interface: it
  96 // is done by clients of this interface.)
  97 
  98 class RedirtyLoggedCardTableEntryClosure : public CardTableEntryClosure {
  99  private:
 100   size_t _num_dirtied;
 101   G1CollectedHeap* _g1h;


2612   bool ret_succeeded = op.prologue_succeeded() && op.pause_succeeded();
2613   assert(result == NULL || ret_succeeded,
2614          "the result should be NULL if the VM did not succeed");
2615   *succeeded = ret_succeeded;
2616 
2617   assert_heap_not_locked();
2618   return result;
2619 }
2620 
2621 void
2622 G1CollectedHeap::doConcurrentMark() {
2623   MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
2624   if (!_cmThread->in_progress()) {
2625     _cmThread->set_started();
2626     CGC_lock->notify();
2627   }
2628 }
2629 
2630 size_t G1CollectedHeap::pending_card_num() {
2631   size_t extra_cards = 0;
2632   JavaThread *curr = Threads::first();
2633   while (curr != NULL) {
2634     DirtyCardQueue& dcq = curr->dirty_card_queue();
2635     extra_cards += dcq.size();
2636     curr = curr->next();
2637   }
2638   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
2639   size_t buffer_size = dcqs.buffer_size();
2640   size_t buffer_num = dcqs.completed_buffers_num();
2641 
2642   return buffer_size * buffer_num + extra_cards;
2643 }
2644 
2645 class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
2646  private:
2647   size_t _total_humongous;
2648   size_t _candidate_humongous;
2649 
2650   DirtyCardQueue _dcq;
2651 
2652   // We don't nominate objects with many remembered set entries, on
2653   // the assumption that such objects are likely still live.
2654   bool is_remset_small(HeapRegion* region) const {
2655     HeapRegionRemSet* const rset = region->rem_set();
2656     return G1EagerReclaimHumongousObjectsWithStaleRefs




  62 #include "gc/shared/gcHeapSummary.hpp"
  63 #include "gc/shared/gcId.hpp"
  64 #include "gc/shared/gcLocker.inline.hpp"
  65 #include "gc/shared/gcTimer.hpp"
  66 #include "gc/shared/gcTrace.hpp"
  67 #include "gc/shared/gcTraceTime.inline.hpp"
  68 #include "gc/shared/generationSpec.hpp"
  69 #include "gc/shared/isGCActiveMark.hpp"
  70 #include "gc/shared/preservedMarks.inline.hpp"
  71 #include "gc/shared/referenceProcessor.inline.hpp"
  72 #include "gc/shared/taskqueue.inline.hpp"
  73 #include "logging/log.hpp"
  74 #include "memory/allocation.hpp"
  75 #include "memory/iterator.hpp"
  76 #include "memory/resourceArea.hpp"
  77 #include "oops/oop.inline.hpp"
  78 #include "prims/resolvedMethodTable.hpp"
  79 #include "runtime/atomic.hpp"
  80 #include "runtime/init.hpp"
  81 #include "runtime/orderAccess.inline.hpp"
  82 #include "runtime/threadSMR.hpp"
  83 #include "runtime/vmThread.hpp"
  84 #include "utilities/align.hpp"
  85 #include "utilities/globalDefinitions.hpp"
  86 #include "utilities/stack.inline.hpp"
  87 
  88 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
  89 
  90 // INVARIANTS/NOTES
  91 //
  92 // All allocation activity covered by the G1CollectedHeap interface is
  93 // serialized by acquiring the HeapLock.  This happens in mem_allocate
  94 // and allocate_new_tlab, which are the "entry" points to the
  95 // allocation code from the rest of the JVM.  (Note that this does not
  96 // apply to TLAB allocation, which is not part of this interface: it
  97 // is done by clients of this interface.)
  98 
  99 class RedirtyLoggedCardTableEntryClosure : public CardTableEntryClosure {
 100  private:
 101   size_t _num_dirtied;
 102   G1CollectedHeap* _g1h;


2613   bool ret_succeeded = op.prologue_succeeded() && op.pause_succeeded();
2614   assert(result == NULL || ret_succeeded,
2615          "the result should be NULL if the VM did not succeed");
2616   *succeeded = ret_succeeded;
2617 
2618   assert_heap_not_locked();
2619   return result;
2620 }
2621 
2622 void
2623 G1CollectedHeap::doConcurrentMark() {
2624   MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
2625   if (!_cmThread->in_progress()) {
2626     _cmThread->set_started();
2627     CGC_lock->notify();
2628   }
2629 }
2630 
2631 size_t G1CollectedHeap::pending_card_num() {
2632   size_t extra_cards = 0;
2633   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *curr = jtiwh.next(); ) {

2634     DirtyCardQueue& dcq = curr->dirty_card_queue();
2635     extra_cards += dcq.size();

2636   }
2637   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
2638   size_t buffer_size = dcqs.buffer_size();
2639   size_t buffer_num = dcqs.completed_buffers_num();
2640 
2641   return buffer_size * buffer_num + extra_cards;
2642 }
2643 
2644 class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
2645  private:
2646   size_t _total_humongous;
2647   size_t _candidate_humongous;
2648 
2649   DirtyCardQueue _dcq;
2650 
2651   // We don't nominate objects with many remembered set entries, on
2652   // the assumption that such objects are likely still live.
2653   bool is_remset_small(HeapRegion* region) const {
2654     HeapRegionRemSet* const rset = region->rem_set();
2655     return G1EagerReclaimHumongousObjectsWithStaleRefs


< prev index next >