686 // but I guess this logging could say "old" or something instead of "1". |
686 // but I guess this logging could say "old" or something instead of "1". |
687 assert(gch->is_old_gen(this), |
687 assert(gch->is_old_gen(this), |
688 "The CMS generation should be the old generation"); |
688 "The CMS generation should be the old generation"); |
689 uint level = 1; |
689 uint level = 1; |
690 if (Verbose) { |
690 if (Verbose) { |
691 gclog_or_tty->print("[%u %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]", |
691 gclog_or_tty->print("[%u %s-%s: " SIZE_FORMAT "(" SIZE_FORMAT ")]", |
692 level, short_name(), s, used(), capacity()); |
692 level, short_name(), s, used(), capacity()); |
693 } else { |
693 } else { |
694 gclog_or_tty->print("[%u %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]", |
694 gclog_or_tty->print("[%u %s-%s: " SIZE_FORMAT "K(" SIZE_FORMAT "K)]", |
695 level, short_name(), s, used() / K, capacity() / K); |
695 level, short_name(), s, used() / K, capacity() / K); |
696 } |
696 } |
697 } |
697 } |
698 if (Verbose) { |
698 if (Verbose) { |
699 gclog_or_tty->print(" "SIZE_FORMAT"("SIZE_FORMAT")", |
699 gclog_or_tty->print(" " SIZE_FORMAT "(" SIZE_FORMAT ")", |
700 gch->used(), gch->capacity()); |
700 gch->used(), gch->capacity()); |
701 } else { |
701 } else { |
702 gclog_or_tty->print(" "SIZE_FORMAT"K("SIZE_FORMAT"K)", |
702 gclog_or_tty->print(" " SIZE_FORMAT "K(" SIZE_FORMAT "K)", |
703 gch->used() / K, gch->capacity() / K); |
703 gch->used() / K, gch->capacity() / K); |
704 } |
704 } |
705 } |
705 } |
706 |
706 |
707 size_t |
707 size_t |
727 size_t available = max_available(); |
727 size_t available = max_available(); |
728 size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average(); |
728 size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average(); |
729 bool res = (available >= av_promo) || (available >= max_promotion_in_bytes); |
729 bool res = (available >= av_promo) || (available >= max_promotion_in_bytes); |
730 if (Verbose && PrintGCDetails) { |
730 if (Verbose && PrintGCDetails) { |
731 gclog_or_tty->print_cr( |
731 gclog_or_tty->print_cr( |
732 "CMS: promo attempt is%s safe: available("SIZE_FORMAT") %s av_promo("SIZE_FORMAT")," |
732 "CMS: promo attempt is%s safe: available(" SIZE_FORMAT ") %s av_promo(" SIZE_FORMAT ")," |
733 "max_promo("SIZE_FORMAT")", |
733 "max_promo(" SIZE_FORMAT ")", |
734 res? "":" not", available, res? ">=":"<", |
734 res? "":" not", available, res? ">=":"<", |
735 av_promo, max_promotion_in_bytes); |
735 av_promo, max_promotion_in_bytes); |
736 } |
736 } |
737 return res; |
737 return res; |
738 } |
738 } |
803 gclog_or_tty->print_cr(" Free fraction %f", free_percentage); |
803 gclog_or_tty->print_cr(" Free fraction %f", free_percentage); |
804 gclog_or_tty->print_cr(" Desired free fraction %f", |
804 gclog_or_tty->print_cr(" Desired free fraction %f", |
805 desired_free_percentage); |
805 desired_free_percentage); |
806 gclog_or_tty->print_cr(" Maximum free fraction %f", |
806 gclog_or_tty->print_cr(" Maximum free fraction %f", |
807 maximum_free_percentage); |
807 maximum_free_percentage); |
808 gclog_or_tty->print_cr(" Capacity "SIZE_FORMAT, capacity()/1000); |
808 gclog_or_tty->print_cr(" Capacity " SIZE_FORMAT, capacity()/1000); |
809 gclog_or_tty->print_cr(" Desired capacity "SIZE_FORMAT, |
809 gclog_or_tty->print_cr(" Desired capacity " SIZE_FORMAT, |
810 desired_capacity/1000); |
810 desired_capacity/1000); |
811 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
811 GenCollectedHeap* gch = GenCollectedHeap::heap(); |
812 assert(gch->is_old_gen(this), "The CMS generation should always be the old generation"); |
812 assert(gch->is_old_gen(this), "The CMS generation should always be the old generation"); |
813 size_t young_size = gch->young_gen()->capacity(); |
813 size_t young_size = gch->young_gen()->capacity(); |
814 gclog_or_tty->print_cr(" Young gen size " SIZE_FORMAT, young_size / 1000); |
814 gclog_or_tty->print_cr(" Young gen size " SIZE_FORMAT, young_size / 1000); |
815 gclog_or_tty->print_cr(" unsafe_max_alloc_nogc "SIZE_FORMAT, |
815 gclog_or_tty->print_cr(" unsafe_max_alloc_nogc " SIZE_FORMAT, |
816 unsafe_max_alloc_nogc()/1000); |
816 unsafe_max_alloc_nogc()/1000); |
817 gclog_or_tty->print_cr(" contiguous available "SIZE_FORMAT, |
817 gclog_or_tty->print_cr(" contiguous available " SIZE_FORMAT, |
818 contiguous_available()/1000); |
818 contiguous_available()/1000); |
819 gclog_or_tty->print_cr(" Expand by "SIZE_FORMAT" (bytes)", |
819 gclog_or_tty->print_cr(" Expand by " SIZE_FORMAT " (bytes)", |
820 expand_bytes); |
820 expand_bytes); |
821 } |
821 } |
822 // safe if expansion fails |
822 // safe if expansion fails |
823 expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio); |
823 expand_for_gc_cause(expand_bytes, 0, CMSExpansionCause::_satisfy_free_ratio); |
824 if (PrintGCDetails && Verbose) { |
824 if (PrintGCDetails && Verbose) { |
1180 gclog_or_tty->stamp(); |
1180 gclog_or_tty->stamp(); |
1181 gclog_or_tty->cr(); |
1181 gclog_or_tty->cr(); |
1182 stats().print_on(gclog_or_tty); |
1182 stats().print_on(gclog_or_tty); |
1183 gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f", |
1183 gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f", |
1184 stats().time_until_cms_gen_full()); |
1184 stats().time_until_cms_gen_full()); |
1185 gclog_or_tty->print_cr("free="SIZE_FORMAT, _cmsGen->free()); |
1185 gclog_or_tty->print_cr("free=" SIZE_FORMAT, _cmsGen->free()); |
1186 gclog_or_tty->print_cr("contiguous_available="SIZE_FORMAT, |
1186 gclog_or_tty->print_cr("contiguous_available=" SIZE_FORMAT, |
1187 _cmsGen->contiguous_available()); |
1187 _cmsGen->contiguous_available()); |
1188 gclog_or_tty->print_cr("promotion_rate=%g", stats().promotion_rate()); |
1188 gclog_or_tty->print_cr("promotion_rate=%g", stats().promotion_rate()); |
1189 gclog_or_tty->print_cr("cms_allocation_rate=%g", stats().cms_allocation_rate()); |
1189 gclog_or_tty->print_cr("cms_allocation_rate=%g", stats().cms_allocation_rate()); |
1190 gclog_or_tty->print_cr("occupancy=%3.7f", _cmsGen->occupancy()); |
1190 gclog_or_tty->print_cr("occupancy=%3.7f", _cmsGen->occupancy()); |
1191 gclog_or_tty->print_cr("initiatingOccupancy=%3.7f", _cmsGen->initiating_occupancy()); |
1191 gclog_or_tty->print_cr("initiatingOccupancy=%3.7f", _cmsGen->initiating_occupancy()); |
2158 // Clear stat counters |
2158 // Clear stat counters |
2159 NOT_PRODUCT( |
2159 NOT_PRODUCT( |
2160 assert(_numObjectsPromoted == 0, "check"); |
2160 assert(_numObjectsPromoted == 0, "check"); |
2161 assert(_numWordsPromoted == 0, "check"); |
2161 assert(_numWordsPromoted == 0, "check"); |
2162 if (Verbose && PrintGC) { |
2162 if (Verbose && PrintGC) { |
2163 gclog_or_tty->print("Allocated "SIZE_FORMAT" objects, " |
2163 gclog_or_tty->print("Allocated " SIZE_FORMAT " objects, " |
2164 SIZE_FORMAT" bytes concurrently", |
2164 SIZE_FORMAT " bytes concurrently", |
2165 _numObjectsAllocated, _numWordsAllocated*sizeof(HeapWord)); |
2165 _numObjectsAllocated, _numWordsAllocated*sizeof(HeapWord)); |
2166 } |
2166 } |
2167 _numObjectsAllocated = 0; |
2167 _numObjectsAllocated = 0; |
2168 _numWordsAllocated = 0; |
2168 _numWordsAllocated = 0; |
2169 ) |
2169 ) |
2239 // Print stat counters |
2239 // Print stat counters |
2240 NOT_PRODUCT( |
2240 NOT_PRODUCT( |
2241 assert(_numObjectsAllocated == 0, "check"); |
2241 assert(_numObjectsAllocated == 0, "check"); |
2242 assert(_numWordsAllocated == 0, "check"); |
2242 assert(_numWordsAllocated == 0, "check"); |
2243 if (Verbose && PrintGC) { |
2243 if (Verbose && PrintGC) { |
2244 gclog_or_tty->print("Promoted "SIZE_FORMAT" objects, " |
2244 gclog_or_tty->print("Promoted " SIZE_FORMAT " objects, " |
2245 SIZE_FORMAT" bytes", |
2245 SIZE_FORMAT " bytes", |
2246 _numObjectsPromoted, _numWordsPromoted*sizeof(HeapWord)); |
2246 _numObjectsPromoted, _numWordsPromoted*sizeof(HeapWord)); |
2247 } |
2247 } |
2248 _numObjectsPromoted = 0; |
2248 _numObjectsPromoted = 0; |
2249 _numWordsPromoted = 0; |
2249 _numWordsPromoted = 0; |
2250 ) |
2250 ) |
2251 |
2251 |
2252 if (PrintGC && Verbose) { |
2252 if (PrintGC && Verbose) { |
2253 // Call down the chain in contiguous_available needs the freelistLock |
2253 // Call down the chain in contiguous_available needs the freelistLock |
2254 // so print this out before releasing the freeListLock. |
2254 // so print this out before releasing the freeListLock. |
2255 gclog_or_tty->print(" Contiguous available "SIZE_FORMAT" bytes ", |
2255 gclog_or_tty->print(" Contiguous available " SIZE_FORMAT " bytes ", |
2256 contiguous_available()); |
2256 contiguous_available()); |
2257 } |
2257 } |
2258 } |
2258 } |
2259 |
2259 |
2260 #ifndef PRODUCT |
2260 #ifndef PRODUCT |
4267 |
4267 |
4268 verify_work_stacks_empty(); |
4268 verify_work_stacks_empty(); |
4269 verify_overflow_empty(); |
4269 verify_overflow_empty(); |
4270 |
4270 |
4271 if (PrintGCDetails) { |
4271 if (PrintGCDetails) { |
4272 gclog_or_tty->print("[YG occupancy: "SIZE_FORMAT" K ("SIZE_FORMAT" K)]", |
4272 gclog_or_tty->print("[YG occupancy: " SIZE_FORMAT " K (" SIZE_FORMAT " K)]", |
4273 _young_gen->used() / K, |
4273 _young_gen->used() / K, |
4274 _young_gen->capacity() / K); |
4274 _young_gen->capacity() / K); |
4275 } |
4275 } |
4276 { |
4276 { |
4277 if (CMSScavengeBeforeRemark) { |
4277 if (CMSScavengeBeforeRemark) { |
4379 size_t ser_ovflw = _ser_pmc_remark_ovflw + _ser_pmc_preclean_ovflw + |
4379 size_t ser_ovflw = _ser_pmc_remark_ovflw + _ser_pmc_preclean_ovflw + |
4380 _ser_kac_ovflw + _ser_kac_preclean_ovflw; |
4380 _ser_kac_ovflw + _ser_kac_preclean_ovflw; |
4381 if (ser_ovflw > 0) { |
4381 if (ser_ovflw > 0) { |
4382 if (PrintCMSStatistics != 0) { |
4382 if (PrintCMSStatistics != 0) { |
4383 gclog_or_tty->print_cr("Marking stack overflow (benign) " |
4383 gclog_or_tty->print_cr("Marking stack overflow (benign) " |
4384 "(pmc_pc="SIZE_FORMAT", pmc_rm="SIZE_FORMAT", kac="SIZE_FORMAT |
4384 "(pmc_pc=" SIZE_FORMAT ", pmc_rm=" SIZE_FORMAT ", kac=" SIZE_FORMAT |
4385 ", kac_preclean="SIZE_FORMAT")", |
4385 ", kac_preclean=" SIZE_FORMAT ")", |
4386 _ser_pmc_preclean_ovflw, _ser_pmc_remark_ovflw, |
4386 _ser_pmc_preclean_ovflw, _ser_pmc_remark_ovflw, |
4387 _ser_kac_ovflw, _ser_kac_preclean_ovflw); |
4387 _ser_kac_ovflw, _ser_kac_preclean_ovflw); |
4388 } |
4388 } |
4389 _markStack.expand(); |
4389 _markStack.expand(); |
4390 _ser_pmc_remark_ovflw = 0; |
4390 _ser_pmc_remark_ovflw = 0; |
4393 _ser_kac_ovflw = 0; |
4393 _ser_kac_ovflw = 0; |
4394 } |
4394 } |
4395 if (_par_pmc_remark_ovflw > 0 || _par_kac_ovflw > 0) { |
4395 if (_par_pmc_remark_ovflw > 0 || _par_kac_ovflw > 0) { |
4396 if (PrintCMSStatistics != 0) { |
4396 if (PrintCMSStatistics != 0) { |
4397 gclog_or_tty->print_cr("Work queue overflow (benign) " |
4397 gclog_or_tty->print_cr("Work queue overflow (benign) " |
4398 "(pmc_rm="SIZE_FORMAT", kac="SIZE_FORMAT")", |
4398 "(pmc_rm=" SIZE_FORMAT ", kac=" SIZE_FORMAT ")", |
4399 _par_pmc_remark_ovflw, _par_kac_ovflw); |
4399 _par_pmc_remark_ovflw, _par_kac_ovflw); |
4400 } |
4400 } |
4401 _par_pmc_remark_ovflw = 0; |
4401 _par_pmc_remark_ovflw = 0; |
4402 _par_kac_ovflw = 0; |
4402 _par_kac_ovflw = 0; |
4403 } |
4403 } |
4404 if (PrintCMSStatistics != 0) { |
4404 if (PrintCMSStatistics != 0) { |
4405 if (_markStack._hit_limit > 0) { |
4405 if (_markStack._hit_limit > 0) { |
4406 gclog_or_tty->print_cr(" (benign) Hit max stack size limit ("SIZE_FORMAT")", |
4406 gclog_or_tty->print_cr(" (benign) Hit max stack size limit (" SIZE_FORMAT ")", |
4407 _markStack._hit_limit); |
4407 _markStack._hit_limit); |
4408 } |
4408 } |
4409 if (_markStack._failed_double > 0) { |
4409 if (_markStack._failed_double > 0) { |
4410 gclog_or_tty->print_cr(" (benign) Failed stack doubling ("SIZE_FORMAT")," |
4410 gclog_or_tty->print_cr(" (benign) Failed stack doubling (" SIZE_FORMAT ")," |
4411 " current capacity "SIZE_FORMAT, |
4411 " current capacity " SIZE_FORMAT, |
4412 _markStack._failed_double, |
4412 _markStack._failed_double, |
4413 _markStack.capacity()); |
4413 _markStack.capacity()); |
4414 } |
4414 } |
4415 } |
4415 } |
4416 _markStack._hit_limit = 0; |
4416 _markStack._hit_limit = 0; |
5159 MemRegion cms_span(lb, ub); |
5159 MemRegion cms_span(lb, ub); |
5160 _modUnionTable.dirty_range_iterate_clear(cms_span, |
5160 _modUnionTable.dirty_range_iterate_clear(cms_span, |
5161 &markFromDirtyCardsClosure); |
5161 &markFromDirtyCardsClosure); |
5162 verify_work_stacks_empty(); |
5162 verify_work_stacks_empty(); |
5163 if (PrintCMSStatistics != 0) { |
5163 if (PrintCMSStatistics != 0) { |
5164 gclog_or_tty->print(" (re-scanned "SIZE_FORMAT" dirty cards in cms gen) ", |
5164 gclog_or_tty->print(" (re-scanned " SIZE_FORMAT " dirty cards in cms gen) ", |
5165 markFromDirtyCardsClosure.num_dirty_cards()); |
5165 markFromDirtyCardsClosure.num_dirty_cards()); |
5166 } |
5166 } |
5167 } |
5167 } |
5168 } |
5168 } |
5169 if (VerifyDuringGC && |
5169 if (VerifyDuringGC && |
6033 _index = 0; |
6033 _index = 0; |
6034 _capacity = new_capacity; |
6034 _capacity = new_capacity; |
6035 } else if (_failed_double++ == 0 && !CMSConcurrentMTEnabled && PrintGCDetails) { |
6035 } else if (_failed_double++ == 0 && !CMSConcurrentMTEnabled && PrintGCDetails) { |
6036 // Failed to double capacity, continue; |
6036 // Failed to double capacity, continue; |
6037 // we print a detail message only once per CMS cycle. |
6037 // we print a detail message only once per CMS cycle. |
6038 gclog_or_tty->print(" (benign) Failed to expand marking stack from "SIZE_FORMAT"K to " |
6038 gclog_or_tty->print(" (benign) Failed to expand marking stack from " SIZE_FORMAT "K to " |
6039 SIZE_FORMAT"K", |
6039 SIZE_FORMAT "K", |
6040 _capacity / K, new_capacity / K); |
6040 _capacity / K, new_capacity / K); |
6041 } |
6041 } |
6042 } |
6042 } |
6043 |
6043 |
6044 |
6044 |
7333 warning("inFreeRange() should have been reset; dumping state of SweepClosure"); |
7333 warning("inFreeRange() should have been reset; dumping state of SweepClosure"); |
7334 print(); |
7334 print(); |
7335 ShouldNotReachHere(); |
7335 ShouldNotReachHere(); |
7336 } |
7336 } |
7337 if (Verbose && PrintGC) { |
7337 if (Verbose && PrintGC) { |
7338 gclog_or_tty->print("Collected "SIZE_FORMAT" objects, " SIZE_FORMAT " bytes", |
7338 gclog_or_tty->print("Collected " SIZE_FORMAT " objects, " SIZE_FORMAT " bytes", |
7339 _numObjectsFreed, _numWordsFreed*sizeof(HeapWord)); |
7339 _numObjectsFreed, _numWordsFreed*sizeof(HeapWord)); |
7340 gclog_or_tty->print_cr("\nLive "SIZE_FORMAT" objects, " |
7340 gclog_or_tty->print_cr("\nLive " SIZE_FORMAT " objects, " |
7341 SIZE_FORMAT" bytes " |
7341 SIZE_FORMAT " bytes " |
7342 "Already free "SIZE_FORMAT" objects, "SIZE_FORMAT" bytes", |
7342 "Already free " SIZE_FORMAT " objects, " SIZE_FORMAT " bytes", |
7343 _numObjectsLive, _numWordsLive*sizeof(HeapWord), |
7343 _numObjectsLive, _numWordsLive*sizeof(HeapWord), |
7344 _numObjectsAlreadyFree, _numWordsAlreadyFree*sizeof(HeapWord)); |
7344 _numObjectsAlreadyFree, _numWordsAlreadyFree*sizeof(HeapWord)); |
7345 size_t totalBytes = (_numWordsFreed + _numWordsLive + _numWordsAlreadyFree) |
7345 size_t totalBytes = (_numWordsFreed + _numWordsLive + _numWordsAlreadyFree) |
7346 * sizeof(HeapWord); |
7346 * sizeof(HeapWord); |
7347 gclog_or_tty->print_cr("Total sweep: "SIZE_FORMAT" bytes", totalBytes); |
7347 gclog_or_tty->print_cr("Total sweep: " SIZE_FORMAT " bytes", totalBytes); |
7348 |
7348 |
7349 if (PrintCMSStatistics && CMSVerifyReturnedBytes) { |
7349 if (PrintCMSStatistics && CMSVerifyReturnedBytes) { |
7350 size_t indexListReturnedBytes = _sp->sumIndexedFreeListArrayReturnedBytes(); |
7350 size_t indexListReturnedBytes = _sp->sumIndexedFreeListArrayReturnedBytes(); |
7351 size_t dict_returned_bytes = _sp->dictionary()->sum_dict_returned_bytes(); |
7351 size_t dict_returned_bytes = _sp->dictionary()->sum_dict_returned_bytes(); |
7352 size_t returned_bytes = indexListReturnedBytes + dict_returned_bytes; |
7352 size_t returned_bytes = indexListReturnedBytes + dict_returned_bytes; |
7353 gclog_or_tty->print("Returned "SIZE_FORMAT" bytes", returned_bytes); |
7353 gclog_or_tty->print("Returned " SIZE_FORMAT " bytes", returned_bytes); |
7354 gclog_or_tty->print(" Indexed List Returned "SIZE_FORMAT" bytes", |
7354 gclog_or_tty->print(" Indexed List Returned " SIZE_FORMAT " bytes", |
7355 indexListReturnedBytes); |
7355 indexListReturnedBytes); |
7356 gclog_or_tty->print_cr(" Dictionary Returned "SIZE_FORMAT" bytes", |
7356 gclog_or_tty->print_cr(" Dictionary Returned " SIZE_FORMAT " bytes", |
7357 dict_returned_bytes); |
7357 dict_returned_bytes); |
7358 } |
7358 } |
7359 } |
7359 } |
7360 if (CMSTraceSweeper) { |
7360 if (CMSTraceSweeper) { |
7361 gclog_or_tty->print_cr("end of sweep with _limit = " PTR_FORMAT "\n================", |
7361 gclog_or_tty->print_cr("end of sweep with _limit = " PTR_FORMAT "\n================", |
7430 assert(addr < _sp->end(), "addr out of bounds"); |
7430 assert(addr < _sp->end(), "addr out of bounds"); |
7431 // Flush any free range we might be holding as a single |
7431 // Flush any free range we might be holding as a single |
7432 // coalesced chunk to the appropriate free list. |
7432 // coalesced chunk to the appropriate free list. |
7433 if (inFreeRange()) { |
7433 if (inFreeRange()) { |
7434 assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit, |
7434 assert(freeFinger() >= _sp->bottom() && freeFinger() < _limit, |
7435 err_msg("freeFinger() " PTR_FORMAT" is out-of-bounds", p2i(freeFinger()))); |
7435 err_msg("freeFinger() " PTR_FORMAT " is out-of-bounds", p2i(freeFinger()))); |
7436 flush_cur_free_chunk(freeFinger(), |
7436 flush_cur_free_chunk(freeFinger(), |
7437 pointer_delta(addr, freeFinger())); |
7437 pointer_delta(addr, freeFinger())); |
7438 if (CMSTraceSweeper) { |
7438 if (CMSTraceSweeper) { |
7439 gclog_or_tty->print("Sweep: last chunk: "); |
7439 gclog_or_tty->print("Sweep: last chunk: "); |
7440 gclog_or_tty->print("put_free_blk " PTR_FORMAT " ("SIZE_FORMAT") " |
7440 gclog_or_tty->print("put_free_blk " PTR_FORMAT " (" SIZE_FORMAT ") " |
7441 "[coalesced:%d]\n", |
7441 "[coalesced:%d]\n", |
7442 p2i(freeFinger()), pointer_delta(addr, freeFinger()), |
7442 p2i(freeFinger()), pointer_delta(addr, freeFinger()), |
7443 lastFreeRangeCoalesced() ? 1 : 0); |
7443 lastFreeRangeCoalesced() ? 1 : 0); |
7444 } |
7444 } |
7445 } |
7445 } |