@@ -2030,17 +2030,16 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
2030
2030
}
2031
2031
2032
2032
// check if we could do inlining
2033
- if (!PatchALot && Inline && target->is_loaded () &&
2034
- (klass->is_initialized () || (klass->is_interface () && target->holder ()->is_initialized ()))
2035
- && !patch_for_appendix) {
2033
+ if (!PatchALot && Inline && target->is_loaded () && callee_holder->is_linked () && !patch_for_appendix) {
2036
2034
// callee is known => check if we have static binding
2037
- if (code == Bytecodes::_invokestatic ||
2035
+ if (( code == Bytecodes::_invokestatic && callee_holder-> is_initialized ()) || // invokestatic involves an initialization barrier on resolved klass
2038
2036
code == Bytecodes::_invokespecial ||
2039
2037
(code == Bytecodes::_invokevirtual && target->is_final_method ()) ||
2040
2038
code == Bytecodes::_invokedynamic) {
2041
- ciMethod* inline_target = (cha_monomorphic_target != NULL ) ? cha_monomorphic_target : target;
2042
2039
// static binding => check if callee is ok
2043
- bool success = try_inline (inline_target, (cha_monomorphic_target != NULL ) || (exact_target != NULL ), false , code, better_receiver);
2040
+ ciMethod* inline_target = (cha_monomorphic_target != NULL ) ? cha_monomorphic_target : target;
2041
+ bool holder_known = (cha_monomorphic_target != NULL ) || (exact_target != NULL );
2042
+ bool success = try_inline (inline_target, holder_known, false /* ignore_return */ , code, better_receiver);
2044
2043
2045
2044
CHECK_BAILOUT ();
2046
2045
clear_inline_bailout ();
@@ -3758,7 +3757,9 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign
3758
3757
!InlineMethodsWithExceptionHandlers) INLINE_BAILOUT (" callee has exception handlers" );
3759
3758
if (callee->is_synchronized () &&
3760
3759
!InlineSynchronizedMethods ) INLINE_BAILOUT (" callee is synchronized" );
3761
- if (!callee->holder ()->is_initialized ()) INLINE_BAILOUT (" callee's klass not initialized yet" );
3760
+ if (!callee->holder ()->is_linked ()) INLINE_BAILOUT (" callee's klass not linked yet" );
3761
+ if (bc == Bytecodes::_invokestatic &&
3762
+ !callee->holder ()->is_initialized ()) INLINE_BAILOUT (" callee's klass not initialized yet" );
3762
3763
if (!callee->has_balanced_monitors ()) INLINE_BAILOUT (" callee's monitors do not match" );
3763
3764
3764
3765
// Proper inlining of methods with jsrs requires a little more work.
@@ -3840,6 +3841,8 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign
3840
3841
print_inlining (callee, " inline" , /* success*/ true );
3841
3842
}
3842
3843
3844
+ assert (bc != Bytecodes::_invokestatic || callee->holder ()->is_initialized (), " required" );
3845
+
3843
3846
// NOTE: Bailouts from this point on, which occur at the
3844
3847
// GraphBuilder level, do not cause bailout just of the inlining but
3845
3848
// in fact of the entire compilation.
0 commit comments