--- old/src/hotspot/share/oops/cpCache.cpp 2018-09-28 11:53:37.000000000 -0700 +++ new/src/hotspot/share/oops/cpCache.cpp 2018-09-28 11:53:36.000000000 -0700 @@ -381,24 +381,23 @@ const methodHandle adapter = call_info.resolved_method(); const Handle appendix = call_info.resolved_appendix(); - const Handle method_type = call_info.resolved_method_type(); const bool has_appendix = appendix.not_null(); - const bool has_method_type = method_type.not_null(); + const bool has_local_sig = call_info.has_local_signature(); + assert(has_local_sig, "MHs and indy are always sig-poly"); // Write the flags. set_method_flags(as_TosState(adapter->result_type()), - ((has_appendix ? 1 : 0) << has_appendix_shift ) | - ((has_method_type ? 1 : 0) << has_method_type_shift) | - ( 1 << is_final_shift ), + ((has_appendix ? 1 : 0) << has_appendix_shift ) | + ((has_local_sig ? 1 : 0) << has_local_signature_shift ) | + ( 1 << is_final_shift ), adapter->size_of_parameters()); if (TraceInvokeDynamic) { ttyLocker ttyl; - tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method_type=" PTR_FORMAT "%s method=" PTR_FORMAT " ", + tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method=" PTR_FORMAT "%s ", invoke_code, p2i(appendix()), (has_appendix ? "" : " (unused)"), - p2i(method_type()), (has_method_type ? "" : " (unused)"), - p2i(adapter())); + p2i(adapter()), (has_local_sig ? " (local signature)" : "")); adapter->print(); if (has_appendix) appendix()->print(); } @@ -424,20 +423,12 @@ // Store appendix, if any. if (has_appendix) { - const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset; + const int appendix_index = f2_as_index(); assert(appendix_index >= 0 && appendix_index < resolved_references->length(), "oob"); assert(resolved_references->obj_at(appendix_index) == NULL, "init just once"); resolved_references->obj_at_put(appendix_index, appendix()); } - // Store MethodType, if any. - if (has_method_type) { - const int method_type_index = f2_as_index() + _indy_resolved_references_method_type_offset; - assert(method_type_index >= 0 && method_type_index < resolved_references->length(), "oob"); - assert(resolved_references->obj_at(method_type_index) == NULL, "init just once"); - resolved_references->obj_at_put(method_type_index, method_type()); - } - release_set_f1(adapter()); // This must be the last one to set (see NOTE above)! // The interpreter assembly code does not check byte_2, @@ -448,6 +439,9 @@ ttyLocker ttyl; this->print(tty, 0); } + + assert(has_appendix == this->has_appendix(), "proper storage of appendix flag"); + assert(has_local_sig == this->has_local_signature(), "proper storage of signature flag"); } bool ConstantPoolCacheEntry::save_and_throw_indy_exc( @@ -533,16 +527,7 @@ oop ConstantPoolCacheEntry::appendix_if_resolved(const constantPoolHandle& cpool) { if (!has_appendix()) return NULL; - const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset; - objArrayOop resolved_references = cpool->resolved_references(); - return resolved_references->obj_at(ref_index); -} - - -oop ConstantPoolCacheEntry::method_type_if_resolved(const constantPoolHandle& cpool) { - if (!has_method_type()) - return NULL; - const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset; + const int ref_index = f2_as_index(); objArrayOop resolved_references = cpool->resolved_references(); return resolved_references->obj_at(ref_index); } @@ -669,7 +654,7 @@ void ConstantPoolCache::initialize(const intArray& inverse_index_map, const intArray& invokedynamic_inverse_index_map, - const intArray& invokedynamic_references_map) { + const intArray& appendix_references_map) { for (int i = 0; i < inverse_index_map.length(); i++) { ConstantPoolCacheEntry* e = entry_at(i); int original_index = inverse_index_map.at(i); @@ -687,19 +672,10 @@ assert(entry_at(offset) == e, "sanity"); } - for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) { - const int cpci = invokedynamic_references_map.at(ref); + for (int ref = 0; ref < appendix_references_map.length(); ref++) { + const int cpci = appendix_references_map.at(ref); if (cpci >= 0) { -#ifdef ASSERT - // invokedynamic and invokehandle have more entries; check if they - // all point to the same constant pool cache entry. - for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { - const int cpci_next = invokedynamic_references_map.at(ref + entry); - assert(cpci == cpci_next, "%d == %d", cpci, cpci_next); - } -#endif entry_at(cpci)->initialize_resolved_reference_index(ref); - ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1; // skip extra entries } } }