< prev index next >

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

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


  63 #include "gc/shared/gcLocker.inline.hpp"
  64 #include "gc/shared/gcTimer.hpp"
  65 #include "gc/shared/gcTrace.hpp"
  66 #include "gc/shared/gcTraceTime.inline.hpp"
  67 #include "gc/shared/generationSpec.hpp"
  68 #include "gc/shared/isGCActiveMark.hpp"
  69 #include "gc/shared/preservedMarks.inline.hpp"
  70 #include "gc/shared/suspendibleThreadSet.hpp"
  71 #include "gc/shared/referenceProcessor.inline.hpp"
  72 #include "gc/shared/taskqueue.inline.hpp"
  73 #include "gc/shared/weakProcessor.hpp"
  74 #include "logging/log.hpp"
  75 #include "memory/allocation.hpp"
  76 #include "memory/iterator.hpp"
  77 #include "memory/resourceArea.hpp"
  78 #include "oops/oop.inline.hpp"
  79 #include "prims/resolvedMethodTable.hpp"
  80 #include "runtime/atomic.hpp"
  81 #include "runtime/init.hpp"
  82 #include "runtime/orderAccess.inline.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   JavaThread *curr = Threads::first();
2634   while (curr != NULL) {
2635     DirtyCardQueue& dcq = curr->dirty_card_queue();
2636     extra_cards += dcq.size();
2637     curr = curr->next();
2638   }
2639   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
2640   size_t buffer_size = dcqs.buffer_size();
2641   size_t buffer_num = dcqs.completed_buffers_num();
2642 
2643   return buffer_size * buffer_num + extra_cards;
2644 }
2645 
2646 class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
2647  private:
2648   size_t _total_humongous;
2649   size_t _candidate_humongous;
2650 
2651   DirtyCardQueue _dcq;
2652 
2653   // We don't nominate objects with many remembered set entries, on
2654   // the assumption that such objects are likely still live.
2655   bool is_remset_small(HeapRegion* region) const {
2656     HeapRegionRemSet* const rset = region->rem_set();
2657     return G1EagerReclaimHumongousObjectsWithStaleRefs




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


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

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

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


< prev index next >