diff -r 13588c901957 -r 9cf78a70fa4f src/hotspot/share/opto/doCall.cpp --- a/src/hotspot/share/opto/doCall.cpp Thu Oct 17 20:27:44 2019 +0100 +++ b/src/hotspot/share/opto/doCall.cpp Thu Oct 17 20:53:35 2019 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -310,10 +310,12 @@ if (call_does_dispatch && bytecode == Bytecodes::_invokeinterface) { ciInstanceKlass* declared_interface = caller->get_declared_method_holder_at_bci(bci)->as_instance_klass(); + ciInstanceKlass* singleton = declared_interface->unique_implementor(); - if (declared_interface->nof_implementors() == 1 && + if (singleton != NULL && (!callee->is_default_method() || callee->is_overpass()) /* CHA doesn't support default methods yet */) { - ciInstanceKlass* singleton = declared_interface->implementor(); + assert(singleton != declared_interface, "not a unique implementor"); + ciMethod* cha_monomorphic_target = callee->find_monomorphic_target(caller->holder(), declared_interface, singleton); @@ -700,8 +702,8 @@ } else if (rt == T_INT || is_subword_type(rt)) { // Nothing. These cases are handled in lambda form bytecode. assert(ct == T_INT || is_subword_type(ct), "must match: rt=%s, ct=%s", type2name(rt), type2name(ct)); - } else if (rt == T_OBJECT || rt == T_ARRAY) { - assert(ct == T_OBJECT || ct == T_ARRAY, "rt=%s, ct=%s", type2name(rt), type2name(ct)); + } else if (is_reference_type(rt)) { + assert(is_reference_type(ct), "rt=%s, ct=%s", type2name(rt), type2name(ct)); if (ctype->is_loaded()) { const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); @@ -748,7 +750,7 @@ set_bci(iter().cur_bci()); // put it back } BasicType ct = ctype->basic_type(); - if (ct == T_OBJECT || ct == T_ARRAY) { + if (is_reference_type(ct)) { record_profiled_return_for_speculation(); } }