equal
deleted
inserted
replaced
31 #include "gc/g1/heapRegion.inline.hpp" |
31 #include "gc/g1/heapRegion.inline.hpp" |
32 #include "gc/g1/heapRegionSet.inline.hpp" |
32 #include "gc/g1/heapRegionSet.inline.hpp" |
33 |
33 |
34 G1DefaultAllocator::G1DefaultAllocator(G1CollectedHeap* heap) : |
34 G1DefaultAllocator::G1DefaultAllocator(G1CollectedHeap* heap) : |
35 G1Allocator(heap), |
35 G1Allocator(heap), |
|
36 _survivor_is_full(false), |
|
37 _old_is_full(false), |
36 _retained_old_gc_alloc_region(NULL), |
38 _retained_old_gc_alloc_region(NULL), |
37 _survivor_gc_alloc_region(heap->alloc_buffer_stats(InCSetState::Young)), |
39 _survivor_gc_alloc_region(heap->alloc_buffer_stats(InCSetState::Young)), |
38 _old_gc_alloc_region(heap->alloc_buffer_stats(InCSetState::Old)) { |
40 _old_gc_alloc_region(heap->alloc_buffer_stats(InCSetState::Old)) { |
39 } |
41 } |
40 |
42 |
85 } |
87 } |
86 |
88 |
87 void G1DefaultAllocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) { |
89 void G1DefaultAllocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) { |
88 assert_at_safepoint(true /* should_be_vm_thread */); |
90 assert_at_safepoint(true /* should_be_vm_thread */); |
89 |
91 |
90 G1Allocator::init_gc_alloc_regions(evacuation_info); |
92 _survivor_is_full = false; |
|
93 _old_is_full = false; |
91 |
94 |
92 _survivor_gc_alloc_region.init(); |
95 _survivor_gc_alloc_region.init(); |
93 _old_gc_alloc_region.init(); |
96 _old_gc_alloc_region.init(); |
94 reuse_retained_old_region(evacuation_info, |
97 reuse_retained_old_region(evacuation_info, |
95 &_old_gc_alloc_region, |
98 &_old_gc_alloc_region, |
116 assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); |
119 assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); |
117 assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); |
120 assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition"); |
118 _retained_old_gc_alloc_region = NULL; |
121 _retained_old_gc_alloc_region = NULL; |
119 } |
122 } |
120 |
123 |
|
124 bool G1DefaultAllocator::survivor_is_full(AllocationContext_t context) const { |
|
125 return _survivor_is_full; |
|
126 } |
|
127 |
|
128 bool G1DefaultAllocator::old_is_full(AllocationContext_t context) const { |
|
129 return _old_is_full; |
|
130 } |
|
131 |
|
132 void G1DefaultAllocator::set_survivor_full(AllocationContext_t context) { |
|
133 _survivor_is_full = true; |
|
134 } |
|
135 |
|
136 void G1DefaultAllocator::set_old_full(AllocationContext_t context) { |
|
137 _old_is_full = true; |
|
138 } |
|
139 |
121 G1PLAB::G1PLAB(size_t gclab_word_size) : |
140 G1PLAB::G1PLAB(size_t gclab_word_size) : |
122 PLAB(gclab_word_size), _retired(true) { } |
141 PLAB(gclab_word_size), _retired(true) { } |
123 |
142 |
124 size_t G1Allocator::unsafe_max_tlab_alloc(AllocationContext_t context) { |
143 size_t G1Allocator::unsafe_max_tlab_alloc(AllocationContext_t context) { |
125 // Return the remaining space in the cur alloc region, but not less than |
144 // Return the remaining space in the cur alloc region, but not less than |
163 ShouldNotReachHere(); |
182 ShouldNotReachHere(); |
164 return NULL; // Keep some compilers happy |
183 return NULL; // Keep some compilers happy |
165 } |
184 } |
166 } |
185 } |
167 |
186 |
168 bool G1Allocator::survivor_is_full(AllocationContext_t context) const { |
|
169 return _survivor_is_full; |
|
170 } |
|
171 |
|
172 bool G1Allocator::old_is_full(AllocationContext_t context) const { |
|
173 return _old_is_full; |
|
174 } |
|
175 |
|
176 void G1Allocator::set_survivor_full(AllocationContext_t context) { |
|
177 _survivor_is_full = true; |
|
178 } |
|
179 |
|
180 void G1Allocator::set_old_full(AllocationContext_t context) { |
|
181 _old_is_full = true; |
|
182 } |
|
183 |
|
184 HeapWord* G1Allocator::survivor_attempt_allocation(size_t min_word_size, |
187 HeapWord* G1Allocator::survivor_attempt_allocation(size_t min_word_size, |
185 size_t desired_word_size, |
188 size_t desired_word_size, |
186 size_t* actual_word_size, |
189 size_t* actual_word_size, |
187 AllocationContext_t context) { |
190 AllocationContext_t context) { |
188 assert(!_g1h->is_humongous(desired_word_size), |
191 assert(!_g1h->is_humongous(desired_word_size), |
228 if (result == NULL) { |
231 if (result == NULL) { |
229 set_old_full(context); |
232 set_old_full(context); |
230 } |
233 } |
231 } |
234 } |
232 return result; |
235 return result; |
233 } |
|
234 |
|
235 void G1Allocator::init_gc_alloc_regions(EvacuationInfo& evacuation_info) { |
|
236 _survivor_is_full = false; |
|
237 _old_is_full = false; |
|
238 } |
236 } |
239 |
237 |
240 G1PLABAllocator::G1PLABAllocator(G1Allocator* allocator) : |
238 G1PLABAllocator::G1PLABAllocator(G1Allocator* allocator) : |
241 _g1h(G1CollectedHeap::heap()), |
239 _g1h(G1CollectedHeap::heap()), |
242 _allocator(allocator), |
240 _allocator(allocator), |