< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp

Print this page
rev 52611 : webrev.00
rev 52613 : webrev.01


  43       ShouldNotReachHere();
  44       return NULL; // Keep some compilers happy
  45   }
  46 }
  47 
  48 size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) {
  49   size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz(workers()->active_workers());
  50   // Prevent humongous PLAB sizes for two reasons:
  51   // * PLABs are allocated using a similar paths as oops, but should
  52   //   never be in a humongous region
  53   // * Allowing humongous PLABs needlessly churns the region free lists
  54   return MIN2(_humongous_object_threshold_in_words, gclab_word_size);
  55 }
  56 
  57 // Inline functions for G1CollectedHeap
  58 
  59 // Return the region with the given index. It assumes the index is valid.
  60 inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm->at(index); }
  61 
  62 // Return the region with the given index, or NULL if unmapped. It assumes the index is valid.
  63 inline HeapRegion* G1CollectedHeap::region_at_or_null(uint index) const { return _hrm.at_or_null(index); }
  64 
  65 inline HeapRegion* G1CollectedHeap::next_region_in_humongous(HeapRegion* hr) const {
  66   return _hrm->next_region_in_humongous(hr);
  67 }
  68 
  69 inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
  70   assert(is_in_reserved(addr),
  71          "Cannot calculate region index for address " PTR_FORMAT " that is outside of the heap [" PTR_FORMAT ", " PTR_FORMAT ")",
  72          p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end()));
  73   return (uint)(pointer_delta(addr, reserved_region().start(), sizeof(uint8_t)) >> HeapRegion::LogOfHRGrainBytes);
  74 }
  75 
  76 inline HeapWord* G1CollectedHeap::bottom_addr_for_region(uint index) const {
  77   return _hrm->reserved().start() + index * HeapRegion::GrainWords;
  78 }
  79 
  80 template <class T>
  81 inline HeapRegion* G1CollectedHeap::heap_region_containing(const T addr) const {
  82   assert(addr != NULL, "invariant");
  83   assert(is_in_g1_reserved((const void*) addr),




  43       ShouldNotReachHere();
  44       return NULL; // Keep some compilers happy
  45   }
  46 }
  47 
  48 size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) {
  49   size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz(workers()->active_workers());
  50   // Prevent humongous PLAB sizes for two reasons:
  51   // * PLABs are allocated using a similar paths as oops, but should
  52   //   never be in a humongous region
  53   // * Allowing humongous PLABs needlessly churns the region free lists
  54   return MIN2(_humongous_object_threshold_in_words, gclab_word_size);
  55 }
  56 
  57 // Inline functions for G1CollectedHeap
  58 
  59 // Return the region with the given index. It assumes the index is valid.
  60 inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm->at(index); }
  61 
  62 // Return the region with the given index, or NULL if unmapped. It assumes the index is valid.
  63 inline HeapRegion* G1CollectedHeap::region_at_or_null(uint index) const { return _hrm->at_or_null(index); }
  64 
  65 inline HeapRegion* G1CollectedHeap::next_region_in_humongous(HeapRegion* hr) const {
  66   return _hrm->next_region_in_humongous(hr);
  67 }
  68 
  69 inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
  70   assert(is_in_reserved(addr),
  71          "Cannot calculate region index for address " PTR_FORMAT " that is outside of the heap [" PTR_FORMAT ", " PTR_FORMAT ")",
  72          p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end()));
  73   return (uint)(pointer_delta(addr, reserved_region().start(), sizeof(uint8_t)) >> HeapRegion::LogOfHRGrainBytes);
  74 }
  75 
  76 inline HeapWord* G1CollectedHeap::bottom_addr_for_region(uint index) const {
  77   return _hrm->reserved().start() + index * HeapRegion::GrainWords;
  78 }
  79 
  80 template <class T>
  81 inline HeapRegion* G1CollectedHeap::heap_region_containing(const T addr) const {
  82   assert(addr != NULL, "invariant");
  83   assert(is_in_g1_reserved((const void*) addr),


< prev index next >