32 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
32 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
33 #include "gc_implementation/g1/heapRegionManager.inline.hpp" |
33 #include "gc_implementation/g1/heapRegionManager.inline.hpp" |
34 #include "gc_implementation/g1/heapRegionSet.inline.hpp" |
34 #include "gc_implementation/g1/heapRegionSet.inline.hpp" |
35 #include "runtime/orderAccess.inline.hpp" |
35 #include "runtime/orderAccess.inline.hpp" |
36 #include "utilities/taskqueue.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 } |
37 |
72 |
38 // Inline functions for G1CollectedHeap |
73 // Inline functions for G1CollectedHeap |
39 |
74 |
40 inline AllocationContextStats& G1CollectedHeap::allocation_context_stats() { |
75 inline AllocationContextStats& G1CollectedHeap::allocation_context_stats() { |
41 return _allocation_context_stats; |
76 return _allocation_context_stats; |
201 |
236 |
202 bool G1CollectedHeap::is_in_cset_or_humongous(const oop obj) { |
237 bool G1CollectedHeap::is_in_cset_or_humongous(const oop obj) { |
203 return _in_cset_fast_test.is_in_cset_or_humongous((HeapWord*)obj); |
238 return _in_cset_fast_test.is_in_cset_or_humongous((HeapWord*)obj); |
204 } |
239 } |
205 |
240 |
206 G1CollectedHeap::in_cset_state_t G1CollectedHeap::in_cset_state(const oop obj) { |
241 InCSetState G1CollectedHeap::in_cset_state(const oop obj) { |
207 return _in_cset_fast_test.at((HeapWord*)obj); |
242 return _in_cset_fast_test.at((HeapWord*)obj); |
208 } |
243 } |
209 |
244 |
210 void G1CollectedHeap::register_humongous_region_with_in_cset_fast_test(uint index) { |
245 void G1CollectedHeap::register_humongous_region_with_in_cset_fast_test(uint index) { |
211 _in_cset_fast_test.set_humongous(index); |
246 _in_cset_fast_test.set_humongous(index); |