< prev index next >

src/hotspot/share/opto/doCall.cpp

Print this page




 645           // The Java code knows this, at VerifyType.isNullConversion.
 646           pop_node(rt);  // whatever it was, pop it
 647         } else if (rt == T_INT || is_subword_type(rt)) {
 648           // Nothing.  These cases are handled in lambda form bytecode.
 649           assert(ct == T_INT || is_subword_type(ct), "must match: rt=%s, ct=%s", type2name(rt), type2name(ct));
 650         } else if (rt == T_OBJECT || rt == T_ARRAY) {
 651           assert(ct == T_OBJECT || ct == T_ARRAY, "rt=%s, ct=%s", type2name(rt), type2name(ct));
 652           if (ctype->is_loaded()) {
 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->is__Value()) {
 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(this, cast);
 668             push(vt);
 669           } else {
 670             assert(ctype->is__Value(), "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)->get_oop();
 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());




 645           // The Java code knows this, at VerifyType.isNullConversion.
 646           pop_node(rt);  // whatever it was, pop it
 647         } else if (rt == T_INT || is_subword_type(rt)) {
 648           // Nothing.  These cases are handled in lambda form bytecode.
 649           assert(ct == T_INT || is_subword_type(ct), "must match: rt=%s, ct=%s", type2name(rt), type2name(ct));
 650         } else if (rt == T_OBJECT || rt == T_ARRAY) {
 651           assert(ct == T_OBJECT || ct == T_ARRAY, "rt=%s, ct=%s", type2name(rt), type2name(ct));
 652           if (ctype->is_loaded()) {
 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->is__Value()) {
 664             const Type* sig_type = TypeOopPtr::make_from_klass(ctype->as_klass());
 665             sig_type = sig_type->join_speculative(TypePtr::NOTNULL);
 666             Node* retnode = pop();
 667             Node* cast = _gvn.transform(new CheckCastPPNode(control(), retnode, sig_type));
 668             ValueTypeNode* vt = ValueTypeNode::make_from_oop(this, cast);
 669             push(vt);
 670           } else {
 671             assert(ctype->is__Value(), "unexpected value type klass");
 672             ValueTypeNode* vt = pop()->as_ValueType();
 673             vt = vt->allocate(this)->as_ValueType();
 674             Node* vtptr = ValueTypePtrNode::make_from_value_type(_gvn, vt);


 675             push(vtptr);
 676           }
 677         } else {
 678           assert(rt == ct, "unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct));
 679           // push a zero; it's better than getting an oop/int mismatch
 680           pop_node(rt);
 681           Node* retnode = zerocon(ct);
 682           push_node(ct, retnode);
 683         }
 684         // Now that the value is well-behaved, continue with the call-site type.
 685         rtype = ctype;
 686       }
 687     } else {
 688       // Symbolic resolution enforces the types to be the same.
 689       // NOTE: We must relax the assert for unloaded types because two
 690       // different ciType instances of the same unloaded class type
 691       // can appear to be "loaded" by different loaders (depending on
 692       // the accessing class).
 693       assert(!rtype->is_loaded() || !ctype->is_loaded() || rtype == ctype,
 694              "mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name());


< prev index next >