8001658: No need to pass resolved_references as argument to ConstantPoolCacheEntry::set_method_handle_common

Reviewed-by: twisti
This commit is contained in:
Bharadwaj Yadavalli 2012-11-02 12:30:46 -07:00 committed by Christian Thalinger
parent d81c4b5d7d
commit 642c6b415a
3 changed files with 16 additions and 37 deletions

View file

@ -733,12 +733,7 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invokehandle(JavaThread* thread)) {
get_index_u2_cpcache(thread, bytecode), bytecode, CHECK); get_index_u2_cpcache(thread, bytecode), bytecode, CHECK);
} // end JvmtiHideSingleStepping } // end JvmtiHideSingleStepping
cache_entry(thread)->set_method_handle( cache_entry(thread)->set_method_handle(pool, info);
pool,
info.resolved_method(),
info.resolved_appendix(),
info.resolved_method_type(),
pool->resolved_references());
} }
IRT_END IRT_END
@ -762,12 +757,7 @@ IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) {
} // end JvmtiHideSingleStepping } // end JvmtiHideSingleStepping
ConstantPoolCacheEntry* cp_cache_entry = pool->invokedynamic_cp_cache_entry_at(index); ConstantPoolCacheEntry* cp_cache_entry = pool->invokedynamic_cp_cache_entry_at(index);
cp_cache_entry->set_dynamic_call( cp_cache_entry->set_dynamic_call(pool, info);
pool,
info.resolved_method(),
info.resolved_appendix(),
info.resolved_method_type(),
pool->resolved_references());
} }
IRT_END IRT_END

View file

@ -243,25 +243,17 @@ void ConstantPoolCacheEntry::set_interface_call(methodHandle method, int index)
} }
void ConstantPoolCacheEntry::set_method_handle(constantPoolHandle cpool, void ConstantPoolCacheEntry::set_method_handle(constantPoolHandle cpool, const CallInfo &call_info) {
methodHandle adapter, set_method_handle_common(cpool, Bytecodes::_invokehandle, call_info);
Handle appendix, Handle method_type,
objArrayHandle resolved_references) {
set_method_handle_common(cpool, Bytecodes::_invokehandle, adapter, appendix, method_type, resolved_references);
} }
void ConstantPoolCacheEntry::set_dynamic_call(constantPoolHandle cpool, void ConstantPoolCacheEntry::set_dynamic_call(constantPoolHandle cpool, const CallInfo &call_info) {
methodHandle adapter, set_method_handle_common(cpool, Bytecodes::_invokedynamic, call_info);
Handle appendix, Handle method_type,
objArrayHandle resolved_references) {
set_method_handle_common(cpool, Bytecodes::_invokedynamic, adapter, appendix, method_type, resolved_references);
} }
void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool, void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool,
Bytecodes::Code invoke_code, Bytecodes::Code invoke_code,
methodHandle adapter, const CallInfo &call_info) {
Handle appendix, Handle method_type,
objArrayHandle resolved_references) {
// NOTE: This CPCE can be the subject of data races. // NOTE: This CPCE can be the subject of data races.
// There are three words to update: flags, refs[f2], f1 (in that order). // There are three words to update: flags, refs[f2], f1 (in that order).
// Writers must store all other values before f1. // Writers must store all other values before f1.
@ -276,6 +268,9 @@ void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool,
return; return;
} }
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_appendix = appendix.not_null();
const bool has_method_type = method_type.not_null(); const bool has_method_type = method_type.not_null();
@ -315,6 +310,7 @@ void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool,
// This allows us to create fewer method oops, while keeping type safety. // This allows us to create fewer method oops, while keeping type safety.
// //
objArrayHandle resolved_references = cpool->resolved_references();
// Store appendix, if any. // Store appendix, if any.
if (has_appendix) { if (has_appendix) {
const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset; const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset;

View file

@ -117,6 +117,8 @@ class PSPromotionManager;
// The fields are volatile so that they are stored in the order written in the // The fields are volatile so that they are stored in the order written in the
// source code. The _indices field with the bytecode must be written last. // source code. The _indices field with the bytecode must be written last.
class CallInfo;
class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC { class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
friend class VMStructs; friend class VMStructs;
friend class constantPoolCacheKlass; friend class constantPoolCacheKlass;
@ -223,18 +225,12 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
void set_method_handle( void set_method_handle(
constantPoolHandle cpool, // holding constant pool (required for locking) constantPoolHandle cpool, // holding constant pool (required for locking)
methodHandle method, // adapter for invokeExact, etc. const CallInfo &call_info // Call link information
Handle appendix, // stored in refs[f2+0]; could be a java.lang.invoke.MethodType
Handle method_type, // stored in refs[f2+1]; is a java.lang.invoke.MethodType
objArrayHandle resolved_references
); );
void set_dynamic_call( void set_dynamic_call(
constantPoolHandle cpool, // holding constant pool (required for locking) constantPoolHandle cpool, // holding constant pool (required for locking)
methodHandle method, // adapter for this call site const CallInfo &call_info // Call link information
Handle appendix, // stored in refs[f2+0]; could be a java.lang.invoke.CallSite
Handle method_type, // stored in refs[f2+1]; is a java.lang.invoke.MethodType
objArrayHandle resolved_references
); );
// Common code for invokedynamic and MH invocations. // Common code for invokedynamic and MH invocations.
@ -255,10 +251,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
void set_method_handle_common( void set_method_handle_common(
constantPoolHandle cpool, // holding constant pool (required for locking) constantPoolHandle cpool, // holding constant pool (required for locking)
Bytecodes::Code invoke_code, // _invokehandle or _invokedynamic Bytecodes::Code invoke_code, // _invokehandle or _invokedynamic
methodHandle adapter, // invoker method (f1) const CallInfo &call_info // Call link information
Handle appendix, // appendix such as CallSite, MethodType, etc. (refs[f2+0])
Handle method_type, // MethodType (refs[f2+1])
objArrayHandle resolved_references
); );
// invokedynamic and invokehandle call sites have two entries in the // invokedynamic and invokehandle call sites have two entries in the