author | shade |
Sat, 23 Feb 2019 10:55:45 +0100 | |
changeset 53908 | 45a23c64d0f6 |
parent 53882 | ca682d9d8db5 |
child 59056 | 15936b142f86 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53882
ca682d9d8db5
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
mikael
parents:
49361
diff
changeset
|
2 |
* Copyright (c) 2002, 2019, 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 "code/nmethod.hpp" |
|
27 |
#include "memory/allocation.hpp" |
|
28 |
#include "memory/allocation.inline.hpp" |
|
37248 | 29 |
#include "memory/resourceArea.hpp" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
30 |
#include "oops/methodData.hpp" |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
31 |
#include "oops/method.hpp" |
7397 | 32 |
#include "oops/oop.inline.hpp" |
33 |
#include "runtime/deoptimization.hpp" |
|
49361
1956d0ec092a
8199319: Remove handles.inline.hpp include from reflectionUtils.hpp
stefank
parents:
47216
diff
changeset
|
34 |
#include "runtime/handles.inline.hpp" |
7397 | 35 |
#include "runtime/vmThread.hpp" |
46589 | 36 |
#include "utilities/vmError.hpp" |
7397 | 37 |
#include "utilities/xmlstream.hpp" |
1 | 38 |
|
28477 | 39 |
// Do not assert this condition if there's already another error reported. |
40 |
#define assert_if_no_error(cond, msg) \ |
|
46589 | 41 |
vmassert((cond) || VMError::is_error_reported(), msg) |
28477 | 42 |
|
1 | 43 |
void xmlStream::initialize(outputStream* out) { |
44 |
_out = out; |
|
45 |
_last_flush = 0; |
|
46 |
_markup_state = BODY; |
|
47 |
_text_init._outer_xmlStream = this; |
|
48 |
_text = &_text_init; |
|
49 |
||
50 |
#ifdef ASSERT |
|
51 |
_element_depth = 0; |
|
52 |
int init_len = 100; |
|
13195 | 53 |
char* init_buf = NEW_C_HEAP_ARRAY(char, init_len, mtInternal); |
1 | 54 |
_element_close_stack_low = init_buf; |
55 |
_element_close_stack_high = init_buf + init_len; |
|
56 |
_element_close_stack_ptr = init_buf + init_len - 1; |
|
57 |
_element_close_stack_ptr[0] = '\0'; |
|
58 |
#endif |
|
59 |
||
60 |
// Make sure each log uses the same base for time stamps. |
|
61 |
if (is_open()) { |
|
62 |
_out->time_stamp().update_to(1); |
|
63 |
} |
|
64 |
} |
|
65 |
||
66 |
#ifdef ASSERT |
|
67 |
xmlStream::~xmlStream() { |
|
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
24424
diff
changeset
|
68 |
FREE_C_HEAP_ARRAY(char, _element_close_stack_low); |
1 | 69 |
} |
70 |
#endif |
|
71 |
||
72 |
// Pass the given chars directly to _out. |
|
73 |
void xmlStream::write(const char* s, size_t len) { |
|
74 |
if (!is_open()) return; |
|
75 |
||
76 |
out()->write(s, len); |
|
768 | 77 |
update_position(s, len); |
1 | 78 |
} |
79 |
||
80 |
||
81 |
// Pass the given chars directly to _out, except that |
|
82 |
// we watch for special "<&>" chars. |
|
83 |
// This is suitable for either attribute text or for body text. |
|
84 |
// We don't fool with "<![CDATA[" quotes, just single-character entities. |
|
85 |
// This makes it easier for dumb tools to parse the output. |
|
86 |
void xmlStream::write_text(const char* s, size_t len) { |
|
87 |
if (!is_open()) return; |
|
88 |
||
89 |
size_t written = 0; |
|
90 |
// All normally printed material goes inside XML quotes. |
|
91 |
// This leaves the output free to include markup also. |
|
92 |
// Scan the string looking for inadvertant "<&>" chars |
|
93 |
for (size_t i = 0; i < len; i++) { |
|
94 |
char ch = s[i]; |
|
95 |
// Escape special chars. |
|
96 |
const char* esc = NULL; |
|
97 |
switch (ch) { |
|
98 |
// These are important only in attrs, but we do them always: |
|
99 |
case '\'': esc = "'"; break; |
|
100 |
case '"': esc = """; break; |
|
101 |
case '<': esc = "<"; break; |
|
102 |
case '&': esc = "&"; break; |
|
103 |
// This is a freebie. |
|
104 |
case '>': esc = ">"; break; |
|
105 |
} |
|
106 |
if (esc != NULL) { |
|
107 |
if (written < i) { |
|
108 |
out()->write(&s[written], i - written); |
|
109 |
written = i; |
|
110 |
} |
|
111 |
out()->print_raw(esc); |
|
112 |
written++; |
|
113 |
} |
|
114 |
} |
|
115 |
||
116 |
// Print the clean remainder. Usually, it is all of s. |
|
117 |
if (written < len) { |
|
118 |
out()->write(&s[written], len - written); |
|
119 |
} |
|
120 |
} |
|
121 |
||
122 |
// ------------------------------------------------------------------ |
|
123 |
// Outputs XML text, with special characters quoted. |
|
124 |
void xmlStream::text(const char* format, ...) { |
|
125 |
va_list ap; |
|
126 |
va_start(ap, format); |
|
127 |
va_text(format, ap); |
|
128 |
va_end(ap); |
|
129 |
} |
|
130 |
||
131 |
#define BUFLEN 2*K /* max size of output of individual print methods */ |
|
132 |
||
133 |
// ------------------------------------------------------------------ |
|
134 |
void xmlStream::va_tag(bool push, const char* format, va_list ap) { |
|
135 |
assert_if_no_error(!inside_attrs(), "cannot print tag inside attrs"); |
|
136 |
char buffer[BUFLEN]; |
|
137 |
size_t len; |
|
138 |
const char* kind = do_vsnprintf(buffer, BUFLEN, format, ap, false, len); |
|
139 |
see_tag(kind, push); |
|
140 |
print_raw("<"); |
|
141 |
write(kind, len); |
|
142 |
_markup_state = (push ? HEAD : ELEM); |
|
143 |
} |
|
144 |
||
145 |
#ifdef ASSERT |
|
146 |
/// Debugging goo to make sure element tags nest properly. |
|
147 |
||
148 |
// ------------------------------------------------------------------ |
|
149 |
void xmlStream::see_tag(const char* tag, bool push) { |
|
150 |
assert_if_no_error(!inside_attrs(), "cannot start new element inside attrs"); |
|
151 |
if (!push) return; |
|
152 |
||
153 |
// tag goes up until either null or space: |
|
154 |
const char* tag_end = strchr(tag, ' '); |
|
155 |
size_t tag_len = (tag_end == NULL) ? strlen(tag) : tag_end - tag; |
|
156 |
assert(tag_len > 0, "tag must not be empty"); |
|
157 |
// push the tag onto the stack, pulling down the pointer |
|
158 |
char* old_ptr = _element_close_stack_ptr; |
|
159 |
char* old_low = _element_close_stack_low; |
|
160 |
char* push_ptr = old_ptr - (tag_len+1); |
|
161 |
if (push_ptr < old_low) { |
|
162 |
int old_len = _element_close_stack_high - old_ptr; |
|
163 |
int new_len = old_len * 2; |
|
164 |
if (new_len < 100) new_len = 100; |
|
13195 | 165 |
char* new_low = NEW_C_HEAP_ARRAY(char, new_len, mtInternal); |
1 | 166 |
char* new_high = new_low + new_len; |
167 |
char* new_ptr = new_high - old_len; |
|
168 |
memcpy(new_ptr, old_ptr, old_len); |
|
169 |
_element_close_stack_high = new_high; |
|
170 |
_element_close_stack_low = new_low; |
|
171 |
_element_close_stack_ptr = new_ptr; |
|
27880
afb974a04396
8060074: os::free() takes MemoryTrackingLevel but doesn't need it
coleenp
parents:
24424
diff
changeset
|
172 |
FREE_C_HEAP_ARRAY(char, old_low); |
1 | 173 |
push_ptr = new_ptr - (tag_len+1); |
174 |
} |
|
175 |
assert(push_ptr >= _element_close_stack_low, "in range"); |
|
176 |
memcpy(push_ptr, tag, tag_len); |
|
177 |
push_ptr[tag_len] = 0; |
|
178 |
_element_close_stack_ptr = push_ptr; |
|
179 |
_element_depth += 1; |
|
180 |
} |
|
181 |
||
182 |
// ------------------------------------------------------------------ |
|
183 |
void xmlStream::pop_tag(const char* tag) { |
|
184 |
assert_if_no_error(!inside_attrs(), "cannot close element inside attrs"); |
|
185 |
assert(_element_depth > 0, "must be in an element to close"); |
|
186 |
assert(*tag != 0, "tag must not be empty"); |
|
187 |
char* cur_tag = _element_close_stack_ptr; |
|
188 |
bool bad_tag = false; |
|
189 |
while (*cur_tag != 0 && strcmp(cur_tag, tag) != 0) { |
|
190 |
this->print_cr("</%s> <!-- missing closing tag -->", cur_tag); |
|
191 |
_element_close_stack_ptr = (cur_tag += strlen(cur_tag) + 1); |
|
192 |
_element_depth -= 1; |
|
193 |
bad_tag = true; |
|
194 |
} |
|
195 |
if (*cur_tag == 0) { |
|
196 |
bad_tag = true; |
|
197 |
} else { |
|
198 |
// Pop the stack, by skipping over the tag and its null. |
|
199 |
_element_close_stack_ptr = cur_tag + strlen(cur_tag) + 1; |
|
200 |
_element_depth -= 1; |
|
201 |
} |
|
11727
c5dfa2639359
7130319: C2: running with -XX:+PrintOptoAssembly crashes the VM with assert(false) failed: bad tag in log
dlong
parents:
8921
diff
changeset
|
202 |
if (bad_tag && !VMThread::should_terminate() && !VM_Exit::vm_exited() && |
46589 | 203 |
!VMError::is_error_reported()) |
11727
c5dfa2639359
7130319: C2: running with -XX:+PrintOptoAssembly crashes the VM with assert(false) failed: bad tag in log
dlong
parents:
8921
diff
changeset
|
204 |
{ |
1 | 205 |
assert(false, "bad tag in log"); |
11727
c5dfa2639359
7130319: C2: running with -XX:+PrintOptoAssembly crashes the VM with assert(false) failed: bad tag in log
dlong
parents:
8921
diff
changeset
|
206 |
} |
1 | 207 |
} |
208 |
#endif |
|
209 |
||
210 |
||
211 |
// ------------------------------------------------------------------ |
|
212 |
// First word in formatted string is element kind, and any subsequent |
|
213 |
// words must be XML attributes. Outputs "<kind .../>". |
|
214 |
void xmlStream::elem(const char* format, ...) { |
|
215 |
va_list ap; |
|
216 |
va_start(ap, format); |
|
217 |
va_elem(format, ap); |
|
218 |
va_end(ap); |
|
219 |
} |
|
220 |
||
221 |
// ------------------------------------------------------------------ |
|
222 |
void xmlStream::va_elem(const char* format, va_list ap) { |
|
223 |
va_begin_elem(format, ap); |
|
224 |
end_elem(); |
|
225 |
} |
|
226 |
||
227 |
||
228 |
// ------------------------------------------------------------------ |
|
229 |
// First word in formatted string is element kind, and any subsequent |
|
230 |
// words must be XML attributes. Outputs "<kind ...", not including "/>". |
|
231 |
void xmlStream::begin_elem(const char* format, ...) { |
|
232 |
va_list ap; |
|
233 |
va_start(ap, format); |
|
234 |
va_tag(false, format, ap); |
|
235 |
va_end(ap); |
|
236 |
} |
|
237 |
||
238 |
// ------------------------------------------------------------------ |
|
239 |
void xmlStream::va_begin_elem(const char* format, va_list ap) { |
|
240 |
va_tag(false, format, ap); |
|
241 |
} |
|
242 |
||
243 |
// ------------------------------------------------------------------ |
|
244 |
// Outputs "/>". |
|
245 |
void xmlStream::end_elem() { |
|
246 |
assert(_markup_state == ELEM, "misplaced end_elem"); |
|
247 |
print_raw("/>\n"); |
|
248 |
_markup_state = BODY; |
|
249 |
} |
|
250 |
||
251 |
// ------------------------------------------------------------------ |
|
252 |
// Outputs formatted text, followed by "/>". |
|
253 |
void xmlStream::end_elem(const char* format, ...) { |
|
254 |
va_list ap; |
|
255 |
va_start(ap, format); |
|
256 |
out()->vprint(format, ap); |
|
257 |
va_end(ap); |
|
258 |
end_elem(); |
|
259 |
} |
|
260 |
||
261 |
||
262 |
// ------------------------------------------------------------------ |
|
263 |
// First word in formatted string is element kind, and any subsequent |
|
264 |
// words must be XML attributes. Outputs "<kind ...>". |
|
265 |
void xmlStream::head(const char* format, ...) { |
|
266 |
va_list ap; |
|
267 |
va_start(ap, format); |
|
268 |
va_head(format, ap); |
|
269 |
va_end(ap); |
|
270 |
} |
|
271 |
||
272 |
// ------------------------------------------------------------------ |
|
273 |
void xmlStream::va_head(const char* format, va_list ap) { |
|
274 |
va_begin_head(format, ap); |
|
275 |
end_head(); |
|
276 |
} |
|
277 |
||
278 |
// ------------------------------------------------------------------ |
|
279 |
// First word in formatted string is element kind, and any subsequent |
|
280 |
// words must be XML attributes. Outputs "<kind ...", not including ">". |
|
281 |
void xmlStream::begin_head(const char* format, ...) { |
|
282 |
va_list ap; |
|
283 |
va_start(ap, format); |
|
284 |
va_tag(true, format, ap); |
|
285 |
va_end(ap); |
|
286 |
} |
|
287 |
||
288 |
// ------------------------------------------------------------------ |
|
289 |
void xmlStream::va_begin_head(const char* format, va_list ap) { |
|
290 |
va_tag(true, format, ap); |
|
291 |
} |
|
292 |
||
293 |
// ------------------------------------------------------------------ |
|
294 |
// Outputs ">". |
|
295 |
void xmlStream::end_head() { |
|
296 |
assert(_markup_state == HEAD, "misplaced end_head"); |
|
297 |
print_raw(">\n"); |
|
298 |
_markup_state = BODY; |
|
299 |
} |
|
300 |
||
301 |
||
302 |
// ------------------------------------------------------------------ |
|
303 |
// Outputs formatted text, followed by ">". |
|
304 |
void xmlStream::end_head(const char* format, ...) { |
|
305 |
va_list ap; |
|
306 |
va_start(ap, format); |
|
307 |
out()->vprint(format, ap); |
|
308 |
va_end(ap); |
|
309 |
end_head(); |
|
310 |
} |
|
311 |
||
312 |
||
313 |
// ------------------------------------------------------------------ |
|
314 |
// Outputs "</kind>". |
|
315 |
void xmlStream::tail(const char* kind) { |
|
316 |
pop_tag(kind); |
|
317 |
print_raw("</"); |
|
318 |
print_raw(kind); |
|
319 |
print_raw(">\n"); |
|
320 |
} |
|
321 |
||
322 |
// ------------------------------------------------------------------ |
|
323 |
// Outputs "<kind_done ... stamp='D.DD'/> </kind>". |
|
324 |
void xmlStream::done(const char* format, ...) { |
|
325 |
va_list ap; |
|
326 |
va_start(ap, format); |
|
327 |
va_done(format, ap); |
|
328 |
va_end(ap); |
|
329 |
} |
|
330 |
||
331 |
// ------------------------------------------------------------------ |
|
332 |
// Outputs "<kind_done stamp='D.DD'/> </kind>". |
|
333 |
// Because done_raw() doesn't need to format strings, it's simpler than |
|
334 |
// done(), and can be called safely by fatal error handler. |
|
335 |
void xmlStream::done_raw(const char* kind) { |
|
336 |
print_raw("<"); |
|
337 |
print_raw(kind); |
|
338 |
print_raw("_done stamp='"); |
|
339 |
out()->stamp(); |
|
340 |
print_raw_cr("'/>"); |
|
341 |
print_raw("</"); |
|
342 |
print_raw(kind); |
|
343 |
print_raw_cr(">"); |
|
344 |
} |
|
345 |
||
33604
ad1cd9269bd4
8139116: Fixes for warning "format not a string literal"
goetz
parents:
28477
diff
changeset
|
346 |
// If you remove the PRAGMA, this fails to compile with clang-503.0.40. |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
347 |
PRAGMA_DIAG_PUSH |
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
348 |
PRAGMA_FORMAT_NONLITERAL_IGNORED |
1 | 349 |
// ------------------------------------------------------------------ |
350 |
void xmlStream::va_done(const char* format, va_list ap) { |
|
351 |
char buffer[200]; |
|
33794 | 352 |
size_t format_len = strlen(format); |
353 |
guarantee(format_len + 10 < sizeof(buffer), "bigger format buffer"); |
|
1 | 354 |
const char* kind = format; |
355 |
const char* kind_end = strchr(kind, ' '); |
|
53882
ca682d9d8db5
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
mikael
parents:
49361
diff
changeset
|
356 |
size_t kind_len; |
33794 | 357 |
if (kind_end != NULL) { |
53882
ca682d9d8db5
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
mikael
parents:
49361
diff
changeset
|
358 |
kind_len = kind_end - kind; |
53908
45a23c64d0f6
8219583: Windows build failure after JDK-8214777 (Avoid some GCC 8.X strncpy() errors in HotSpot)
shade
parents:
53882
diff
changeset
|
359 |
int n = os::snprintf(buffer, sizeof(buffer), "%.*s_done", (int)kind_len, kind); |
53882
ca682d9d8db5
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
mikael
parents:
49361
diff
changeset
|
360 |
assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string"); |
ca682d9d8db5
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
mikael
parents:
49361
diff
changeset
|
361 |
} else { |
ca682d9d8db5
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
mikael
parents:
49361
diff
changeset
|
362 |
kind_len = format_len; |
53908
45a23c64d0f6
8219583: Windows build failure after JDK-8214777 (Avoid some GCC 8.X strncpy() errors in HotSpot)
shade
parents:
53882
diff
changeset
|
363 |
int n = os::snprintf(buffer, sizeof(buffer), "%s_done%s", kind, kind + kind_len); |
53882
ca682d9d8db5
8214777: Avoid some GCC 8.X strncpy() errors in HotSpot
mikael
parents:
49361
diff
changeset
|
364 |
assert((size_t)n < sizeof(buffer), "Unexpected number of characters in string"); |
33794 | 365 |
} |
1 | 366 |
// Output the trailing event with the timestamp. |
367 |
va_begin_elem(buffer, ap); |
|
368 |
stamp(); |
|
369 |
end_elem(); |
|
370 |
// Output the tail-tag of the enclosing element. |
|
371 |
buffer[kind_len] = 0; |
|
372 |
tail(buffer); |
|
373 |
} |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
374 |
PRAGMA_DIAG_POP |
1 | 375 |
|
376 |
// Output a timestamp attribute. |
|
377 |
void xmlStream::stamp() { |
|
378 |
assert_if_no_error(inside_attrs(), "stamp must be an attribute"); |
|
379 |
print_raw(" stamp='"); |
|
380 |
out()->stamp(); |
|
381 |
print_raw("'"); |
|
382 |
} |
|
383 |
||
384 |
||
385 |
// ------------------------------------------------------------------ |
|
386 |
// Output a method attribute, in the form " method='pkg/cls name sig'". |
|
387 |
// This is used only when there is no ciMethod available. |
|
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46589
diff
changeset
|
388 |
void xmlStream::method(const methodHandle& method) { |
1 | 389 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
390 |
if (method.is_null()) return; |
|
391 |
print_raw(" method='"); |
|
392 |
method_text(method); |
|
393 |
print("' bytes='%d'", method->code_size()); |
|
394 |
print(" count='%d'", method->invocation_count()); |
|
395 |
int bec = method->backedge_count(); |
|
396 |
if (bec != 0) print(" backedge_count='%d'", bec); |
|
397 |
print(" iicount='%d'", method->interpreter_invocation_count()); |
|
398 |
int throwouts = method->interpreter_throwout_count(); |
|
399 |
if (throwouts != 0) print(" throwouts='%d'", throwouts); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
400 |
MethodData* mdo = method->method_data(); |
1 | 401 |
if (mdo != NULL) { |
402 |
uint cnt; |
|
403 |
cnt = mdo->decompile_count(); |
|
404 |
if (cnt != 0) print(" decompiles='%d'", cnt); |
|
405 |
for (uint reason = 0; reason < mdo->trap_reason_limit(); reason++) { |
|
406 |
cnt = mdo->trap_count(reason); |
|
407 |
if (cnt != 0) print(" %s_traps='%d'", Deoptimization::trap_reason_name(reason), cnt); |
|
408 |
} |
|
409 |
cnt = mdo->overflow_trap_count(); |
|
410 |
if (cnt != 0) print(" overflow_traps='%d'", cnt); |
|
411 |
cnt = mdo->overflow_recompile_count(); |
|
412 |
if (cnt != 0) print(" overflow_recompiles='%d'", cnt); |
|
413 |
} |
|
414 |
} |
|
415 |
||
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46589
diff
changeset
|
416 |
void xmlStream::method_text(const methodHandle& method) { |
24002
4e6a72032a99
8005079: fix LogCompilation for incremental inlining
roland
parents:
13728
diff
changeset
|
417 |
ResourceMark rm; |
1 | 418 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
419 |
if (method.is_null()) return; |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
24002
diff
changeset
|
420 |
text()->print("%s", method->method_holder()->external_name()); |
1 | 421 |
print_raw(" "); // " " is easier for tools to parse than "::" |
422 |
method->name()->print_symbol_on(text()); |
|
423 |
print_raw(" "); // separator |
|
424 |
method->signature()->print_symbol_on(text()); |
|
425 |
} |
|
426 |
||
427 |
||
428 |
// ------------------------------------------------------------------ |
|
429 |
// Output a klass attribute, in the form " klass='pkg/cls'". |
|
430 |
// This is used only when there is no ciKlass available. |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
37248
diff
changeset
|
431 |
void xmlStream::klass(Klass* klass) { |
1 | 432 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
37248
diff
changeset
|
433 |
if (klass == NULL) return; |
1 | 434 |
print_raw(" klass='"); |
435 |
klass_text(klass); |
|
436 |
print_raw("'"); |
|
437 |
} |
|
438 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
37248
diff
changeset
|
439 |
void xmlStream::klass_text(Klass* klass) { |
1 | 440 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
37248
diff
changeset
|
441 |
if (klass == NULL) return; |
1 | 442 |
//klass->print_short_name(log->out()); |
443 |
klass->name()->print_symbol_on(out()); |
|
444 |
} |
|
445 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
446 |
void xmlStream::name(const Symbol* name) { |
1 | 447 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
448 |
if (name == NULL) return; |
1 | 449 |
print_raw(" name='"); |
450 |
name_text(name); |
|
451 |
print_raw("'"); |
|
452 |
} |
|
453 |
||
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
454 |
void xmlStream::name_text(const Symbol* name) { |
1 | 455 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
456 |
if (name == NULL) return; |
1 | 457 |
//name->print_short_name(text()); |
458 |
name->print_symbol_on(text()); |
|
459 |
} |
|
460 |
||
461 |
void xmlStream::object(const char* attr, Handle x) { |
|
462 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
463 |
if (x == NULL) return; |
1 | 464 |
print_raw(" "); |
465 |
print_raw(attr); |
|
466 |
print_raw("='"); |
|
467 |
object_text(x); |
|
468 |
print_raw("'"); |
|
469 |
} |
|
470 |
||
471 |
void xmlStream::object_text(Handle x) { |
|
472 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
473 |
if (x == NULL) return; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
474 |
x->print_value_on(text()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
475 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
476 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
477 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
478 |
void xmlStream::object(const char* attr, Metadata* x) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
479 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
480 |
if (x == NULL) return; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
481 |
print_raw(" "); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
482 |
print_raw(attr); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
483 |
print_raw("='"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
484 |
object_text(x); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
485 |
print_raw("'"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
486 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
487 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
488 |
void xmlStream::object_text(Metadata* x) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
489 |
assert_if_no_error(inside_attrs(), "printing attributes"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
490 |
if (x == NULL) return; |
1 | 491 |
//x->print_value_on(text()); |
492 |
if (x->is_method()) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
493 |
method_text((Method*)x); |
1 | 494 |
else if (x->is_klass()) |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
495 |
klass_text((Klass*)x); |
1 | 496 |
else |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13195
diff
changeset
|
497 |
ShouldNotReachHere(); // Add impl if this is reached. |
1 | 498 |
} |
499 |
||
500 |
||
501 |
void xmlStream::flush() { |
|
502 |
out()->flush(); |
|
503 |
_last_flush = count(); |
|
504 |
} |
|
505 |
||
506 |
void xmlTextStream::flush() { |
|
507 |
if (_outer_xmlStream == NULL) return; |
|
508 |
_outer_xmlStream->flush(); |
|
509 |
} |
|
510 |
||
511 |
void xmlTextStream::write(const char* str, size_t len) { |
|
512 |
if (_outer_xmlStream == NULL) return; |
|
513 |
_outer_xmlStream->write_text(str, len); |
|
514 |
update_position(str, len); |
|
515 |
} |