src/share/vm/opto/doCall.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7187454 Sdiff src/share/vm/opto

src/share/vm/opto/doCall.cpp

Print this page




 506         Node* retnode = peek();
 507         if (ct == T_VOID) {
 508           // It's OK for a method  to return a value that is discarded.
 509           // The discarding does not require any special action from the caller.
 510           // The Java code knows this, at VerifyType.isNullConversion.
 511           pop_node(rt);  // whatever it was, pop it
 512           retnode = top();
 513         } else if (rt == T_INT || is_subword_type(rt)) {
 514           // FIXME: This logic should be factored out.
 515           if (ct == T_BOOLEAN) {
 516             retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0x1)) );
 517           } else if (ct == T_CHAR) {
 518             retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0xFFFF)) );
 519           } else if (ct == T_BYTE) {
 520             retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(24)) );
 521             retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(24)) );
 522           } else if (ct == T_SHORT) {
 523             retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(16)) );
 524             retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(16)) );
 525           } else {
 526             assert(ct == T_INT, err_msg("rt=%d, ct=%d", rt, ct));
 527           }
 528         } else if (rt == T_OBJECT) {
 529           assert(ct == T_OBJECT, err_msg("rt=T_OBJECT, ct=%d", ct));
 530           if (ctype->is_loaded()) {
 531             Node* if_fail = top();
 532             retnode = gen_checkcast(retnode, makecon(TypeKlassPtr::make(ctype->as_klass())), &if_fail);
 533             if (if_fail != top()) {
 534               PreserveJVMState pjvms(this);
 535               set_control(if_fail);
 536               builtin_throw(Deoptimization::Reason_class_check);
 537             }
 538             pop();
 539             push(retnode);
 540           }
 541         } else {
 542           assert(ct == rt, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct));
 543           // push a zero; it's better than getting an oop/int mismatch
 544           retnode = pop_node(rt);
 545           retnode = zerocon(ct);
 546           push_node(ct, retnode);
 547         }
 548         // Now that the value is well-behaved, continue with the call-site type.
 549         rtype = ctype;
 550       }
 551     }
 552 
 553     // If the return type of the method is not loaded, assert that the
 554     // value we got is a null.  Otherwise, we need to recompile.
 555     if (!rtype->is_loaded()) {
 556 #ifndef PRODUCT
 557       if (PrintOpto && (Verbose || WizardMode)) {
 558         method()->print_name(); tty->print_cr(" asserting nullness of result at bci: %d", bci());
 559         cg->method()->print_name(); tty->cr();
 560       }
 561 #endif
 562       if (C->log() != NULL) {




 506         Node* retnode = peek();
 507         if (ct == T_VOID) {
 508           // It's OK for a method  to return a value that is discarded.
 509           // The discarding does not require any special action from the caller.
 510           // The Java code knows this, at VerifyType.isNullConversion.
 511           pop_node(rt);  // whatever it was, pop it
 512           retnode = top();
 513         } else if (rt == T_INT || is_subword_type(rt)) {
 514           // FIXME: This logic should be factored out.
 515           if (ct == T_BOOLEAN) {
 516             retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0x1)) );
 517           } else if (ct == T_CHAR) {
 518             retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0xFFFF)) );
 519           } else if (ct == T_BYTE) {
 520             retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(24)) );
 521             retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(24)) );
 522           } else if (ct == T_SHORT) {
 523             retnode = _gvn.transform( new (C, 3) LShiftINode(retnode, intcon(16)) );
 524             retnode = _gvn.transform( new (C, 3) RShiftINode(retnode, intcon(16)) );
 525           } else {
 526             assert(ct == T_INT, err_msg_res("rt=%d, ct=%d", rt, ct));
 527           }
 528         } else if (rt == T_OBJECT) {
 529           assert(ct == T_OBJECT, err_msg_res("rt=T_OBJECT, ct=%d", ct));
 530           if (ctype->is_loaded()) {
 531             Node* if_fail = top();
 532             retnode = gen_checkcast(retnode, makecon(TypeKlassPtr::make(ctype->as_klass())), &if_fail);
 533             if (if_fail != top()) {
 534               PreserveJVMState pjvms(this);
 535               set_control(if_fail);
 536               builtin_throw(Deoptimization::Reason_class_check);
 537             }
 538             pop();
 539             push(retnode);
 540           }
 541         } else {
 542           assert(ct == rt, err_msg_res("unexpected mismatch rt=%d, ct=%d", rt, ct));
 543           // push a zero; it's better than getting an oop/int mismatch
 544           retnode = pop_node(rt);
 545           retnode = zerocon(ct);
 546           push_node(ct, retnode);
 547         }
 548         // Now that the value is well-behaved, continue with the call-site type.
 549         rtype = ctype;
 550       }
 551     }
 552 
 553     // If the return type of the method is not loaded, assert that the
 554     // value we got is a null.  Otherwise, we need to recompile.
 555     if (!rtype->is_loaded()) {
 556 #ifndef PRODUCT
 557       if (PrintOpto && (Verbose || WizardMode)) {
 558         method()->print_name(); tty->print_cr(" asserting nullness of result at bci: %d", bci());
 559         cg->method()->print_name(); tty->cr();
 560       }
 561 #endif
 562       if (C->log() != NULL) {


src/share/vm/opto/doCall.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File