src/share/vm/opto/memnode.cpp

changeset 599
c436414a719e
parent 598
885ed790ecf0
child 603
7793bd37a336
     1.1 --- a/src/share/vm/opto/memnode.cpp	Wed May 21 10:45:07 2008 -0700
     1.2 +++ b/src/share/vm/opto/memnode.cpp	Wed May 21 13:46:23 2008 -0700
     1.3 @@ -671,11 +671,13 @@
     1.4        case Op_LoadP:            // Loading from within a klass
     1.5        case Op_LoadN:            // Loading from within a klass
     1.6        case Op_LoadKlass:        // Loading from within a klass
     1.7 +      case Op_LoadNKlass:       // Loading from within a klass
     1.8        case Op_ConP:             // Loading from a klass
     1.9        case Op_ConN:             // Loading from a klass
    1.10        case Op_CreateEx:         // Sucking up the guts of an exception oop
    1.11        case Op_Con:              // Reading from TLS
    1.12        case Op_CMoveP:           // CMoveP is pinned
    1.13 +      case Op_CMoveN:           // CMoveN is pinned
    1.14          break;                  // No progress
    1.15  
    1.16        case Op_Proj:             // Direct call to an allocation routine
    1.17 @@ -1610,8 +1612,35 @@
    1.18  }
    1.19  
    1.20  //=============================================================================
    1.21 +//----------------------------LoadKlassNode::make------------------------------
    1.22 +// Polymorphic factory method:
    1.23 +Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk ) {
    1.24 +  Compile* C = gvn.C;
    1.25 +  Node *ctl = NULL;
    1.26 +  // sanity check the alias category against the created node type
    1.27 +  const TypeOopPtr *adr_type = adr->bottom_type()->isa_oopptr();
    1.28 +  assert(adr_type != NULL, "expecting TypeOopPtr");
    1.29 +#ifdef _LP64
    1.30 +  if (adr_type->is_ptr_to_narrowoop()) {
    1.31 +    const TypeNarrowOop* narrowtype = tk->is_oopptr()->make_narrowoop();
    1.32 +    Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, narrowtype));
    1.33 +    return DecodeNNode::decode(&gvn, load_klass);
    1.34 +  } else
    1.35 +#endif
    1.36 +  {
    1.37 +    assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
    1.38 +    return new (C, 3) LoadKlassNode(ctl, mem, adr, at, tk);
    1.39 +  }
    1.40 +  ShouldNotReachHere();
    1.41 +  return (LoadKlassNode*)NULL;
    1.42 +}
    1.43 +
    1.44  //------------------------------Value------------------------------------------
    1.45  const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
    1.46 +  return klass_value_common(phase);
    1.47 +}
    1.48 +
    1.49 +const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
    1.50    // Either input is TOP ==> the result is TOP
    1.51    const Type *t1 = phase->type( in(MemNode::Memory) );
    1.52    if (t1 == Type::TOP)  return Type::TOP;
    1.53 @@ -1743,6 +1772,10 @@
    1.54  // To clean up reflective code, simplify k.java_mirror.as_klass to plain k.
    1.55  // Also feed through the klass in Allocate(...klass...)._klass.
    1.56  Node* LoadKlassNode::Identity( PhaseTransform *phase ) {
    1.57 +  return klass_identity_common(phase);
    1.58 +}
    1.59 +
    1.60 +Node* LoadNode::klass_identity_common(PhaseTransform *phase ) {
    1.61    Node* x = LoadNode::Identity(phase);
    1.62    if (x != this)  return x;
    1.63  
    1.64 @@ -1801,6 +1834,34 @@
    1.65    return this;
    1.66  }
    1.67  
    1.68 +
    1.69 +//------------------------------Value------------------------------------------
    1.70 +const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
    1.71 +  const Type *t = klass_value_common(phase);
    1.72 +
    1.73 +  if (t == TypePtr::NULL_PTR) {
    1.74 +    return TypeNarrowOop::NULL_PTR;
    1.75 +  }
    1.76 +  if (t != Type::TOP && !t->isa_narrowoop()) {
    1.77 +    assert(t->is_oopptr(), "sanity");
    1.78 +    t = t->is_oopptr()->make_narrowoop();
    1.79 +  }
    1.80 +  return t;
    1.81 +}
    1.82 +
    1.83 +//------------------------------Identity---------------------------------------
    1.84 +// To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
    1.85 +// Also feed through the klass in Allocate(...klass...)._klass.
    1.86 +Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
    1.87 +  Node *x = klass_identity_common(phase);
    1.88 +
    1.89 +  const Type *t = phase->type( x );
    1.90 +  if( t == Type::TOP ) return x;
    1.91 +  if( t->isa_narrowoop()) return x;
    1.92 +
    1.93 +  return EncodePNode::encode(phase, x);
    1.94 +}
    1.95 +
    1.96  //------------------------------Value-----------------------------------------
    1.97  const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
    1.98    // Either input is TOP ==> the result is TOP

mercurial