annotate src/share/vm/memory/specialized_oop_closures.cpp @ 1994:6cd6d394f280

7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed()) 7002546: regression on SpecJbb2005 on 7b118 comparing to 7b117 on small heaps Summary: Relaxed assertion checking related to incremental_collection_failed flag to allow for ExplicitGCInvokesConcurrent behaviour where we do not want a failing scavenge to bail to a stop-world collection. Parameterized incremental_collection_will_fail() so we can selectively use, or not use, as appropriate, the statistical prediction at specific use sites. This essentially reverts the scavenge bail-out logic to what it was prior to some recent changes that had inadvertently started using the statistical prediction which can be noisy in the presence of bursty loads. Added some associated verbose non-product debugging messages. Reviewed-by: johnc, tonyp
author ysr
date Tue, 07 Dec 2010 21:55:53 -0800
parents f95d63e2154a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "memory/specialized_oop_closures.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "utilities/ostream.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // For keeping stats on effectiveness.
a61af66fc99e Initial load
duke
parents:
diff changeset
30 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
31 #if ENABLE_SPECIALIZATION_STATS
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 int SpecializationStats::_numCallsAll;
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 int SpecializationStats::_numCallsTotal[NUM_Kinds];
a61af66fc99e Initial load
duke
parents:
diff changeset
36 int SpecializationStats::_numCalls_nv[NUM_Kinds];
a61af66fc99e Initial load
duke
parents:
diff changeset
37
a61af66fc99e Initial load
duke
parents:
diff changeset
38 int SpecializationStats::_numDoOopCallsTotal[NUM_Kinds];
a61af66fc99e Initial load
duke
parents:
diff changeset
39 int SpecializationStats::_numDoOopCalls_nv[NUM_Kinds];
a61af66fc99e Initial load
duke
parents:
diff changeset
40
a61af66fc99e Initial load
duke
parents:
diff changeset
41 void SpecializationStats::clear() {
a61af66fc99e Initial load
duke
parents:
diff changeset
42 _numCallsAll = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 for (int k = ik; k < NUM_Kinds; k++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
44 _numCallsTotal[k] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 _numCalls_nv[k] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 _numDoOopCallsTotal[k] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 _numDoOopCalls_nv[k] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 }
a61af66fc99e Initial load
duke
parents:
diff changeset
50 }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 void SpecializationStats::print() {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 const char* header_format = " %20s %10s %11s %10s";
a61af66fc99e Initial load
duke
parents:
diff changeset
54 const char* line_format = " %20s %10d %11d %9.2f%%";
a61af66fc99e Initial load
duke
parents:
diff changeset
55 int all_numCallsTotal =
a61af66fc99e Initial load
duke
parents:
diff changeset
56 _numCallsTotal[ik] + _numCallsTotal[irk] + _numCallsTotal[oa];
a61af66fc99e Initial load
duke
parents:
diff changeset
57 int all_numCalls_nv =
a61af66fc99e Initial load
duke
parents:
diff changeset
58 _numCalls_nv[ik] + _numCalls_nv[irk] + _numCalls_nv[oa];
a61af66fc99e Initial load
duke
parents:
diff changeset
59 gclog_or_tty->print_cr("\nOf %d oop_oop_iterate calls %d (%6.3f%%) are in (ik, irk, oa).",
a61af66fc99e Initial load
duke
parents:
diff changeset
60 _numCallsAll, all_numCallsTotal,
a61af66fc99e Initial load
duke
parents:
diff changeset
61 100.0 * (float)all_numCallsTotal / (float)_numCallsAll);
a61af66fc99e Initial load
duke
parents:
diff changeset
62 // irk calls are double-counted.
a61af66fc99e Initial load
duke
parents:
diff changeset
63 int real_ik_numCallsTotal = _numCallsTotal[ik] - _numCallsTotal[irk];
a61af66fc99e Initial load
duke
parents:
diff changeset
64 int real_ik_numCalls_nv = _numCalls_nv[ik] - _numCalls_nv[irk];
a61af66fc99e Initial load
duke
parents:
diff changeset
65 gclog_or_tty->print_cr("");
a61af66fc99e Initial load
duke
parents:
diff changeset
66 gclog_or_tty->print_cr(header_format, "oop_oop_iterate:", "calls", "non-virtual", "pct");
a61af66fc99e Initial load
duke
parents:
diff changeset
67 gclog_or_tty->print_cr(header_format,
a61af66fc99e Initial load
duke
parents:
diff changeset
68 "----------",
a61af66fc99e Initial load
duke
parents:
diff changeset
69 "----------",
a61af66fc99e Initial load
duke
parents:
diff changeset
70 "-----------",
a61af66fc99e Initial load
duke
parents:
diff changeset
71 "----------");
a61af66fc99e Initial load
duke
parents:
diff changeset
72 gclog_or_tty->print_cr(line_format, "all",
a61af66fc99e Initial load
duke
parents:
diff changeset
73 all_numCallsTotal,
a61af66fc99e Initial load
duke
parents:
diff changeset
74 all_numCalls_nv,
a61af66fc99e Initial load
duke
parents:
diff changeset
75 100.0 * (float)all_numCalls_nv / (float)all_numCallsTotal);
a61af66fc99e Initial load
duke
parents:
diff changeset
76 gclog_or_tty->print_cr(line_format, "ik",
a61af66fc99e Initial load
duke
parents:
diff changeset
77 real_ik_numCallsTotal, real_ik_numCalls_nv,
a61af66fc99e Initial load
duke
parents:
diff changeset
78 100.0 * (float)real_ik_numCalls_nv /
a61af66fc99e Initial load
duke
parents:
diff changeset
79 (float)real_ik_numCallsTotal);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 gclog_or_tty->print_cr(line_format, "irk",
a61af66fc99e Initial load
duke
parents:
diff changeset
81 _numCallsTotal[irk], _numCalls_nv[irk],
a61af66fc99e Initial load
duke
parents:
diff changeset
82 100.0 * (float)_numCalls_nv[irk] / (float)_numCallsTotal[irk]);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 gclog_or_tty->print_cr(line_format, "oa",
a61af66fc99e Initial load
duke
parents:
diff changeset
84 _numCallsTotal[oa], _numCalls_nv[oa],
a61af66fc99e Initial load
duke
parents:
diff changeset
85 100.0 * (float)_numCalls_nv[oa] / (float)_numCallsTotal[oa]);
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 gclog_or_tty->print_cr("");
a61af66fc99e Initial load
duke
parents:
diff changeset
89 gclog_or_tty->print_cr(header_format, "do_oop:", "calls", "non-virtual", "pct");
a61af66fc99e Initial load
duke
parents:
diff changeset
90 gclog_or_tty->print_cr(header_format,
a61af66fc99e Initial load
duke
parents:
diff changeset
91 "----------",
a61af66fc99e Initial load
duke
parents:
diff changeset
92 "----------",
a61af66fc99e Initial load
duke
parents:
diff changeset
93 "-----------",
a61af66fc99e Initial load
duke
parents:
diff changeset
94 "----------");
a61af66fc99e Initial load
duke
parents:
diff changeset
95 int all_numDoOopCallsTotal =
a61af66fc99e Initial load
duke
parents:
diff changeset
96 _numDoOopCallsTotal[ik] + _numDoOopCallsTotal[irk] + _numDoOopCallsTotal[oa];
a61af66fc99e Initial load
duke
parents:
diff changeset
97 int all_numDoOopCalls_nv =
a61af66fc99e Initial load
duke
parents:
diff changeset
98 _numDoOopCalls_nv[ik] + _numDoOopCalls_nv[irk] + _numDoOopCalls_nv[oa];
a61af66fc99e Initial load
duke
parents:
diff changeset
99 gclog_or_tty->print_cr(line_format, "all",
a61af66fc99e Initial load
duke
parents:
diff changeset
100 all_numDoOopCallsTotal, all_numDoOopCalls_nv,
a61af66fc99e Initial load
duke
parents:
diff changeset
101 100.0 * (float)all_numDoOopCalls_nv /
a61af66fc99e Initial load
duke
parents:
diff changeset
102 (float)all_numDoOopCallsTotal);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 const char* kind_names[] = { "ik", "irk", "oa" };
a61af66fc99e Initial load
duke
parents:
diff changeset
104 for (int k = ik; k < NUM_Kinds; k++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
105 gclog_or_tty->print_cr(line_format, kind_names[k],
a61af66fc99e Initial load
duke
parents:
diff changeset
106 _numDoOopCallsTotal[k], _numDoOopCalls_nv[k],
a61af66fc99e Initial load
duke
parents:
diff changeset
107 (_numDoOopCallsTotal[k] > 0 ?
a61af66fc99e Initial load
duke
parents:
diff changeset
108 100.0 * (float)_numDoOopCalls_nv[k] /
a61af66fc99e Initial load
duke
parents:
diff changeset
109 (float)_numDoOopCallsTotal[k]
a61af66fc99e Initial load
duke
parents:
diff changeset
110 : 0.0));
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 #endif // ENABLE_SPECIALIZATION_STATS
a61af66fc99e Initial load
duke
parents:
diff changeset
115 #endif // !PRODUCT