1.1 --- a/src/share/vm/oops/cpCache.cpp Mon Sep 17 15:04:58 2018 +0100 1.2 +++ b/src/share/vm/oops/cpCache.cpp Sat Sep 29 03:37:34 2018 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -209,12 +209,22 @@ 1.11 if (byte_no == 1) { 1.12 assert(invoke_code != Bytecodes::_invokevirtual && 1.13 invoke_code != Bytecodes::_invokeinterface, ""); 1.14 + bool do_resolve = true; 1.15 // Don't mark invokespecial to method as resolved if sender is an interface. The receiver 1.16 // has to be checked that it is a subclass of the current class every time this bytecode 1.17 // is executed. 1.18 - if (invoke_code != Bytecodes::_invokespecial || !sender_is_interface || 1.19 - method->name() == vmSymbols::object_initializer_name()) { 1.20 - set_bytecode_1(invoke_code); 1.21 + if (invoke_code == Bytecodes::_invokespecial && sender_is_interface && 1.22 + method->name() != vmSymbols::object_initializer_name()) { 1.23 + do_resolve = false; 1.24 + } 1.25 + // Don't mark invokestatic to method as resolved if the holder class has not yet completed 1.26 + // initialization. An invokestatic must only proceed if the class is initialized, but if 1.27 + // we resolve it before then that class initialization check is skipped. 1.28 + if (invoke_code == Bytecodes::_invokestatic && !method->method_holder()->is_initialized()) { 1.29 + do_resolve = false; 1.30 + } 1.31 + if (do_resolve) { 1.32 + set_bytecode_1(invoke_code); 1.33 } 1.34 } else if (byte_no == 2) { 1.35 if (change_to_virtual) {