1 /* |
1 /* |
2 * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
308 // it's 0 then no class implements decl_interface and there's |
308 // it's 0 then no class implements decl_interface and there's |
309 // no point in inlining. |
309 // no point in inlining. |
310 if (call_does_dispatch && bytecode == Bytecodes::_invokeinterface) { |
310 if (call_does_dispatch && bytecode == Bytecodes::_invokeinterface) { |
311 ciInstanceKlass* declared_interface = |
311 ciInstanceKlass* declared_interface = |
312 caller->get_declared_method_holder_at_bci(bci)->as_instance_klass(); |
312 caller->get_declared_method_holder_at_bci(bci)->as_instance_klass(); |
313 |
313 ciInstanceKlass* singleton = declared_interface->unique_implementor(); |
314 if (declared_interface->nof_implementors() == 1 && |
314 |
|
315 if (singleton != NULL && |
315 (!callee->is_default_method() || callee->is_overpass()) /* CHA doesn't support default methods yet */) { |
316 (!callee->is_default_method() || callee->is_overpass()) /* CHA doesn't support default methods yet */) { |
316 ciInstanceKlass* singleton = declared_interface->implementor(); |
317 assert(singleton != declared_interface, "not a unique implementor"); |
|
318 |
317 ciMethod* cha_monomorphic_target = |
319 ciMethod* cha_monomorphic_target = |
318 callee->find_monomorphic_target(caller->holder(), declared_interface, singleton); |
320 callee->find_monomorphic_target(caller->holder(), declared_interface, singleton); |
319 |
321 |
320 if (cha_monomorphic_target != NULL && |
322 if (cha_monomorphic_target != NULL && |
321 cha_monomorphic_target->holder() != env()->Object_klass()) { // subtype check against Object is useless |
323 cha_monomorphic_target->holder() != env()->Object_klass()) { // subtype check against Object is useless |
698 // The Java code knows this, at VerifyType.isNullConversion. |
700 // The Java code knows this, at VerifyType.isNullConversion. |
699 pop_node(rt); // whatever it was, pop it |
701 pop_node(rt); // whatever it was, pop it |
700 } else if (rt == T_INT || is_subword_type(rt)) { |
702 } else if (rt == T_INT || is_subword_type(rt)) { |
701 // Nothing. These cases are handled in lambda form bytecode. |
703 // Nothing. These cases are handled in lambda form bytecode. |
702 assert(ct == T_INT || is_subword_type(ct), "must match: rt=%s, ct=%s", type2name(rt), type2name(ct)); |
704 assert(ct == T_INT || is_subword_type(ct), "must match: rt=%s, ct=%s", type2name(rt), type2name(ct)); |
703 } else if (rt == T_OBJECT || rt == T_ARRAY) { |
705 } else if (is_reference_type(rt)) { |
704 assert(ct == T_OBJECT || ct == T_ARRAY, "rt=%s, ct=%s", type2name(rt), type2name(ct)); |
706 assert(is_reference_type(ct), "rt=%s, ct=%s", type2name(rt), type2name(ct)); |
705 if (ctype->is_loaded()) { |
707 if (ctype->is_loaded()) { |
706 const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); |
708 const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); |
707 const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); |
709 const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); |
708 if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { |
710 if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { |
709 Node* retnode = pop(); |
711 Node* retnode = pop(); |
746 set_bci(iter().next_bci()); |
748 set_bci(iter().next_bci()); |
747 null_assert(peek()); |
749 null_assert(peek()); |
748 set_bci(iter().cur_bci()); // put it back |
750 set_bci(iter().cur_bci()); // put it back |
749 } |
751 } |
750 BasicType ct = ctype->basic_type(); |
752 BasicType ct = ctype->basic_type(); |
751 if (ct == T_OBJECT || ct == T_ARRAY) { |
753 if (is_reference_type(ct)) { |
752 record_profiled_return_for_speculation(); |
754 record_profiled_return_for_speculation(); |
753 } |
755 } |
754 } |
756 } |
755 |
757 |
756 // Restart record of parsing work after possible inlining of call |
758 // Restart record of parsing work after possible inlining of call |