annotate src/share/vm/utilities/events.cpp @ 17575:0297e36d24a1

8037076: Check constant pool constants Summary: Fix events log string. Reviewed-by: kvn, mschoene
author coleenp
date Wed, 19 Mar 2014 14:45:43 -0400
parents f34d701e952e
children f73af4455d7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17575
0297e36d24a1 8037076: Check constant pool constants
coleenp
parents: 7180
diff changeset
2 * Copyright (c) 1997, 2014, 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/allocation.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "runtime/mutexLocker.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "runtime/osThread.hpp"
7180
f34d701e952e 8003935: Simplify the needed includes for using Thread::current()
stefank
parents: 4944
diff changeset
29 #include "runtime/thread.inline.hpp"
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
30 #include "runtime/threadCritical.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "runtime/threadLocalStorage.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "runtime/timer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "utilities/events.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
36 EventLog* Events::_logs = NULL;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
37 StringEventLog* Events::_messages = NULL;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
38 StringEventLog* Events::_exceptions = NULL;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
39 StringEventLog* Events::_deopt_messages = NULL;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
40
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
41 EventLog::EventLog() {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
42 // This normally done during bootstrap when we're only single
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
43 // threaded but use a ThreadCritical to ensure inclusion in case
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
44 // some are created slightly late.
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
45 ThreadCritical tc;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
46 _next = Events::_logs;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
47 Events::_logs = this;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
48 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
49
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
50 // For each registered event logger, print out the current contents of
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
51 // the buffer. This is normally called when the JVM is crashing.
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
52 void Events::print_all(outputStream* out) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
53 EventLog* log = _logs;
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
54 while (log != NULL) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
55 log->print_log_on(out);
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
56 log = log->next();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58 }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
4944
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
60 void Events::print() {
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
61 print_all(tty);
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
62 }
09d00c18e323 7145537: minor tweaks to LogEvents
never
parents: 4872
diff changeset
63
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
64 void Events::init() {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
65 if (LogEvents) {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
66 _messages = new StringEventLog("Events");
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
67 _exceptions = new StringEventLog("Internal exceptions");
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
68 _deopt_messages = new StringEventLog("Deoptimization events");
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
69 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
72 void eventlog_init() {
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
73 Events::init();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 ///////////////////////////////////////////////////////////////////////////
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // EventMark
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 EventMark::EventMark(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 if (LogEvents) {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
82 va_start(ap, format);
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
83 // Save a copy of begin message and log it.
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
84 _buffer.printv(format, ap);
17575
0297e36d24a1 8037076: Check constant pool constants
coleenp
parents: 7180
diff changeset
85 Events::log(NULL, "%s", (const char*)_buffer);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
86 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 EventMark::~EventMark() {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 if (LogEvents) {
4872
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
92 // Append " done" to the begin message and log it
aa3d708d67c4 7141200: log some interesting information in ring buffers for crashes
never
parents: 3960
diff changeset
93 _buffer.append(" done");
17575
0297e36d24a1 8037076: Check constant pool constants
coleenp
parents: 7180
diff changeset
94 Events::log(NULL, "%s", (const char*)_buffer);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }