changeset 491:89a156565b76

meth-lazy: allow non-void LF method to return to void call site
author jrose
date Thu, 19 Jul 2012 17:38:53 -0700
parents f8ac1c76761f
children 8680e3b4be3b
files meth-lazy-7023639.review.patch
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/meth-lazy-7023639.review.patch	Thu Jul 19 15:15:32 2012 -0700
+++ b/meth-lazy-7023639.review.patch	Thu Jul 19 17:38:53 2012 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent fe6edd334f2d863f8b842505ef37ea0b4c608f68
+# Parent 2decd0611811b96605f0a5baf657ec969538d7c0
 
 diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
 --- a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
@@ -1582,7 +1582,7 @@
 diff --git a/src/share/vm/opto/doCall.cpp b/src/share/vm/opto/doCall.cpp
 --- a/src/share/vm/opto/doCall.cpp
 +++ b/src/share/vm/opto/doCall.cpp
-@@ -496,9 +496,57 @@
+@@ -496,9 +496,63 @@
      // Round double result after a call from strict to non-strict code
      round_double_result(cg->method());
  
@@ -1594,7 +1594,13 @@
 +        BasicType rt = rtype->basic_type();
 +        BasicType ct = ctype->basic_type();
 +        Node* retnode = peek();
-+        if (rt == T_INT || is_subword_type(rt)) {
++        if (ct == T_VOID) {
++          // It's OK for a method  to return a value that is discarded.
++          // The discarding does not require any special action from the caller.
++          // The Java code knows this, at VerifyType.isNullConversion.
++          pop_node(rt);  // whatever it was, pop it
++          retnode = top();
++        } else if (rt == T_INT || is_subword_type(rt)) {
 +          // FIXME: This logic should be factored out.
 +          if (ct == T_BOOLEAN) {
 +            retnode = _gvn.transform( new (C, 3) AndINode(retnode, intcon(0x1)) );
@@ -1623,7 +1629,7 @@
 +            push(retnode);
 +          }
 +        } else {
-+          assert(ct == T_VOID, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct));
++          assert(ct == rt, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct));
 +          // push a zero; it's better than getting an oop/int mismatch
 +          retnode = pop_node(rt);
 +          retnode = zerocon(ct);
@@ -1641,7 +1647,7 @@
  #ifndef PRODUCT
        if (PrintOpto && (Verbose || WizardMode)) {
          method()->print_name(); tty->print_cr(" asserting nullness of result at bci: %d", bci());
-@@ -507,7 +555,7 @@
+@@ -507,7 +561,7 @@
  #endif
        if (C->log() != NULL) {
          C->log()->elem("assert_null reason='return' klass='%d'",