< prev index next >

src/hotspot/share/opto/doCall.cpp

Print this page
rev 55090 : secret-sfac


 542     if (receiver_node->is_ValueType()) {
 543       receiver_type = TypeInstPtr::make(TypePtr::NotNull, _gvn.type(receiver_node)->is_valuetype()->value_klass());
 544     } else {
 545       receiver_type = _gvn.type(receiver_node)->isa_oopptr();
 546     }
 547     // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
 548     // For arrays, klass below is Object. When vtable calls are used,
 549     // resolving the call with Object would allow an illegal call to
 550     // finalize() on an array. We use holder instead: illegal calls to
 551     // finalize() won't be compiled as vtable calls (IC call
 552     // resolution will catch the illegal call) and the few legal calls
 553     // on array types won't be either.
 554     callee = C->optimize_virtual_call(method(), bci(), klass, holder, orig_callee,
 555                                       receiver_type, is_virtual,
 556                                       call_does_dispatch, vtable_index);  // out-parameters
 557     speculative_receiver_type = receiver_type != NULL ? receiver_type->speculative_type() : NULL;
 558   }
 559 
 560   // Additional receiver subtype checks for interface calls via invokespecial or invokeinterface.
 561   ciKlass* receiver_constraint = NULL;
 562   if (iter().cur_bc_raw() == Bytecodes::_invokespecial && !orig_callee->is_object_initializer()) {
 563     ciInstanceKlass* calling_klass = method()->holder();
 564     ciInstanceKlass* sender_klass =
 565         calling_klass->is_unsafe_anonymous() ? calling_klass->unsafe_anonymous_host() :
 566                                                calling_klass;
 567     if (sender_klass->is_interface()) {
 568       receiver_constraint = sender_klass;
 569     }
 570   } else if (iter().cur_bc_raw() == Bytecodes::_invokeinterface && orig_callee->is_private()) {
 571     assert(holder->is_interface(), "How did we get a non-interface method here!");
 572     receiver_constraint = holder;
 573   }
 574 
 575   if (receiver_constraint != NULL) {
 576     Node* receiver_node = stack(sp() - nargs);
 577     Node* cls_node = makecon(TypeKlassPtr::make(receiver_constraint));
 578     Node* bad_type_ctrl = NULL;
 579     Node* casted_receiver = gen_checkcast(receiver_node, cls_node, &bad_type_ctrl);
 580     if (bad_type_ctrl != NULL) {
 581       PreserveJVMState pjvms(this);
 582       set_control(bad_type_ctrl);




 542     if (receiver_node->is_ValueType()) {
 543       receiver_type = TypeInstPtr::make(TypePtr::NotNull, _gvn.type(receiver_node)->is_valuetype()->value_klass());
 544     } else {
 545       receiver_type = _gvn.type(receiver_node)->isa_oopptr();
 546     }
 547     // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
 548     // For arrays, klass below is Object. When vtable calls are used,
 549     // resolving the call with Object would allow an illegal call to
 550     // finalize() on an array. We use holder instead: illegal calls to
 551     // finalize() won't be compiled as vtable calls (IC call
 552     // resolution will catch the illegal call) and the few legal calls
 553     // on array types won't be either.
 554     callee = C->optimize_virtual_call(method(), bci(), klass, holder, orig_callee,
 555                                       receiver_type, is_virtual,
 556                                       call_does_dispatch, vtable_index);  // out-parameters
 557     speculative_receiver_type = receiver_type != NULL ? receiver_type->speculative_type() : NULL;
 558   }
 559 
 560   // Additional receiver subtype checks for interface calls via invokespecial or invokeinterface.
 561   ciKlass* receiver_constraint = NULL;
 562   if (iter().cur_bc_raw() == Bytecodes::_invokespecial && !orig_callee->is_object_constructor()) {
 563     ciInstanceKlass* calling_klass = method()->holder();
 564     ciInstanceKlass* sender_klass =
 565         calling_klass->is_unsafe_anonymous() ? calling_klass->unsafe_anonymous_host() :
 566                                                calling_klass;
 567     if (sender_klass->is_interface()) {
 568       receiver_constraint = sender_klass;
 569     }
 570   } else if (iter().cur_bc_raw() == Bytecodes::_invokeinterface && orig_callee->is_private()) {
 571     assert(holder->is_interface(), "How did we get a non-interface method here!");
 572     receiver_constraint = holder;
 573   }
 574 
 575   if (receiver_constraint != NULL) {
 576     Node* receiver_node = stack(sp() - nargs);
 577     Node* cls_node = makecon(TypeKlassPtr::make(receiver_constraint));
 578     Node* bad_type_ctrl = NULL;
 579     Node* casted_receiver = gen_checkcast(receiver_node, cls_node, &bad_type_ctrl);
 580     if (bad_type_ctrl != NULL) {
 581       PreserveJVMState pjvms(this);
 582       set_control(bad_type_ctrl);


< prev index next >