src/share/vm/opto/connode.cpp

changeset 4159
8e47bac5643a
parent 4115
e626685e9f6c
child 4889
cc32ccaaf47f
     1.1 --- a/src/share/vm/opto/connode.cpp	Mon Oct 08 17:04:00 2012 -0700
     1.2 +++ b/src/share/vm/opto/connode.cpp	Tue Oct 09 10:11:38 2012 +0200
     1.3 @@ -45,16 +45,17 @@
     1.4  //------------------------------make-------------------------------------------
     1.5  ConNode *ConNode::make( Compile* C, const Type *t ) {
     1.6    switch( t->basic_type() ) {
     1.7 -  case T_INT:       return new (C) ConINode( t->is_int() );
     1.8 -  case T_LONG:      return new (C) ConLNode( t->is_long() );
     1.9 -  case T_FLOAT:     return new (C) ConFNode( t->is_float_constant() );
    1.10 -  case T_DOUBLE:    return new (C) ConDNode( t->is_double_constant() );
    1.11 -  case T_VOID:      return new (C) ConNode ( Type::TOP );
    1.12 -  case T_OBJECT:    return new (C) ConPNode( t->is_ptr() );
    1.13 -  case T_ARRAY:     return new (C) ConPNode( t->is_aryptr() );
    1.14 -  case T_ADDRESS:   return new (C) ConPNode( t->is_ptr() );
    1.15 -  case T_NARROWOOP: return new (C) ConNNode( t->is_narrowoop() );
    1.16 -  case T_METADATA:  return new (C) ConPNode( t->is_ptr() );
    1.17 +  case T_INT:         return new (C) ConINode( t->is_int() );
    1.18 +  case T_LONG:        return new (C) ConLNode( t->is_long() );
    1.19 +  case T_FLOAT:       return new (C) ConFNode( t->is_float_constant() );
    1.20 +  case T_DOUBLE:      return new (C) ConDNode( t->is_double_constant() );
    1.21 +  case T_VOID:        return new (C) ConNode ( Type::TOP );
    1.22 +  case T_OBJECT:      return new (C) ConPNode( t->is_ptr() );
    1.23 +  case T_ARRAY:       return new (C) ConPNode( t->is_aryptr() );
    1.24 +  case T_ADDRESS:     return new (C) ConPNode( t->is_ptr() );
    1.25 +  case T_NARROWOOP:   return new (C) ConNNode( t->is_narrowoop() );
    1.26 +  case T_NARROWKLASS: return new (C) ConNKlassNode( t->is_narrowklass() );
    1.27 +  case T_METADATA:    return new (C) ConPNode( t->is_ptr() );
    1.28      // Expected cases:  TypePtr::NULL_PTR, any is_rawptr()
    1.29      // Also seen: AnyPtr(TopPTR *+top); from command line:
    1.30      //   r -XX:+PrintOpto -XX:CIStart=285 -XX:+CompileTheWorld -XX:CompileTheWorldStartAt=660
    1.31 @@ -447,7 +448,7 @@
    1.32  // If not converting int->oop, throw away cast after constant propagation
    1.33  Node *CastPPNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
    1.34    const Type *t = ccp->type(in(1));
    1.35 -  if (!t->isa_oop_ptr() || (in(1)->is_DecodeN() && Matcher::gen_narrow_oop_implicit_null_checks())) {
    1.36 +  if (!t->isa_oop_ptr() || ((in(1)->is_DecodeN()) && Matcher::gen_narrow_oop_implicit_null_checks())) {
    1.37      return NULL; // do not transform raw pointers or narrow oops
    1.38    }
    1.39    return ConstraintCastNode::Ideal_DU_postCCP(ccp);
    1.40 @@ -607,15 +608,56 @@
    1.41    if (t == Type::TOP) return Type::TOP;
    1.42    if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR;
    1.43  
    1.44 -  assert(t->isa_oop_ptr() || UseCompressedKlassPointers && t->isa_klassptr(), "only oopptr here");
    1.45 +  assert(t->isa_oop_ptr(), "only oopptr here");
    1.46    return t->make_narrowoop();
    1.47  }
    1.48  
    1.49  
    1.50 -Node *EncodePNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
    1.51 +Node *EncodeNarrowPtrNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
    1.52    return MemNode::Ideal_common_DU_postCCP(ccp, this, in(1));
    1.53  }
    1.54  
    1.55 +Node* DecodeNKlassNode::Identity(PhaseTransform* phase) {
    1.56 +  const Type *t = phase->type( in(1) );
    1.57 +  if( t == Type::TOP ) return in(1);
    1.58 +
    1.59 +  if (in(1)->is_EncodePKlass()) {
    1.60 +    // (DecodeNKlass (EncodePKlass p)) -> p
    1.61 +    return in(1)->in(1);
    1.62 +  }
    1.63 +  return this;
    1.64 +}
    1.65 +
    1.66 +const Type *DecodeNKlassNode::Value( PhaseTransform *phase ) const {
    1.67 +  const Type *t = phase->type( in(1) );
    1.68 +  if (t == Type::TOP) return Type::TOP;
    1.69 +  assert(t != TypeNarrowKlass::NULL_PTR, "null klass?");
    1.70 +
    1.71 +  assert(t->isa_narrowklass(), "only narrow klass ptr here");
    1.72 +  return t->make_ptr();
    1.73 +}
    1.74 +
    1.75 +Node* EncodePKlassNode::Identity(PhaseTransform* phase) {
    1.76 +  const Type *t = phase->type( in(1) );
    1.77 +  if( t == Type::TOP ) return in(1);
    1.78 +
    1.79 +  if (in(1)->is_DecodeNKlass()) {
    1.80 +    // (EncodePKlass (DecodeNKlass p)) -> p
    1.81 +    return in(1)->in(1);
    1.82 +  }
    1.83 +  return this;
    1.84 +}
    1.85 +
    1.86 +const Type *EncodePKlassNode::Value( PhaseTransform *phase ) const {
    1.87 +  const Type *t = phase->type( in(1) );
    1.88 +  if (t == Type::TOP) return Type::TOP;
    1.89 +  assert (t != TypePtr::NULL_PTR, "null klass?");
    1.90 +
    1.91 +  assert(UseCompressedKlassPointers && t->isa_klassptr(), "only klass ptr here");
    1.92 +  return t->make_narrowklass();
    1.93 +}
    1.94 +
    1.95 +
    1.96  //=============================================================================
    1.97  //------------------------------Identity---------------------------------------
    1.98  Node *Conv2BNode::Identity( PhaseTransform *phase ) {

mercurial