annotate src/share/vm/utilities/xmlstream.cpp @ 20543:e7d0505c8a30

8059758: Footprint regressions with JDK-8038423 Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything. Reviewed-by: jwilhelm, brutisso
author tschatzl
date Fri, 10 Oct 2014 15:51:58 +0200
parents 78bbf4d43a14
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 6725
diff changeset
2 * Copyright (c) 2002, 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: 1489
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1489
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: 1489
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 "code/nmethod.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "memory/allocation.inline.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
29 #include "oops/methodData.hpp"
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
30 #include "oops/method.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "runtime/deoptimization.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "runtime/vmThread.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #include "utilities/xmlstream.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 void xmlStream::initialize(outputStream* out) {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 _out = out;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 _last_flush = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 _markup_state = BODY;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 _text_init._outer_xmlStream = this;
a61af66fc99e Initial load
duke
parents:
diff changeset
41 _text = &_text_init;
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
44 _element_depth = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 int init_len = 100;
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 4897
diff changeset
46 char* init_buf = NEW_C_HEAP_ARRAY(char, init_len, mtInternal);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
47 _element_close_stack_low = init_buf;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 _element_close_stack_high = init_buf + init_len;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 _element_close_stack_ptr = init_buf + init_len - 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 _element_close_stack_ptr[0] = '\0';
a61af66fc99e Initial load
duke
parents:
diff changeset
51 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // Make sure each log uses the same base for time stamps.
a61af66fc99e Initial load
duke
parents:
diff changeset
54 if (is_open()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 _out->time_stamp().update_to(1);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 }
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
60 xmlStream::~xmlStream() {
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 4897
diff changeset
61 FREE_C_HEAP_ARRAY(char, _element_close_stack_low, mtInternal);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
62 }
a61af66fc99e Initial load
duke
parents:
diff changeset
63 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Pass the given chars directly to _out.
a61af66fc99e Initial load
duke
parents:
diff changeset
66 void xmlStream::write(const char* s, size_t len) {
a61af66fc99e Initial load
duke
parents:
diff changeset
67 if (!is_open()) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 out()->write(s, len);
222
2a1a77d3458f 6718676: putback for 6604014 is incomplete
never
parents: 0
diff changeset
70 update_position(s, len);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
71 }
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Pass the given chars directly to _out, except that
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // we watch for special "<&>" chars.
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // This is suitable for either attribute text or for body text.
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // We don't fool with "<![CDATA[" quotes, just single-character entities.
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // This makes it easier for dumb tools to parse the output.
a61af66fc99e Initial load
duke
parents:
diff changeset
79 void xmlStream::write_text(const char* s, size_t len) {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 if (!is_open()) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 size_t written = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
83 // All normally printed material goes inside XML quotes.
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // This leaves the output free to include markup also.
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Scan the string looking for inadvertant "<&>" chars
a61af66fc99e Initial load
duke
parents:
diff changeset
86 for (size_t i = 0; i < len; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 char ch = s[i];
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // Escape special chars.
a61af66fc99e Initial load
duke
parents:
diff changeset
89 const char* esc = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 switch (ch) {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // These are important only in attrs, but we do them always:
a61af66fc99e Initial load
duke
parents:
diff changeset
92 case '\'': esc = "&apos;"; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
93 case '"': esc = "&quot;"; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 case '<': esc = "&lt;"; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
95 case '&': esc = "&amp;"; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // This is a freebie.
a61af66fc99e Initial load
duke
parents:
diff changeset
97 case '>': esc = "&gt;"; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 if (esc != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 if (written < i) {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 out()->write(&s[written], i - written);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 written = i;
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104 out()->print_raw(esc);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 written++;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 }
a61af66fc99e Initial load
duke
parents:
diff changeset
107 }
a61af66fc99e Initial load
duke
parents:
diff changeset
108
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // Print the clean remainder. Usually, it is all of s.
a61af66fc99e Initial load
duke
parents:
diff changeset
110 if (written < len) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 out()->write(&s[written], len - written);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Outputs XML text, with special characters quoted.
a61af66fc99e Initial load
duke
parents:
diff changeset
117 void xmlStream::text(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 va_text(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
122 }
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 #define BUFLEN 2*K /* max size of output of individual print methods */
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
127 void xmlStream::va_tag(bool push, const char* format, va_list ap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 assert_if_no_error(!inside_attrs(), "cannot print tag inside attrs");
a61af66fc99e Initial load
duke
parents:
diff changeset
129 char buffer[BUFLEN];
a61af66fc99e Initial load
duke
parents:
diff changeset
130 size_t len;
a61af66fc99e Initial load
duke
parents:
diff changeset
131 const char* kind = do_vsnprintf(buffer, BUFLEN, format, ap, false, len);
a61af66fc99e Initial load
duke
parents:
diff changeset
132 see_tag(kind, push);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 print_raw("<");
a61af66fc99e Initial load
duke
parents:
diff changeset
134 write(kind, len);
a61af66fc99e Initial load
duke
parents:
diff changeset
135 _markup_state = (push ? HEAD : ELEM);
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
139 /// Debugging goo to make sure element tags nest properly.
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
142 void xmlStream::see_tag(const char* tag, bool push) {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 assert_if_no_error(!inside_attrs(), "cannot start new element inside attrs");
a61af66fc99e Initial load
duke
parents:
diff changeset
144 if (!push) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // tag goes up until either null or space:
a61af66fc99e Initial load
duke
parents:
diff changeset
147 const char* tag_end = strchr(tag, ' ');
a61af66fc99e Initial load
duke
parents:
diff changeset
148 size_t tag_len = (tag_end == NULL) ? strlen(tag) : tag_end - tag;
a61af66fc99e Initial load
duke
parents:
diff changeset
149 assert(tag_len > 0, "tag must not be empty");
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // push the tag onto the stack, pulling down the pointer
a61af66fc99e Initial load
duke
parents:
diff changeset
151 char* old_ptr = _element_close_stack_ptr;
a61af66fc99e Initial load
duke
parents:
diff changeset
152 char* old_low = _element_close_stack_low;
a61af66fc99e Initial load
duke
parents:
diff changeset
153 char* push_ptr = old_ptr - (tag_len+1);
a61af66fc99e Initial load
duke
parents:
diff changeset
154 if (push_ptr < old_low) {
a61af66fc99e Initial load
duke
parents:
diff changeset
155 int old_len = _element_close_stack_high - old_ptr;
a61af66fc99e Initial load
duke
parents:
diff changeset
156 int new_len = old_len * 2;
a61af66fc99e Initial load
duke
parents:
diff changeset
157 if (new_len < 100) new_len = 100;
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 4897
diff changeset
158 char* new_low = NEW_C_HEAP_ARRAY(char, new_len, mtInternal);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
159 char* new_high = new_low + new_len;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 char* new_ptr = new_high - old_len;
a61af66fc99e Initial load
duke
parents:
diff changeset
161 memcpy(new_ptr, old_ptr, old_len);
a61af66fc99e Initial load
duke
parents:
diff changeset
162 _element_close_stack_high = new_high;
a61af66fc99e Initial load
duke
parents:
diff changeset
163 _element_close_stack_low = new_low;
a61af66fc99e Initial load
duke
parents:
diff changeset
164 _element_close_stack_ptr = new_ptr;
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 4897
diff changeset
165 FREE_C_HEAP_ARRAY(char, old_low, mtInternal);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
166 push_ptr = new_ptr - (tag_len+1);
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168 assert(push_ptr >= _element_close_stack_low, "in range");
a61af66fc99e Initial load
duke
parents:
diff changeset
169 memcpy(push_ptr, tag, tag_len);
a61af66fc99e Initial load
duke
parents:
diff changeset
170 push_ptr[tag_len] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
171 _element_close_stack_ptr = push_ptr;
a61af66fc99e Initial load
duke
parents:
diff changeset
172 _element_depth += 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 }
a61af66fc99e Initial load
duke
parents:
diff changeset
174
a61af66fc99e Initial load
duke
parents:
diff changeset
175 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
176 void xmlStream::pop_tag(const char* tag) {
a61af66fc99e Initial load
duke
parents:
diff changeset
177 assert_if_no_error(!inside_attrs(), "cannot close element inside attrs");
a61af66fc99e Initial load
duke
parents:
diff changeset
178 assert(_element_depth > 0, "must be in an element to close");
a61af66fc99e Initial load
duke
parents:
diff changeset
179 assert(*tag != 0, "tag must not be empty");
a61af66fc99e Initial load
duke
parents:
diff changeset
180 char* cur_tag = _element_close_stack_ptr;
a61af66fc99e Initial load
duke
parents:
diff changeset
181 bool bad_tag = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 while (*cur_tag != 0 && strcmp(cur_tag, tag) != 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
183 this->print_cr("</%s> <!-- missing closing tag -->", cur_tag);
a61af66fc99e Initial load
duke
parents:
diff changeset
184 _element_close_stack_ptr = (cur_tag += strlen(cur_tag) + 1);
a61af66fc99e Initial load
duke
parents:
diff changeset
185 _element_depth -= 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
186 bad_tag = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
187 }
a61af66fc99e Initial load
duke
parents:
diff changeset
188 if (*cur_tag == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 bad_tag = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
190 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // Pop the stack, by skipping over the tag and its null.
a61af66fc99e Initial load
duke
parents:
diff changeset
192 _element_close_stack_ptr = cur_tag + strlen(cur_tag) + 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
193 _element_depth -= 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
4897
1ac084126285 7130319: C2: running with -XX:+PrintOptoAssembly crashes the VM with assert(false) failed: bad tag in log
dlong
parents: 2426
diff changeset
195 if (bad_tag && !VMThread::should_terminate() && !VM_Exit::vm_exited() &&
1ac084126285 7130319: C2: running with -XX:+PrintOptoAssembly crashes the VM with assert(false) failed: bad tag in log
dlong
parents: 2426
diff changeset
196 !is_error_reported())
1ac084126285 7130319: C2: running with -XX:+PrintOptoAssembly crashes the VM with assert(false) failed: bad tag in log
dlong
parents: 2426
diff changeset
197 {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
198 assert(false, "bad tag in log");
4897
1ac084126285 7130319: C2: running with -XX:+PrintOptoAssembly crashes the VM with assert(false) failed: bad tag in log
dlong
parents: 2426
diff changeset
199 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
200 }
a61af66fc99e Initial load
duke
parents:
diff changeset
201 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203
a61af66fc99e Initial load
duke
parents:
diff changeset
204 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
205 // First word in formatted string is element kind, and any subsequent
a61af66fc99e Initial load
duke
parents:
diff changeset
206 // words must be XML attributes. Outputs "<kind .../>".
a61af66fc99e Initial load
duke
parents:
diff changeset
207 void xmlStream::elem(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
208 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
209 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
210 va_elem(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
211 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
212 }
a61af66fc99e Initial load
duke
parents:
diff changeset
213
a61af66fc99e Initial load
duke
parents:
diff changeset
214 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
215 void xmlStream::va_elem(const char* format, va_list ap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
216 va_begin_elem(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
217 end_elem();
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
222 // First word in formatted string is element kind, and any subsequent
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // words must be XML attributes. Outputs "<kind ...", not including "/>".
a61af66fc99e Initial load
duke
parents:
diff changeset
224 void xmlStream::begin_elem(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
225 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
226 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
227 va_tag(false, format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
229 }
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
232 void xmlStream::va_begin_elem(const char* format, va_list ap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
233 va_tag(false, format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
234 }
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
237 // Outputs "/>".
a61af66fc99e Initial load
duke
parents:
diff changeset
238 void xmlStream::end_elem() {
a61af66fc99e Initial load
duke
parents:
diff changeset
239 assert(_markup_state == ELEM, "misplaced end_elem");
a61af66fc99e Initial load
duke
parents:
diff changeset
240 print_raw("/>\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
241 _markup_state = BODY;
a61af66fc99e Initial load
duke
parents:
diff changeset
242 }
a61af66fc99e Initial load
duke
parents:
diff changeset
243
a61af66fc99e Initial load
duke
parents:
diff changeset
244 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
245 // Outputs formatted text, followed by "/>".
a61af66fc99e Initial load
duke
parents:
diff changeset
246 void xmlStream::end_elem(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
247 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
248 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
249 out()->vprint(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
250 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
251 end_elem();
a61af66fc99e Initial load
duke
parents:
diff changeset
252 }
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
256 // First word in formatted string is element kind, and any subsequent
a61af66fc99e Initial load
duke
parents:
diff changeset
257 // words must be XML attributes. Outputs "<kind ...>".
a61af66fc99e Initial load
duke
parents:
diff changeset
258 void xmlStream::head(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
260 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
261 va_head(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
262 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
263 }
a61af66fc99e Initial load
duke
parents:
diff changeset
264
a61af66fc99e Initial load
duke
parents:
diff changeset
265 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
266 void xmlStream::va_head(const char* format, va_list ap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
267 va_begin_head(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
268 end_head();
a61af66fc99e Initial load
duke
parents:
diff changeset
269 }
a61af66fc99e Initial load
duke
parents:
diff changeset
270
a61af66fc99e Initial load
duke
parents:
diff changeset
271 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
272 // First word in formatted string is element kind, and any subsequent
a61af66fc99e Initial load
duke
parents:
diff changeset
273 // words must be XML attributes. Outputs "<kind ...", not including ">".
a61af66fc99e Initial load
duke
parents:
diff changeset
274 void xmlStream::begin_head(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
275 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
276 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 va_tag(true, format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
282 void xmlStream::va_begin_head(const char* format, va_list ap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
283 va_tag(true, format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
284 }
a61af66fc99e Initial load
duke
parents:
diff changeset
285
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
287 // Outputs ">".
a61af66fc99e Initial load
duke
parents:
diff changeset
288 void xmlStream::end_head() {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 assert(_markup_state == HEAD, "misplaced end_head");
a61af66fc99e Initial load
duke
parents:
diff changeset
290 print_raw(">\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
291 _markup_state = BODY;
a61af66fc99e Initial load
duke
parents:
diff changeset
292 }
a61af66fc99e Initial load
duke
parents:
diff changeset
293
a61af66fc99e Initial load
duke
parents:
diff changeset
294
a61af66fc99e Initial load
duke
parents:
diff changeset
295 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // Outputs formatted text, followed by ">".
a61af66fc99e Initial load
duke
parents:
diff changeset
297 void xmlStream::end_head(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
298 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
299 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
300 out()->vprint(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
301 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
302 end_head();
a61af66fc99e Initial load
duke
parents:
diff changeset
303 }
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
307 // Outputs "</kind>".
a61af66fc99e Initial load
duke
parents:
diff changeset
308 void xmlStream::tail(const char* kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
309 pop_tag(kind);
a61af66fc99e Initial load
duke
parents:
diff changeset
310 print_raw("</");
a61af66fc99e Initial load
duke
parents:
diff changeset
311 print_raw(kind);
a61af66fc99e Initial load
duke
parents:
diff changeset
312 print_raw(">\n");
a61af66fc99e Initial load
duke
parents:
diff changeset
313 }
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
316 // Outputs "<kind_done ... stamp='D.DD'/> </kind>".
a61af66fc99e Initial load
duke
parents:
diff changeset
317 void xmlStream::done(const char* format, ...) {
a61af66fc99e Initial load
duke
parents:
diff changeset
318 va_list ap;
a61af66fc99e Initial load
duke
parents:
diff changeset
319 va_start(ap, format);
a61af66fc99e Initial load
duke
parents:
diff changeset
320 va_done(format, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
321 va_end(ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
322 }
a61af66fc99e Initial load
duke
parents:
diff changeset
323
a61af66fc99e Initial load
duke
parents:
diff changeset
324 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
325 // Outputs "<kind_done stamp='D.DD'/> </kind>".
a61af66fc99e Initial load
duke
parents:
diff changeset
326 // Because done_raw() doesn't need to format strings, it's simpler than
a61af66fc99e Initial load
duke
parents:
diff changeset
327 // done(), and can be called safely by fatal error handler.
a61af66fc99e Initial load
duke
parents:
diff changeset
328 void xmlStream::done_raw(const char* kind) {
a61af66fc99e Initial load
duke
parents:
diff changeset
329 print_raw("<");
a61af66fc99e Initial load
duke
parents:
diff changeset
330 print_raw(kind);
a61af66fc99e Initial load
duke
parents:
diff changeset
331 print_raw("_done stamp='");
a61af66fc99e Initial load
duke
parents:
diff changeset
332 out()->stamp();
a61af66fc99e Initial load
duke
parents:
diff changeset
333 print_raw_cr("'/>");
a61af66fc99e Initial load
duke
parents:
diff changeset
334 print_raw("</");
a61af66fc99e Initial load
duke
parents:
diff changeset
335 print_raw(kind);
a61af66fc99e Initial load
duke
parents:
diff changeset
336 print_raw_cr(">");
a61af66fc99e Initial load
duke
parents:
diff changeset
337 }
a61af66fc99e Initial load
duke
parents:
diff changeset
338
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 6725
diff changeset
339 PRAGMA_DIAG_PUSH
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 6725
diff changeset
340 PRAGMA_FORMAT_NONLITERAL_IGNORED
0
a61af66fc99e Initial load
duke
parents:
diff changeset
341 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
342 void xmlStream::va_done(const char* format, va_list ap) {
a61af66fc99e Initial load
duke
parents:
diff changeset
343 char buffer[200];
1489
cff162798819 6888953: some calls to function-like macros are missing semicolons
jcoomes
parents: 222
diff changeset
344 guarantee(strlen(format) + 10 < sizeof(buffer), "bigger format buffer");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
345 const char* kind = format;
a61af66fc99e Initial load
duke
parents:
diff changeset
346 const char* kind_end = strchr(kind, ' ');
a61af66fc99e Initial load
duke
parents:
diff changeset
347 size_t kind_len = (kind_end != NULL) ? (kind_end - kind) : strlen(kind);
a61af66fc99e Initial load
duke
parents:
diff changeset
348 strncpy(buffer, kind, kind_len);
a61af66fc99e Initial load
duke
parents:
diff changeset
349 strcpy(buffer + kind_len, "_done");
a61af66fc99e Initial load
duke
parents:
diff changeset
350 strcat(buffer, format + kind_len);
a61af66fc99e Initial load
duke
parents:
diff changeset
351 // Output the trailing event with the timestamp.
a61af66fc99e Initial load
duke
parents:
diff changeset
352 va_begin_elem(buffer, ap);
a61af66fc99e Initial load
duke
parents:
diff changeset
353 stamp();
a61af66fc99e Initial load
duke
parents:
diff changeset
354 end_elem();
a61af66fc99e Initial load
duke
parents:
diff changeset
355 // Output the tail-tag of the enclosing element.
a61af66fc99e Initial load
duke
parents:
diff changeset
356 buffer[kind_len] = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
357 tail(buffer);
a61af66fc99e Initial load
duke
parents:
diff changeset
358 }
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 6725
diff changeset
359 PRAGMA_DIAG_POP
0
a61af66fc99e Initial load
duke
parents:
diff changeset
360
a61af66fc99e Initial load
duke
parents:
diff changeset
361 // Output a timestamp attribute.
a61af66fc99e Initial load
duke
parents:
diff changeset
362 void xmlStream::stamp() {
a61af66fc99e Initial load
duke
parents:
diff changeset
363 assert_if_no_error(inside_attrs(), "stamp must be an attribute");
a61af66fc99e Initial load
duke
parents:
diff changeset
364 print_raw(" stamp='");
a61af66fc99e Initial load
duke
parents:
diff changeset
365 out()->stamp();
a61af66fc99e Initial load
duke
parents:
diff changeset
366 print_raw("'");
a61af66fc99e Initial load
duke
parents:
diff changeset
367 }
a61af66fc99e Initial load
duke
parents:
diff changeset
368
a61af66fc99e Initial load
duke
parents:
diff changeset
369
a61af66fc99e Initial load
duke
parents:
diff changeset
370 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
371 // Output a method attribute, in the form " method='pkg/cls name sig'".
a61af66fc99e Initial load
duke
parents:
diff changeset
372 // This is used only when there is no ciMethod available.
a61af66fc99e Initial load
duke
parents:
diff changeset
373 void xmlStream::method(methodHandle method) {
a61af66fc99e Initial load
duke
parents:
diff changeset
374 assert_if_no_error(inside_attrs(), "printing attributes");
a61af66fc99e Initial load
duke
parents:
diff changeset
375 if (method.is_null()) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
376 print_raw(" method='");
a61af66fc99e Initial load
duke
parents:
diff changeset
377 method_text(method);
a61af66fc99e Initial load
duke
parents:
diff changeset
378 print("' bytes='%d'", method->code_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
379 print(" count='%d'", method->invocation_count());
a61af66fc99e Initial load
duke
parents:
diff changeset
380 int bec = method->backedge_count();
a61af66fc99e Initial load
duke
parents:
diff changeset
381 if (bec != 0) print(" backedge_count='%d'", bec);
a61af66fc99e Initial load
duke
parents:
diff changeset
382 print(" iicount='%d'", method->interpreter_invocation_count());
a61af66fc99e Initial load
duke
parents:
diff changeset
383 int throwouts = method->interpreter_throwout_count();
a61af66fc99e Initial load
duke
parents:
diff changeset
384 if (throwouts != 0) print(" throwouts='%d'", throwouts);
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
385 MethodData* mdo = method->method_data();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
386 if (mdo != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
387 uint cnt;
a61af66fc99e Initial load
duke
parents:
diff changeset
388 cnt = mdo->decompile_count();
a61af66fc99e Initial load
duke
parents:
diff changeset
389 if (cnt != 0) print(" decompiles='%d'", cnt);
a61af66fc99e Initial load
duke
parents:
diff changeset
390 for (uint reason = 0; reason < mdo->trap_reason_limit(); reason++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
391 cnt = mdo->trap_count(reason);
a61af66fc99e Initial load
duke
parents:
diff changeset
392 if (cnt != 0) print(" %s_traps='%d'", Deoptimization::trap_reason_name(reason), cnt);
a61af66fc99e Initial load
duke
parents:
diff changeset
393 }
a61af66fc99e Initial load
duke
parents:
diff changeset
394 cnt = mdo->overflow_trap_count();
a61af66fc99e Initial load
duke
parents:
diff changeset
395 if (cnt != 0) print(" overflow_traps='%d'", cnt);
a61af66fc99e Initial load
duke
parents:
diff changeset
396 cnt = mdo->overflow_recompile_count();
a61af66fc99e Initial load
duke
parents:
diff changeset
397 if (cnt != 0) print(" overflow_recompiles='%d'", cnt);
a61af66fc99e Initial load
duke
parents:
diff changeset
398 }
a61af66fc99e Initial load
duke
parents:
diff changeset
399 }
a61af66fc99e Initial load
duke
parents:
diff changeset
400
a61af66fc99e Initial load
duke
parents:
diff changeset
401 void xmlStream::method_text(methodHandle method) {
a61af66fc99e Initial load
duke
parents:
diff changeset
402 assert_if_no_error(inside_attrs(), "printing attributes");
a61af66fc99e Initial load
duke
parents:
diff changeset
403 if (method.is_null()) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
404 //method->print_short_name(text());
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
405 method->method_holder()->name()->print_symbol_on(text());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
406 print_raw(" "); // " " is easier for tools to parse than "::"
a61af66fc99e Initial load
duke
parents:
diff changeset
407 method->name()->print_symbol_on(text());
a61af66fc99e Initial load
duke
parents:
diff changeset
408 print_raw(" "); // separator
a61af66fc99e Initial load
duke
parents:
diff changeset
409 method->signature()->print_symbol_on(text());
a61af66fc99e Initial load
duke
parents:
diff changeset
410 }
a61af66fc99e Initial load
duke
parents:
diff changeset
411
a61af66fc99e Initial load
duke
parents:
diff changeset
412
a61af66fc99e Initial load
duke
parents:
diff changeset
413 // ------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
414 // Output a klass attribute, in the form " klass='pkg/cls'".
a61af66fc99e Initial load
duke
parents:
diff changeset
415 // This is used only when there is no ciKlass available.
a61af66fc99e Initial load
duke
parents:
diff changeset
416 void xmlStream::klass(KlassHandle klass) {
a61af66fc99e Initial load
duke
parents:
diff changeset
417 assert_if_no_error(inside_attrs(), "printing attributes");
a61af66fc99e Initial load
duke
parents:
diff changeset
418 if (klass.is_null()) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
419 print_raw(" klass='");
a61af66fc99e Initial load
duke
parents:
diff changeset
420 klass_text(klass);
a61af66fc99e Initial load
duke
parents:
diff changeset
421 print_raw("'");
a61af66fc99e Initial load
duke
parents:
diff changeset
422 }
a61af66fc99e Initial load
duke
parents:
diff changeset
423
a61af66fc99e Initial load
duke
parents:
diff changeset
424 void xmlStream::klass_text(KlassHandle klass) {
a61af66fc99e Initial load
duke
parents:
diff changeset
425 assert_if_no_error(inside_attrs(), "printing attributes");
a61af66fc99e Initial load
duke
parents:
diff changeset
426 if (klass.is_null()) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
427 //klass->print_short_name(log->out());
a61af66fc99e Initial load
duke
parents:
diff changeset
428 klass->name()->print_symbol_on(out());
a61af66fc99e Initial load
duke
parents:
diff changeset
429 }
a61af66fc99e Initial load
duke
parents:
diff changeset
430
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
431 void xmlStream::name(const Symbol* name) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
432 assert_if_no_error(inside_attrs(), "printing attributes");
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
433 if (name == NULL) return;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
434 print_raw(" name='");
a61af66fc99e Initial load
duke
parents:
diff changeset
435 name_text(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
436 print_raw("'");
a61af66fc99e Initial load
duke
parents:
diff changeset
437 }
a61af66fc99e Initial load
duke
parents:
diff changeset
438
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
439 void xmlStream::name_text(const Symbol* name) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
440 assert_if_no_error(inside_attrs(), "printing attributes");
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
441 if (name == NULL) return;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
442 //name->print_short_name(text());
a61af66fc99e Initial load
duke
parents:
diff changeset
443 name->print_symbol_on(text());
a61af66fc99e Initial load
duke
parents:
diff changeset
444 }
a61af66fc99e Initial load
duke
parents:
diff changeset
445
a61af66fc99e Initial load
duke
parents:
diff changeset
446 void xmlStream::object(const char* attr, Handle x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
447 assert_if_no_error(inside_attrs(), "printing attributes");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
448 if (x == NULL) return;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
449 print_raw(" ");
a61af66fc99e Initial load
duke
parents:
diff changeset
450 print_raw(attr);
a61af66fc99e Initial load
duke
parents:
diff changeset
451 print_raw("='");
a61af66fc99e Initial load
duke
parents:
diff changeset
452 object_text(x);
a61af66fc99e Initial load
duke
parents:
diff changeset
453 print_raw("'");
a61af66fc99e Initial load
duke
parents:
diff changeset
454 }
a61af66fc99e Initial load
duke
parents:
diff changeset
455
a61af66fc99e Initial load
duke
parents:
diff changeset
456 void xmlStream::object_text(Handle x) {
a61af66fc99e Initial load
duke
parents:
diff changeset
457 assert_if_no_error(inside_attrs(), "printing attributes");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
458 if (x == NULL) return;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
459 x->print_value_on(text());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
460 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
461
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
462
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
463 void xmlStream::object(const char* attr, Metadata* x) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
464 assert_if_no_error(inside_attrs(), "printing attributes");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
465 if (x == NULL) return;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
466 print_raw(" ");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
467 print_raw(attr);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
468 print_raw("='");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
469 object_text(x);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
470 print_raw("'");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
471 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
472
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
473 void xmlStream::object_text(Metadata* x) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
474 assert_if_no_error(inside_attrs(), "printing attributes");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
475 if (x == NULL) return;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
476 //x->print_value_on(text());
a61af66fc99e Initial load
duke
parents:
diff changeset
477 if (x->is_method())
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
478 method_text((Method*)x);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
479 else if (x->is_klass())
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
480 klass_text((Klass*)x);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
481 else
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6197
diff changeset
482 ShouldNotReachHere(); // Add impl if this is reached.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
483 }
a61af66fc99e Initial load
duke
parents:
diff changeset
484
a61af66fc99e Initial load
duke
parents:
diff changeset
485
a61af66fc99e Initial load
duke
parents:
diff changeset
486 void xmlStream::flush() {
a61af66fc99e Initial load
duke
parents:
diff changeset
487 out()->flush();
a61af66fc99e Initial load
duke
parents:
diff changeset
488 _last_flush = count();
a61af66fc99e Initial load
duke
parents:
diff changeset
489 }
a61af66fc99e Initial load
duke
parents:
diff changeset
490
a61af66fc99e Initial load
duke
parents:
diff changeset
491 void xmlTextStream::flush() {
a61af66fc99e Initial load
duke
parents:
diff changeset
492 if (_outer_xmlStream == NULL) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
493 _outer_xmlStream->flush();
a61af66fc99e Initial load
duke
parents:
diff changeset
494 }
a61af66fc99e Initial load
duke
parents:
diff changeset
495
a61af66fc99e Initial load
duke
parents:
diff changeset
496 void xmlTextStream::write(const char* str, size_t len) {
a61af66fc99e Initial load
duke
parents:
diff changeset
497 if (_outer_xmlStream == NULL) return;
a61af66fc99e Initial load
duke
parents:
diff changeset
498 _outer_xmlStream->write_text(str, len);
a61af66fc99e Initial load
duke
parents:
diff changeset
499 update_position(str, len);
a61af66fc99e Initial load
duke
parents:
diff changeset
500 }