annotate src/share/vm/gc_implementation/g1/g1HRPrinter.cpp @ 20211:82693fb204a5

8038930: G1CodeRootSet::test fails with assert(_num_chunks_handed_out == 0) failed: No elements must have been handed out yet Summary: The test incorrectly assumed that it had been started with no other previous compilation activity. Fix this by allowing multiple code root free chunk lists, and use one separate from the global one to perform the test. Reviewed-by: brutisso
author tschatzl
date Wed, 16 Apr 2014 10:14:50 +0200
parents 78bbf4d43a14
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3778
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
1 /*
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 3778
diff changeset
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3778
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
4 *
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
7 * published by the Free Software Foundation.
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
8 *
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
13 * accompanied this code).
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
14 *
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
18 *
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
21 * questions.
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
22 *
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
23 */
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
24
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
25 #include "precompiled.hpp"
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
26 #include "gc_implementation/g1/g1HRPrinter.hpp"
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
27 #include "gc_implementation/g1/heapRegion.hpp"
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
28 #include "utilities/ostream.hpp"
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
29
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 3778
diff changeset
30 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 3778
diff changeset
31
3778
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
32 const char* G1HRPrinter::action_name(ActionType action) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
33 switch(action) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
34 case Alloc: return "ALLOC";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
35 case AllocForce: return "ALLOC-FORCE";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
36 case Retire: return "RETIRE";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
37 case Reuse: return "REUSE";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
38 case CSet: return "CSET";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
39 case EvacFailure: return "EVAC-FAILURE";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
40 case Cleanup: return "CLEANUP";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
41 case PostCompaction: return "POST-COMPACTION";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
42 case Commit: return "COMMIT";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
43 case Uncommit: return "UNCOMMIT";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
44 default: ShouldNotReachHere();
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
45 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
46 // trying to keep the Windows compiler happy
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
47 return NULL;
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
48 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
49
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
50 const char* G1HRPrinter::region_type_name(RegionType type) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
51 switch (type) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
52 case Unset: return NULL;
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
53 case Eden: return "Eden";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
54 case Survivor: return "Survivor";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
55 case Old: return "Old";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
56 case SingleHumongous: return "SingleH";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
57 case StartsHumongous: return "StartsH";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
58 case ContinuesHumongous: return "ContinuesH";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
59 default: ShouldNotReachHere();
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
60 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
61 // trying to keep the Windows compiler happy
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
62 return NULL;
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
63 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
64
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
65 const char* G1HRPrinter::phase_name(PhaseType phase) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
66 switch (phase) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
67 case StartGC: return "StartGC";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
68 case EndGC: return "EndGC";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
69 case StartFullGC: return "StartFullGC";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
70 case EndFullGC: return "EndFullGC";
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
71 default: ShouldNotReachHere();
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
72 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
73 // trying to keep the Windows compiler happy
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
74 return NULL;
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
75 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
76
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
77 #define G1HR_PREFIX " G1HR"
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
78
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
79 void G1HRPrinter::print(ActionType action, RegionType type,
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
80 HeapRegion* hr, HeapWord* top) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
81 const char* action_str = action_name(action);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
82 const char* type_str = region_type_name(type);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
83 HeapWord* bottom = hr->bottom();
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
84
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
85 if (type_str != NULL) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
86 if (top != NULL) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
87 gclog_or_tty->print_cr(G1HR_PREFIX" %s(%s) "PTR_FORMAT" "PTR_FORMAT,
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
88 action_str, type_str, bottom, top);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
89 } else {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
90 gclog_or_tty->print_cr(G1HR_PREFIX" %s(%s) "PTR_FORMAT,
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
91 action_str, type_str, bottom);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
92 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
93 } else {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
94 if (top != NULL) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
95 gclog_or_tty->print_cr(G1HR_PREFIX" %s "PTR_FORMAT" "PTR_FORMAT,
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
96 action_str, bottom, top);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
97 } else {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
98 gclog_or_tty->print_cr(G1HR_PREFIX" %s "PTR_FORMAT,
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
99 action_str, bottom);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
100 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
101 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
102 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
103
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
104 void G1HRPrinter::print(ActionType action, HeapWord* bottom, HeapWord* end) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
105 const char* action_str = action_name(action);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
106
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
107 gclog_or_tty->print_cr(G1HR_PREFIX" %s ["PTR_FORMAT","PTR_FORMAT"]",
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
108 action_str, bottom, end);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
109 }
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
110
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
111 void G1HRPrinter::print(PhaseType phase, size_t phase_num) {
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
112 const char* phase_str = phase_name(phase);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
113 gclog_or_tty->print_cr(G1HR_PREFIX" #%s "SIZE_FORMAT, phase_str, phase_num);
5f6f2615433a 7049999: G1: Make the G1PrintHeapRegions output consistent and complete
tonyp
parents:
diff changeset
114 }