src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp

Print this page
rev 5363 : imported patch filtering.diff


  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  27 
  28 #include "gc_implementation/g1/concurrentMark.hpp"
  29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
  30 #include "gc_implementation/g1/g1AllocRegion.inline.hpp"
  31 #include "gc_implementation/g1/g1CollectorPolicy.hpp"

  32 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
  33 #include "utilities/taskqueue.hpp"
  34 
  35 // Inline functions for G1CollectedHeap
  36 
  37 template <class T>
  38 inline HeapRegion*
  39 G1CollectedHeap::heap_region_containing(const T addr) const {
  40   HeapRegion* hr = _hrs.addr_to_region((HeapWord*) addr);
  41   // hr can be null if addr in perm_gen
  42   if (hr != NULL && hr->continuesHumongous()) {
  43     hr = hr->humongous_start_region();
  44   }
  45   return hr;
  46 }
  47 
  48 template <class T>
  49 inline HeapRegion*
  50 G1CollectedHeap::heap_region_containing_raw(const T addr) const {
  51   assert(_g1_reserved.contains((const void*) addr), "invariant");


 117 // block. It is assumed (and in fact we assert) that the block
 118 // belongs to a young region.
 119 inline void
 120 G1CollectedHeap::dirty_young_block(HeapWord* start, size_t word_size) {
 121   assert_heap_not_locked();
 122 
 123   // Assign the containing region to containing_hr so that we don't
 124   // have to keep calling heap_region_containing_raw() in the
 125   // asserts below.
 126   DEBUG_ONLY(HeapRegion* containing_hr = heap_region_containing_raw(start);)
 127   assert(containing_hr != NULL && start != NULL && word_size > 0,
 128          "pre-condition");
 129   assert(containing_hr->is_in(start), "it should contain start");
 130   assert(containing_hr->is_young(), "it should be young");
 131   assert(!containing_hr->isHumongous(), "it should not be humongous");
 132 
 133   HeapWord* end = start + word_size;
 134   assert(containing_hr->is_in(end - 1), "it should also contain end - 1");
 135 
 136   MemRegion mr(start, end);
 137   g1_barrier_set()->dirty(mr);
 138 }
 139 
 140 inline RefToScanQueue* G1CollectedHeap::task_queue(int i) const {
 141   return _task_queues->queue(i);
 142 }
 143 
 144 inline bool G1CollectedHeap::isMarkedPrev(oop obj) const {
 145   return _cm->prevMarkBitMap()->isMarked((HeapWord *)obj);
 146 }
 147 
 148 inline bool G1CollectedHeap::isMarkedNext(oop obj) const {
 149   return _cm->nextMarkBitMap()->isMarked((HeapWord *)obj);
 150 }
 151 
 152 #ifndef PRODUCT
 153 // Support for G1EvacuationFailureALot
 154 
 155 inline bool
 156 G1CollectedHeap::evacuation_failure_alot_for_gc_type(bool gcs_are_young,
 157                                                      bool during_initial_mark,




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP
  27 
  28 #include "gc_implementation/g1/concurrentMark.hpp"
  29 #include "gc_implementation/g1/g1CollectedHeap.hpp"
  30 #include "gc_implementation/g1/g1AllocRegion.inline.hpp"
  31 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  32 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
  33 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
  34 #include "utilities/taskqueue.hpp"
  35 
  36 // Inline functions for G1CollectedHeap
  37 
  38 template <class T>
  39 inline HeapRegion*
  40 G1CollectedHeap::heap_region_containing(const T addr) const {
  41   HeapRegion* hr = _hrs.addr_to_region((HeapWord*) addr);
  42   // hr can be null if addr in perm_gen
  43   if (hr != NULL && hr->continuesHumongous()) {
  44     hr = hr->humongous_start_region();
  45   }
  46   return hr;
  47 }
  48 
  49 template <class T>
  50 inline HeapRegion*
  51 G1CollectedHeap::heap_region_containing_raw(const T addr) const {
  52   assert(_g1_reserved.contains((const void*) addr), "invariant");


 118 // block. It is assumed (and in fact we assert) that the block
 119 // belongs to a young region.
 120 inline void
 121 G1CollectedHeap::dirty_young_block(HeapWord* start, size_t word_size) {
 122   assert_heap_not_locked();
 123 
 124   // Assign the containing region to containing_hr so that we don't
 125   // have to keep calling heap_region_containing_raw() in the
 126   // asserts below.
 127   DEBUG_ONLY(HeapRegion* containing_hr = heap_region_containing_raw(start);)
 128   assert(containing_hr != NULL && start != NULL && word_size > 0,
 129          "pre-condition");
 130   assert(containing_hr->is_in(start), "it should contain start");
 131   assert(containing_hr->is_young(), "it should be young");
 132   assert(!containing_hr->isHumongous(), "it should not be humongous");
 133 
 134   HeapWord* end = start + word_size;
 135   assert(containing_hr->is_in(end - 1), "it should also contain end - 1");
 136 
 137   MemRegion mr(start, end);
 138   g1_barrier_set()->g1_mark_as_young(mr);
 139 }
 140 
 141 inline RefToScanQueue* G1CollectedHeap::task_queue(int i) const {
 142   return _task_queues->queue(i);
 143 }
 144 
 145 inline bool G1CollectedHeap::isMarkedPrev(oop obj) const {
 146   return _cm->prevMarkBitMap()->isMarked((HeapWord *)obj);
 147 }
 148 
 149 inline bool G1CollectedHeap::isMarkedNext(oop obj) const {
 150   return _cm->nextMarkBitMap()->isMarked((HeapWord *)obj);
 151 }
 152 
 153 #ifndef PRODUCT
 154 // Support for G1EvacuationFailureALot
 155 
 156 inline bool
 157 G1CollectedHeap::evacuation_failure_alot_for_gc_type(bool gcs_are_young,
 158                                                      bool during_initial_mark,