1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Wed Mar 25 15:50:17 2015 +0100 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Fri Dec 19 09:21:06 2014 +0100 1.3 @@ -35,6 +35,41 @@ 1.4 #include "runtime/orderAccess.inline.hpp" 1.5 #include "utilities/taskqueue.hpp" 1.6 1.7 +PLABStats* G1CollectedHeap::alloc_buffer_stats(InCSetState dest) { 1.8 + switch (dest.value()) { 1.9 + case InCSetState::Young: 1.10 + return &_survivor_plab_stats; 1.11 + case InCSetState::Old: 1.12 + return &_old_plab_stats; 1.13 + default: 1.14 + ShouldNotReachHere(); 1.15 + return NULL; // Keep some compilers happy 1.16 + } 1.17 +} 1.18 + 1.19 +size_t G1CollectedHeap::desired_plab_sz(InCSetState dest) { 1.20 + size_t gclab_word_size = alloc_buffer_stats(dest)->desired_plab_sz(); 1.21 + // Prevent humongous PLAB sizes for two reasons: 1.22 + // * PLABs are allocated using a similar paths as oops, but should 1.23 + // never be in a humongous region 1.24 + // * Allowing humongous PLABs needlessly churns the region free lists 1.25 + return MIN2(_humongous_object_threshold_in_words, gclab_word_size); 1.26 +} 1.27 + 1.28 +HeapWord* G1CollectedHeap::par_allocate_during_gc(InCSetState dest, 1.29 + size_t word_size, 1.30 + AllocationContext_t context) { 1.31 + switch (dest.value()) { 1.32 + case InCSetState::Young: 1.33 + return survivor_attempt_allocation(word_size, context); 1.34 + case InCSetState::Old: 1.35 + return old_attempt_allocation(word_size, context); 1.36 + default: 1.37 + ShouldNotReachHere(); 1.38 + return NULL; // Keep some compilers happy 1.39 + } 1.40 +} 1.41 + 1.42 // Inline functions for G1CollectedHeap 1.43 1.44 inline AllocationContextStats& G1CollectedHeap::allocation_context_stats() { 1.45 @@ -203,7 +238,7 @@ 1.46 return _in_cset_fast_test.is_in_cset_or_humongous((HeapWord*)obj); 1.47 } 1.48 1.49 -G1CollectedHeap::in_cset_state_t G1CollectedHeap::in_cset_state(const oop obj) { 1.50 +InCSetState G1CollectedHeap::in_cset_state(const oop obj) { 1.51 return _in_cset_fast_test.at((HeapWord*)obj); 1.52 } 1.53