提交 99179e62 编写于 作者: J jrose

6969574: invokedynamic call sites deoptimize instead of executing

Reviewed-by: kvn
上级 8c86f1bb
...@@ -728,8 +728,8 @@ ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool, ...@@ -728,8 +728,8 @@ ciMethod* ciEnv::get_fake_invokedynamic_method_impl(constantPoolHandle cpool,
} }
// Get the invoker methodOop from the constant pool. // Get the invoker methodOop from the constant pool.
intptr_t f2_value = cpool->cache()->main_entry_at(index)->f2(); oop f1_value = cpool->cache()->main_entry_at(index)->f1();
methodOop signature_invoker = methodOop(f2_value); methodOop signature_invoker = methodOop(f1_value);
assert(signature_invoker != NULL && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(), assert(signature_invoker != NULL && signature_invoker->is_method() && signature_invoker->is_method_handle_invoke(),
"correct result from LinkResolver::resolve_invokedynamic"); "correct result from LinkResolver::resolve_invokedynamic");
......
...@@ -694,30 +694,21 @@ int ciMethod::scale_count(int count, float prof_factor) { ...@@ -694,30 +694,21 @@ int ciMethod::scale_count(int count, float prof_factor) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// ciMethod::is_method_handle_invoke // ciMethod::is_method_handle_invoke
// //
// Return true if the method is a MethodHandle target. // Return true if the method is an instance of one of the two
// signature-polymorphic MethodHandle methods, invokeExact or invokeGeneric.
bool ciMethod::is_method_handle_invoke() const { bool ciMethod::is_method_handle_invoke() const {
bool flag = (holder()->name() == ciSymbol::java_dyn_MethodHandle() && if (!is_loaded()) return false;
methodOopDesc::is_method_handle_invoke_name(name()->sid()));
#ifdef ASSERT
if (is_loaded()) {
bool flag2 = ((flags().as_int() & JVM_MH_INVOKE_BITS) == JVM_MH_INVOKE_BITS);
{
VM_ENTRY_MARK; VM_ENTRY_MARK;
bool flag3 = get_methodOop()->is_method_handle_invoke(); return get_methodOop()->is_method_handle_invoke();
assert(flag2 == flag3, "consistent");
assert(flag == flag3, "consistent");
}
}
#endif //ASSERT
return flag;
} }
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// ciMethod::is_method_handle_adapter // ciMethod::is_method_handle_adapter
// //
// Return true if the method is a generated MethodHandle adapter. // Return true if the method is a generated MethodHandle adapter.
// These are built by MethodHandleCompiler.
bool ciMethod::is_method_handle_adapter() const { bool ciMethod::is_method_handle_adapter() const {
check_is_loaded(); if (!is_loaded()) return false;
VM_ENTRY_MARK; VM_ENTRY_MARK;
return get_methodOop()->is_method_handle_adapter(); return get_methodOop()->is_method_handle_adapter();
} }
......
...@@ -168,7 +168,7 @@ void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code, ...@@ -168,7 +168,7 @@ void ConstantPoolCacheEntry::set_method(Bytecodes::Code invoke_code,
set_f1(method()); set_f1(method());
needs_vfinal_flag = false; // _f2 is not an oop needs_vfinal_flag = false; // _f2 is not an oop
assert(!is_vfinal(), "f2 not an oop"); assert(!is_vfinal(), "f2 not an oop");
byte_no = 1; // just a formality byte_no = 1; // coordinate this with bytecode_number & is_resolved
break; break;
case Bytecodes::_invokespecial: case Bytecodes::_invokespecial:
......
...@@ -211,6 +211,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC { ...@@ -211,6 +211,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
case Bytecodes::_getfield : // fall through case Bytecodes::_getfield : // fall through
case Bytecodes::_invokespecial : // fall through case Bytecodes::_invokespecial : // fall through
case Bytecodes::_invokestatic : // fall through case Bytecodes::_invokestatic : // fall through
case Bytecodes::_invokedynamic : // fall through
case Bytecodes::_invokeinterface : return 1; case Bytecodes::_invokeinterface : return 1;
case Bytecodes::_putstatic : // fall through case Bytecodes::_putstatic : // fall through
case Bytecodes::_putfield : // fall through case Bytecodes::_putfield : // fall through
......
...@@ -851,9 +851,15 @@ jint* methodOopDesc::method_type_offsets_chain() { ...@@ -851,9 +851,15 @@ jint* methodOopDesc::method_type_offsets_chain() {
// MethodHandleCompiler. // MethodHandleCompiler.
// Must be consistent with MethodHandleCompiler::get_method_oop(). // Must be consistent with MethodHandleCompiler::get_method_oop().
bool methodOopDesc::is_method_handle_adapter() const { bool methodOopDesc::is_method_handle_adapter() const {
return (is_method_handle_invoke_name(name()) && if (is_synthetic() &&
is_synthetic() && !is_native() && // has code from MethodHandleCompiler
MethodHandleCompiler::klass_is_method_handle_adapter_holder(method_holder())); is_method_handle_invoke_name(name()) &&
MethodHandleCompiler::klass_is_method_handle_adapter_holder(method_holder())) {
assert(!is_method_handle_invoke(), "disjoint");
return true;
} else {
return false;
}
} }
methodHandle methodOopDesc::make_invoke_method(KlassHandle holder, methodHandle methodOopDesc::make_invoke_method(KlassHandle holder,
......
...@@ -738,6 +738,12 @@ void MethodHandleCompiler::emit_bc(Bytecodes::Code op, int index) { ...@@ -738,6 +738,12 @@ void MethodHandleCompiler::emit_bc(Bytecodes::Code op, int index) {
// bi // bi
case Bytecodes::_ldc: case Bytecodes::_ldc:
assert(Bytecodes::format_bits(op, false) == (Bytecodes::_fmt_b|Bytecodes::_fmt_has_k), "wrong bytecode format");
assert((char) index == index, "index does not fit in 8-bit");
_bytecode.push(op);
_bytecode.push(index);
break;
case Bytecodes::_iload: case Bytecodes::_iload:
case Bytecodes::_lload: case Bytecodes::_lload:
case Bytecodes::_fload: case Bytecodes::_fload:
...@@ -754,7 +760,8 @@ void MethodHandleCompiler::emit_bc(Bytecodes::Code op, int index) { ...@@ -754,7 +760,8 @@ void MethodHandleCompiler::emit_bc(Bytecodes::Code op, int index) {
_bytecode.push(index); _bytecode.push(index);
break; break;
// bii // bkk
case Bytecodes::_ldc_w:
case Bytecodes::_ldc2_w: case Bytecodes::_ldc2_w:
case Bytecodes::_checkcast: case Bytecodes::_checkcast:
assert(Bytecodes::format_bits(op, false) == Bytecodes::_fmt_bkk, "wrong bytecode format"); assert(Bytecodes::format_bits(op, false) == Bytecodes::_fmt_bkk, "wrong bytecode format");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册