Mercurial > hg > truffle
comparison src/share/vm/oops/constantPoolOop.cpp @ 1059:389049f3f393
6858164: invokedynamic code needs some cleanup (post-6655638)
Summary: Fix several crashers, remove needless paths for boxed-style bootstrap method call, refactor & simplify APIs for rewriter constantPoolOop, remove sun.dyn.CallSiteImpl
Reviewed-by: kvn
author | jrose |
---|---|
date | Fri, 30 Oct 2009 16:22:59 -0700 |
parents | 47ffceb239d0 |
children | 4ce7240d622c |
comparison
equal
deleted
inserted
replaced
1058:73a726751507 | 1059:389049f3f393 |
---|---|
260 return symbol_at(signature_index); | 260 return symbol_at(signature_index); |
261 } | 261 } |
262 | 262 |
263 | 263 |
264 int constantPoolOopDesc::impl_name_and_type_ref_index_at(int which, bool uncached) { | 264 int constantPoolOopDesc::impl_name_and_type_ref_index_at(int which, bool uncached) { |
265 jint ref_index = field_or_method_at(which, uncached); | 265 int i = which; |
266 if (!uncached && cache() != NULL) { | |
267 if (constantPoolCacheOopDesc::is_secondary_index(which)) | |
268 // Invokedynamic indexes are always processed in native order | |
269 // so there is no question of reading a native u2 in Java order here. | |
270 return cache()->main_entry_at(which)->constant_pool_index(); | |
271 // change byte-ordering and go via cache | |
272 i = remap_instruction_operand_from_cache(which); | |
273 } else { | |
274 if (tag_at(which).is_name_and_type()) | |
275 // invokedynamic index is a simple name-and-type | |
276 return which; | |
277 } | |
278 assert(tag_at(i).is_field_or_method(), "Corrupted constant pool"); | |
279 jint ref_index = *int_at_addr(i); | |
266 return extract_high_short_from_int(ref_index); | 280 return extract_high_short_from_int(ref_index); |
267 } | 281 } |
268 | 282 |
269 | 283 |
270 int constantPoolOopDesc::impl_klass_ref_index_at(int which, bool uncached) { | 284 int constantPoolOopDesc::impl_klass_ref_index_at(int which, bool uncached) { |
271 jint ref_index = field_or_method_at(which, uncached); | 285 guarantee(!constantPoolCacheOopDesc::is_secondary_index(which), |
286 "an invokedynamic instruction does not have a klass"); | |
287 int i = which; | |
288 if (!uncached && cache() != NULL) { | |
289 // change byte-ordering and go via cache | |
290 i = remap_instruction_operand_from_cache(which); | |
291 } | |
292 assert(tag_at(i).is_field_or_method(), "Corrupted constant pool"); | |
293 jint ref_index = *int_at_addr(i); | |
272 return extract_low_short_from_int(ref_index); | 294 return extract_low_short_from_int(ref_index); |
273 } | 295 } |
274 | 296 |
275 | 297 |
276 | 298 |
277 int constantPoolOopDesc::map_instruction_operand_to_index(int operand) { | 299 int constantPoolOopDesc::remap_instruction_operand_from_cache(int operand) { |
278 if (constantPoolCacheOopDesc::is_secondary_index(operand)) { | 300 // Operand was fetched by a stream using get_Java_u2, yet was stored |
279 return cache()->main_entry_at(operand)->constant_pool_index(); | 301 // by Rewriter::rewrite_member_reference in native order. |
280 } | 302 // So now we have to fix the damage by swapping back to native order. |
281 assert((int)(u2)operand == operand, "clean u2"); | 303 assert((int)(u2)operand == operand, "clean u2"); |
282 int index = Bytes::swap_u2(operand); | 304 int cpc_index = Bytes::swap_u2(operand); |
283 return cache()->entry_at(index)->constant_pool_index(); | 305 int member_index = cache()->entry_at(cpc_index)->constant_pool_index(); |
306 return member_index; | |
284 } | 307 } |
285 | 308 |
286 | 309 |
287 void constantPoolOopDesc::verify_constant_pool_resolve(constantPoolHandle this_oop, KlassHandle k, TRAPS) { | 310 void constantPoolOopDesc::verify_constant_pool_resolve(constantPoolHandle this_oop, KlassHandle k, TRAPS) { |
288 if (k->oop_is_instance() || k->oop_is_objArray()) { | 311 if (k->oop_is_instance() || k->oop_is_objArray()) { |