changeset 488:13510fe048e4

meth-lazy: fix EA bug (contributed by kvn)
author jrose
date Thu, 19 Jul 2012 00:23:11 -0700
parents 88f29874d717
children cc59efc75960
files meth-lazy-7023639.review.patch
diffstat 1 files changed, 74 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/meth-lazy-7023639.review.patch	Wed Jul 18 18:57:43 2012 -0700
+++ b/meth-lazy-7023639.review.patch	Thu Jul 19 00:23:11 2012 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent fe6edd334f2d863f8b842505ef37ea0b4c608f68
+# Parent 2decd0611811b96605f0a5baf657ec969538d7c0
 
 diff --git a/src/cpu/sparc/vm/interpreter_sparc.cpp b/src/cpu/sparc/vm/interpreter_sparc.cpp
 --- a/src/cpu/sparc/vm/interpreter_sparc.cpp
@@ -1222,6 +1222,79 @@
        }
        // If there is going to be a trap, put it at the next bytecode:
        set_bci(iter().next_bci());
+diff --git a/src/share/vm/opto/escape.cpp b/src/share/vm/opto/escape.cpp
+--- a/src/share/vm/opto/escape.cpp
++++ b/src/share/vm/opto/escape.cpp
+@@ -1768,8 +1768,12 @@
+     assert(ptadr->is_Field() && ptadr->ideal_node() == n, "sanity");
+     return;
+   }
++  bool unsafe = false;
++  bool is_oop = is_oop_field(n, offset, &unsafe);
++  if (unsafe) {
++    es = PointsToNode::GlobalEscape;
++  }
+   Compile* C = _compile;
+-  bool is_oop = is_oop_field(n, offset);
+   FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop);
+   _nodes.at_put(n->_idx, field);
+ }
+@@ -1794,7 +1798,7 @@
+   dst->set_arraycopy_dst();
+ }
+ 
+-bool ConnectionGraph::is_oop_field(Node* n, int offset) {
++bool ConnectionGraph::is_oop_field(Node* n, int offset, bool* unsafe) {
+   const Type* adr_type = n->as_AddP()->bottom_type();
+   BasicType bt = T_INT;
+   if (offset == Type::OffsetBot) {
+@@ -1813,7 +1817,16 @@
+       if (field != NULL) {
+         bt = field->layout_type();
+       } else {
+-        // Ignore non field load (for example, klass load)
++        // Check for unsafe oop field access
++        for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
++          int opcode = n->fast_out(i)->Opcode();
++          if (opcode == Op_StoreP || opcode == Op_LoadP ||
++              opcode == Op_StoreN || opcode == Op_LoadN) {
++            bt = T_OBJECT;
++            (*unsafe) = true;
++            break;
++          }
++        }
+       }
+     } else if (adr_type->isa_aryptr()) {
+       if (offset == arrayOopDesc::length_offset_in_bytes()) {
+@@ -1831,6 +1844,7 @@
+         if (opcode == Op_StoreP || opcode == Op_LoadP ||
+             opcode == Op_StoreN || opcode == Op_LoadN) {
+           bt = T_OBJECT;
++          break;
+         }
+       }
+     }
+diff --git a/src/share/vm/opto/escape.hpp b/src/share/vm/opto/escape.hpp
+--- a/src/share/vm/opto/escape.hpp
++++ b/src/share/vm/opto/escape.hpp
+@@ -512,13 +512,11 @@
+       assert(ptn != NULL, "node should be registered");
+     }
+     add_edge(ptnode_adr(n->_idx), ptn);
+-  }
+-
++ }
+   // Helper functions
+-  bool   is_oop_field(Node* n, int offset);
+-  static Node* get_addp_base(Node *addp);
+-  static Node* find_second_addp(Node* addp, Node* n);
+-
++  bool   is_oop_field(Node* n, int offset, bool* unsafe);
++ static Node* get_addp_base(Node *addp);
++ static Node* find_second_addp(Node* addp, Node* n);
+   // offset of a field reference
+   int address_offset(Node* adr, PhaseTransform *phase);
+ 
 diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp
 --- a/src/share/vm/opto/graphKit.cpp
 +++ b/src/share/vm/opto/graphKit.cpp