Mercurial > hg > graal-jvmci-8
annotate src/share/vm/oops/symbol.cpp @ 6972:bd7a7ce2e264
6830717: replay of compilations would help with debugging
Summary: When java process crashed in compiler thread, repeat the compilation process will help finding root cause. This is done with using SA dump application class data and replay data from core dump, then use debug version of jvm to recompile the problematic java method.
Reviewed-by: kvn, twisti, sspitsyn
Contributed-by: yumin.qi@oracle.com
author | minqi |
---|---|
date | Mon, 12 Nov 2012 14:03:53 -0800 |
parents | da91efe96a93 |
children | fcc9e7681d63 |
rev | line source |
---|---|
0 | 1 /* |
5979
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1138
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1138
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:
1138
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
25 |
1972 | 26 #include "precompiled.hpp" |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
27 #include "classfile/altHashing.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
28 #include "classfile/classLoaderData.hpp" |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
29 #include "oops/symbol.hpp" |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
30 #include "runtime/os.hpp" |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
31 #include "memory/allocation.inline.hpp" |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
32 #include "memory/resourceArea.hpp" |
0 | 33 |
5979
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
34 Symbol::Symbol(const u1* name, int length, int refcount) : _refcount(refcount), _length(length) { |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
35 _identity_hash = os::random(); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
36 for (int i = 0; i < _length; i++) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
37 byte_at_put(i, name[i]); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
38 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
39 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
40 |
5979
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
41 void* Symbol::operator new(size_t sz, int len, TRAPS) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
42 int alloc_size = size(len)*HeapWordSize; |
6197 | 43 address res = (address) AllocateHeap(alloc_size, mtSymbol); |
5979
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
44 return res; |
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
45 } |
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
46 |
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
47 void* Symbol::operator new(size_t sz, int len, Arena* arena, TRAPS) { |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
48 int alloc_size = size(len)*HeapWordSize; |
5979
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
49 address res = (address)arena->Amalloc(alloc_size); |
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
50 return res; |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
51 } |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
52 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
53 void* Symbol::operator new(size_t sz, int len, ClassLoaderData* loader_data, TRAPS) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
54 address res; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
55 int alloc_size = size(len)*HeapWordSize; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
56 res = (address) Metaspace::allocate(loader_data, size(len), true, |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
57 Metaspace::NonClassType, CHECK_NULL); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
58 return res; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
59 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
60 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
61 void Symbol::operator delete(void *p) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
62 assert(((Symbol*)p)->refcount() == 0, "should not call this"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
63 FreeHeap(p); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
64 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
65 |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
66 // ------------------------------------------------------------------ |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
67 // Symbol::equals |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
68 // |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
69 // Compares the symbol with a string of the given length. |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
70 bool Symbol::equals(const char* str, int len) const { |
0 | 71 int l = utf8_length(); |
72 if (l != len) return false; | |
73 while (l-- > 0) { | |
74 if (str[l] != (char) byte_at(l)) | |
75 return false; | |
76 } | |
77 assert(l == -1, "we should be at the beginning"); | |
78 return true; | |
79 } | |
80 | |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
81 |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
82 // ------------------------------------------------------------------ |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
83 // Symbol::starts_with |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
84 // |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
85 // Tests if the symbol starts with the specified prefix of the given |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
86 // length. |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
87 bool Symbol::starts_with(const char* prefix, int len) const { |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
88 if (len > utf8_length()) return false; |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
89 while (len-- > 0) { |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
90 if (prefix[len] != (char) byte_at(len)) |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
91 return false; |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
92 } |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
93 assert(len == -1, "we should be at the beginning"); |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
94 return true; |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
95 } |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
96 |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
97 |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
98 // ------------------------------------------------------------------ |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
99 // Symbol::index_of |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
100 // |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
101 // Finds if the given string is a substring of this symbol's utf8 bytes. |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
102 // Return -1 on failure. Otherwise return the first index where str occurs. |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
103 int Symbol::index_of_at(int i, const char* str, int len) const { |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
104 assert(i >= 0 && i <= utf8_length(), "oob"); |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
105 if (len <= 0) return 0; |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
106 char first_char = str[0]; |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
107 address bytes = (address) ((Symbol*)this)->base(); |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
108 address limit = bytes + utf8_length() - len; // inclusive limit |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
109 address scan = bytes + i; |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
110 if (scan > limit) |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
111 return -1; |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
112 for (; scan <= limit; scan++) { |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
113 scan = (address) memchr(scan, first_char, (limit + 1 - scan)); |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
114 if (scan == NULL) |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
115 return -1; // not found |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
116 assert(scan >= bytes+i && scan <= limit, "scan oob"); |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
117 if (memcmp(scan, str, len) == 0) |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
118 return (int)(scan - bytes); |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
119 } |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
120 return -1; |
1138
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
121 } |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
122 |
dd57230ba8fe
6893268: additional dynamic language related optimizations in C2
twisti
parents:
222
diff
changeset
|
123 |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
124 char* Symbol::as_C_string(char* buf, int size) const { |
0 | 125 if (size > 0) { |
126 int len = MIN2(size - 1, utf8_length()); | |
127 for (int i = 0; i < len; i++) { | |
128 buf[i] = byte_at(i); | |
129 } | |
130 buf[len] = '\0'; | |
131 } | |
132 return buf; | |
133 } | |
134 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
135 char* Symbol::as_C_string() const { |
0 | 136 int len = utf8_length(); |
137 char* str = NEW_RESOURCE_ARRAY(char, len + 1); | |
138 return as_C_string(str, len + 1); | |
139 } | |
140 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
141 char* Symbol::as_C_string_flexible_buffer(Thread* t, |
0 | 142 char* buf, int size) const { |
143 char* str; | |
144 int len = utf8_length(); | |
145 int buf_len = len + 1; | |
146 if (size < buf_len) { | |
147 str = NEW_RESOURCE_ARRAY(char, buf_len); | |
148 } else { | |
149 str = buf; | |
150 } | |
151 return as_C_string(str, buf_len); | |
152 } | |
153 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
154 void Symbol::print_symbol_on(outputStream* st) const { |
0 | 155 st = st ? st : tty; |
6972
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
156 st->print("%s", as_quoted_ascii()); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
157 } |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
158 |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
159 char* Symbol::as_quoted_ascii() const { |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
160 const char *ptr = (const char *)&_body[0]; |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
161 int quoted_length = UTF8::quoted_ascii_length(ptr, utf8_length()); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
162 char* result = NEW_RESOURCE_ARRAY(char, quoted_length + 1); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
163 UTF8::as_quoted_ascii(ptr, result, quoted_length + 1); |
bd7a7ce2e264
6830717: replay of compilations would help with debugging
minqi
parents:
6725
diff
changeset
|
164 return result; |
0 | 165 } |
166 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
167 jchar* Symbol::as_unicode(int& length) const { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
168 Symbol* this_ptr = (Symbol*)this; |
0 | 169 length = UTF8::unicode_length((char*)this_ptr->bytes(), utf8_length()); |
170 jchar* result = NEW_RESOURCE_ARRAY(jchar, length); | |
171 if (length > 0) { | |
172 UTF8::convert_to_unicode((char*)this_ptr->bytes(), result, length); | |
173 } | |
174 return result; | |
175 } | |
176 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
177 const char* Symbol::as_klass_external_name(char* buf, int size) const { |
0 | 178 if (size > 0) { |
179 char* str = as_C_string(buf, size); | |
180 int length = (int)strlen(str); | |
181 // Turn all '/'s into '.'s (also for array klasses) | |
182 for (int index = 0; index < length; index++) { | |
183 if (str[index] == '/') { | |
184 str[index] = '.'; | |
185 } | |
186 } | |
187 return str; | |
188 } else { | |
189 return buf; | |
190 } | |
191 } | |
192 | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
193 const char* Symbol::as_klass_external_name() const { |
0 | 194 char* str = as_C_string(); |
195 int length = (int)strlen(str); | |
196 // Turn all '/'s into '.'s (also for array klasses) | |
197 for (int index = 0; index < length; index++) { | |
198 if (str[index] == '/') { | |
199 str[index] = '.'; | |
200 } | |
201 } | |
202 return str; | |
203 } | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
204 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
205 // Alternate hashing for unbalanced symbol tables. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
206 unsigned int Symbol::new_hash(jint seed) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
207 ResourceMark rm; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
208 // Use alternate hashing algorithm on this symbol. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
209 return AltHashing::murmur3_32(seed, (const jbyte*)as_C_string(), utf8_length()); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
210 } |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
211 |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
212 void Symbol::print_on(outputStream* st) const { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
213 if (this == NULL) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
214 st->print_cr("NULL"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
215 } else { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
216 st->print("Symbol: '"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
217 print_symbol_on(st); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
218 st->print("'"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
219 st->print(" count %d", refcount()); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
220 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
221 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
222 |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
223 // The print_value functions are present in all builds, to support the |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
224 // disassembler and error reporting. |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
225 void Symbol::print_value_on(outputStream* st) const { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
226 if (this == NULL) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
227 st->print("NULL"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
228 } else { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
229 st->print("'"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
230 for (int i = 0; i < utf8_length(); i++) { |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
231 st->print("%c", byte_at(i)); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
232 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
233 st->print("'"); |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
234 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
235 } |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
236 |
5979
fc9d8850ab8b
7150058: Allocate symbols from null boot loader to an arena for NMT
coleenp
parents:
2426
diff
changeset
|
237 // SymbolTable prints this in its statistics |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
238 NOT_PRODUCT(int Symbol::_total_count = 0;) |