comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 18058:54bc75c144b0

Merge
author asaha
date Thu, 29 May 2014 13:14:25 -0700
parents 78bbf4d43a14
children 8e20ef014b08
comparison
equal deleted inserted replaced
18055:1fa005fb28f5 18058:54bc75c144b0
1 /* 1 /*
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
60 #include "runtime/handles.inline.hpp" 60 #include "runtime/handles.inline.hpp"
61 #include "runtime/java.hpp" 61 #include "runtime/java.hpp"
62 #include "runtime/vmThread.hpp" 62 #include "runtime/vmThread.hpp"
63 #include "services/memoryService.hpp" 63 #include "services/memoryService.hpp"
64 #include "services/runtimeService.hpp" 64 #include "services/runtimeService.hpp"
65
66 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
65 67
66 // statics 68 // statics
67 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL; 69 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL;
68 bool CMSCollector::_full_gc_requested = false; 70 bool CMSCollector::_full_gc_requested = false;
69 GCCause::Cause CMSCollector::_full_gc_cause = GCCause::_no_gc; 71 GCCause::Cause CMSCollector::_full_gc_cause = GCCause::_no_gc;
1179 1181
1180 if (CMSTraceIncrementalMode) { 1182 if (CMSTraceIncrementalMode) {
1181 gclog_or_tty->print(" icms alloc limits: " 1183 gclog_or_tty->print(" icms alloc limits: "
1182 PTR_FORMAT "," PTR_FORMAT 1184 PTR_FORMAT "," PTR_FORMAT
1183 " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ", 1185 " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ",
1184 _icms_start_limit, _icms_stop_limit, 1186 p2i(_icms_start_limit), p2i(_icms_stop_limit),
1185 percent_of_space(eden, _icms_start_limit), 1187 percent_of_space(eden, _icms_start_limit),
1186 percent_of_space(eden, _icms_stop_limit)); 1188 percent_of_space(eden, _icms_stop_limit));
1187 if (Verbose) { 1189 if (Verbose) {
1188 gclog_or_tty->print("eden: "); 1190 gclog_or_tty->print("eden: ");
1189 eden->print_on(gclog_or_tty); 1191 eden->print_on(gclog_or_tty);
1207 space->print_on(gclog_or_tty); 1209 space->print_on(gclog_or_tty);
1208 gclog_or_tty->stamp(); 1210 gclog_or_tty->stamp();
1209 gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT 1211 gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT
1210 ", new limit=" PTR_FORMAT 1212 ", new limit=" PTR_FORMAT
1211 " (" SIZE_FORMAT "%%)", 1213 " (" SIZE_FORMAT "%%)",
1212 top, _icms_stop_limit, 1214 p2i(top), p2i(_icms_stop_limit),
1213 percent_of_space(space, _icms_stop_limit)); 1215 percent_of_space(space, _icms_stop_limit));
1214 } 1216 }
1215 ConcurrentMarkSweepThread::start_icms(); 1217 ConcurrentMarkSweepThread::start_icms();
1216 assert(top < _icms_stop_limit, "Tautology"); 1218 assert(top < _icms_stop_limit, "Tautology");
1217 if (word_size < pointer_delta(_icms_stop_limit, top)) { 1219 if (word_size < pointer_delta(_icms_stop_limit, top)) {
1224 space->print_on(gclog_or_tty); 1226 space->print_on(gclog_or_tty);
1225 gclog_or_tty->stamp(); 1227 gclog_or_tty->stamp();
1226 gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT 1228 gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT
1227 ", new limit=" PTR_FORMAT 1229 ", new limit=" PTR_FORMAT
1228 " (" SIZE_FORMAT "%%)", 1230 " (" SIZE_FORMAT "%%)",
1229 top, space->end(), 1231 p2i(top), p2i(space->end()),
1230 percent_of_space(space, space->end())); 1232 percent_of_space(space, space->end()));
1231 } 1233 }
1232 ConcurrentMarkSweepThread::stop_icms(); 1234 ConcurrentMarkSweepThread::stop_icms();
1233 return space->end(); 1235 return space->end();
1234 } 1236 }
1499 // Print out lots of information which affects the initiation of 1501 // Print out lots of information which affects the initiation of
1500 // a collection. 1502 // a collection.
1501 if (PrintCMSInitiationStatistics && stats().valid()) { 1503 if (PrintCMSInitiationStatistics && stats().valid()) {
1502 gclog_or_tty->print("CMSCollector shouldConcurrentCollect: "); 1504 gclog_or_tty->print("CMSCollector shouldConcurrentCollect: ");
1503 gclog_or_tty->stamp(); 1505 gclog_or_tty->stamp();
1504 gclog_or_tty->print_cr(""); 1506 gclog_or_tty->cr();
1505 stats().print_on(gclog_or_tty); 1507 stats().print_on(gclog_or_tty);
1506 gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f", 1508 gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f",
1507 stats().time_until_cms_gen_full()); 1509 stats().time_until_cms_gen_full());
1508 gclog_or_tty->print_cr("free="SIZE_FORMAT, _cmsGen->free()); 1510 gclog_or_tty->print_cr("free="SIZE_FORMAT, _cmsGen->free());
1509 gclog_or_tty->print_cr("contiguous_available="SIZE_FORMAT, 1511 gclog_or_tty->print_cr("contiguous_available="SIZE_FORMAT,
2494 _last_heap_summary = gch->create_heap_summary(); 2496 _last_heap_summary = gch->create_heap_summary();
2495 _last_metaspace_summary = gch->create_metaspace_summary(); 2497 _last_metaspace_summary = gch->create_metaspace_summary();
2496 } 2498 }
2497 2499
2498 void CMSCollector::report_heap_summary(GCWhen::Type when) { 2500 void CMSCollector::report_heap_summary(GCWhen::Type when) {
2499 _gc_tracer_cm->report_gc_heap_summary(when, _last_heap_summary, _last_metaspace_summary); 2501 _gc_tracer_cm->report_gc_heap_summary(when, _last_heap_summary);
2502 _gc_tracer_cm->report_metaspace_summary(when, _last_metaspace_summary);
2500 } 2503 }
2501 2504
2502 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) { 2505 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) {
2503 assert(_foregroundGCIsActive && !_foregroundGCShouldWait, 2506 assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
2504 "Foreground collector should be waiting, not executing"); 2507 "Foreground collector should be waiting, not executing");
3574 gclog_or_tty->stamp(PrintGCTimeStamps); 3577 gclog_or_tty->stamp(PrintGCTimeStamps);
3575 gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]", 3578 gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]",
3576 _collector->cmsGen()->short_name(), 3579 _collector->cmsGen()->short_name(),
3577 _phase, _collector->timerValue(), _wallclock.seconds()); 3580 _phase, _collector->timerValue(), _wallclock.seconds());
3578 if (_print_cr) { 3581 if (_print_cr) {
3579 gclog_or_tty->print_cr(""); 3582 gclog_or_tty->cr();
3580 } 3583 }
3581 if (PrintCMSStatistics != 0) { 3584 if (PrintCMSStatistics != 0) {
3582 gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase, 3585 gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase,
3583 _collector->yields()); 3586 _collector->yields());
3584 } 3587 }
6360 } 6363 }
6361 verify_work_stacks_empty(); 6364 verify_work_stacks_empty();
6362 verify_overflow_empty(); 6365 verify_overflow_empty();
6363 6366
6364 if (should_unload_classes()) { 6367 if (should_unload_classes()) {
6365 ClassLoaderDataGraph::purge(); 6368 // Delay purge to the beginning of the next safepoint. Metaspace::contains
6369 // requires that the virtual spaces are stable and not deleted.
6370 ClassLoaderDataGraph::set_should_purge(true);
6366 } 6371 }
6367 6372
6368 _intra_sweep_timer.stop(); 6373 _intra_sweep_timer.stop();
6369 _intra_sweep_estimate.sample(_intra_sweep_timer.seconds()); 6374 _intra_sweep_estimate.sample(_intra_sweep_timer.seconds());
6370 6375