< prev index next >

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

Print this page
rev 8362 : [mq]: hotspot


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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/heapRegionManager.inline.hpp"
  34 #include "gc_implementation/g1/heapRegionSet.inline.hpp"

  35 #include "runtime/orderAccess.inline.hpp"
  36 #include "utilities/taskqueue.hpp"
  37 
  38 PLABStats* G1CollectedHeap::alloc_buffer_stats(InCSetState dest) {
  39   switch (dest.value()) {
  40     case InCSetState::Young:
  41       return &_survivor_plab_stats;
  42     case InCSetState::Old:
  43       return &_old_plab_stats;
  44     default:
  45       ShouldNotReachHere();
  46       return NULL; // Keep some compilers happy
  47   }
  48 }
  49 
  50 size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) {
  51   size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz();
  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);


 363 }
 364 
 365 inline void G1CollectedHeap::set_humongous_is_live(oop obj) {
 366   uint region = addr_to_region((HeapWord*)obj);
 367   // Clear the flag in the humongous_reclaim_candidates table.  Also
 368   // reset the entry in the _in_cset_fast_test table so that subsequent references
 369   // to the same humongous object do not go into the slow path again.
 370   // This is racy, as multiple threads may at the same time enter here, but this
 371   // is benign.
 372   // During collection we only ever clear the "candidate" flag, and only ever clear the
 373   // entry in the in_cset_fast_table.
 374   // We only ever evaluate the contents of these tables (in the VM thread) after
 375   // having synchronized the worker threads with the VM thread, or in the same
 376   // thread (i.e. within the VM thread).
 377   if (is_humongous_reclaim_candidate(region)) {
 378     set_humongous_reclaim_candidate(region, false);
 379     _in_cset_fast_test.clear_humongous(region);
 380   }
 381 }
 382 
 383 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTEDHEAP_INLINE_HPP


   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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_G1_G1COLLECTEDHEAP_INLINE_HPP
  26 #define SHARE_VM_GC_G1_G1COLLECTEDHEAP_INLINE_HPP
  27 
  28 #include "gc/g1/concurrentMark.hpp"
  29 #include "gc/g1/g1AllocRegion.inline.hpp"
  30 #include "gc/g1/g1CollectedHeap.hpp"
  31 #include "gc/g1/g1CollectorPolicy.hpp"
  32 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  33 #include "gc/g1/heapRegionManager.inline.hpp"
  34 #include "gc/g1/heapRegionSet.inline.hpp"
  35 #include "gc/shared/taskqueue.hpp"
  36 #include "runtime/orderAccess.inline.hpp"

  37 
  38 PLABStats* G1CollectedHeap::alloc_buffer_stats(InCSetState dest) {
  39   switch (dest.value()) {
  40     case InCSetState::Young:
  41       return &_survivor_plab_stats;
  42     case InCSetState::Old:
  43       return &_old_plab_stats;
  44     default:
  45       ShouldNotReachHere();
  46       return NULL; // Keep some compilers happy
  47   }
  48 }
  49 
  50 size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) {
  51   size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz();
  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);


 363 }
 364 
 365 inline void G1CollectedHeap::set_humongous_is_live(oop obj) {
 366   uint region = addr_to_region((HeapWord*)obj);
 367   // Clear the flag in the humongous_reclaim_candidates table.  Also
 368   // reset the entry in the _in_cset_fast_test table so that subsequent references
 369   // to the same humongous object do not go into the slow path again.
 370   // This is racy, as multiple threads may at the same time enter here, but this
 371   // is benign.
 372   // During collection we only ever clear the "candidate" flag, and only ever clear the
 373   // entry in the in_cset_fast_table.
 374   // We only ever evaluate the contents of these tables (in the VM thread) after
 375   // having synchronized the worker threads with the VM thread, or in the same
 376   // thread (i.e. within the VM thread).
 377   if (is_humongous_reclaim_candidate(region)) {
 378     set_humongous_reclaim_candidate(region, false);
 379     _in_cset_fast_test.clear_humongous(region);
 380   }
 381 }
 382 
 383 #endif // SHARE_VM_GC_G1_G1COLLECTEDHEAP_INLINE_HPP
< prev index next >