653 const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); 654 const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); 655 if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { 656 Node* retnode = pop(); 657 Node* cast_obj = _gvn.transform(new CheckCastPPNode(control(), retnode, sig_type)); 658 push(cast_obj); 659 } 660 } 661 } else if (rt == T_VALUETYPE) { 662 assert(ct == T_VALUETYPE, "value type expected but got rt=%s, ct=%s", type2name(rt), type2name(ct)); 663 if (rtype == C->env()->___Value_klass()) { 664 const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); 665 Node* retnode = pop(); 666 Node* cast = _gvn.transform(new CheckCastPPNode(control(), retnode, sig_type)); 667 Node* vt = ValueTypeNode::make(_gvn, merged_memory(), cast); 668 push(vt); 669 } else { 670 assert(ctype == C->env()->___Value_klass(), "unexpected value type klass"); 671 Node* retnode = pop(); 672 assert(retnode->is_ValueType(), "inconsistent"); 673 retnode = retnode->as_ValueType()->allocate(this); 674 push(retnode); 675 } 676 } else { 677 assert(rt == ct, "unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct)); 678 // push a zero; it's better than getting an oop/int mismatch 679 pop_node(rt); 680 Node* retnode = zerocon(ct); 681 push_node(ct, retnode); 682 } 683 // Now that the value is well-behaved, continue with the call-site type. 684 rtype = ctype; 685 } 686 } else { 687 // Symbolic resolution enforces the types to be the same. 688 // NOTE: We must relax the assert for unloaded types because two 689 // different ciType instances of the same unloaded class type 690 // can appear to be "loaded" by different loaders (depending on 691 // the accessing class). 692 assert(!rtype->is_loaded() || !ctype->is_loaded() || rtype == ctype, 693 "mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name()); 694 } | 653 const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass()); 654 const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); 655 if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { 656 Node* retnode = pop(); 657 Node* cast_obj = _gvn.transform(new CheckCastPPNode(control(), retnode, sig_type)); 658 push(cast_obj); 659 } 660 } 661 } else if (rt == T_VALUETYPE) { 662 assert(ct == T_VALUETYPE, "value type expected but got rt=%s, ct=%s", type2name(rt), type2name(ct)); 663 if (rtype == C->env()->___Value_klass()) { 664 const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass()); 665 Node* retnode = pop(); 666 Node* cast = _gvn.transform(new CheckCastPPNode(control(), retnode, sig_type)); 667 Node* vt = ValueTypeNode::make(_gvn, merged_memory(), cast); 668 push(vt); 669 } else { 670 assert(ctype == C->env()->___Value_klass(), "unexpected value type klass"); 671 Node* retnode = pop(); 672 assert(retnode->is_ValueType(), "inconsistent"); 673 ValueTypeNode* vt = retnode->as_ValueType(); 674 Node* alloc = vt->allocate(this); 675 Node* vtptr = _gvn.transform(new ValueTypePtrNode(vt, alloc, C)); 676 push(vtptr); 677 } 678 } else { 679 assert(rt == ct, "unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct)); 680 // push a zero; it's better than getting an oop/int mismatch 681 pop_node(rt); 682 Node* retnode = zerocon(ct); 683 push_node(ct, retnode); 684 } 685 // Now that the value is well-behaved, continue with the call-site type. 686 rtype = ctype; 687 } 688 } else { 689 // Symbolic resolution enforces the types to be the same. 690 // NOTE: We must relax the assert for unloaded types because two 691 // different ciType instances of the same unloaded class type 692 // can appear to be "loaded" by different loaders (depending on 693 // the accessing class). 694 assert(!rtype->is_loaded() || !ctype->is_loaded() || rtype == ctype, 695 "mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name()); 696 } |