2235 }
2236 return false;
2237 }
2238 size_t result() { return _used; }
2239 };
2240
2241 size_t G1CollectedHeap::recalculate_used() const {
2242 double recalculate_used_start = os::elapsedTime();
2243
2244 SumUsedClosure blk;
2245 heap_region_iterate(&blk);
2246
2247 g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
2248 return blk.result();
2249 }
2250
2251 bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
2252 switch (cause) {
2253 case GCCause::_gc_locker: return GCLockerInvokesConcurrent;
2254 case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent;
2255 case GCCause::_g1_humongous_allocation: return true;
2256 case GCCause::_update_allocation_context_stats_inc: return true;
2257 case GCCause::_wb_conc_mark: return true;
2258 default: return false;
2259 }
2260 }
2261
2262 #ifndef PRODUCT
2263 void G1CollectedHeap::allocate_dummy_regions() {
2264 // Let's fill up most of the region
2265 size_t word_size = HeapRegion::GrainWords - 1024;
2266 // And as a result the region we'll allocate will be humongous.
2267 guarantee(is_humongous(word_size), "sanity");
2268
2269 for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) {
2270 // Let's use the existing mechanism for the allocation
2271 HeapWord* dummy_obj = humongous_obj_allocate(word_size,
2272 AllocationContext::system());
2273 if (dummy_obj != NULL) {
2274 MemRegion mr(dummy_obj, word_size);
|
2235 }
2236 return false;
2237 }
2238 size_t result() { return _used; }
2239 };
2240
2241 size_t G1CollectedHeap::recalculate_used() const {
2242 double recalculate_used_start = os::elapsedTime();
2243
2244 SumUsedClosure blk;
2245 heap_region_iterate(&blk);
2246
2247 g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
2248 return blk.result();
2249 }
2250
2251 bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
2252 switch (cause) {
2253 case GCCause::_gc_locker: return GCLockerInvokesConcurrent;
2254 case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent;
2255 case GCCause::_dcmd_gc_run: return ExplicitGCInvokesConcurrent;
2256 case GCCause::_g1_humongous_allocation: return true;
2257 case GCCause::_update_allocation_context_stats_inc: return true;
2258 case GCCause::_wb_conc_mark: return true;
2259 default: return false;
2260 }
2261 }
2262
2263 #ifndef PRODUCT
2264 void G1CollectedHeap::allocate_dummy_regions() {
2265 // Let's fill up most of the region
2266 size_t word_size = HeapRegion::GrainWords - 1024;
2267 // And as a result the region we'll allocate will be humongous.
2268 guarantee(is_humongous(word_size), "sanity");
2269
2270 for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) {
2271 // Let's use the existing mechanism for the allocation
2272 HeapWord* dummy_obj = humongous_obj_allocate(word_size,
2273 AllocationContext::system());
2274 if (dummy_obj != NULL) {
2275 MemRegion mr(dummy_obj, word_size);
|