mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
7174928: JSR 292: unresolved invokedynamic call sites deopt and osr infinitely
Reviewed-by: kvn
This commit is contained in:
parent
dd85e2f356
commit
301e9f9548
7 changed files with 35 additions and 28 deletions
|
@ -2807,31 +2807,29 @@ void LIRGenerator::do_Invoke(Invoke* x) {
|
|||
int index = bcs.get_method_index();
|
||||
size_t call_site_offset = cpcache->get_f1_offset(index);
|
||||
|
||||
// Load CallSite object from constant pool cache.
|
||||
LIR_Opr call_site = new_register(objectType);
|
||||
__ oop2reg(cpcache->constant_encoding(), call_site);
|
||||
__ move_wide(new LIR_Address(call_site, call_site_offset, T_OBJECT), call_site);
|
||||
|
||||
// If this invokedynamic call site hasn't been executed yet in
|
||||
// the interpreter, the CallSite object in the constant pool
|
||||
// cache is still null and we need to deoptimize.
|
||||
if (cpcache->is_f1_null_at(index)) {
|
||||
// Cannot re-use same xhandlers for multiple CodeEmitInfos, so
|
||||
// clone all handlers. This is handled transparently in other
|
||||
// places by the CodeEmitInfo cloning logic but is handled
|
||||
// specially here because a stub isn't being used.
|
||||
x->set_exception_handlers(new XHandlers(x->exception_handlers()));
|
||||
|
||||
// Only deoptimize if the CallSite object is still null; we don't
|
||||
// recompile methods in C1 after deoptimization so this call site
|
||||
// might be resolved the next time we execute it after OSR.
|
||||
DeoptimizeStub* deopt_stub = new DeoptimizeStub(deopt_info);
|
||||
__ jump(deopt_stub);
|
||||
__ cmp(lir_cond_equal, call_site, LIR_OprFact::oopConst(NULL));
|
||||
__ branch(lir_cond_equal, T_OBJECT, deopt_stub);
|
||||
}
|
||||
|
||||
// Use the receiver register for the synthetic MethodHandle
|
||||
// argument.
|
||||
receiver = LIR_Assembler::receiverOpr();
|
||||
LIR_Opr tmp = new_register(objectType);
|
||||
|
||||
// Load CallSite object from constant pool cache.
|
||||
__ oop2reg(cpcache->constant_encoding(), tmp);
|
||||
__ move_wide(new LIR_Address(tmp, call_site_offset, T_OBJECT), tmp);
|
||||
|
||||
// Load target MethodHandle from CallSite object.
|
||||
__ load(new LIR_Address(tmp, java_lang_invoke_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
|
||||
__ load(new LIR_Address(call_site, java_lang_invoke_CallSite::target_offset_in_bytes(), T_OBJECT), receiver);
|
||||
|
||||
__ call_dynamic(target, receiver, result_register,
|
||||
SharedRuntime::get_resolve_opt_virtual_call_stub(),
|
||||
|
@ -2839,7 +2837,7 @@ void LIRGenerator::do_Invoke(Invoke* x) {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
fatal(err_msg("unexpected bytecode: %s", Bytecodes::name(x->code())));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue