src/share/vm/opto/escape.cpp

changeset 3969
1d7922586cf6
parent 3657
ed4c92f54c2d
child 3971
6c5b7a6becc8
     1.1 --- a/src/share/vm/opto/escape.cpp	Mon Jul 23 13:04:59 2012 -0700
     1.2 +++ b/src/share/vm/opto/escape.cpp	Tue Jul 24 10:51:00 2012 -0700
     1.3 @@ -1768,8 +1768,12 @@
     1.4      assert(ptadr->is_Field() && ptadr->ideal_node() == n, "sanity");
     1.5      return;
     1.6    }
     1.7 +  bool unsafe = false;
     1.8 +  bool is_oop = is_oop_field(n, offset, &unsafe);
     1.9 +  if (unsafe) {
    1.10 +    es = PointsToNode::GlobalEscape;
    1.11 +  }
    1.12    Compile* C = _compile;
    1.13 -  bool is_oop = is_oop_field(n, offset);
    1.14    FieldNode* field = new (C->comp_arena()) FieldNode(C, n, es, offset, is_oop);
    1.15    _nodes.at_put(n->_idx, field);
    1.16  }
    1.17 @@ -1794,7 +1798,7 @@
    1.18    dst->set_arraycopy_dst();
    1.19  }
    1.20  
    1.21 -bool ConnectionGraph::is_oop_field(Node* n, int offset) {
    1.22 +bool ConnectionGraph::is_oop_field(Node* n, int offset, bool* unsafe) {
    1.23    const Type* adr_type = n->as_AddP()->bottom_type();
    1.24    BasicType bt = T_INT;
    1.25    if (offset == Type::OffsetBot) {
    1.26 @@ -1813,7 +1817,16 @@
    1.27        if (field != NULL) {
    1.28          bt = field->layout_type();
    1.29        } else {
    1.30 -        // Ignore non field load (for example, klass load)
    1.31 +        // Check for unsafe oop field access
    1.32 +        for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
    1.33 +          int opcode = n->fast_out(i)->Opcode();
    1.34 +          if (opcode == Op_StoreP || opcode == Op_LoadP ||
    1.35 +              opcode == Op_StoreN || opcode == Op_LoadN) {
    1.36 +            bt = T_OBJECT;
    1.37 +            (*unsafe) = true;
    1.38 +            break;
    1.39 +          }
    1.40 +        }
    1.41        }
    1.42      } else if (adr_type->isa_aryptr()) {
    1.43        if (offset == arrayOopDesc::length_offset_in_bytes()) {
    1.44 @@ -1831,6 +1844,7 @@
    1.45          if (opcode == Op_StoreP || opcode == Op_LoadP ||
    1.46              opcode == Op_StoreN || opcode == Op_LoadN) {
    1.47            bt = T_OBJECT;
    1.48 +          break;
    1.49          }
    1.50        }
    1.51      }

mercurial