< prev index next >

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

Print this page




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




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


< prev index next >