comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4ca6dc0799b6 8e20ef014b08
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
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;
306 (ParallelGCThreads > 1) && ParallelRefProcEnabled, // mt processing 308 (ParallelGCThreads > 1) && ParallelRefProcEnabled, // mt processing
307 (int) ParallelGCThreads, // mt processing degree 309 (int) ParallelGCThreads, // mt processing degree
308 _cmsGen->refs_discovery_is_mt(), // mt discovery 310 _cmsGen->refs_discovery_is_mt(), // mt discovery
309 (int) MAX2(ConcGCThreads, ParallelGCThreads), // mt discovery degree 311 (int) MAX2(ConcGCThreads, ParallelGCThreads), // mt discovery degree
310 _cmsGen->refs_discovery_is_atomic(), // discovery is not atomic 312 _cmsGen->refs_discovery_is_atomic(), // discovery is not atomic
311 &_is_alive_closure, // closure for liveness info 313 &_is_alive_closure); // closure for liveness info
312 false); // next field updates do not need write barrier
313 // Initialize the _ref_processor field of CMSGen 314 // Initialize the _ref_processor field of CMSGen
314 _cmsGen->set_ref_processor(_ref_processor); 315 _cmsGen->set_ref_processor(_ref_processor);
315 316
316 } 317 }
317 } 318 }
1179 1180
1180 if (CMSTraceIncrementalMode) { 1181 if (CMSTraceIncrementalMode) {
1181 gclog_or_tty->print(" icms alloc limits: " 1182 gclog_or_tty->print(" icms alloc limits: "
1182 PTR_FORMAT "," PTR_FORMAT 1183 PTR_FORMAT "," PTR_FORMAT
1183 " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ", 1184 " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ",
1184 _icms_start_limit, _icms_stop_limit, 1185 p2i(_icms_start_limit), p2i(_icms_stop_limit),
1185 percent_of_space(eden, _icms_start_limit), 1186 percent_of_space(eden, _icms_start_limit),
1186 percent_of_space(eden, _icms_stop_limit)); 1187 percent_of_space(eden, _icms_stop_limit));
1187 if (Verbose) { 1188 if (Verbose) {
1188 gclog_or_tty->print("eden: "); 1189 gclog_or_tty->print("eden: ");
1189 eden->print_on(gclog_or_tty); 1190 eden->print_on(gclog_or_tty);
1207 space->print_on(gclog_or_tty); 1208 space->print_on(gclog_or_tty);
1208 gclog_or_tty->stamp(); 1209 gclog_or_tty->stamp();
1209 gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT 1210 gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT
1210 ", new limit=" PTR_FORMAT 1211 ", new limit=" PTR_FORMAT
1211 " (" SIZE_FORMAT "%%)", 1212 " (" SIZE_FORMAT "%%)",
1212 top, _icms_stop_limit, 1213 p2i(top), p2i(_icms_stop_limit),
1213 percent_of_space(space, _icms_stop_limit)); 1214 percent_of_space(space, _icms_stop_limit));
1214 } 1215 }
1215 ConcurrentMarkSweepThread::start_icms(); 1216 ConcurrentMarkSweepThread::start_icms();
1216 assert(top < _icms_stop_limit, "Tautology"); 1217 assert(top < _icms_stop_limit, "Tautology");
1217 if (word_size < pointer_delta(_icms_stop_limit, top)) { 1218 if (word_size < pointer_delta(_icms_stop_limit, top)) {
1224 space->print_on(gclog_or_tty); 1225 space->print_on(gclog_or_tty);
1225 gclog_or_tty->stamp(); 1226 gclog_or_tty->stamp();
1226 gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT 1227 gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT
1227 ", new limit=" PTR_FORMAT 1228 ", new limit=" PTR_FORMAT
1228 " (" SIZE_FORMAT "%%)", 1229 " (" SIZE_FORMAT "%%)",
1229 top, space->end(), 1230 p2i(top), p2i(space->end()),
1230 percent_of_space(space, space->end())); 1231 percent_of_space(space, space->end()));
1231 } 1232 }
1232 ConcurrentMarkSweepThread::stop_icms(); 1233 ConcurrentMarkSweepThread::stop_icms();
1233 return space->end(); 1234 return space->end();
1234 } 1235 }
1499 // Print out lots of information which affects the initiation of 1500 // Print out lots of information which affects the initiation of
1500 // a collection. 1501 // a collection.
1501 if (PrintCMSInitiationStatistics && stats().valid()) { 1502 if (PrintCMSInitiationStatistics && stats().valid()) {
1502 gclog_or_tty->print("CMSCollector shouldConcurrentCollect: "); 1503 gclog_or_tty->print("CMSCollector shouldConcurrentCollect: ");
1503 gclog_or_tty->stamp(); 1504 gclog_or_tty->stamp();
1504 gclog_or_tty->print_cr(""); 1505 gclog_or_tty->cr();
1505 stats().print_on(gclog_or_tty); 1506 stats().print_on(gclog_or_tty);
1506 gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f", 1507 gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f",
1507 stats().time_until_cms_gen_full()); 1508 stats().time_until_cms_gen_full());
1508 gclog_or_tty->print_cr("free="SIZE_FORMAT, _cmsGen->free()); 1509 gclog_or_tty->print_cr("free="SIZE_FORMAT, _cmsGen->free());
1509 gclog_or_tty->print_cr("contiguous_available="SIZE_FORMAT, 1510 gclog_or_tty->print_cr("contiguous_available="SIZE_FORMAT,
2494 _last_heap_summary = gch->create_heap_summary(); 2495 _last_heap_summary = gch->create_heap_summary();
2495 _last_metaspace_summary = gch->create_metaspace_summary(); 2496 _last_metaspace_summary = gch->create_metaspace_summary();
2496 } 2497 }
2497 2498
2498 void CMSCollector::report_heap_summary(GCWhen::Type when) { 2499 void CMSCollector::report_heap_summary(GCWhen::Type when) {
2499 _gc_tracer_cm->report_gc_heap_summary(when, _last_heap_summary, _last_metaspace_summary); 2500 _gc_tracer_cm->report_gc_heap_summary(when, _last_heap_summary);
2501 _gc_tracer_cm->report_metaspace_summary(when, _last_metaspace_summary);
2500 } 2502 }
2501 2503
2502 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) { 2504 void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) {
2503 assert(_foregroundGCIsActive && !_foregroundGCShouldWait, 2505 assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
2504 "Foreground collector should be waiting, not executing"); 2506 "Foreground collector should be waiting, not executing");
3574 gclog_or_tty->stamp(PrintGCTimeStamps); 3576 gclog_or_tty->stamp(PrintGCTimeStamps);
3575 gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]", 3577 gclog_or_tty->print("[%s-concurrent-%s: %3.3f/%3.3f secs]",
3576 _collector->cmsGen()->short_name(), 3578 _collector->cmsGen()->short_name(),
3577 _phase, _collector->timerValue(), _wallclock.seconds()); 3579 _phase, _collector->timerValue(), _wallclock.seconds());
3578 if (_print_cr) { 3580 if (_print_cr) {
3579 gclog_or_tty->print_cr(""); 3581 gclog_or_tty->cr();
3580 } 3582 }
3581 if (PrintCMSStatistics != 0) { 3583 if (PrintCMSStatistics != 0) {
3582 gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase, 3584 gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase,
3583 _collector->yields()); 3585 _collector->yields());
3584 } 3586 }
6360 } 6362 }
6361 verify_work_stacks_empty(); 6363 verify_work_stacks_empty();
6362 verify_overflow_empty(); 6364 verify_overflow_empty();
6363 6365
6364 if (should_unload_classes()) { 6366 if (should_unload_classes()) {
6365 ClassLoaderDataGraph::purge(); 6367 // Delay purge to the beginning of the next safepoint. Metaspace::contains
6368 // requires that the virtual spaces are stable and not deleted.
6369 ClassLoaderDataGraph::set_should_purge(true);
6366 } 6370 }
6367 6371
6368 _intra_sweep_timer.stop(); 6372 _intra_sweep_timer.stop();
6369 _intra_sweep_estimate.sample(_intra_sweep_timer.seconds()); 6373 _intra_sweep_estimate.sample(_intra_sweep_timer.seconds());
6370 6374