< prev index next >
src/share/vm/c1/c1_GraphBuilder.cpp
Print this page
rev 12282 : 8167656: Unstable MethodHandle inlining causing huge performance variations
Summary: Profile calls without a reciever
Reviewed-by:
*** 2054,2074 ****
// either.
vtable_index = target->resolve_vtable_index(calling_klass, holder);
}
#endif
! // invokespecial always needs a NULL check. invokevirtual where the target is
! // final or where it's not known whether the target is final requires a NULL check.
! // Otherwise normal invokevirtual will perform the null check during the lookup
! // logic or the unverified entry point. Profiling of calls requires that
! // the null check is performed in all cases.
! bool do_null_check = (recv != NULL) &&
! (code == Bytecodes::_invokespecial || (target->is_loaded() && (target->is_final() || (is_profiling() && profile_calls()))));
! if (do_null_check) {
null_check(recv);
if (is_profiling()) {
// Note that we'd collect profile data in this method if we wanted it.
compilation()->set_would_profile(true);
--- 2054,2080 ----
// either.
vtable_index = target->resolve_vtable_index(calling_klass, holder);
}
#endif
! // A null check is required for any of the following call types
! // - invokespecial, always need a null check
! // - invokevirtual, when the target is final and loaded, will become optimized and requires a null check
! // (Null check on an final but unloaded optimized call would can break the JVM specification because
! // a potential LinkageError must be thrown before the NPE. Resolve will use the unverified entry point
! // to cover this case)
! // - when the call will be profiled (but we can't add a nullcheck when the call is unloaded, and thus can't
! // add a profile either)
! // Otherwise normal invokevirtual will perform the null check during lookup
! bool need_null_check = (code == Bytecodes::_invokespecial) ||
! (target->is_loaded() && (target->is_final_method() || (is_profiling() && profile_calls())));
! if (need_null_check) {
! if (recv != NULL) {
null_check(recv);
+ }
if (is_profiling()) {
// Note that we'd collect profile data in this method if we wanted it.
compilation()->set_would_profile(true);
< prev index next >