< prev index next >

src/hotspot/share/interpreter/rewriter.cpp

Print this page
rev 52749 : Bootstrap method consolidation
* clean up and simplify JDK support code for BSM invocation
* simplify JVM bootstrap handshake: use BootstrapCallInfo only
* remove unused JVM paths and data fields
* move bootstrap argument processing from MethodHandleNatives to ConstantPool
* remove ConstantGroup; merge argument access into BootstrapCallInfo
* adjust BSM argument access: remove copyArguments, add argumentRef API
* add metadata-free BSM modes, including symbolic arguments from CP

*** 94,104 **** void Rewriter::make_constant_pool_cache(TRAPS) { ClassLoaderData* loader_data = _pool->pool_holder()->class_loader_data(); ConstantPoolCache* cache = ConstantPoolCache::allocate(loader_data, _cp_cache_map, _invokedynamic_cp_cache_map, ! _invokedynamic_references_map, CHECK); // initialize object cache in constant pool _pool->set_cache(cache); cache->set_constant_pool(_pool()); --- 94,104 ---- void Rewriter::make_constant_pool_cache(TRAPS) { ClassLoaderData* loader_data = _pool->pool_holder()->class_loader_data(); ConstantPoolCache* cache = ConstantPoolCache::allocate(loader_data, _cp_cache_map, _invokedynamic_cp_cache_map, ! _appendix_references_map, CHECK); // initialize object cache in constant pool _pool->set_cache(cache); cache->set_constant_pool(_pool());
*** 219,235 **** if (status == 0) { if (_pool->klass_ref_at_noresolve(cp_index) == vmSymbols::java_lang_invoke_MethodHandle() && MethodHandles::is_signature_polymorphic_name(SystemDictionary::MethodHandle_klass(), _pool->name_ref_at(cp_index))) { // we may need a resolved_refs entry for the appendix ! add_invokedynamic_resolved_references_entries(cp_index, cache_index); status = +1; } else if (_pool->klass_ref_at_noresolve(cp_index) == vmSymbols::java_lang_invoke_VarHandle() && MethodHandles::is_signature_polymorphic_name(SystemDictionary::VarHandle_klass(), _pool->name_ref_at(cp_index))) { // we may need a resolved_refs entry for the appendix ! add_invokedynamic_resolved_references_entries(cp_index, cache_index); status = +1; } else { status = -1; } _method_handle_invokers.at(cp_index) = status; --- 219,235 ---- if (status == 0) { if (_pool->klass_ref_at_noresolve(cp_index) == vmSymbols::java_lang_invoke_MethodHandle() && MethodHandles::is_signature_polymorphic_name(SystemDictionary::MethodHandle_klass(), _pool->name_ref_at(cp_index))) { // we may need a resolved_refs entry for the appendix ! add_appendix_references_entry(cp_index, cache_index); status = +1; } else if (_pool->klass_ref_at_noresolve(cp_index) == vmSymbols::java_lang_invoke_VarHandle() && MethodHandles::is_signature_polymorphic_name(SystemDictionary::VarHandle_klass(), _pool->name_ref_at(cp_index))) { // we may need a resolved_refs entry for the appendix ! add_appendix_references_entry(cp_index, cache_index); status = +1; } else { status = -1; } _method_handle_invokers.at(cp_index) = status;
*** 257,267 **** address p = bcp + offset; assert(p[-1] == Bytecodes::_invokedynamic, "not invokedynamic bytecode"); if (!reverse) { int cp_index = Bytes::get_Java_u2(p); int cache_index = add_invokedynamic_cp_cache_entry(cp_index); ! int resolved_index = add_invokedynamic_resolved_references_entries(cp_index, cache_index); // Replace the trailing four bytes with a CPC index for the dynamic // call site. Unlike other CPC entries, there is one per bytecode, // not just one per distinct CP entry. In other words, the // CPC-to-CP relation is many-to-one for invokedynamic entries. // This means we must use a larger index size than u2 to address --- 257,267 ---- address p = bcp + offset; assert(p[-1] == Bytecodes::_invokedynamic, "not invokedynamic bytecode"); if (!reverse) { int cp_index = Bytes::get_Java_u2(p); int cache_index = add_invokedynamic_cp_cache_entry(cp_index); ! int resolved_index = add_appendix_references_entry(cp_index, cache_index); // Replace the trailing four bytes with a CPC index for the dynamic // call site. Unlike other CPC entries, there is one per bytecode, // not just one per distinct CP entry. In other words, the // CPC-to-CP relation is many-to-one for invokedynamic entries. // This means we must use a larger index size than u2 to address
*** 305,320 **** Bytes::put_native_u4(p, ConstantPool::encode_invokedynamic_index(cache_index + delta)); // invokedynamic resolved references map also points to cp cache and must // add delta to each. int resolved_index = _patch_invokedynamic_refs->at(i); ! for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { ! assert(_invokedynamic_references_map.at(resolved_index + entry) == cache_index, "should be the same index"); ! _invokedynamic_references_map.at_put(resolved_index+entry, ! cache_index + delta); ! } } } } --- 305,317 ---- Bytes::put_native_u4(p, ConstantPool::encode_invokedynamic_index(cache_index + delta)); // invokedynamic resolved references map also points to cp cache and must // add delta to each. int resolved_index = _patch_invokedynamic_refs->at(i); ! assert(_appendix_references_map.at(resolved_index) == cache_index, "should be the same index"); ! _appendix_references_map.at_put(resolved_index, cache_index + delta); } } }
*** 582,592 **** _methods(methods), _cp_map(cpool->length()), _cp_cache_map(cpool->length() / 2), _reference_map(cpool->length()), _resolved_references_map(cpool->length() / 2), ! _invokedynamic_references_map(cpool->length() / 2), _method_handle_invokers(cpool->length()), _invokedynamic_cp_cache_map(cpool->length() / 4) { // Rewrite bytecodes - exception here exits. --- 579,589 ---- _methods(methods), _cp_map(cpool->length()), _cp_cache_map(cpool->length() / 2), _reference_map(cpool->length()), _resolved_references_map(cpool->length() / 2), ! _appendix_references_map(cpool->length() / 2), _method_handle_invokers(cpool->length()), _invokedynamic_cp_cache_map(cpool->length() / 4) { // Rewrite bytecodes - exception here exits.
< prev index next >