--- old/src/share/vm/c1/c1_GraphBuilder.cpp 2016-10-13 15:45:24.126274531 +0200 +++ new/src/share/vm/c1/c1_GraphBuilder.cpp 2016-10-13 15:45:23.998274535 +0200 @@ -1813,15 +1813,10 @@ ciKlass* holder = stream()->get_declared_method_holder(); const Bytecodes::Code bc_raw = stream()->cur_bc_raw(); assert(declared_signature != NULL, "cannot be null"); + assert(will_link == target->is_loaded(), "Check"); ciInstanceKlass* klass = target->holder(); - // Make sure there are no evident problems with linking the instruction. - bool is_resolved = true; - if (klass->is_loaded() && !target->is_loaded()) { - is_resolved = false; // method not found - } - // check if CHA possible: if so, change the code to invoke_special ciInstanceKlass* calling_klass = method()->holder(); ciInstanceKlass* callee_holder = ciEnv::get_instance_klass_for_declared_method_holder(holder); @@ -1988,7 +1983,7 @@ } // check if we could do inlining - if (!PatchALot && Inline && is_resolved && + if (!PatchALot && Inline && klass->is_loaded() && target->is_loaded() && (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized()) && !patch_for_appendix) { @@ -2032,7 +2027,6 @@ CHECK_BAILOUT(); // inlining not successful => standard invoke - bool is_loaded = target->is_loaded(); ValueType* result_type = as_ValueType(declared_signature->return_type()); ValueStack* state_before = copy_state_exhandling(); @@ -2049,7 +2043,7 @@ // Currently only supported on Sparc. // The UseInlineCaches only controls dispatch to invokevirtuals for // loaded classes which we weren't able to statically bind. - if (!UseInlineCaches && is_resolved && is_loaded && code == Bytecodes::_invokevirtual + if (!UseInlineCaches && target->is_loaded() && code == Bytecodes::_invokevirtual && !target->can_be_statically_bound()) { // Find a vtable index if one is available // For arrays, callee_holder is Object. Resolving the call with @@ -2062,18 +2056,17 @@ } #endif - if (is_resolved) { - // 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 || !is_loaded || target->is_final() || (is_profiling() && profile_calls())); + // 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. - if (do_null_check) { - null_check(recv); - } + 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. @@ -2090,9 +2083,6 @@ profile_call(target, recv, target_klass, collect_args_for_profiling(args, NULL, false), false); } } - } else { - // No need in null check or profiling: linkage error will be thrown at runtime - // during resolution. } Invoke* result = new Invoke(code, result_type, recv, args, vtable_index, target, state_before);