< prev index next >

src/hotspot/share/opto/doCall.cpp

Print this page




 643           // It's OK for a method  to return a value that is discarded.
 644           // The discarding does not require any special action from the caller.
 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 == 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,




 643           // It's OK for a method  to return a value that is discarded.
 644           // The discarding does not require any special action from the caller.
 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,


< prev index next >