Mercurial > hg > graal-jvmci-8
annotate src/share/vm/oops/constantPoolOop.cpp @ 2119:d4fca0a6abde
7011386: race in objArrayKlass::array_klass_impl
Summary: Move _lower_dimension field initialization before _higher_dimension and add storestore barrier.
Reviewed-by: dholmes, iveresov, never
author | kvn |
---|---|
date | Tue, 11 Jan 2011 20:26:13 -0800 |
parents | dad31fc330cd |
children | 3582bf76420e |
rev | line source |
---|---|
0 | 1 /* |
1579 | 2 * Copyright (c) 1997, 2010, 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:
1142
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1142
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:
1142
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/javaClasses.hpp" | |
27 #include "classfile/symbolTable.hpp" | |
28 #include "classfile/systemDictionary.hpp" | |
29 #include "classfile/vmSymbols.hpp" | |
30 #include "interpreter/linkResolver.hpp" | |
31 #include "memory/oopFactory.hpp" | |
32 #include "memory/universe.inline.hpp" | |
33 #include "oops/constantPoolOop.hpp" | |
34 #include "oops/instanceKlass.hpp" | |
35 #include "oops/objArrayKlass.hpp" | |
36 #include "oops/oop.inline.hpp" | |
37 #include "runtime/fieldType.hpp" | |
38 #include "runtime/init.hpp" | |
39 #include "runtime/signature.hpp" | |
40 #include "runtime/vframe.hpp" | |
0 | 41 |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
42 void constantPoolOopDesc::set_flag_at(FlagBit fb) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
43 const int MAX_STATE_CHANGES = 2; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
44 for (int i = MAX_STATE_CHANGES + 10; i > 0; i--) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
45 int oflags = _flags; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
46 int nflags = oflags | (1 << (int)fb); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
47 if (Atomic::cmpxchg(nflags, &_flags, oflags) == oflags) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
48 return; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
49 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
50 assert(false, "failed to cmpxchg flags"); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
51 _flags |= (1 << (int)fb); // better than nothing |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
52 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
53 |
0 | 54 klassOop constantPoolOopDesc::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS) { |
55 // A resolved constantPool entry will contain a klassOop, otherwise a symbolOop. | |
56 // It is not safe to rely on the tag bit's here, since we don't have a lock, and the entry and | |
57 // tag is not updated atomicly. | |
58 oop entry = *(this_oop->obj_at_addr(which)); | |
59 if (entry->is_klass()) { | |
60 // Already resolved - return entry. | |
61 return (klassOop)entry; | |
62 } | |
63 | |
64 // Acquire lock on constant oop while doing update. After we get the lock, we check if another object | |
65 // already has updated the object | |
66 assert(THREAD->is_Java_thread(), "must be a Java thread"); | |
67 bool do_resolve = false; | |
68 bool in_error = false; | |
69 | |
70 symbolHandle name; | |
71 Handle loader; | |
72 { ObjectLocker ol(this_oop, THREAD); | |
73 | |
74 if (this_oop->tag_at(which).is_unresolved_klass()) { | |
75 if (this_oop->tag_at(which).is_unresolved_klass_in_error()) { | |
76 in_error = true; | |
77 } else { | |
78 do_resolve = true; | |
79 name = symbolHandle(THREAD, this_oop->unresolved_klass_at(which)); | |
80 loader = Handle(THREAD, instanceKlass::cast(this_oop->pool_holder())->class_loader()); | |
81 } | |
82 } | |
83 } // unlocking constantPool | |
84 | |
85 | |
86 // The original attempt to resolve this constant pool entry failed so find the | |
87 // original error and throw it again (JVMS 5.4.3). | |
88 if (in_error) { | |
89 symbolOop error = SystemDictionary::find_resolution_error(this_oop, which); | |
90 guarantee(error != (symbolOop)NULL, "tag mismatch with resolution error table"); | |
91 ResourceMark rm; | |
92 // exception text will be the class name | |
93 const char* className = this_oop->unresolved_klass_at(which)->as_C_string(); | |
94 THROW_MSG_0(error, className); | |
95 } | |
96 | |
97 if (do_resolve) { | |
98 // this_oop must be unlocked during resolve_or_fail | |
99 oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); | |
100 Handle h_prot (THREAD, protection_domain); | |
101 klassOop k_oop = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD); | |
102 KlassHandle k; | |
103 if (!HAS_PENDING_EXCEPTION) { | |
104 k = KlassHandle(THREAD, k_oop); | |
105 // Do access check for klasses | |
106 verify_constant_pool_resolve(this_oop, k, THREAD); | |
107 } | |
108 | |
109 // Failed to resolve class. We must record the errors so that subsequent attempts | |
110 // to resolve this constant pool entry fail with the same error (JVMS 5.4.3). | |
111 if (HAS_PENDING_EXCEPTION) { | |
112 ResourceMark rm; | |
113 symbolHandle error(PENDING_EXCEPTION->klass()->klass_part()->name()); | |
114 | |
115 bool throw_orig_error = false; | |
116 { | |
117 ObjectLocker ol (this_oop, THREAD); | |
118 | |
119 // some other thread has beaten us and has resolved the class. | |
120 if (this_oop->tag_at(which).is_klass()) { | |
121 CLEAR_PENDING_EXCEPTION; | |
122 entry = this_oop->resolved_klass_at(which); | |
123 return (klassOop)entry; | |
124 } | |
125 | |
126 if (!PENDING_EXCEPTION-> | |
1142 | 127 is_a(SystemDictionary::LinkageError_klass())) { |
0 | 128 // Just throw the exception and don't prevent these classes from |
129 // being loaded due to virtual machine errors like StackOverflow | |
130 // and OutOfMemoryError, etc, or if the thread was hit by stop() | |
131 // Needs clarification to section 5.4.3 of the VM spec (see 6308271) | |
132 } | |
133 else if (!this_oop->tag_at(which).is_unresolved_klass_in_error()) { | |
134 SystemDictionary::add_resolution_error(this_oop, which, error); | |
135 this_oop->tag_at_put(which, JVM_CONSTANT_UnresolvedClassInError); | |
136 } else { | |
137 // some other thread has put the class in error state. | |
138 error = symbolHandle(SystemDictionary::find_resolution_error(this_oop, which)); | |
139 assert(!error.is_null(), "checking"); | |
140 throw_orig_error = true; | |
141 } | |
142 } // unlocked | |
143 | |
144 if (throw_orig_error) { | |
145 CLEAR_PENDING_EXCEPTION; | |
146 ResourceMark rm; | |
147 const char* className = this_oop->unresolved_klass_at(which)->as_C_string(); | |
148 THROW_MSG_0(error, className); | |
149 } | |
150 | |
151 return 0; | |
152 } | |
153 | |
154 if (TraceClassResolution && !k()->klass_part()->oop_is_array()) { | |
155 // skip resolving the constant pool so that this code get's | |
156 // called the next time some bytecodes refer to this class. | |
157 ResourceMark rm; | |
158 int line_number = -1; | |
159 const char * source_file = NULL; | |
160 if (JavaThread::current()->has_last_Java_frame()) { | |
161 // try to identify the method which called this function. | |
162 vframeStream vfst(JavaThread::current()); | |
163 if (!vfst.at_end()) { | |
164 line_number = vfst.method()->line_number_from_bci(vfst.bci()); | |
165 symbolOop s = instanceKlass::cast(vfst.method()->method_holder())->source_file_name(); | |
166 if (s != NULL) { | |
167 source_file = s->as_C_string(); | |
168 } | |
169 } | |
170 } | |
171 if (k() != this_oop->pool_holder()) { | |
172 // only print something if the classes are different | |
173 if (source_file != NULL) { | |
174 tty->print("RESOLVE %s %s %s:%d\n", | |
175 instanceKlass::cast(this_oop->pool_holder())->external_name(), | |
176 instanceKlass::cast(k())->external_name(), source_file, line_number); | |
177 } else { | |
178 tty->print("RESOLVE %s %s\n", | |
179 instanceKlass::cast(this_oop->pool_holder())->external_name(), | |
180 instanceKlass::cast(k())->external_name()); | |
181 } | |
182 } | |
183 return k(); | |
184 } else { | |
185 ObjectLocker ol (this_oop, THREAD); | |
186 // Only updated constant pool - if it is resolved. | |
187 do_resolve = this_oop->tag_at(which).is_unresolved_klass(); | |
188 if (do_resolve) { | |
189 this_oop->klass_at_put(which, k()); | |
190 } | |
191 } | |
192 } | |
193 | |
194 entry = this_oop->resolved_klass_at(which); | |
195 assert(entry->is_klass(), "must be resolved at this point"); | |
196 return (klassOop)entry; | |
197 } | |
198 | |
199 | |
200 // Does not update constantPoolOop - to avoid any exception throwing. Used | |
201 // by compiler and exception handling. Also used to avoid classloads for | |
202 // instanceof operations. Returns NULL if the class has not been loaded or | |
203 // if the verification of constant pool failed | |
204 klassOop constantPoolOopDesc::klass_at_if_loaded(constantPoolHandle this_oop, int which) { | |
205 oop entry = *this_oop->obj_at_addr(which); | |
206 if (entry->is_klass()) { | |
207 return (klassOop)entry; | |
208 } else { | |
209 assert(entry->is_symbol(), "must be either symbol or klass"); | |
210 Thread *thread = Thread::current(); | |
211 symbolHandle name (thread, (symbolOop)entry); | |
212 oop loader = instanceKlass::cast(this_oop->pool_holder())->class_loader(); | |
213 oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); | |
214 Handle h_prot (thread, protection_domain); | |
215 Handle h_loader (thread, loader); | |
216 klassOop k = SystemDictionary::find(name, h_loader, h_prot, thread); | |
217 | |
218 if (k != NULL) { | |
219 // Make sure that resolving is legal | |
220 EXCEPTION_MARK; | |
221 KlassHandle klass(THREAD, k); | |
222 // return NULL if verification fails | |
223 verify_constant_pool_resolve(this_oop, klass, THREAD); | |
224 if (HAS_PENDING_EXCEPTION) { | |
225 CLEAR_PENDING_EXCEPTION; | |
226 return NULL; | |
227 } | |
228 return klass(); | |
229 } else { | |
230 return k; | |
231 } | |
232 } | |
233 } | |
234 | |
235 | |
236 klassOop constantPoolOopDesc::klass_ref_at_if_loaded(constantPoolHandle this_oop, int which) { | |
237 return klass_at_if_loaded(this_oop, this_oop->klass_ref_index_at(which)); | |
238 } | |
239 | |
240 | |
241 // This is an interface for the compiler that allows accessing non-resolved entries | |
242 // in the constant pool - but still performs the validations tests. Must be used | |
243 // in a pre-parse of the compiler - to determine what it can do and not do. | |
244 // Note: We cannot update the ConstantPool from the vm_thread. | |
245 klassOop constantPoolOopDesc::klass_ref_at_if_loaded_check(constantPoolHandle this_oop, int index, TRAPS) { | |
246 int which = this_oop->klass_ref_index_at(index); | |
247 oop entry = *this_oop->obj_at_addr(which); | |
248 if (entry->is_klass()) { | |
249 return (klassOop)entry; | |
250 } else { | |
251 assert(entry->is_symbol(), "must be either symbol or klass"); | |
252 symbolHandle name (THREAD, (symbolOop)entry); | |
253 oop loader = instanceKlass::cast(this_oop->pool_holder())->class_loader(); | |
254 oop protection_domain = Klass::cast(this_oop->pool_holder())->protection_domain(); | |
255 Handle h_loader(THREAD, loader); | |
256 Handle h_prot (THREAD, protection_domain); | |
257 KlassHandle k(THREAD, SystemDictionary::find(name, h_loader, h_prot, THREAD)); | |
258 | |
259 // Do access check for klasses | |
260 if( k.not_null() ) verify_constant_pool_resolve(this_oop, k, CHECK_NULL); | |
261 return k(); | |
262 } | |
263 } | |
264 | |
265 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
266 symbolOop constantPoolOopDesc::impl_name_ref_at(int which, bool uncached) { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
267 int name_index = name_ref_index_at(impl_name_and_type_ref_index_at(which, uncached)); |
0 | 268 return symbol_at(name_index); |
269 } | |
270 | |
271 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
272 symbolOop constantPoolOopDesc::impl_signature_ref_at(int which, bool uncached) { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
273 int signature_index = signature_ref_index_at(impl_name_and_type_ref_index_at(which, uncached)); |
0 | 274 return symbol_at(signature_index); |
275 } | |
276 | |
277 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
278 int constantPoolOopDesc::impl_name_and_type_ref_index_at(int which, bool uncached) { |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
279 int i = which; |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
280 if (!uncached && cache() != NULL) { |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
281 if (constantPoolCacheOopDesc::is_secondary_index(which)) { |
1910
d1896d1dda3e
6981788: GC map generator sometimes picks up the wrong kind of instruction operand
jrose
parents:
1793
diff
changeset
|
282 // Invokedynamic index. |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
283 int pool_index = cache()->main_entry_at(which)->constant_pool_index(); |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
284 if (!AllowTransitionalJSR292 || tag_at(pool_index).is_invoke_dynamic()) |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
285 pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index); |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
286 assert(tag_at(pool_index).is_name_and_type(), ""); |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
287 return pool_index; |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
288 } |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
289 // change byte-ordering and go via cache |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
290 i = remap_instruction_operand_from_cache(which); |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
291 } else { |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
292 if (AllowTransitionalJSR292 && tag_at(which).is_name_and_type()) |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
293 // invokedynamic index is a simple name-and-type |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
294 return which; |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
295 if (tag_at(which).is_invoke_dynamic()) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
296 int pool_index = invoke_dynamic_name_and_type_ref_index_at(which); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
297 assert(tag_at(pool_index).is_name_and_type(), ""); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
298 return pool_index; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
299 } |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
300 } |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
301 assert(tag_at(i).is_field_or_method(), "Corrupted constant pool"); |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
302 assert(!tag_at(i).is_invoke_dynamic(), "Must be handled above"); |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
303 jint ref_index = *int_at_addr(i); |
0 | 304 return extract_high_short_from_int(ref_index); |
305 } | |
306 | |
307 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
308 int constantPoolOopDesc::impl_klass_ref_index_at(int which, bool uncached) { |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
309 guarantee(!constantPoolCacheOopDesc::is_secondary_index(which), |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
310 "an invokedynamic instruction does not have a klass"); |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
311 int i = which; |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
312 if (!uncached && cache() != NULL) { |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
313 // change byte-ordering and go via cache |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
314 i = remap_instruction_operand_from_cache(which); |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
315 } |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
316 assert(tag_at(i).is_field_or_method(), "Corrupted constant pool"); |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
317 jint ref_index = *int_at_addr(i); |
0 | 318 return extract_low_short_from_int(ref_index); |
319 } | |
320 | |
321 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
322 |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
323 int constantPoolOopDesc::remap_instruction_operand_from_cache(int operand) { |
1565 | 324 int cpc_index = operand; |
325 DEBUG_ONLY(cpc_index -= CPCACHE_INDEX_TAG); | |
326 assert((int)(u2)cpc_index == cpc_index, "clean u2"); | |
1059
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
327 int member_index = cache()->entry_at(cpc_index)->constant_pool_index(); |
389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
jrose
parents:
773
diff
changeset
|
328 return member_index; |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
329 } |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
330 |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
331 |
0 | 332 void constantPoolOopDesc::verify_constant_pool_resolve(constantPoolHandle this_oop, KlassHandle k, TRAPS) { |
333 if (k->oop_is_instance() || k->oop_is_objArray()) { | |
334 instanceKlassHandle holder (THREAD, this_oop->pool_holder()); | |
335 klassOop elem_oop = k->oop_is_instance() ? k() : objArrayKlass::cast(k())->bottom_klass(); | |
336 KlassHandle element (THREAD, elem_oop); | |
337 | |
338 // The element type could be a typeArray - we only need the access check if it is | |
339 // an reference to another class | |
340 if (element->oop_is_instance()) { | |
341 LinkResolver::check_klass_accessability(holder, element, CHECK); | |
342 } | |
343 } | |
344 } | |
345 | |
346 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
347 int constantPoolOopDesc::name_ref_index_at(int which_nt) { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
348 jint ref_index = name_and_type_at(which_nt); |
0 | 349 return extract_low_short_from_int(ref_index); |
350 } | |
351 | |
352 | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
353 int constantPoolOopDesc::signature_ref_index_at(int which_nt) { |
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
579
diff
changeset
|
354 jint ref_index = name_and_type_at(which_nt); |
0 | 355 return extract_high_short_from_int(ref_index); |
356 } | |
357 | |
358 | |
359 klassOop constantPoolOopDesc::klass_ref_at(int which, TRAPS) { | |
360 return klass_at(klass_ref_index_at(which), CHECK_NULL); | |
361 } | |
362 | |
363 | |
364 symbolOop constantPoolOopDesc::klass_name_at(int which) { | |
365 assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass(), | |
366 "Corrupted constant pool"); | |
367 // A resolved constantPool entry will contain a klassOop, otherwise a symbolOop. | |
368 // It is not safe to rely on the tag bit's here, since we don't have a lock, and the entry and | |
369 // tag is not updated atomicly. | |
370 oop entry = *(obj_at_addr(which)); | |
371 if (entry->is_klass()) { | |
372 // Already resolved - return entry's name. | |
373 return klassOop(entry)->klass_part()->name(); | |
374 } else { | |
375 assert(entry->is_symbol(), "must be either symbol or klass"); | |
376 return (symbolOop)entry; | |
377 } | |
378 } | |
379 | |
380 symbolOop constantPoolOopDesc::klass_ref_at_noresolve(int which) { | |
381 jint ref_index = klass_ref_index_at(which); | |
382 return klass_at_noresolve(ref_index); | |
383 } | |
384 | |
1602 | 385 symbolOop constantPoolOopDesc::uncached_klass_ref_at_noresolve(int which) { |
386 jint ref_index = uncached_klass_ref_index_at(which); | |
387 return klass_at_noresolve(ref_index); | |
388 } | |
389 | |
0 | 390 char* constantPoolOopDesc::string_at_noresolve(int which) { |
391 // Test entry type in case string is resolved while in here. | |
392 oop entry = *(obj_at_addr(which)); | |
393 if (entry->is_symbol()) { | |
394 return ((symbolOop)entry)->as_C_string(); | |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
395 } else if (java_lang_String::is_instance(entry)) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
396 return java_lang_String::as_utf8_string(entry); |
0 | 397 } else { |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
398 return (char*)"<pseudo-string>"; |
0 | 399 } |
400 } | |
401 | |
402 | |
403 BasicType constantPoolOopDesc::basic_type_for_signature_at(int which) { | |
404 return FieldType::basic_type(symbol_at(which)); | |
405 } | |
406 | |
407 | |
408 void constantPoolOopDesc::resolve_string_constants_impl(constantPoolHandle this_oop, TRAPS) { | |
409 for (int index = 1; index < this_oop->length(); index++) { // Index 0 is unused | |
410 if (this_oop->tag_at(index).is_unresolved_string()) { | |
411 this_oop->string_at(index, CHECK); | |
412 } | |
413 } | |
414 } | |
415 | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
416 // A resolved constant value in the CP cache is represented as a non-null |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
417 // value. As a special case, this value can be a 'systemObjArray' |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
418 // which masks an exception object to throw. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
419 // This allows a MethodHandle constant reference to throw a consistent |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
420 // exception every time, if it fails to resolve. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
421 static oop decode_exception_from_f1(oop result_oop, TRAPS) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
422 if (result_oop->klass() != Universe::systemObjArrayKlassObj()) |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
423 return result_oop; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
424 |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
425 // Special cases here: Masked null, saved exception. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
426 objArrayOop sys_array = (objArrayOop) result_oop; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
427 assert(sys_array->length() == 1, "bad system array"); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
428 if (sys_array->length() == 1) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
429 THROW_OOP_(sys_array->obj_at(0), NULL); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
430 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
431 return NULL; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
432 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
433 |
1602 | 434 oop constantPoolOopDesc::resolve_constant_at_impl(constantPoolHandle this_oop, int index, int cache_index, TRAPS) { |
435 oop result_oop = NULL; | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
436 Handle throw_exception; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
437 |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
438 if (cache_index == _possible_index_sentinel) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
439 // It is possible that this constant is one which is cached in the CP cache. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
440 // We'll do a linear search. This should be OK because this usage is rare. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
441 assert(index > 0, "valid index"); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
442 constantPoolCacheOop cache = this_oop()->cache(); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
443 for (int i = 0, len = cache->length(); i < len; i++) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
444 ConstantPoolCacheEntry* cpc_entry = cache->entry_at(i); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
445 if (!cpc_entry->is_secondary_entry() && cpc_entry->constant_pool_index() == index) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
446 // Switch the query to use this CPC entry. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
447 cache_index = i; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
448 index = _no_index_sentinel; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
449 break; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
450 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
451 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
452 if (cache_index == _possible_index_sentinel) |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
453 cache_index = _no_index_sentinel; // not found |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
454 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
455 assert(cache_index == _no_index_sentinel || cache_index >= 0, ""); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
456 assert(index == _no_index_sentinel || index >= 0, ""); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
457 |
1602 | 458 if (cache_index >= 0) { |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
459 assert(index == _no_index_sentinel, "only one kind of index at a time"); |
1602 | 460 ConstantPoolCacheEntry* cpc_entry = this_oop->cache()->entry_at(cache_index); |
461 result_oop = cpc_entry->f1(); | |
462 if (result_oop != NULL) { | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
463 return decode_exception_from_f1(result_oop, THREAD); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
464 // That was easy... |
1602 | 465 } |
466 index = cpc_entry->constant_pool_index(); | |
467 } | |
468 | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
469 jvalue prim_value; // temp used only in a few cases below |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
470 |
1602 | 471 int tag_value = this_oop->tag_at(index).value(); |
472 switch (tag_value) { | |
473 | |
474 case JVM_CONSTANT_UnresolvedClass: | |
475 case JVM_CONSTANT_UnresolvedClassInError: | |
476 case JVM_CONSTANT_Class: | |
477 { | |
478 klassOop resolved = klass_at_impl(this_oop, index, CHECK_NULL); | |
479 // ldc wants the java mirror. | |
480 result_oop = resolved->klass_part()->java_mirror(); | |
481 break; | |
482 } | |
483 | |
484 case JVM_CONSTANT_String: | |
485 case JVM_CONSTANT_UnresolvedString: | |
486 if (this_oop->is_pseudo_string_at(index)) { | |
487 result_oop = this_oop->pseudo_string_at(index); | |
488 break; | |
489 } | |
490 result_oop = string_at_impl(this_oop, index, CHECK_NULL); | |
491 break; | |
492 | |
493 case JVM_CONSTANT_Object: | |
494 result_oop = this_oop->object_at(index); | |
495 break; | |
496 | |
497 case JVM_CONSTANT_MethodHandle: | |
498 { | |
499 int ref_kind = this_oop->method_handle_ref_kind_at(index); | |
500 int callee_index = this_oop->method_handle_klass_index_at(index); | |
501 symbolHandle name(THREAD, this_oop->method_handle_name_ref_at(index)); | |
502 symbolHandle signature(THREAD, this_oop->method_handle_signature_ref_at(index)); | |
503 if (PrintMiscellaneous) | |
504 tty->print_cr("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s", | |
505 ref_kind, index, this_oop->method_handle_index_at(index), | |
506 callee_index, name->as_C_string(), signature->as_C_string()); | |
507 KlassHandle callee; | |
508 { klassOop k = klass_at_impl(this_oop, callee_index, CHECK_NULL); | |
509 callee = KlassHandle(THREAD, k); | |
510 } | |
511 KlassHandle klass(THREAD, this_oop->pool_holder()); | |
512 Handle value = SystemDictionary::link_method_handle_constant(klass, ref_kind, | |
513 callee, name, signature, | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
514 THREAD); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
515 if (HAS_PENDING_EXCEPTION) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
516 throw_exception = Handle(THREAD, PENDING_EXCEPTION); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
517 CLEAR_PENDING_EXCEPTION; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
518 break; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
519 } |
1602 | 520 result_oop = value(); |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
521 assert(result_oop != NULL, ""); |
1602 | 522 break; |
523 } | |
524 | |
525 case JVM_CONSTANT_MethodType: | |
526 { | |
527 symbolHandle signature(THREAD, this_oop->method_type_signature_at(index)); | |
528 if (PrintMiscellaneous) | |
529 tty->print_cr("resolve JVM_CONSTANT_MethodType [%d/%d] %s", | |
530 index, this_oop->method_type_index_at(index), | |
531 signature->as_C_string()); | |
532 KlassHandle klass(THREAD, this_oop->pool_holder()); | |
533 bool ignore_is_on_bcp = false; | |
534 Handle value = SystemDictionary::find_method_handle_type(signature, | |
535 klass, | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1660
diff
changeset
|
536 false, |
1602 | 537 ignore_is_on_bcp, |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
538 THREAD); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
539 if (HAS_PENDING_EXCEPTION) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
540 throw_exception = Handle(THREAD, PENDING_EXCEPTION); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
541 CLEAR_PENDING_EXCEPTION; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
542 break; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
543 } |
1602 | 544 result_oop = value(); |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
545 assert(result_oop != NULL, ""); |
1602 | 546 break; |
547 } | |
548 | |
549 case JVM_CONSTANT_Integer: | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
550 prim_value.i = this_oop->int_at(index); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
551 result_oop = java_lang_boxing_object::create(T_INT, &prim_value, CHECK_NULL); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
552 break; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
553 |
1602 | 554 case JVM_CONSTANT_Float: |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
555 prim_value.f = this_oop->float_at(index); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
556 result_oop = java_lang_boxing_object::create(T_FLOAT, &prim_value, CHECK_NULL); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
557 break; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
558 |
1602 | 559 case JVM_CONSTANT_Long: |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
560 prim_value.j = this_oop->long_at(index); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
561 result_oop = java_lang_boxing_object::create(T_LONG, &prim_value, CHECK_NULL); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
562 break; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
563 |
1602 | 564 case JVM_CONSTANT_Double: |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
565 prim_value.d = this_oop->double_at(index); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
566 result_oop = java_lang_boxing_object::create(T_DOUBLE, &prim_value, CHECK_NULL); |
1602 | 567 break; |
568 | |
569 default: | |
570 DEBUG_ONLY( tty->print_cr("*** %p: tag at CP[%d/%d] = %d", | |
571 this_oop(), index, cache_index, tag_value) ); | |
572 assert(false, "unexpected constant tag"); | |
573 break; | |
574 } | |
575 | |
576 if (cache_index >= 0) { | |
577 // Cache the oop here also. | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
578 if (throw_exception.not_null()) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
579 objArrayOop sys_array = oopFactory::new_system_objArray(1, CHECK_NULL); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
580 sys_array->obj_at_put(0, throw_exception()); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
581 result_oop = sys_array; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
582 throw_exception = Handle(); // be tidy |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
583 } |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
584 Handle result_handle(THREAD, result_oop); |
1602 | 585 result_oop = NULL; // safety |
586 ObjectLocker ol(this_oop, THREAD); | |
587 ConstantPoolCacheEntry* cpc_entry = this_oop->cache()->entry_at(cache_index); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
588 result_oop = cpc_entry->f1(); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
589 // Benign race condition: f1 may already be filled in while we were trying to lock. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
590 // The important thing here is that all threads pick up the same result. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
591 // It doesn't matter which racing thread wins, as long as only one |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
592 // result is used by all threads, and all future queries. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
593 // That result may be either a resolved constant or a failure exception. |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
594 if (result_oop == NULL) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
595 result_oop = result_handle(); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
596 cpc_entry->set_f1(result_oop); |
1602 | 597 } |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
598 return decode_exception_from_f1(result_oop, THREAD); |
1602 | 599 } else { |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
600 if (throw_exception.not_null()) { |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
601 THROW_HANDLE_(throw_exception, NULL); |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
602 } |
1602 | 603 return result_oop; |
604 } | |
605 } | |
606 | |
0 | 607 oop constantPoolOopDesc::string_at_impl(constantPoolHandle this_oop, int which, TRAPS) { |
608 oop entry = *(this_oop->obj_at_addr(which)); | |
609 if (entry->is_symbol()) { | |
610 ObjectLocker ol(this_oop, THREAD); | |
611 if (this_oop->tag_at(which).is_unresolved_string()) { | |
612 // Intern string | |
613 symbolOop sym = this_oop->unresolved_string_at(which); | |
614 entry = StringTable::intern(sym, CHECK_(constantPoolOop(NULL))); | |
615 this_oop->string_at_put(which, entry); | |
616 } else { | |
617 // Another thread beat us and interned string, read string from constant pool | |
618 entry = this_oop->resolved_string_at(which); | |
619 } | |
620 } | |
621 assert(java_lang_String::is_instance(entry), "must be string"); | |
622 return entry; | |
623 } | |
624 | |
625 | |
431
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
626 bool constantPoolOopDesc::is_pseudo_string_at(int which) { |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
627 oop entry = *(obj_at_addr(which)); |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
628 if (entry->is_symbol()) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
629 // Not yet resolved, but it will resolve to a string. |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
630 return false; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
631 else if (java_lang_String::is_instance(entry)) |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
632 return false; // actually, it might be a non-interned or non-perm string |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
633 else |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
634 // truly pseudo |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
635 return true; |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
636 } |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
637 |
a45484ea312d
6653858: dynamic languages need to be able to load anonymous classes
jrose
parents:
0
diff
changeset
|
638 |
0 | 639 bool constantPoolOopDesc::klass_name_at_matches(instanceKlassHandle k, |
640 int which) { | |
641 // Names are interned, so we can compare symbolOops directly | |
642 symbolOop cp_name = klass_name_at(which); | |
643 return (cp_name == k->name()); | |
644 } | |
645 | |
646 | |
647 int constantPoolOopDesc::pre_resolve_shared_klasses(TRAPS) { | |
648 ResourceMark rm; | |
649 int count = 0; | |
650 for (int index = 1; index < tags()->length(); index++) { // Index 0 is unused | |
651 if (tag_at(index).is_unresolved_string()) { | |
652 // Intern string | |
653 symbolOop sym = unresolved_string_at(index); | |
654 oop entry = StringTable::intern(sym, CHECK_(-1)); | |
655 string_at_put(index, entry); | |
656 } | |
657 } | |
658 return count; | |
659 } | |
660 | |
661 | |
662 // Iterate over symbols which are used as class, field, method names and | |
663 // signatures (in preparation for writing to the shared archive). | |
664 | |
665 void constantPoolOopDesc::shared_symbols_iterate(OopClosure* closure) { | |
666 for (int index = 1; index < length(); index++) { // Index 0 is unused | |
667 switch (tag_at(index).value()) { | |
668 | |
669 case JVM_CONSTANT_UnresolvedClass: | |
670 closure->do_oop(obj_at_addr(index)); | |
671 break; | |
672 | |
673 case JVM_CONSTANT_NameAndType: | |
674 { | |
675 int i = *int_at_addr(index); | |
676 closure->do_oop(obj_at_addr((unsigned)i >> 16)); | |
677 closure->do_oop(obj_at_addr((unsigned)i & 0xffff)); | |
678 } | |
679 break; | |
680 | |
681 case JVM_CONSTANT_Class: | |
682 case JVM_CONSTANT_InterfaceMethodref: | |
683 case JVM_CONSTANT_Fieldref: | |
684 case JVM_CONSTANT_Methodref: | |
685 case JVM_CONSTANT_Integer: | |
686 case JVM_CONSTANT_Float: | |
687 // Do nothing! Not an oop. | |
688 // These constant types do not reference symbols at this point. | |
689 break; | |
690 | |
691 case JVM_CONSTANT_String: | |
692 // Do nothing! Not a symbol. | |
693 break; | |
694 | |
695 case JVM_CONSTANT_UnresolvedString: | |
696 case JVM_CONSTANT_Utf8: | |
697 // These constants are symbols, but unless these symbols are | |
698 // actually to be used for something, we don't want to mark them. | |
699 break; | |
700 | |
701 case JVM_CONSTANT_Long: | |
702 case JVM_CONSTANT_Double: | |
703 // Do nothing! Not an oop. (But takes two pool entries.) | |
704 ++index; | |
705 break; | |
706 | |
707 default: | |
708 ShouldNotReachHere(); | |
709 break; | |
710 } | |
711 } | |
712 } | |
713 | |
714 | |
715 // Iterate over the [one] tags array (in preparation for writing to the | |
716 // shared archive). | |
717 | |
718 void constantPoolOopDesc::shared_tags_iterate(OopClosure* closure) { | |
719 closure->do_oop(tags_addr()); | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
720 closure->do_oop(operands_addr()); |
0 | 721 } |
722 | |
723 | |
724 // Iterate over String objects (in preparation for writing to the shared | |
725 // archive). | |
726 | |
727 void constantPoolOopDesc::shared_strings_iterate(OopClosure* closure) { | |
728 for (int index = 1; index < length(); index++) { // Index 0 is unused | |
729 switch (tag_at(index).value()) { | |
730 | |
731 case JVM_CONSTANT_UnresolvedClass: | |
732 case JVM_CONSTANT_NameAndType: | |
733 // Do nothing! Not a String. | |
734 break; | |
735 | |
736 case JVM_CONSTANT_Class: | |
737 case JVM_CONSTANT_InterfaceMethodref: | |
738 case JVM_CONSTANT_Fieldref: | |
739 case JVM_CONSTANT_Methodref: | |
740 case JVM_CONSTANT_Integer: | |
741 case JVM_CONSTANT_Float: | |
742 // Do nothing! Not an oop. | |
743 // These constant types do not reference symbols at this point. | |
744 break; | |
745 | |
746 case JVM_CONSTANT_String: | |
747 closure->do_oop(obj_at_addr(index)); | |
748 break; | |
749 | |
750 case JVM_CONSTANT_UnresolvedString: | |
751 case JVM_CONSTANT_Utf8: | |
752 // These constants are symbols, but unless these symbols are | |
753 // actually to be used for something, we don't want to mark them. | |
754 break; | |
755 | |
756 case JVM_CONSTANT_Long: | |
757 case JVM_CONSTANT_Double: | |
758 // Do nothing! Not an oop. (But takes two pool entries.) | |
759 ++index; | |
760 break; | |
761 | |
762 default: | |
763 ShouldNotReachHere(); | |
764 break; | |
765 } | |
766 } | |
767 } | |
768 | |
769 | |
770 // Compare this constant pool's entry at index1 to the constant pool | |
771 // cp2's entry at index2. | |
772 bool constantPoolOopDesc::compare_entry_to(int index1, constantPoolHandle cp2, | |
773 int index2, TRAPS) { | |
774 | |
775 jbyte t1 = tag_at(index1).value(); | |
776 jbyte t2 = cp2->tag_at(index2).value(); | |
777 | |
778 | |
779 // JVM_CONSTANT_UnresolvedClassInError is equal to JVM_CONSTANT_UnresolvedClass | |
780 // when comparing | |
781 if (t1 == JVM_CONSTANT_UnresolvedClassInError) { | |
782 t1 = JVM_CONSTANT_UnresolvedClass; | |
783 } | |
784 if (t2 == JVM_CONSTANT_UnresolvedClassInError) { | |
785 t2 = JVM_CONSTANT_UnresolvedClass; | |
786 } | |
787 | |
788 if (t1 != t2) { | |
789 // Not the same entry type so there is nothing else to check. Note | |
790 // that this style of checking will consider resolved/unresolved | |
791 // class pairs and resolved/unresolved string pairs as different. | |
792 // From the constantPoolOop API point of view, this is correct | |
793 // behavior. See constantPoolKlass::merge() to see how this plays | |
794 // out in the context of constantPoolOop merging. | |
795 return false; | |
796 } | |
797 | |
798 switch (t1) { | |
799 case JVM_CONSTANT_Class: | |
800 { | |
801 klassOop k1 = klass_at(index1, CHECK_false); | |
802 klassOop k2 = cp2->klass_at(index2, CHECK_false); | |
803 if (k1 == k2) { | |
804 return true; | |
805 } | |
806 } break; | |
807 | |
808 case JVM_CONSTANT_ClassIndex: | |
809 { | |
810 int recur1 = klass_index_at(index1); | |
811 int recur2 = cp2->klass_index_at(index2); | |
812 bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false); | |
813 if (match) { | |
814 return true; | |
815 } | |
816 } break; | |
817 | |
818 case JVM_CONSTANT_Double: | |
819 { | |
820 jdouble d1 = double_at(index1); | |
821 jdouble d2 = cp2->double_at(index2); | |
822 if (d1 == d2) { | |
823 return true; | |
824 } | |
825 } break; | |
826 | |
827 case JVM_CONSTANT_Fieldref: | |
828 case JVM_CONSTANT_InterfaceMethodref: | |
829 case JVM_CONSTANT_Methodref: | |
830 { | |
831 int recur1 = uncached_klass_ref_index_at(index1); | |
832 int recur2 = cp2->uncached_klass_ref_index_at(index2); | |
833 bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false); | |
834 if (match) { | |
835 recur1 = uncached_name_and_type_ref_index_at(index1); | |
836 recur2 = cp2->uncached_name_and_type_ref_index_at(index2); | |
837 match = compare_entry_to(recur1, cp2, recur2, CHECK_false); | |
838 if (match) { | |
839 return true; | |
840 } | |
841 } | |
842 } break; | |
843 | |
844 case JVM_CONSTANT_Float: | |
845 { | |
846 jfloat f1 = float_at(index1); | |
847 jfloat f2 = cp2->float_at(index2); | |
848 if (f1 == f2) { | |
849 return true; | |
850 } | |
851 } break; | |
852 | |
853 case JVM_CONSTANT_Integer: | |
854 { | |
855 jint i1 = int_at(index1); | |
856 jint i2 = cp2->int_at(index2); | |
857 if (i1 == i2) { | |
858 return true; | |
859 } | |
860 } break; | |
861 | |
862 case JVM_CONSTANT_Long: | |
863 { | |
864 jlong l1 = long_at(index1); | |
865 jlong l2 = cp2->long_at(index2); | |
866 if (l1 == l2) { | |
867 return true; | |
868 } | |
869 } break; | |
870 | |
871 case JVM_CONSTANT_NameAndType: | |
872 { | |
873 int recur1 = name_ref_index_at(index1); | |
874 int recur2 = cp2->name_ref_index_at(index2); | |
875 bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false); | |
876 if (match) { | |
877 recur1 = signature_ref_index_at(index1); | |
878 recur2 = cp2->signature_ref_index_at(index2); | |
879 match = compare_entry_to(recur1, cp2, recur2, CHECK_false); | |
880 if (match) { | |
881 return true; | |
882 } | |
883 } | |
884 } break; | |
885 | |
886 case JVM_CONSTANT_String: | |
887 { | |
888 oop s1 = string_at(index1, CHECK_false); | |
889 oop s2 = cp2->string_at(index2, CHECK_false); | |
890 if (s1 == s2) { | |
891 return true; | |
892 } | |
893 } break; | |
894 | |
895 case JVM_CONSTANT_StringIndex: | |
896 { | |
897 int recur1 = string_index_at(index1); | |
898 int recur2 = cp2->string_index_at(index2); | |
899 bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false); | |
900 if (match) { | |
901 return true; | |
902 } | |
903 } break; | |
904 | |
905 case JVM_CONSTANT_UnresolvedClass: | |
906 { | |
907 symbolOop k1 = unresolved_klass_at(index1); | |
908 symbolOop k2 = cp2->unresolved_klass_at(index2); | |
909 if (k1 == k2) { | |
910 return true; | |
911 } | |
912 } break; | |
913 | |
1602 | 914 case JVM_CONSTANT_MethodType: |
915 { | |
916 int k1 = method_type_index_at(index1); | |
917 int k2 = cp2->method_type_index_at(index2); | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
918 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
919 if (match) { |
1602 | 920 return true; |
921 } | |
922 } break; | |
923 | |
924 case JVM_CONSTANT_MethodHandle: | |
925 { | |
926 int k1 = method_handle_ref_kind_at(index1); | |
927 int k2 = cp2->method_handle_ref_kind_at(index2); | |
928 if (k1 == k2) { | |
929 int i1 = method_handle_index_at(index1); | |
930 int i2 = cp2->method_handle_index_at(index2); | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
931 bool match = compare_entry_to(i1, cp2, i2, CHECK_false); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
932 if (match) { |
1602 | 933 return true; |
934 } | |
935 } | |
936 } break; | |
937 | |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
938 case JVM_CONSTANT_InvokeDynamic: |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
939 case JVM_CONSTANT_InvokeDynamicTrans: |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
940 { |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
941 int k1 = invoke_dynamic_bootstrap_method_ref_index_at(index1); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
942 int k2 = cp2->invoke_dynamic_bootstrap_method_ref_index_at(index2); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
943 bool match = compare_entry_to(k1, cp2, k2, CHECK_false); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
944 if (!match) return false; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
945 k1 = invoke_dynamic_name_and_type_ref_index_at(index1); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
946 k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
947 match = compare_entry_to(k1, cp2, k2, CHECK_false); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
948 if (!match) return false; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
949 int argc = invoke_dynamic_argument_count_at(index1); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
950 if (argc == cp2->invoke_dynamic_argument_count_at(index2)) { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
951 for (int j = 0; j < argc; j++) { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
952 k1 = invoke_dynamic_argument_index_at(index1, j); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
953 k2 = cp2->invoke_dynamic_argument_index_at(index2, j); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
954 match = compare_entry_to(k1, cp2, k2, CHECK_false); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
955 if (!match) return false; |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
956 } |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
957 return true; // got through loop; all elements equal |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
958 } |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
959 } break; |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
960 |
0 | 961 case JVM_CONSTANT_UnresolvedString: |
962 { | |
963 symbolOop s1 = unresolved_string_at(index1); | |
964 symbolOop s2 = cp2->unresolved_string_at(index2); | |
965 if (s1 == s2) { | |
966 return true; | |
967 } | |
968 } break; | |
969 | |
970 case JVM_CONSTANT_Utf8: | |
971 { | |
972 symbolOop s1 = symbol_at(index1); | |
973 symbolOop s2 = cp2->symbol_at(index2); | |
974 if (s1 == s2) { | |
975 return true; | |
976 } | |
977 } break; | |
978 | |
979 // Invalid is used as the tag for the second constant pool entry | |
980 // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should | |
981 // not be seen by itself. | |
982 case JVM_CONSTANT_Invalid: // fall through | |
983 | |
984 default: | |
985 ShouldNotReachHere(); | |
986 break; | |
987 } | |
988 | |
989 return false; | |
990 } // end compare_entry_to() | |
991 | |
992 | |
993 // Copy this constant pool's entries at start_i to end_i (inclusive) | |
994 // to the constant pool to_cp's entries starting at to_i. A total of | |
995 // (end_i - start_i) + 1 entries are copied. | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
996 void constantPoolOopDesc::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i, |
0 | 997 constantPoolHandle to_cp, int to_i, TRAPS) { |
998 | |
999 int dest_i = to_i; // leave original alone for debug purposes | |
1000 | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1001 for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1002 copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK); |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
1003 |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1004 switch (from_cp->tag_at(src_i).value()) { |
0 | 1005 case JVM_CONSTANT_Double: |
1006 case JVM_CONSTANT_Long: | |
1007 // double and long take two constant pool entries | |
1008 src_i += 2; | |
1009 dest_i += 2; | |
1010 break; | |
1011 | |
1012 default: | |
1013 // all others take one constant pool entry | |
1014 src_i++; | |
1015 dest_i++; | |
1016 break; | |
1017 } | |
1018 } | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1019 |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1020 int from_oplen = operand_array_length(from_cp->operands()); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1021 int old_oplen = operand_array_length(to_cp->operands()); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1022 if (from_oplen != 0) { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1023 // append my operands to the target's operands array |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1024 if (old_oplen == 0) { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1025 to_cp->set_operands(from_cp->operands()); // reuse; do not merge |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1026 } else { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1027 int old_len = to_cp->operands()->length(); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1028 int from_len = from_cp->operands()->length(); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1029 int old_off = old_oplen * sizeof(u2); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1030 int from_off = from_oplen * sizeof(u2); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1031 typeArrayHandle new_operands = oopFactory::new_permanent_shortArray(old_len + from_len, CHECK); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1032 int fillp = 0, len = 0; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1033 // first part of dest |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1034 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(0), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1035 new_operands->short_at_addr(fillp), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1036 (len = old_off) * sizeof(u2)); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1037 fillp += len; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1038 // first part of src |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1039 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(0), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1040 new_operands->short_at_addr(fillp), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1041 (len = from_off) * sizeof(u2)); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1042 fillp += len; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1043 // second part of dest |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1044 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(old_off), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1045 new_operands->short_at_addr(fillp), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1046 (len = old_len - old_off) * sizeof(u2)); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1047 fillp += len; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1048 // second part of src |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1049 Copy::conjoint_memory_atomic(to_cp->operands()->short_at_addr(from_off), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1050 new_operands->short_at_addr(fillp), |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1051 (len = from_len - from_off) * sizeof(u2)); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1052 fillp += len; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1053 assert(fillp == new_operands->length(), ""); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1054 |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1055 // Adjust indexes in the first part of the copied operands array. |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1056 for (int j = 0; j < from_oplen; j++) { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1057 int offset = operand_offset_at(new_operands(), old_oplen + j); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1058 assert(offset == operand_offset_at(from_cp->operands(), j), "correct copy"); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1059 offset += old_len; // every new tuple is preceded by old_len extra u2's |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1060 operand_offset_at_put(new_operands(), old_oplen + j, offset); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1061 } |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1062 |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1063 // replace target operands array with combined array |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1064 to_cp->set_operands(new_operands()); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1065 } |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1066 } |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1067 |
0 | 1068 } // end copy_cp_to() |
1069 | |
1070 | |
1071 // Copy this constant pool's entry at from_i to the constant pool | |
1072 // to_cp's entry at to_i. | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1073 void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i, |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1074 constantPoolHandle to_cp, int to_i, |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1075 TRAPS) { |
0 | 1076 |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1077 int tag = from_cp->tag_at(from_i).value(); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1078 switch (tag) { |
0 | 1079 case JVM_CONSTANT_Class: |
1080 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1081 klassOop k = from_cp->klass_at(from_i, CHECK); |
0 | 1082 to_cp->klass_at_put(to_i, k); |
1083 } break; | |
1084 | |
1085 case JVM_CONSTANT_ClassIndex: | |
1086 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1087 jint ki = from_cp->klass_index_at(from_i); |
0 | 1088 to_cp->klass_index_at_put(to_i, ki); |
1089 } break; | |
1090 | |
1091 case JVM_CONSTANT_Double: | |
1092 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1093 jdouble d = from_cp->double_at(from_i); |
0 | 1094 to_cp->double_at_put(to_i, d); |
1095 // double takes two constant pool entries so init second entry's tag | |
1096 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); | |
1097 } break; | |
1098 | |
1099 case JVM_CONSTANT_Fieldref: | |
1100 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1101 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1102 int name_and_type_index = from_cp->uncached_name_and_type_ref_index_at(from_i); |
0 | 1103 to_cp->field_at_put(to_i, class_index, name_and_type_index); |
1104 } break; | |
1105 | |
1106 case JVM_CONSTANT_Float: | |
1107 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1108 jfloat f = from_cp->float_at(from_i); |
0 | 1109 to_cp->float_at_put(to_i, f); |
1110 } break; | |
1111 | |
1112 case JVM_CONSTANT_Integer: | |
1113 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1114 jint i = from_cp->int_at(from_i); |
0 | 1115 to_cp->int_at_put(to_i, i); |
1116 } break; | |
1117 | |
1118 case JVM_CONSTANT_InterfaceMethodref: | |
1119 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1120 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1121 int name_and_type_index = from_cp->uncached_name_and_type_ref_index_at(from_i); |
0 | 1122 to_cp->interface_method_at_put(to_i, class_index, name_and_type_index); |
1123 } break; | |
1124 | |
1125 case JVM_CONSTANT_Long: | |
1126 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1127 jlong l = from_cp->long_at(from_i); |
0 | 1128 to_cp->long_at_put(to_i, l); |
1129 // long takes two constant pool entries so init second entry's tag | |
1130 to_cp->tag_at_put(to_i + 1, JVM_CONSTANT_Invalid); | |
1131 } break; | |
1132 | |
1133 case JVM_CONSTANT_Methodref: | |
1134 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1135 int class_index = from_cp->uncached_klass_ref_index_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1136 int name_and_type_index = from_cp->uncached_name_and_type_ref_index_at(from_i); |
0 | 1137 to_cp->method_at_put(to_i, class_index, name_and_type_index); |
1138 } break; | |
1139 | |
1140 case JVM_CONSTANT_NameAndType: | |
1141 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1142 int name_ref_index = from_cp->name_ref_index_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1143 int signature_ref_index = from_cp->signature_ref_index_at(from_i); |
0 | 1144 to_cp->name_and_type_at_put(to_i, name_ref_index, signature_ref_index); |
1145 } break; | |
1146 | |
1147 case JVM_CONSTANT_String: | |
1148 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1149 oop s = from_cp->string_at(from_i, CHECK); |
0 | 1150 to_cp->string_at_put(to_i, s); |
1151 } break; | |
1152 | |
1153 case JVM_CONSTANT_StringIndex: | |
1154 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1155 jint si = from_cp->string_index_at(from_i); |
0 | 1156 to_cp->string_index_at_put(to_i, si); |
1157 } break; | |
1158 | |
1159 case JVM_CONSTANT_UnresolvedClass: | |
1160 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1161 symbolOop k = from_cp->unresolved_klass_at(from_i); |
0 | 1162 to_cp->unresolved_klass_at_put(to_i, k); |
1163 } break; | |
1164 | |
1165 case JVM_CONSTANT_UnresolvedClassInError: | |
1166 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1167 symbolOop k = from_cp->unresolved_klass_at(from_i); |
0 | 1168 to_cp->unresolved_klass_at_put(to_i, k); |
1169 to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError); | |
1170 } break; | |
1171 | |
1172 | |
1173 case JVM_CONSTANT_UnresolvedString: | |
1174 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1175 symbolOop s = from_cp->unresolved_string_at(from_i); |
0 | 1176 to_cp->unresolved_string_at_put(to_i, s); |
1177 } break; | |
1178 | |
1179 case JVM_CONSTANT_Utf8: | |
1180 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1181 symbolOop s = from_cp->symbol_at(from_i); |
0 | 1182 to_cp->symbol_at_put(to_i, s); |
1183 } break; | |
1184 | |
1602 | 1185 case JVM_CONSTANT_MethodType: |
1186 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1187 jint k = from_cp->method_type_index_at(from_i); |
1602 | 1188 to_cp->method_type_index_at_put(to_i, k); |
1189 } break; | |
1190 | |
1191 case JVM_CONSTANT_MethodHandle: | |
1192 { | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1193 int k1 = from_cp->method_handle_ref_kind_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1194 int k2 = from_cp->method_handle_index_at(from_i); |
1602 | 1195 to_cp->method_handle_index_at_put(to_i, k1, k2); |
1196 } break; | |
1197 | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1198 case JVM_CONSTANT_InvokeDynamicTrans: |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1199 { |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1200 int k1 = from_cp->invoke_dynamic_bootstrap_method_ref_index_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1201 int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1202 to_cp->invoke_dynamic_trans_at_put(to_i, k1, k2); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1203 } break; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1204 |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1205 case JVM_CONSTANT_InvokeDynamic: |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1206 { |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1207 int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1208 int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1209 k1 += operand_array_length(to_cp->operands()); // to_cp might already have operands |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1210 to_cp->invoke_dynamic_at_put(to_i, k1, k2); |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1211 } break; |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1212 |
0 | 1213 // Invalid is used as the tag for the second constant pool entry |
1214 // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should | |
1215 // not be seen by itself. | |
1216 case JVM_CONSTANT_Invalid: // fall through | |
1217 | |
1218 default: | |
1219 { | |
1220 ShouldNotReachHere(); | |
1221 } break; | |
1222 } | |
1223 } // end copy_entry_to() | |
1224 | |
1225 | |
1226 // Search constant pool search_cp for an entry that matches this | |
1227 // constant pool's entry at pattern_i. Returns the index of a | |
1228 // matching entry or zero (0) if there is no matching entry. | |
1229 int constantPoolOopDesc::find_matching_entry(int pattern_i, | |
1230 constantPoolHandle search_cp, TRAPS) { | |
1231 | |
1232 // index zero (0) is not used | |
1233 for (int i = 1; i < search_cp->length(); i++) { | |
1234 bool found = compare_entry_to(pattern_i, search_cp, i, CHECK_0); | |
1235 if (found) { | |
1236 return i; | |
1237 } | |
1238 } | |
1239 | |
1240 return 0; // entry not found; return unused index zero (0) | |
1241 } // end find_matching_entry() | |
1242 | |
1243 | |
1244 #ifndef PRODUCT | |
1245 | |
1246 const char* constantPoolOopDesc::printable_name_at(int which) { | |
1247 | |
1248 constantTag tag = tag_at(which); | |
1249 | |
1250 if (tag.is_unresolved_string() || tag.is_string()) { | |
1251 return string_at_noresolve(which); | |
1252 } else if (tag.is_klass() || tag.is_unresolved_klass()) { | |
1253 return klass_name_at(which)->as_C_string(); | |
1254 } else if (tag.is_symbol()) { | |
1255 return symbol_at(which)->as_C_string(); | |
1256 } | |
1257 return ""; | |
1258 } | |
1259 | |
1260 #endif // PRODUCT | |
1261 | |
1262 | |
1263 // JVMTI GetConstantPool support | |
1264 | |
1265 // For temporary use until code is stable. | |
1266 #define DBG(code) | |
1267 | |
1268 static const char* WARN_MSG = "Must not be such entry!"; | |
1269 | |
1270 static void print_cpool_bytes(jint cnt, u1 *bytes) { | |
1271 jint size = 0; | |
1272 u2 idx1, idx2; | |
1273 | |
1274 for (jint idx = 1; idx < cnt; idx++) { | |
1275 jint ent_size = 0; | |
1276 u1 tag = *bytes++; | |
1277 size++; // count tag | |
1278 | |
1279 printf("const #%03d, tag: %02d ", idx, tag); | |
1280 switch(tag) { | |
1281 case JVM_CONSTANT_Invalid: { | |
1282 printf("Invalid"); | |
1283 break; | |
1284 } | |
1285 case JVM_CONSTANT_Unicode: { | |
1286 printf("Unicode %s", WARN_MSG); | |
1287 break; | |
1288 } | |
1289 case JVM_CONSTANT_Utf8: { | |
1290 u2 len = Bytes::get_Java_u2(bytes); | |
1291 char str[128]; | |
1292 if (len > 127) { | |
1293 len = 127; | |
1294 } | |
1295 strncpy(str, (char *) (bytes+2), len); | |
1296 str[len] = '\0'; | |
1297 printf("Utf8 \"%s\"", str); | |
1298 ent_size = 2 + len; | |
1299 break; | |
1300 } | |
1301 case JVM_CONSTANT_Integer: { | |
1302 u4 val = Bytes::get_Java_u4(bytes); | |
1303 printf("int %d", *(int *) &val); | |
1304 ent_size = 4; | |
1305 break; | |
1306 } | |
1307 case JVM_CONSTANT_Float: { | |
1308 u4 val = Bytes::get_Java_u4(bytes); | |
1309 printf("float %5.3ff", *(float *) &val); | |
1310 ent_size = 4; | |
1311 break; | |
1312 } | |
1313 case JVM_CONSTANT_Long: { | |
1314 u8 val = Bytes::get_Java_u8(bytes); | |
513
2328d1d3f8cf
6781583: Hotspot build fails on linux 64 bit platform with gcc 4.3.2
xlu
parents:
431
diff
changeset
|
1315 printf("long "INT64_FORMAT, *(jlong *) &val); |
0 | 1316 ent_size = 8; |
1317 idx++; // Long takes two cpool slots | |
1318 break; | |
1319 } | |
1320 case JVM_CONSTANT_Double: { | |
1321 u8 val = Bytes::get_Java_u8(bytes); | |
1322 printf("double %5.3fd", *(jdouble *)&val); | |
1323 ent_size = 8; | |
1324 idx++; // Double takes two cpool slots | |
1325 break; | |
1326 } | |
1327 case JVM_CONSTANT_Class: { | |
1328 idx1 = Bytes::get_Java_u2(bytes); | |
1329 printf("class #%03d", idx1); | |
1330 ent_size = 2; | |
1331 break; | |
1332 } | |
1333 case JVM_CONSTANT_String: { | |
1334 idx1 = Bytes::get_Java_u2(bytes); | |
1335 printf("String #%03d", idx1); | |
1336 ent_size = 2; | |
1337 break; | |
1338 } | |
1339 case JVM_CONSTANT_Fieldref: { | |
1340 idx1 = Bytes::get_Java_u2(bytes); | |
1341 idx2 = Bytes::get_Java_u2(bytes+2); | |
1342 printf("Field #%03d, #%03d", (int) idx1, (int) idx2); | |
1343 ent_size = 4; | |
1344 break; | |
1345 } | |
1346 case JVM_CONSTANT_Methodref: { | |
1347 idx1 = Bytes::get_Java_u2(bytes); | |
1348 idx2 = Bytes::get_Java_u2(bytes+2); | |
1349 printf("Method #%03d, #%03d", idx1, idx2); | |
1350 ent_size = 4; | |
1351 break; | |
1352 } | |
1353 case JVM_CONSTANT_InterfaceMethodref: { | |
1354 idx1 = Bytes::get_Java_u2(bytes); | |
1355 idx2 = Bytes::get_Java_u2(bytes+2); | |
1356 printf("InterfMethod #%03d, #%03d", idx1, idx2); | |
1357 ent_size = 4; | |
1358 break; | |
1359 } | |
1360 case JVM_CONSTANT_NameAndType: { | |
1361 idx1 = Bytes::get_Java_u2(bytes); | |
1362 idx2 = Bytes::get_Java_u2(bytes+2); | |
1363 printf("NameAndType #%03d, #%03d", idx1, idx2); | |
1364 ent_size = 4; | |
1365 break; | |
1366 } | |
1367 case JVM_CONSTANT_ClassIndex: { | |
1368 printf("ClassIndex %s", WARN_MSG); | |
1369 break; | |
1370 } | |
1371 case JVM_CONSTANT_UnresolvedClass: { | |
1372 printf("UnresolvedClass: %s", WARN_MSG); | |
1373 break; | |
1374 } | |
1375 case JVM_CONSTANT_UnresolvedClassInError: { | |
1376 printf("UnresolvedClassInErr: %s", WARN_MSG); | |
1377 break; | |
1378 } | |
1379 case JVM_CONSTANT_StringIndex: { | |
1380 printf("StringIndex: %s", WARN_MSG); | |
1381 break; | |
1382 } | |
1383 case JVM_CONSTANT_UnresolvedString: { | |
1384 printf("UnresolvedString: %s", WARN_MSG); | |
1385 break; | |
1386 } | |
1387 } | |
1388 printf(";\n"); | |
1389 bytes += ent_size; | |
1390 size += ent_size; | |
1391 } | |
1392 printf("Cpool size: %d\n", size); | |
1393 fflush(0); | |
1394 return; | |
1395 } /* end print_cpool_bytes */ | |
1396 | |
1397 | |
1398 // Returns size of constant pool entry. | |
1399 jint constantPoolOopDesc::cpool_entry_size(jint idx) { | |
1400 switch(tag_at(idx).value()) { | |
1401 case JVM_CONSTANT_Invalid: | |
1402 case JVM_CONSTANT_Unicode: | |
1403 return 1; | |
1404 | |
1405 case JVM_CONSTANT_Utf8: | |
1406 return 3 + symbol_at(idx)->utf8_length(); | |
1407 | |
1408 case JVM_CONSTANT_Class: | |
1409 case JVM_CONSTANT_String: | |
1410 case JVM_CONSTANT_ClassIndex: | |
1411 case JVM_CONSTANT_UnresolvedClass: | |
1412 case JVM_CONSTANT_UnresolvedClassInError: | |
1413 case JVM_CONSTANT_StringIndex: | |
1414 case JVM_CONSTANT_UnresolvedString: | |
1602 | 1415 case JVM_CONSTANT_MethodType: |
0 | 1416 return 3; |
1417 | |
1602 | 1418 case JVM_CONSTANT_MethodHandle: |
1419 return 4; //tag, ref_kind, ref_index | |
1420 | |
0 | 1421 case JVM_CONSTANT_Integer: |
1422 case JVM_CONSTANT_Float: | |
1423 case JVM_CONSTANT_Fieldref: | |
1424 case JVM_CONSTANT_Methodref: | |
1425 case JVM_CONSTANT_InterfaceMethodref: | |
1426 case JVM_CONSTANT_NameAndType: | |
1913
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
1427 return 5; |
3b2dea75431e
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
1910
diff
changeset
|
1428 |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1429 case JVM_CONSTANT_InvokeDynamic: |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1430 case JVM_CONSTANT_InvokeDynamicTrans: |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1431 // u1 tag, u2 bsm, u2 nt |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1432 return 5; |
0 | 1433 |
1434 case JVM_CONSTANT_Long: | |
1435 case JVM_CONSTANT_Double: | |
1436 return 9; | |
1437 } | |
1438 assert(false, "cpool_entry_size: Invalid constant pool entry tag"); | |
1439 return 1; | |
1440 } /* end cpool_entry_size */ | |
1441 | |
1442 | |
1443 // SymbolHashMap is used to find a constant pool index from a string. | |
1444 // This function fills in SymbolHashMaps, one for utf8s and one for | |
1445 // class names, returns size of the cpool raw bytes. | |
1446 jint constantPoolOopDesc::hash_entries_to(SymbolHashMap *symmap, | |
1447 SymbolHashMap *classmap) { | |
1448 jint size = 0; | |
1449 | |
1450 for (u2 idx = 1; idx < length(); idx++) { | |
1451 u2 tag = tag_at(idx).value(); | |
1452 size += cpool_entry_size(idx); | |
1453 | |
1454 switch(tag) { | |
1455 case JVM_CONSTANT_Utf8: { | |
1456 symbolOop sym = symbol_at(idx); | |
1457 symmap->add_entry(sym, idx); | |
1458 DBG(printf("adding symbol entry %s = %d\n", sym->as_utf8(), idx)); | |
1459 break; | |
1460 } | |
1461 case JVM_CONSTANT_Class: | |
1462 case JVM_CONSTANT_UnresolvedClass: | |
1463 case JVM_CONSTANT_UnresolvedClassInError: { | |
1464 symbolOop sym = klass_name_at(idx); | |
1465 classmap->add_entry(sym, idx); | |
1466 DBG(printf("adding class entry %s = %d\n", sym->as_utf8(), idx)); | |
1467 break; | |
1468 } | |
1469 case JVM_CONSTANT_Long: | |
1470 case JVM_CONSTANT_Double: { | |
1471 idx++; // Both Long and Double take two cpool slots | |
1472 break; | |
1473 } | |
1474 } | |
1475 } | |
1476 return size; | |
1477 } /* end hash_utf8_entries_to */ | |
1478 | |
1479 | |
1480 // Copy cpool bytes. | |
1481 // Returns: | |
1482 // 0, in case of OutOfMemoryError | |
1483 // -1, in case of internal error | |
1484 // > 0, count of the raw cpool bytes that have been copied | |
1485 int constantPoolOopDesc::copy_cpool_bytes(int cpool_size, | |
1486 SymbolHashMap* tbl, | |
1487 unsigned char *bytes) { | |
1488 u2 idx1, idx2; | |
1489 jint size = 0; | |
1490 jint cnt = length(); | |
1491 unsigned char *start_bytes = bytes; | |
1492 | |
1493 for (jint idx = 1; idx < cnt; idx++) { | |
1494 u1 tag = tag_at(idx).value(); | |
1495 jint ent_size = cpool_entry_size(idx); | |
1496 | |
1497 assert(size + ent_size <= cpool_size, "Size mismatch"); | |
1498 | |
1499 *bytes = tag; | |
1500 DBG(printf("#%03hd tag=%03hd, ", idx, tag)); | |
1501 switch(tag) { | |
1502 case JVM_CONSTANT_Invalid: { | |
1503 DBG(printf("JVM_CONSTANT_Invalid")); | |
1504 break; | |
1505 } | |
1506 case JVM_CONSTANT_Unicode: { | |
1507 assert(false, "Wrong constant pool tag: JVM_CONSTANT_Unicode"); | |
1508 DBG(printf("JVM_CONSTANT_Unicode")); | |
1509 break; | |
1510 } | |
1511 case JVM_CONSTANT_Utf8: { | |
1512 symbolOop sym = symbol_at(idx); | |
1513 char* str = sym->as_utf8(); | |
1514 // Warning! It's crashing on x86 with len = sym->utf8_length() | |
1515 int len = (int) strlen(str); | |
1516 Bytes::put_Java_u2((address) (bytes+1), (u2) len); | |
1517 for (int i = 0; i < len; i++) { | |
1518 bytes[3+i] = (u1) str[i]; | |
1519 } | |
1520 DBG(printf("JVM_CONSTANT_Utf8: %s ", str)); | |
1521 break; | |
1522 } | |
1523 case JVM_CONSTANT_Integer: { | |
1524 jint val = int_at(idx); | |
1525 Bytes::put_Java_u4((address) (bytes+1), *(u4*)&val); | |
1526 break; | |
1527 } | |
1528 case JVM_CONSTANT_Float: { | |
1529 jfloat val = float_at(idx); | |
1530 Bytes::put_Java_u4((address) (bytes+1), *(u4*)&val); | |
1531 break; | |
1532 } | |
1533 case JVM_CONSTANT_Long: { | |
1534 jlong val = long_at(idx); | |
1535 Bytes::put_Java_u8((address) (bytes+1), *(u8*)&val); | |
1536 idx++; // Long takes two cpool slots | |
1537 break; | |
1538 } | |
1539 case JVM_CONSTANT_Double: { | |
1540 jdouble val = double_at(idx); | |
1541 Bytes::put_Java_u8((address) (bytes+1), *(u8*)&val); | |
1542 idx++; // Double takes two cpool slots | |
1543 break; | |
1544 } | |
1545 case JVM_CONSTANT_Class: | |
1546 case JVM_CONSTANT_UnresolvedClass: | |
1547 case JVM_CONSTANT_UnresolvedClassInError: { | |
1548 *bytes = JVM_CONSTANT_Class; | |
1549 symbolOop sym = klass_name_at(idx); | |
1550 idx1 = tbl->symbol_to_value(sym); | |
1551 assert(idx1 != 0, "Have not found a hashtable entry"); | |
1552 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1553 DBG(printf("JVM_CONSTANT_Class: idx=#%03hd, %s", idx1, sym->as_utf8())); | |
1554 break; | |
1555 } | |
1556 case JVM_CONSTANT_String: { | |
1557 unsigned int hash; | |
1558 char *str = string_at_noresolve(idx); | |
1559 symbolOop sym = SymbolTable::lookup_only(str, (int) strlen(str), hash); | |
773
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1560 if (sym == NULL) { |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1561 // sym can be NULL if string refers to incorrectly encoded JVM_CONSTANT_Utf8 |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1562 // this can happen with JVM TI; see CR 6839599 for more details |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1563 oop string = *(obj_at_addr(idx)); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1564 assert(java_lang_String::is_instance(string),"Not a String"); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1565 DBG(printf("Error #%03hd tag=%03hd\n", idx, tag)); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1566 idx1 = 0; |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1567 for (int j = 0; j < tbl->table_size() && idx1 == 0; j++) { |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1568 for (SymbolHashMapEntry* cur = tbl->bucket(j); cur != NULL; cur = cur->next()) { |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1569 int length; |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1570 sym = cur->symbol(); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1571 jchar* chars = sym->as_unicode(length); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1572 if (java_lang_String::equals(string, chars, length)) { |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1573 idx1 = cur->value(); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1574 DBG(printf("Index found: %d\n",idx1)); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1575 break; |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1576 } |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1577 } |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1578 } |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1579 } else { |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1580 idx1 = tbl->symbol_to_value(sym); |
47ffceb239d0
6839599: JVM crash while profiling Tomcat and Liferay
thurka
parents:
726
diff
changeset
|
1581 } |
0 | 1582 assert(idx1 != 0, "Have not found a hashtable entry"); |
1583 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1584 DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, str)); | |
1585 break; | |
1586 } | |
1587 case JVM_CONSTANT_UnresolvedString: { | |
1588 *bytes = JVM_CONSTANT_String; | |
1589 symbolOop sym = unresolved_string_at(idx); | |
1590 idx1 = tbl->symbol_to_value(sym); | |
1591 assert(idx1 != 0, "Have not found a hashtable entry"); | |
1592 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1593 DBG(char *str = sym->as_utf8()); | |
1594 DBG(printf("JVM_CONSTANT_UnresolvedString: idx=#%03hd, %s", idx1, str)); | |
1595 break; | |
1596 } | |
1597 case JVM_CONSTANT_Fieldref: | |
1598 case JVM_CONSTANT_Methodref: | |
1599 case JVM_CONSTANT_InterfaceMethodref: { | |
1600 idx1 = uncached_klass_ref_index_at(idx); | |
1601 idx2 = uncached_name_and_type_ref_index_at(idx); | |
1602 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1603 Bytes::put_Java_u2((address) (bytes+3), idx2); | |
1604 DBG(printf("JVM_CONSTANT_Methodref: %hd %hd", idx1, idx2)); | |
1605 break; | |
1606 } | |
1607 case JVM_CONSTANT_NameAndType: { | |
1608 idx1 = name_ref_index_at(idx); | |
1609 idx2 = signature_ref_index_at(idx); | |
1610 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1611 Bytes::put_Java_u2((address) (bytes+3), idx2); | |
1612 DBG(printf("JVM_CONSTANT_NameAndType: %hd %hd", idx1, idx2)); | |
1613 break; | |
1614 } | |
1615 case JVM_CONSTANT_ClassIndex: { | |
1616 *bytes = JVM_CONSTANT_Class; | |
1617 idx1 = klass_index_at(idx); | |
1618 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1619 DBG(printf("JVM_CONSTANT_ClassIndex: %hd", idx1)); | |
1620 break; | |
1621 } | |
1622 case JVM_CONSTANT_StringIndex: { | |
1623 *bytes = JVM_CONSTANT_String; | |
1624 idx1 = string_index_at(idx); | |
1625 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1626 DBG(printf("JVM_CONSTANT_StringIndex: %hd", idx1)); | |
1627 break; | |
1628 } | |
1602 | 1629 case JVM_CONSTANT_MethodHandle: { |
1630 *bytes = JVM_CONSTANT_MethodHandle; | |
1631 int kind = method_handle_ref_kind_at(idx); | |
1632 idx1 = method_handle_index_at(idx); | |
1633 *(bytes+1) = (unsigned char) kind; | |
1634 Bytes::put_Java_u2((address) (bytes+2), idx1); | |
1635 DBG(printf("JVM_CONSTANT_MethodHandle: %d %hd", kind, idx1)); | |
1636 break; | |
1637 } | |
1638 case JVM_CONSTANT_MethodType: { | |
1639 *bytes = JVM_CONSTANT_MethodType; | |
1640 idx1 = method_type_index_at(idx); | |
1641 Bytes::put_Java_u2((address) (bytes+1), idx1); | |
1642 DBG(printf("JVM_CONSTANT_MethodType: %hd", idx1)); | |
1643 break; | |
1644 } | |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1645 case JVM_CONSTANT_InvokeDynamicTrans: |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1646 case JVM_CONSTANT_InvokeDynamic: { |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1647 *bytes = tag; |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1648 idx1 = extract_low_short_from_int(*int_at_addr(idx)); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1649 idx2 = extract_high_short_from_int(*int_at_addr(idx)); |
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1650 assert(idx2 == invoke_dynamic_name_and_type_ref_index_at(idx), "correct half of u4"); |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1651 Bytes::put_Java_u2((address) (bytes+1), idx1); |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1652 Bytes::put_Java_u2((address) (bytes+3), idx2); |
2011
dad31fc330cd
7001379: bootstrap method data needs to be moved from constant pool to a classfile attribute
jrose
parents:
1972
diff
changeset
|
1653 DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2)); |
1660
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1654 break; |
083fde3b838e
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
1602
diff
changeset
|
1655 } |
0 | 1656 } |
1657 DBG(printf("\n")); | |
1658 bytes += ent_size; | |
1659 size += ent_size; | |
1660 } | |
1661 assert(size == cpool_size, "Size mismatch"); | |
1662 | |
1663 // Keep temorarily for debugging until it's stable. | |
1664 DBG(print_cpool_bytes(cnt, start_bytes)); | |
1665 return (int)(bytes - start_bytes); | |
1666 } /* end copy_cpool_bytes */ | |
1667 | |
1668 | |
1669 void SymbolHashMap::add_entry(symbolOop sym, u2 value) { | |
1670 char *str = sym->as_utf8(); | |
1671 unsigned int hash = compute_hash(str, sym->utf8_length()); | |
1672 unsigned int index = hash % table_size(); | |
1673 | |
1674 // check if already in map | |
1675 // we prefer the first entry since it is more likely to be what was used in | |
1676 // the class file | |
1677 for (SymbolHashMapEntry *en = bucket(index); en != NULL; en = en->next()) { | |
1678 assert(en->symbol() != NULL, "SymbolHashMapEntry symbol is NULL"); | |
1679 if (en->hash() == hash && en->symbol() == sym) { | |
1680 return; // already there | |
1681 } | |
1682 } | |
1683 | |
1684 SymbolHashMapEntry* entry = new SymbolHashMapEntry(hash, sym, value); | |
1685 entry->set_next(bucket(index)); | |
1686 _buckets[index].set_entry(entry); | |
1687 assert(entry->symbol() != NULL, "SymbolHashMapEntry symbol is NULL"); | |
1688 } | |
1689 | |
1690 SymbolHashMapEntry* SymbolHashMap::find_entry(symbolOop sym) { | |
1691 assert(sym != NULL, "SymbolHashMap::find_entry - symbol is NULL"); | |
1692 char *str = sym->as_utf8(); | |
1693 int len = sym->utf8_length(); | |
1694 unsigned int hash = SymbolHashMap::compute_hash(str, len); | |
1695 unsigned int index = hash % table_size(); | |
1696 for (SymbolHashMapEntry *en = bucket(index); en != NULL; en = en->next()) { | |
1697 assert(en->symbol() != NULL, "SymbolHashMapEntry symbol is NULL"); | |
1698 if (en->hash() == hash && en->symbol() == sym) { | |
1699 return en; | |
1700 } | |
1701 } | |
1702 return NULL; | |
1703 } |