< prev index next >

src/hotspot/share/opto/memnode.cpp

Print this page




2174   return LoadNode::Ideal(phase, can_reshape);
2175 }
2176 
2177 const Type* LoadSNode::Value(PhaseGVN* phase) const {
2178   Node* mem = in(MemNode::Memory);
2179   Node* value = can_see_stored_value(mem,phase);
2180   if (value != NULL && value->is_Con() &&
2181       !value->bottom_type()->higher_equal(_type)) {
2182     // If the input to the store does not fit with the load's result type,
2183     // it must be truncated. We can't delay until Ideal call since
2184     // a singleton Value is needed for split_thru_phi optimization.
2185     int con = value->get_int();
2186     return TypeInt::make((con << 16) >> 16);
2187   }
2188   return LoadNode::Value(phase);
2189 }
2190 
2191 //=============================================================================
2192 //----------------------------LoadKlassNode::make------------------------------
2193 // Polymorphic factory method:
2194 Node* LoadKlassNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, const TypeKlassPtr* tk) {

2195   // sanity check the alias category against the created node type
2196   const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
2197   assert(adr_type != NULL, "expecting TypeKlassPtr");
2198 #ifdef _LP64
2199   if (adr_type->is_ptr_to_narrowklass()) {
2200     assert(UseCompressedClassPointers, "no compressed klasses");
2201     Node* load_klass = gvn.transform(new LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass(), MemNode::unordered));
2202     return new DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr());
2203   }
2204 #endif
2205   assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
2206   return new LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered);
2207 }
2208 
2209 //------------------------------Value------------------------------------------
2210 const Type* LoadKlassNode::Value(PhaseGVN* phase) const {
2211   return klass_value_common(phase);
2212 }
2213 
2214 // In most cases, LoadKlassNode does not have the control input set. If the control
2215 // input is set, it must not be removed (by LoadNode::Ideal()).
2216 bool LoadKlassNode::can_remove_control() const {
2217   return false;
2218 }
2219 
2220 const Type* LoadNode::klass_value_common(PhaseGVN* phase) const {
2221   // Either input is TOP ==> the result is TOP
2222   const Type *t1 = phase->type( in(MemNode::Memory) );
2223   if (t1 == Type::TOP)  return Type::TOP;
2224   Node *adr = in(MemNode::Address);
2225   const Type *t2 = phase->type( adr );
2226   if (t2 == Type::TOP)  return Type::TOP;




2174   return LoadNode::Ideal(phase, can_reshape);
2175 }
2176 
2177 const Type* LoadSNode::Value(PhaseGVN* phase) const {
2178   Node* mem = in(MemNode::Memory);
2179   Node* value = can_see_stored_value(mem,phase);
2180   if (value != NULL && value->is_Con() &&
2181       !value->bottom_type()->higher_equal(_type)) {
2182     // If the input to the store does not fit with the load's result type,
2183     // it must be truncated. We can't delay until Ideal call since
2184     // a singleton Value is needed for split_thru_phi optimization.
2185     int con = value->get_int();
2186     return TypeInt::make((con << 16) >> 16);
2187   }
2188   return LoadNode::Value(phase);
2189 }
2190 
2191 //=============================================================================
2192 //----------------------------LoadKlassNode::make------------------------------
2193 // Polymorphic factory method:
2194 Node* LoadKlassNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at,
2195                           const TypeKlassPtr* tk, bool clear_prop_bits) {
2196   // sanity check the alias category against the created node type
2197   const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
2198   assert(adr_type != NULL, "expecting TypeKlassPtr");
2199 #ifdef _LP64
2200   if (adr_type->is_ptr_to_narrowklass()) {
2201     assert(UseCompressedClassPointers, "no compressed klasses");
2202     Node* load_klass = gvn.transform(new LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass(), MemNode::unordered, clear_prop_bits));
2203     return new DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr());
2204   }
2205 #endif
2206   assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
2207   return new LoadKlassNode(ctl, mem, adr, at, tk, MemNode::unordered, clear_prop_bits);
2208 }
2209 
2210 //------------------------------Value------------------------------------------
2211 const Type* LoadKlassNode::Value(PhaseGVN* phase) const {
2212   return klass_value_common(phase);
2213 }
2214 
2215 // In most cases, LoadKlassNode does not have the control input set. If the control
2216 // input is set, it must not be removed (by LoadNode::Ideal()).
2217 bool LoadKlassNode::can_remove_control() const {
2218   return false;
2219 }
2220 
2221 const Type* LoadNode::klass_value_common(PhaseGVN* phase) const {
2222   // Either input is TOP ==> the result is TOP
2223   const Type *t1 = phase->type( in(MemNode::Memory) );
2224   if (t1 == Type::TOP)  return Type::TOP;
2225   Node *adr = in(MemNode::Address);
2226   const Type *t2 = phase->type( adr );
2227   if (t2 == Type::TOP)  return Type::TOP;


< prev index next >