Mercurial > hg > graal-compiler
annotate src/share/vm/memory/specialized_oop_closures.cpp @ 1751:2528b5bd749c
6980262: Memory leak when exception is thrown in static initializer
Summary: Use resource memory instead of c-heap for the exception message
Reviewed-by: phh, jmasa
author | kamg |
---|---|
date | Fri, 27 Aug 2010 15:05:28 -0400 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2001, 2003, 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 | |
25 # include "incls/_precompiled.incl" | |
26 # include "incls/_specialized_oop_closures.cpp.incl" | |
27 | |
28 // For keeping stats on effectiveness. | |
29 #ifndef PRODUCT | |
30 #if ENABLE_SPECIALIZATION_STATS | |
31 | |
32 int SpecializationStats::_numCallsAll; | |
33 | |
34 int SpecializationStats::_numCallsTotal[NUM_Kinds]; | |
35 int SpecializationStats::_numCalls_nv[NUM_Kinds]; | |
36 | |
37 int SpecializationStats::_numDoOopCallsTotal[NUM_Kinds]; | |
38 int SpecializationStats::_numDoOopCalls_nv[NUM_Kinds]; | |
39 | |
40 void SpecializationStats::clear() { | |
41 _numCallsAll = 0; | |
42 for (int k = ik; k < NUM_Kinds; k++) { | |
43 _numCallsTotal[k] = 0; | |
44 _numCalls_nv[k] = 0; | |
45 | |
46 _numDoOopCallsTotal[k] = 0; | |
47 _numDoOopCalls_nv[k] = 0; | |
48 } | |
49 } | |
50 | |
51 void SpecializationStats::print() { | |
52 const char* header_format = " %20s %10s %11s %10s"; | |
53 const char* line_format = " %20s %10d %11d %9.2f%%"; | |
54 int all_numCallsTotal = | |
55 _numCallsTotal[ik] + _numCallsTotal[irk] + _numCallsTotal[oa]; | |
56 int all_numCalls_nv = | |
57 _numCalls_nv[ik] + _numCalls_nv[irk] + _numCalls_nv[oa]; | |
58 gclog_or_tty->print_cr("\nOf %d oop_oop_iterate calls %d (%6.3f%%) are in (ik, irk, oa).", | |
59 _numCallsAll, all_numCallsTotal, | |
60 100.0 * (float)all_numCallsTotal / (float)_numCallsAll); | |
61 // irk calls are double-counted. | |
62 int real_ik_numCallsTotal = _numCallsTotal[ik] - _numCallsTotal[irk]; | |
63 int real_ik_numCalls_nv = _numCalls_nv[ik] - _numCalls_nv[irk]; | |
64 gclog_or_tty->print_cr(""); | |
65 gclog_or_tty->print_cr(header_format, "oop_oop_iterate:", "calls", "non-virtual", "pct"); | |
66 gclog_or_tty->print_cr(header_format, | |
67 "----------", | |
68 "----------", | |
69 "-----------", | |
70 "----------"); | |
71 gclog_or_tty->print_cr(line_format, "all", | |
72 all_numCallsTotal, | |
73 all_numCalls_nv, | |
74 100.0 * (float)all_numCalls_nv / (float)all_numCallsTotal); | |
75 gclog_or_tty->print_cr(line_format, "ik", | |
76 real_ik_numCallsTotal, real_ik_numCalls_nv, | |
77 100.0 * (float)real_ik_numCalls_nv / | |
78 (float)real_ik_numCallsTotal); | |
79 gclog_or_tty->print_cr(line_format, "irk", | |
80 _numCallsTotal[irk], _numCalls_nv[irk], | |
81 100.0 * (float)_numCalls_nv[irk] / (float)_numCallsTotal[irk]); | |
82 gclog_or_tty->print_cr(line_format, "oa", | |
83 _numCallsTotal[oa], _numCalls_nv[oa], | |
84 100.0 * (float)_numCalls_nv[oa] / (float)_numCallsTotal[oa]); | |
85 | |
86 | |
87 gclog_or_tty->print_cr(""); | |
88 gclog_or_tty->print_cr(header_format, "do_oop:", "calls", "non-virtual", "pct"); | |
89 gclog_or_tty->print_cr(header_format, | |
90 "----------", | |
91 "----------", | |
92 "-----------", | |
93 "----------"); | |
94 int all_numDoOopCallsTotal = | |
95 _numDoOopCallsTotal[ik] + _numDoOopCallsTotal[irk] + _numDoOopCallsTotal[oa]; | |
96 int all_numDoOopCalls_nv = | |
97 _numDoOopCalls_nv[ik] + _numDoOopCalls_nv[irk] + _numDoOopCalls_nv[oa]; | |
98 gclog_or_tty->print_cr(line_format, "all", | |
99 all_numDoOopCallsTotal, all_numDoOopCalls_nv, | |
100 100.0 * (float)all_numDoOopCalls_nv / | |
101 (float)all_numDoOopCallsTotal); | |
102 const char* kind_names[] = { "ik", "irk", "oa" }; | |
103 for (int k = ik; k < NUM_Kinds; k++) { | |
104 gclog_or_tty->print_cr(line_format, kind_names[k], | |
105 _numDoOopCallsTotal[k], _numDoOopCalls_nv[k], | |
106 (_numDoOopCallsTotal[k] > 0 ? | |
107 100.0 * (float)_numDoOopCalls_nv[k] / | |
108 (float)_numDoOopCallsTotal[k] | |
109 : 0.0)); | |
110 } | |
111 } | |
112 | |
113 #endif // ENABLE_SPECIALIZATION_STATS | |
114 #endif // !PRODUCT |