comparison src/hotspot/share/oops/cpCache.cpp @ 54896:bdccafc038a2

8217998: Remove method_type field associated with the appendix field of an indy or method handle call Summary: Removed the unused method_type field associated with the appendix field of an indy or method handle call. Reviewed-by: acorn, coleenp, dlong
author lfoltan
date Wed, 13 Feb 2019 15:50:08 -0500
parents f72661ff0294
children 9c3fe09f69bc
comparison
equal deleted inserted replaced
21:aab5c016af46 22:245f4ab0e0d1
390 return; 390 return;
391 } 391 }
392 392
393 const methodHandle adapter = call_info.resolved_method(); 393 const methodHandle adapter = call_info.resolved_method();
394 const Handle appendix = call_info.resolved_appendix(); 394 const Handle appendix = call_info.resolved_appendix();
395 const Handle method_type = call_info.resolved_method_type();
396 const bool has_appendix = appendix.not_null(); 395 const bool has_appendix = appendix.not_null();
397 const bool has_method_type = method_type.not_null();
398 396
399 // Write the flags. 397 // Write the flags.
398 // MHs and indy are always sig-poly and have a local signature.
400 set_method_flags(as_TosState(adapter->result_type()), 399 set_method_flags(as_TosState(adapter->result_type()),
401 ((has_appendix ? 1 : 0) << has_appendix_shift ) | 400 ((has_appendix ? 1 : 0) << has_appendix_shift ) |
402 ((has_method_type ? 1 : 0) << has_method_type_shift) | 401 ( 1 << has_local_signature_shift ) |
403 ( 1 << is_final_shift ), 402 ( 1 << is_final_shift ),
404 adapter->size_of_parameters()); 403 adapter->size_of_parameters());
405 404
406 if (TraceInvokeDynamic) { 405 if (TraceInvokeDynamic) {
407 ttyLocker ttyl; 406 ttyLocker ttyl;
408 tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method_type=" PTR_FORMAT "%s method=" PTR_FORMAT " ", 407 tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method=" PTR_FORMAT " (local signature) ",
409 invoke_code, 408 invoke_code,
410 p2i(appendix()), (has_appendix ? "" : " (unused)"), 409 p2i(appendix()),
411 p2i(method_type()), (has_method_type ? "" : " (unused)"), 410 (has_appendix ? "" : " (unused)"),
412 p2i(adapter())); 411 p2i(adapter()));
413 adapter->print(); 412 adapter->print();
414 if (has_appendix) appendix()->print(); 413 if (has_appendix) appendix()->print();
415 } 414 }
416 415
433 // This allows us to create fewer Methods, while keeping type safety. 432 // This allows us to create fewer Methods, while keeping type safety.
434 // 433 //
435 434
436 // Store appendix, if any. 435 // Store appendix, if any.
437 if (has_appendix) { 436 if (has_appendix) {
438 const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset; 437 const int appendix_index = f2_as_index();
439 assert(appendix_index >= 0 && appendix_index < resolved_references->length(), "oob"); 438 assert(appendix_index >= 0 && appendix_index < resolved_references->length(), "oob");
440 assert(resolved_references->obj_at(appendix_index) == NULL, "init just once"); 439 assert(resolved_references->obj_at(appendix_index) == NULL, "init just once");
441 resolved_references->obj_at_put(appendix_index, appendix()); 440 resolved_references->obj_at_put(appendix_index, appendix());
442 }
443
444 // Store MethodType, if any.
445 if (has_method_type) {
446 const int method_type_index = f2_as_index() + _indy_resolved_references_method_type_offset;
447 assert(method_type_index >= 0 && method_type_index < resolved_references->length(), "oob");
448 assert(resolved_references->obj_at(method_type_index) == NULL, "init just once");
449 resolved_references->obj_at_put(method_type_index, method_type());
450 } 441 }
451 442
452 release_set_f1(adapter()); // This must be the last one to set (see NOTE above)! 443 release_set_f1(adapter()); // This must be the last one to set (see NOTE above)!
453 444
454 // The interpreter assembly code does not check byte_2, 445 // The interpreter assembly code does not check byte_2,
457 NOT_PRODUCT(verify(tty)); 448 NOT_PRODUCT(verify(tty));
458 if (TraceInvokeDynamic) { 449 if (TraceInvokeDynamic) {
459 ttyLocker ttyl; 450 ttyLocker ttyl;
460 this->print(tty, 0); 451 this->print(tty, 0);
461 } 452 }
453
454 assert(has_appendix == this->has_appendix(), "proper storage of appendix flag");
455 assert(this->has_local_signature(), "proper storage of signature flag");
462 } 456 }
463 457
464 bool ConstantPoolCacheEntry::save_and_throw_indy_exc( 458 bool ConstantPoolCacheEntry::save_and_throw_indy_exc(
465 const constantPoolHandle& cpool, int cpool_index, int index, constantTag tag, TRAPS) { 459 const constantPoolHandle& cpool, int cpool_index, int index, constantTag tag, TRAPS) {
466 460
542 536
543 537
544 oop ConstantPoolCacheEntry::appendix_if_resolved(const constantPoolHandle& cpool) { 538 oop ConstantPoolCacheEntry::appendix_if_resolved(const constantPoolHandle& cpool) {
545 if (!has_appendix()) 539 if (!has_appendix())
546 return NULL; 540 return NULL;
547 const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset; 541 const int ref_index = f2_as_index();
548 objArrayOop resolved_references = cpool->resolved_references();
549 return resolved_references->obj_at(ref_index);
550 }
551
552
553 oop ConstantPoolCacheEntry::method_type_if_resolved(const constantPoolHandle& cpool) {
554 if (!has_method_type())
555 return NULL;
556 const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset;
557 objArrayOop resolved_references = cpool->resolved_references(); 542 objArrayOop resolved_references = cpool->resolved_references();
558 return resolved_references->obj_at(ref_index); 543 return resolved_references->obj_at(ref_index);
559 } 544 }
560 545
561 546
699 } 684 }
700 685
701 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) { 686 for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
702 const int cpci = invokedynamic_references_map.at(ref); 687 const int cpci = invokedynamic_references_map.at(ref);
703 if (cpci >= 0) { 688 if (cpci >= 0) {
704 #ifdef ASSERT
705 // invokedynamic and invokehandle have more entries; check if they
706 // all point to the same constant pool cache entry.
707 for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
708 const int cpci_next = invokedynamic_references_map.at(ref + entry);
709 assert(cpci == cpci_next, "%d == %d", cpci, cpci_next);
710 }
711 #endif
712 entry_at(cpci)->initialize_resolved_reference_index(ref); 689 entry_at(cpci)->initialize_resolved_reference_index(ref);
713 ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1; // skip extra entries
714 } 690 }
715 } 691 }
716 } 692 }
717 693
718 void ConstantPoolCache::verify_just_initialized() { 694 void ConstantPoolCache::verify_just_initialized() {