src/share/vm/opto/escape.cpp

changeset 1894
c52275c698d1
parent 1571
4b84186a8248
child 1907
c18cbe5936b8
     1.1 --- a/src/share/vm/opto/escape.cpp	Mon May 17 16:50:07 2010 -0700
     1.2 +++ b/src/share/vm/opto/escape.cpp	Tue May 18 09:54:05 2010 -0700
     1.3 @@ -1989,20 +1989,15 @@
     1.4      case Op_Allocate:
     1.5      {
     1.6        Node *k = call->in(AllocateNode::KlassNode);
     1.7 -      const TypeKlassPtr *kt;
     1.8 -      if (k->Opcode() == Op_LoadKlass) {
     1.9 -        kt = k->as_Load()->type()->isa_klassptr();
    1.10 -      } else {
    1.11 -        // Also works for DecodeN(LoadNKlass).
    1.12 -        kt = k->as_Type()->type()->isa_klassptr();
    1.13 -      }
    1.14 +      const TypeKlassPtr *kt = k->bottom_type()->isa_klassptr();
    1.15        assert(kt != NULL, "TypeKlassPtr  required.");
    1.16        ciKlass* cik = kt->klass();
    1.17 -      ciInstanceKlass* ciik = cik->as_instance_klass();
    1.18  
    1.19        PointsToNode::EscapeState es;
    1.20        uint edge_to;
    1.21 -      if (cik->is_subclass_of(_compile->env()->Thread_klass()) || ciik->has_finalizer()) {
    1.22 +      if (cik->is_subclass_of(_compile->env()->Thread_klass()) ||
    1.23 +         !cik->is_instance_klass() || // StressReflectiveCode
    1.24 +          cik->as_instance_klass()->has_finalizer()) {
    1.25          es = PointsToNode::GlobalEscape;
    1.26          edge_to = _phantom_object; // Could not be worse
    1.27        } else {
    1.28 @@ -2017,13 +2012,28 @@
    1.29  
    1.30      case Op_AllocateArray:
    1.31      {
    1.32 -      int length = call->in(AllocateNode::ALength)->find_int_con(-1);
    1.33 -      if (length < 0 || length > EliminateAllocationArraySizeLimit) {
    1.34 -        // Not scalar replaceable if the length is not constant or too big.
    1.35 -        ptnode_adr(call_idx)->_scalar_replaceable = false;
    1.36 +
    1.37 +      Node *k = call->in(AllocateNode::KlassNode);
    1.38 +      const TypeKlassPtr *kt = k->bottom_type()->isa_klassptr();
    1.39 +      assert(kt != NULL, "TypeKlassPtr  required.");
    1.40 +      ciKlass* cik = kt->klass();
    1.41 +
    1.42 +      PointsToNode::EscapeState es;
    1.43 +      uint edge_to;
    1.44 +      if (!cik->is_array_klass()) { // StressReflectiveCode
    1.45 +        es = PointsToNode::GlobalEscape;
    1.46 +        edge_to = _phantom_object;
    1.47 +      } else {
    1.48 +        es = PointsToNode::NoEscape;
    1.49 +        edge_to = call_idx;
    1.50 +        int length = call->in(AllocateNode::ALength)->find_int_con(-1);
    1.51 +        if (length < 0 || length > EliminateAllocationArraySizeLimit) {
    1.52 +          // Not scalar replaceable if the length is not constant or too big.
    1.53 +          ptnode_adr(call_idx)->_scalar_replaceable = false;
    1.54 +        }
    1.55        }
    1.56 -      set_escape_state(call_idx, PointsToNode::NoEscape);
    1.57 -      add_pointsto_edge(resproj_idx, call_idx);
    1.58 +      set_escape_state(call_idx, es);
    1.59 +      add_pointsto_edge(resproj_idx, edge_to);
    1.60        _processed.set(resproj_idx);
    1.61        break;
    1.62      }

mercurial