author | coleenp |
Wed, 23 Dec 2015 20:07:39 +0000 | |
changeset 35222 | fc89375d788d |
parent 31409 | e73d834e5b49 |
child 38658 | 34f9c45625d8 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
31409
e73d834e5b49
8129423: Fix unlink() of LogCompilation tmp files lost in merge of 8007993 and 8060074.
goetz
parents:
27883
diff
changeset
|
2 |
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5402
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5402
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5402
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "ci/ciMethod.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
24424
diff
changeset
|
27 |
#include "code/codeCache.hpp" |
7397 | 28 |
#include "compiler/compileLog.hpp" |
29 |
#include "memory/allocation.inline.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
30 |
#include "oops/method.hpp" |
7397 | 31 |
#include "runtime/mutexLocker.hpp" |
32 |
#include "runtime/os.hpp" |
|
1 | 33 |
|
34 |
CompileLog* CompileLog::_first = NULL; |
|
35 |
||
36 |
// ------------------------------------------------------------------ |
|
37 |
// CompileLog::CompileLog |
|
17876
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
38 |
CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id) |
1 | 39 |
: _context(_context_buffer, sizeof(_context_buffer)) |
40 |
{ |
|
17876
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
41 |
initialize(new(ResourceObj::C_HEAP, mtCompiler) fileStream(fp, true)); |
1 | 42 |
_file_end = 0; |
43 |
_thread_id = thread_id; |
|
44 |
||
45 |
_identities_limit = 0; |
|
46 |
_identities_capacity = 400; |
|
13195 | 47 |
_identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler); |
17876
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
48 |
_file = NEW_C_HEAP_ARRAY(char, strlen(file_name)+1, mtCompiler); |
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
49 |
strcpy((char*)_file, file_name); |
1 | 50 |
|
51 |
// link into the global list |
|
52 |
{ MutexLocker locker(CompileTaskAlloc_lock); |
|
53 |
_next = _first; |
|
54 |
_first = this; |
|
55 |
} |
|
56 |
} |
|
57 |
||
58 |
CompileLog::~CompileLog() { |
|
27709
e6f02d6fee44
8007993: hotspot.log w/ enabled LogCompilation can be an invalid XML
thartmann
parents:
25715
diff
changeset
|
59 |
delete _out; // Close fd in fileStream::~fileStream() |
1 | 60 |
_out = NULL; |
31409
e73d834e5b49
8129423: Fix unlink() of LogCompilation tmp files lost in merge of 8007993 and 8060074.
goetz
parents:
27883
diff
changeset
|
61 |
// Remove partial file after merging in CompileLog::finish_log_on_error |
e73d834e5b49
8129423: Fix unlink() of LogCompilation tmp files lost in merge of 8007993 and 8060074.
goetz
parents:
27883
diff
changeset
|
62 |
unlink(_file); |
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
25715
diff
changeset
|
63 |
FREE_C_HEAP_ARRAY(char, _identities); |
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
25715
diff
changeset
|
64 |
FREE_C_HEAP_ARRAY(char, _file); |
1 | 65 |
} |
66 |
||
67 |
||
68 |
// see_tag, pop_tag: Override the default do-nothing methods on xmlStream. |
|
31409
e73d834e5b49
8129423: Fix unlink() of LogCompilation tmp files lost in merge of 8007993 and 8060074.
goetz
parents:
27883
diff
changeset
|
69 |
// These methods provide a hook for managing the extra context markup. |
1 | 70 |
void CompileLog::see_tag(const char* tag, bool push) { |
71 |
if (_context.size() > 0 && _out != NULL) { |
|
72 |
_out->write(_context.base(), _context.size()); |
|
73 |
_context.reset(); |
|
74 |
} |
|
75 |
xmlStream::see_tag(tag, push); |
|
76 |
} |
|
77 |
void CompileLog::pop_tag(const char* tag) { |
|
78 |
_context.reset(); // toss any context info. |
|
79 |
xmlStream::pop_tag(tag); |
|
80 |
} |
|
81 |
||
82 |
||
83 |
// ------------------------------------------------------------------ |
|
84 |
// CompileLog::identify |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
85 |
int CompileLog::identify(ciBaseObject* obj) { |
1 | 86 |
if (obj == NULL) return 0; |
87 |
int id = obj->ident(); |
|
88 |
if (id < 0) return id; |
|
89 |
// If it has already been identified, just return the id. |
|
90 |
if (id < _identities_limit && _identities[id] != 0) return id; |
|
91 |
// Lengthen the array, if necessary. |
|
92 |
if (id >= _identities_capacity) { |
|
93 |
int new_cap = _identities_capacity * 2; |
|
94 |
if (new_cap <= id) new_cap = id + 100; |
|
13195 | 95 |
_identities = REALLOC_C_HEAP_ARRAY(char, _identities, new_cap, mtCompiler); |
1 | 96 |
_identities_capacity = new_cap; |
97 |
} |
|
98 |
while (id >= _identities_limit) { |
|
99 |
_identities[_identities_limit++] = 0; |
|
100 |
} |
|
101 |
assert(id < _identities_limit, "oob"); |
|
102 |
// Mark this id as processed. |
|
103 |
// (Be sure to do this before any recursive calls to identify.) |
|
104 |
_identities[id] = 1; // mark |
|
105 |
||
106 |
// Now, print the object's identity once, in detail. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
107 |
if (obj->is_metadata()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
108 |
ciMetadata* mobj = obj->as_metadata(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
109 |
if (mobj->is_klass()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
110 |
ciKlass* klass = mobj->as_klass(); |
13891
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
111 |
begin_elem("klass id='%d'", id); |
24002
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
112 |
name(klass); |
13891
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
113 |
if (!klass->is_loaded()) { |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
114 |
print(" unloaded='1'"); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
115 |
} else { |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
116 |
print(" flags='%d'", klass->modifier_flags()); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
117 |
} |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
118 |
end_elem(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
119 |
} else if (mobj->is_method()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
120 |
ciMethod* method = mobj->as_method(); |
13891
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
121 |
ciSignature* sig = method->signature(); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
122 |
// Pre-identify items that we will need! |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
123 |
identify(sig->return_type()); |
1 | 124 |
for (int i = 0; i < sig->count(); i++) { |
13891
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
125 |
identify(sig->type_at(i)); |
1 | 126 |
} |
13891
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
127 |
begin_elem("method id='%d' holder='%d'", |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
128 |
id, identify(method->holder())); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
129 |
name(method->name()); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
130 |
print(" return='%d'", identify(sig->return_type())); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
131 |
if (sig->count() > 0) { |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
132 |
print(" arguments='"); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
133 |
for (int i = 0; i < sig->count(); i++) { |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
134 |
print((i == 0) ? "%d" : " %d", identify(sig->type_at(i))); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
135 |
} |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
136 |
print("'"); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
137 |
} |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
138 |
if (!method->is_loaded()) { |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
139 |
print(" unloaded='1'"); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
140 |
} else { |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
141 |
print(" flags='%d'", (jchar) method->flags().as_int()); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
142 |
// output a few metrics |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
143 |
print(" bytes='%d'", method->code_size()); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
144 |
method->log_nmethod_identity(this); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
145 |
//print(" count='%d'", method->invocation_count()); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
146 |
//int bec = method->backedge_count(); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
147 |
//if (bec != 0) print(" backedge_count='%d'", bec); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
148 |
print(" iicount='%d'", method->interpreter_invocation_count()); |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
149 |
} |
35dabd293e56
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
13728
diff
changeset
|
150 |
end_elem(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
151 |
} else if (mobj->is_type()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
152 |
BasicType type = mobj->as_type()->basic_type(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
153 |
elem("type id='%d' name='%s'", id, type2name(type)); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
154 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
155 |
// Should not happen. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
156 |
elem("unknown id='%d'", id); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
157 |
ShouldNotReachHere(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
158 |
} |
1 | 159 |
} else if (obj->is_symbol()) { |
160 |
begin_elem("symbol id='%d'", id); |
|
161 |
name(obj->as_symbol()); |
|
162 |
end_elem(); |
|
163 |
} else { |
|
164 |
// Should not happen. |
|
165 |
elem("unknown id='%d'", id); |
|
166 |
} |
|
167 |
return id; |
|
168 |
} |
|
169 |
||
170 |
void CompileLog::name(ciSymbol* name) { |
|
171 |
if (name == NULL) return; |
|
172 |
print(" name='"); |
|
173 |
name->print_symbol_on(text()); // handles quoting conventions |
|
174 |
print("'"); |
|
175 |
} |
|
176 |
||
24002
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
177 |
void CompileLog::name(ciKlass* k) { |
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
178 |
print(" name='"); |
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
179 |
if (!k->is_loaded()) { |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
180 |
text()->print("%s", k->name()->as_klass_external_name()); |
24002
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
181 |
} else { |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
182 |
text()->print("%s", k->external_name()); |
24002
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
183 |
} |
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
184 |
print("'"); |
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
22234
diff
changeset
|
185 |
} |
1 | 186 |
|
187 |
// ------------------------------------------------------------------ |
|
188 |
// CompileLog::clear_identities |
|
189 |
// Forget which identities have been printed. |
|
190 |
void CompileLog::clear_identities() { |
|
191 |
_identities_limit = 0; |
|
192 |
} |
|
193 |
||
194 |
// ------------------------------------------------------------------ |
|
195 |
// CompileLog::finish_log_on_error |
|
196 |
// |
|
197 |
// Note: This function is called after fatal error, avoid unnecessary memory |
|
198 |
// or stack allocation, use only async-safe functions. It's possible JVM is |
|
199 |
// only partially initialized. |
|
200 |
void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen) { |
|
201 |
static bool called_exit = false; |
|
202 |
if (called_exit) return; |
|
203 |
called_exit = true; |
|
204 |
||
17876
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
205 |
CompileLog* log = _first; |
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
206 |
while (log != NULL) { |
1 | 207 |
log->flush(); |
208 |
const char* partial_file = log->file(); |
|
209 |
int partial_fd = open(partial_file, O_RDONLY); |
|
210 |
if (partial_fd != -1) { |
|
211 |
// print/print_cr may need to allocate large stack buffer to format |
|
212 |
// strings, here we use snprintf() and print_raw() instead. |
|
213 |
file->print_raw("<compilation_log thread='"); |
|
214 |
jio_snprintf(buf, buflen, UINTX_FORMAT, log->thread_id()); |
|
215 |
file->print_raw(buf); |
|
216 |
file->print_raw_cr("'>"); |
|
217 |
||
218 |
size_t nr; // number read into buf from partial log |
|
219 |
// Copy data up to the end of the last <event> element: |
|
220 |
julong to_read = log->_file_end; |
|
221 |
while (to_read > 0) { |
|
222 |
if (to_read < (julong)buflen) |
|
223 |
nr = (size_t)to_read; |
|
224 |
else nr = buflen; |
|
225 |
nr = read(partial_fd, buf, (int)nr); |
|
226 |
if (nr <= 0) break; |
|
227 |
to_read -= (julong)nr; |
|
228 |
file->write(buf, nr); |
|
229 |
} |
|
230 |
||
231 |
// Copy any remaining data inside a quote: |
|
232 |
bool saw_slop = false; |
|
233 |
int end_cdata = 0; // state machine [0..2] watching for too many "]]" |
|
234 |
while ((nr = read(partial_fd, buf, buflen)) > 0) { |
|
235 |
if (!saw_slop) { |
|
236 |
file->print_raw_cr("<fragment>"); |
|
237 |
file->print_raw_cr("<![CDATA["); |
|
238 |
saw_slop = true; |
|
239 |
} |
|
240 |
// The rest of this loop amounts to a simple copy operation: |
|
241 |
// { file->write(buf, nr); } |
|
242 |
// However, it must sometimes output the buffer in parts, |
|
243 |
// in case there is a CDATA quote embedded in the fragment. |
|
244 |
const char* bufp; // pointer into buf |
|
245 |
size_t nw; // number written in each pass of the following loop: |
|
246 |
for (bufp = buf; nr > 0; nr -= nw, bufp += nw) { |
|
247 |
// Write up to any problematic CDATA delimiter (usually all of nr). |
|
248 |
for (nw = 0; nw < nr; nw++) { |
|
249 |
// First, scan ahead into the buf, checking the state machine. |
|
250 |
switch (bufp[nw]) { |
|
251 |
case ']': |
|
252 |
if (end_cdata < 2) end_cdata += 1; // saturating counter |
|
253 |
continue; // keep scanning |
|
254 |
case '>': |
|
255 |
if (end_cdata == 2) break; // found CDATA delimiter! |
|
256 |
// else fall through: |
|
257 |
default: |
|
258 |
end_cdata = 0; |
|
259 |
continue; // keep scanning |
|
260 |
} |
|
261 |
// If we get here, nw is pointing at a bad '>'. |
|
262 |
// It is very rare for this to happen. |
|
263 |
// However, this code has been tested by introducing |
|
264 |
// CDATA sequences into the compilation log. |
|
265 |
break; |
|
266 |
} |
|
267 |
// Now nw is the number of characters to write, usually == nr. |
|
268 |
file->write(bufp, nw); |
|
269 |
if (nw < nr) { |
|
270 |
// We are about to go around the loop again. |
|
271 |
// But first, disrupt the ]]> by closing and reopening the quote. |
|
272 |
file->print_raw("]]><![CDATA["); |
|
273 |
end_cdata = 0; // reset state machine |
|
274 |
} |
|
275 |
} |
|
276 |
} |
|
277 |
if (saw_slop) { |
|
278 |
file->print_raw_cr("]]>"); |
|
279 |
file->print_raw_cr("</fragment>"); |
|
280 |
} |
|
281 |
file->print_raw_cr("</compilation_log>"); |
|
282 |
close(partial_fd); |
|
283 |
} |
|
17876
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
284 |
CompileLog* next_log = log->_next; |
27709
e6f02d6fee44
8007993: hotspot.log w/ enabled LogCompilation can be an invalid XML
thartmann
parents:
25715
diff
changeset
|
285 |
delete log; // Removes partial file |
17876
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
286 |
log = next_log; |
1 | 287 |
} |
17876
7313e6d57e36
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
16670
diff
changeset
|
288 |
_first = NULL; |
1 | 289 |
} |
290 |
||
291 |
// ------------------------------------------------------------------ |
|
292 |
// CompileLog::finish_log |
|
293 |
// |
|
294 |
// Called during normal shutdown. For now, any clean-up needed in normal |
|
295 |
// shutdown is also needed in VM abort, so is covered by finish_log_on_error(). |
|
296 |
// Just allocate a buffer and call finish_log_on_error(). |
|
297 |
void CompileLog::finish_log(outputStream* file) { |
|
298 |
char buf[4 * K]; |
|
299 |
finish_log_on_error(file, buf, sizeof(buf)); |
|
300 |
} |
|
13964 | 301 |
|
302 |
// ------------------------------------------------------------------ |
|
303 |
// CompileLog::inline_success |
|
304 |
// |
|
305 |
// Print about successful method inlining. |
|
306 |
void CompileLog::inline_success(const char* reason) { |
|
307 |
begin_elem("inline_success reason='"); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
308 |
text("%s", reason); |
13964 | 309 |
end_elem("'"); |
310 |
} |
|
311 |
||
312 |
// ------------------------------------------------------------------ |
|
313 |
// CompileLog::inline_fail |
|
314 |
// |
|
315 |
// Print about failed method inlining. |
|
316 |
void CompileLog::inline_fail(const char* reason) { |
|
317 |
begin_elem("inline_fail reason='"); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
318 |
text("%s", reason); |
13964 | 319 |
end_elem("'"); |
320 |
} |
|
321 |
||
322 |
// ------------------------------------------------------------------ |
|
323 |
// CompileLog::set_context |
|
324 |
// |
|
325 |
// Set XML tag as an optional marker - it is printed only if |
|
326 |
// there are other entries after until it is reset. |
|
327 |
void CompileLog::set_context(const char* format, ...) { |
|
328 |
va_list ap; |
|
329 |
va_start(ap, format); |
|
330 |
clear_context(); |
|
331 |
_context.print("<"); |
|
332 |
_context.vprint(format, ap); |
|
333 |
_context.print_cr("/>"); |
|
334 |
va_end(ap); |
|
335 |
} |
|
336 |
||
337 |
// ------------------------------------------------------------------ |
|
338 |
// CompileLog::code_cache_state |
|
339 |
// |
|
340 |
// Print code cache state. |
|
341 |
void CompileLog::code_cache_state() { |
|
342 |
begin_elem("code_cache"); |
|
343 |
CodeCache::log_state(this); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
344 |
end_elem("%s", ""); |
13964 | 345 |
} |