Mercurial > hg > graal-compiler
annotate src/share/vm/memory/specialized_oop_closures.cpp @ 2461:758ba0bf7bcc
7012087: JSR 292 Misleading exception message for a non-bound MH for a virtual method
Summary: Improve error message formatting to give more information to user. Also, catch a corner case related to 6930553 and 6844449.
Reviewed-by: kvn
author | jrose |
---|---|
date | Thu, 07 Apr 2011 17:12:21 -0700 |
parents | f95d63e2154a |
children |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "memory/specialized_oop_closures.hpp" | |
27 #include "utilities/ostream.hpp" | |
0 | 28 |
29 // For keeping stats on effectiveness. | |
30 #ifndef PRODUCT | |
31 #if ENABLE_SPECIALIZATION_STATS | |
32 | |
33 int SpecializationStats::_numCallsAll; | |
34 | |
35 int SpecializationStats::_numCallsTotal[NUM_Kinds]; | |
36 int SpecializationStats::_numCalls_nv[NUM_Kinds]; | |
37 | |
38 int SpecializationStats::_numDoOopCallsTotal[NUM_Kinds]; | |
39 int SpecializationStats::_numDoOopCalls_nv[NUM_Kinds]; | |
40 | |
41 void SpecializationStats::clear() { | |
42 _numCallsAll = 0; | |
43 for (int k = ik; k < NUM_Kinds; k++) { | |
44 _numCallsTotal[k] = 0; | |
45 _numCalls_nv[k] = 0; | |
46 | |
47 _numDoOopCallsTotal[k] = 0; | |
48 _numDoOopCalls_nv[k] = 0; | |
49 } | |
50 } | |
51 | |
52 void SpecializationStats::print() { | |
53 const char* header_format = " %20s %10s %11s %10s"; | |
54 const char* line_format = " %20s %10d %11d %9.2f%%"; | |
55 int all_numCallsTotal = | |
56 _numCallsTotal[ik] + _numCallsTotal[irk] + _numCallsTotal[oa]; | |
57 int all_numCalls_nv = | |
58 _numCalls_nv[ik] + _numCalls_nv[irk] + _numCalls_nv[oa]; | |
59 gclog_or_tty->print_cr("\nOf %d oop_oop_iterate calls %d (%6.3f%%) are in (ik, irk, oa).", | |
60 _numCallsAll, all_numCallsTotal, | |
61 100.0 * (float)all_numCallsTotal / (float)_numCallsAll); | |
62 // irk calls are double-counted. | |
63 int real_ik_numCallsTotal = _numCallsTotal[ik] - _numCallsTotal[irk]; | |
64 int real_ik_numCalls_nv = _numCalls_nv[ik] - _numCalls_nv[irk]; | |
65 gclog_or_tty->print_cr(""); | |
66 gclog_or_tty->print_cr(header_format, "oop_oop_iterate:", "calls", "non-virtual", "pct"); | |
67 gclog_or_tty->print_cr(header_format, | |
68 "----------", | |
69 "----------", | |
70 "-----------", | |
71 "----------"); | |
72 gclog_or_tty->print_cr(line_format, "all", | |
73 all_numCallsTotal, | |
74 all_numCalls_nv, | |
75 100.0 * (float)all_numCalls_nv / (float)all_numCallsTotal); | |
76 gclog_or_tty->print_cr(line_format, "ik", | |
77 real_ik_numCallsTotal, real_ik_numCalls_nv, | |
78 100.0 * (float)real_ik_numCalls_nv / | |
79 (float)real_ik_numCallsTotal); | |
80 gclog_or_tty->print_cr(line_format, "irk", | |
81 _numCallsTotal[irk], _numCalls_nv[irk], | |
82 100.0 * (float)_numCalls_nv[irk] / (float)_numCallsTotal[irk]); | |
83 gclog_or_tty->print_cr(line_format, "oa", | |
84 _numCallsTotal[oa], _numCalls_nv[oa], | |
85 100.0 * (float)_numCalls_nv[oa] / (float)_numCallsTotal[oa]); | |
86 | |
87 | |
88 gclog_or_tty->print_cr(""); | |
89 gclog_or_tty->print_cr(header_format, "do_oop:", "calls", "non-virtual", "pct"); | |
90 gclog_or_tty->print_cr(header_format, | |
91 "----------", | |
92 "----------", | |
93 "-----------", | |
94 "----------"); | |
95 int all_numDoOopCallsTotal = | |
96 _numDoOopCallsTotal[ik] + _numDoOopCallsTotal[irk] + _numDoOopCallsTotal[oa]; | |
97 int all_numDoOopCalls_nv = | |
98 _numDoOopCalls_nv[ik] + _numDoOopCalls_nv[irk] + _numDoOopCalls_nv[oa]; | |
99 gclog_or_tty->print_cr(line_format, "all", | |
100 all_numDoOopCallsTotal, all_numDoOopCalls_nv, | |
101 100.0 * (float)all_numDoOopCalls_nv / | |
102 (float)all_numDoOopCallsTotal); | |
103 const char* kind_names[] = { "ik", "irk", "oa" }; | |
104 for (int k = ik; k < NUM_Kinds; k++) { | |
105 gclog_or_tty->print_cr(line_format, kind_names[k], | |
106 _numDoOopCallsTotal[k], _numDoOopCalls_nv[k], | |
107 (_numDoOopCallsTotal[k] > 0 ? | |
108 100.0 * (float)_numDoOopCalls_nv[k] / | |
109 (float)_numDoOopCallsTotal[k] | |
110 : 0.0)); | |
111 } | |
112 } | |
113 | |
114 #endif // ENABLE_SPECIALIZATION_STATS | |
115 #endif // !PRODUCT |