hotspot/src/share/vm/opto/memnode.cpp
changeset 13974 791cba24758f
parent 13952 e3cf184080bc
parent 13969 d2a189b83b87
child 15114 4074553c678b
equal deleted inserted replaced
13963:e5b53c306fb5 13974:791cba24758f
   712       case Op_AddP:             // No change to NULL-ness, so peek thru AddP's
   712       case Op_AddP:             // No change to NULL-ness, so peek thru AddP's
   713         adr = adr->in(AddPNode::Base);
   713         adr = adr->in(AddPNode::Base);
   714         continue;
   714         continue;
   715 
   715 
   716       case Op_DecodeN:         // No change to NULL-ness, so peek thru
   716       case Op_DecodeN:         // No change to NULL-ness, so peek thru
       
   717       case Op_DecodeNKlass:
   717         adr = adr->in(1);
   718         adr = adr->in(1);
   718         continue;
   719         continue;
   719 
   720 
   720       case Op_EncodeP:
   721       case Op_EncodeP:
       
   722       case Op_EncodePKlass:
   721         // EncodeP node's control edge could be set by this method
   723         // EncodeP node's control edge could be set by this method
   722         // when EncodeP node depends on CastPP node.
   724         // when EncodeP node depends on CastPP node.
   723         //
   725         //
   724         // Use its control edge for memory op because EncodeP may go away
   726         // Use its control edge for memory op because EncodeP may go away
   725         // later when it is folded with following or preceding DecodeN node.
   727         // later when it is folded with following or preceding DecodeN node.
   792       case Op_LoadN:            // Loading from within a klass
   794       case Op_LoadN:            // Loading from within a klass
   793       case Op_LoadKlass:        // Loading from within a klass
   795       case Op_LoadKlass:        // Loading from within a klass
   794       case Op_LoadNKlass:       // Loading from within a klass
   796       case Op_LoadNKlass:       // Loading from within a klass
   795       case Op_ConP:             // Loading from a klass
   797       case Op_ConP:             // Loading from a klass
   796       case Op_ConN:             // Loading from a klass
   798       case Op_ConN:             // Loading from a klass
       
   799       case Op_ConNKlass:        // Loading from a klass
   797       case Op_CreateEx:         // Sucking up the guts of an exception oop
   800       case Op_CreateEx:         // Sucking up the guts of an exception oop
   798       case Op_Con:              // Reading from TLS
   801       case Op_Con:              // Reading from TLS
   799       case Op_CMoveP:           // CMoveP is pinned
   802       case Op_CMoveP:           // CMoveP is pinned
   800       case Op_CMoveN:           // CMoveN is pinned
   803       case Op_CMoveN:           // CMoveN is pinned
   801         break;                  // No progress
   804         break;                  // No progress
   898       Node* load  = gvn.transform(new (C) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop()));
   901       Node* load  = gvn.transform(new (C) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop()));
   899       return new (C) DecodeNNode(load, load->bottom_type()->make_ptr());
   902       return new (C) DecodeNNode(load, load->bottom_type()->make_ptr());
   900     } else
   903     } else
   901 #endif
   904 #endif
   902     {
   905     {
   903       assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop");
   906       assert(!adr->bottom_type()->is_ptr_to_narrowoop() && !adr->bottom_type()->is_ptr_to_narrowklass(), "should have got back a narrow oop");
   904       return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
   907       return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
   905     }
   908     }
   906   }
   909   }
   907   ShouldNotReachHere();
   910   ShouldNotReachHere();
   908   return (LoadNode*)NULL;
   911   return (LoadNode*)NULL;
  1892   Node *ctl = NULL;
  1895   Node *ctl = NULL;
  1893   // sanity check the alias category against the created node type
  1896   // sanity check the alias category against the created node type
  1894   const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
  1897   const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
  1895   assert(adr_type != NULL, "expecting TypeKlassPtr");
  1898   assert(adr_type != NULL, "expecting TypeKlassPtr");
  1896 #ifdef _LP64
  1899 #ifdef _LP64
  1897   if (adr_type->is_ptr_to_narrowoop()) {
  1900   if (adr_type->is_ptr_to_narrowklass()) {
  1898     assert(UseCompressedKlassPointers, "no compressed klasses");
  1901     assert(UseCompressedKlassPointers, "no compressed klasses");
  1899     Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop()));
  1902     Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass()));
  1900     return new (C) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr());
  1903     return new (C) DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr());
  1901   }
  1904   }
  1902 #endif
  1905 #endif
  1903   assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
  1906   assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
  1904   return new (C) LoadKlassNode(ctl, mem, adr, at, tk);
  1907   return new (C) LoadKlassNode(ctl, mem, adr, at, tk);
  1905 }
  1908 }
  1906 
  1909 
  1907 //------------------------------Value------------------------------------------
  1910 //------------------------------Value------------------------------------------
  1908 const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
  1911 const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
  2108 const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
  2111 const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
  2109   const Type *t = klass_value_common(phase);
  2112   const Type *t = klass_value_common(phase);
  2110   if (t == Type::TOP)
  2113   if (t == Type::TOP)
  2111     return t;
  2114     return t;
  2112 
  2115 
  2113   return t->make_narrowoop();
  2116   return t->make_narrowklass();
  2114 }
  2117 }
  2115 
  2118 
  2116 //------------------------------Identity---------------------------------------
  2119 //------------------------------Identity---------------------------------------
  2117 // To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
  2120 // To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
  2118 // Also feed through the klass in Allocate(...klass...)._klass.
  2121 // Also feed through the klass in Allocate(...klass...)._klass.
  2119 Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
  2122 Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
  2120   Node *x = klass_identity_common(phase);
  2123   Node *x = klass_identity_common(phase);
  2121 
  2124 
  2122   const Type *t = phase->type( x );
  2125   const Type *t = phase->type( x );
  2123   if( t == Type::TOP ) return x;
  2126   if( t == Type::TOP ) return x;
  2124   if( t->isa_narrowoop()) return x;
  2127   if( t->isa_narrowklass()) return x;
  2125 
  2128   assert (!t->isa_narrowoop(), "no narrow oop here");
  2126   return phase->transform(new (phase->C) EncodePNode(x, t->make_narrowoop()));
  2129 
       
  2130   return phase->transform(new (phase->C) EncodePKlassNode(x, t->make_narrowklass()));
  2127 }
  2131 }
  2128 
  2132 
  2129 //------------------------------Value-----------------------------------------
  2133 //------------------------------Value-----------------------------------------
  2130 const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
  2134 const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
  2131   // Either input is TOP ==> the result is TOP
  2135   // Either input is TOP ==> the result is TOP
  2226   case T_DOUBLE:  return new (C) StoreDNode(ctl, mem, adr, adr_type, val);
  2230   case T_DOUBLE:  return new (C) StoreDNode(ctl, mem, adr, adr_type, val);
  2227   case T_METADATA:
  2231   case T_METADATA:
  2228   case T_ADDRESS:
  2232   case T_ADDRESS:
  2229   case T_OBJECT:
  2233   case T_OBJECT:
  2230 #ifdef _LP64
  2234 #ifdef _LP64
  2231     if (adr->bottom_type()->is_ptr_to_narrowoop() ||
  2235     if (adr->bottom_type()->is_ptr_to_narrowoop()) {
  2232         (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() &&
       
  2233          adr->bottom_type()->isa_rawptr())) {
       
  2234       val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop()));
  2236       val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop()));
  2235       return new (C) StoreNNode(ctl, mem, adr, adr_type, val);
  2237       return new (C) StoreNNode(ctl, mem, adr, adr_type, val);
  2236     } else
  2238     } else if (adr->bottom_type()->is_ptr_to_narrowklass() ||
       
  2239                (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() &&
       
  2240                 adr->bottom_type()->isa_rawptr())) {
       
  2241       val = gvn.transform(new (C) EncodePKlassNode(val, val->bottom_type()->make_narrowklass()));
       
  2242       return new (C) StoreNKlassNode(ctl, mem, adr, adr_type, val);
       
  2243     }
  2237 #endif
  2244 #endif
  2238     {
  2245     {
  2239       return new (C) StorePNode(ctl, mem, adr, adr_type, val);
  2246       return new (C) StorePNode(ctl, mem, adr, adr_type, val);
  2240     }
  2247     }
  2241   }
  2248   }