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);
57 }
58
59 HeapWord* G1CollectedHeap::par_allocate_during_gc(InCSetState dest,
60 size_t word_size,
61 AllocationContext_t context) {
62 switch (dest.value()) {
63 case InCSetState::Young:
64 return survivor_attempt_allocation(word_size, context);
65 case InCSetState::Old:
66 return old_attempt_allocation(word_size, context);
67 default:
68 ShouldNotReachHere();
69 return NULL; // Keep some compilers happy
70 }
71 }
|
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(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 HeapWord* G1CollectedHeap::par_allocate_during_gc(InCSetState dest,
60 size_t word_size,
61 AllocationContext_t context) {
62 switch (dest.value()) {
63 case InCSetState::Young:
64 return survivor_attempt_allocation(word_size, context);
65 case InCSetState::Old:
66 return old_attempt_allocation(word_size, context);
67 default:
68 ShouldNotReachHere();
69 return NULL; // Keep some compilers happy
70 }
71 }
|