src/share/vm/opto/parse3.cpp

Print this page




 216       must_assert_null = true;
 217     } else if (field->is_constant() && field->is_static()) {
 218       // This can happen if the constant oop is non-perm.
 219       ciObject* con = field->constant_value().as_object();
 220       // Do not "join" in the previous type; it doesn't add value,
 221       // and may yield a vacuous result if the field is of interface type.
 222       type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
 223       assert(type != NULL, "field singleton type must be consistent");
 224     } else {
 225       type = TypeOopPtr::make_from_klass(field_klass->as_klass());
 226     }
 227   } else {
 228     type = Type::get_const_basic_type(bt);
 229   }
 230   if (support_IRIW_for_not_multiple_copy_atomic_cpu && field->is_volatile()) {
 231     insert_mem_bar(Op_MemBarVolatile);   // StoreLoad barrier
 232   }
 233   // Build the load.
 234   //
 235   MemNode::MemOrd mo = is_vol ? MemNode::acquire : MemNode::unordered;
 236   Node* ld = make_load(NULL, adr, type, bt, adr_type, mo, is_vol);

 237 
 238   // Adjust Java stack
 239   if (type2size[bt] == 1)
 240     push(ld);
 241   else
 242     push_pair(ld);
 243 
 244   if (must_assert_null) {
 245     // Do not take a trap here.  It's possible that the program
 246     // will never load the field's class, and will happily see
 247     // null values in this field forever.  Don't stumble into a
 248     // trap for such a program, or we might get a long series
 249     // of useless recompilations.  (Or, we might load a class
 250     // which should not be loaded.)  If we ever see a non-null
 251     // value, we will then trap and recompile.  (The trap will
 252     // not need to mention the class index, since the class will
 253     // already have been loaded if we ever see a non-null value.)
 254     // uncommon_trap(iter().get_field_signature_index());
 255 #ifndef PRODUCT
 256     if (PrintOpto && (Verbose || WizardMode)) {


 297   const MemNode::MemOrd mo =
 298     is_vol ?
 299     // Volatile fields need releasing stores.
 300     MemNode::release :
 301     // Non-volatile fields also need releasing stores if they hold an
 302     // object reference, because the object reference might point to
 303     // a freshly created object.
 304     StoreNode::release_if_reference(bt);
 305 
 306   // Store the value.
 307   Node* store;
 308   if (bt == T_OBJECT) {
 309     const TypeOopPtr* field_type;
 310     if (!field->type()->is_loaded()) {
 311       field_type = TypeInstPtr::BOTTOM;
 312     } else {
 313       field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
 314     }
 315     store = store_oop_to_object(control(), obj, adr, adr_type, val, field_type, bt, mo);
 316   } else {
 317     store = store_to_memory(control(), adr, val, bt, adr_type, mo, is_vol);

 318   }
 319 
 320   // If reference is volatile, prevent following volatiles ops from
 321   // floating up before the volatile write.
 322   if (is_vol) {
 323     // If not multiple copy atomic, we do the MemBarVolatile before the load.
 324     if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {
 325       insert_mem_bar(Op_MemBarVolatile); // Use fat membar
 326     }
 327     // Remember we wrote a volatile field.
 328     // For not multiple copy atomic cpu (ppc64) a barrier should be issued
 329     // in constructors which have such stores. See do_exits() in parse1.cpp.
 330     if (is_field) {
 331       set_wrote_volatile(true);
 332     }
 333   }
 334 
 335   // If the field is final, the rules of Java say we are in <init> or <clinit>.
 336   // Note the presence of writes to final non-static fields, so that we
 337   // can insert a memory barrier later on to keep the writes from floating




 216       must_assert_null = true;
 217     } else if (field->is_constant() && field->is_static()) {
 218       // This can happen if the constant oop is non-perm.
 219       ciObject* con = field->constant_value().as_object();
 220       // Do not "join" in the previous type; it doesn't add value,
 221       // and may yield a vacuous result if the field is of interface type.
 222       type = TypeOopPtr::make_from_constant(con)->isa_oopptr();
 223       assert(type != NULL, "field singleton type must be consistent");
 224     } else {
 225       type = TypeOopPtr::make_from_klass(field_klass->as_klass());
 226     }
 227   } else {
 228     type = Type::get_const_basic_type(bt);
 229   }
 230   if (support_IRIW_for_not_multiple_copy_atomic_cpu && field->is_volatile()) {
 231     insert_mem_bar(Op_MemBarVolatile);   // StoreLoad barrier
 232   }
 233   // Build the load.
 234   //
 235   MemNode::MemOrd mo = is_vol ? MemNode::acquire : MemNode::unordered;
 236   bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
 237   Node* ld = make_load(NULL, adr, type, bt, adr_type, mo, needs_atomic_access);
 238 
 239   // Adjust Java stack
 240   if (type2size[bt] == 1)
 241     push(ld);
 242   else
 243     push_pair(ld);
 244 
 245   if (must_assert_null) {
 246     // Do not take a trap here.  It's possible that the program
 247     // will never load the field's class, and will happily see
 248     // null values in this field forever.  Don't stumble into a
 249     // trap for such a program, or we might get a long series
 250     // of useless recompilations.  (Or, we might load a class
 251     // which should not be loaded.)  If we ever see a non-null
 252     // value, we will then trap and recompile.  (The trap will
 253     // not need to mention the class index, since the class will
 254     // already have been loaded if we ever see a non-null value.)
 255     // uncommon_trap(iter().get_field_signature_index());
 256 #ifndef PRODUCT
 257     if (PrintOpto && (Verbose || WizardMode)) {


 298   const MemNode::MemOrd mo =
 299     is_vol ?
 300     // Volatile fields need releasing stores.
 301     MemNode::release :
 302     // Non-volatile fields also need releasing stores if they hold an
 303     // object reference, because the object reference might point to
 304     // a freshly created object.
 305     StoreNode::release_if_reference(bt);
 306 
 307   // Store the value.
 308   Node* store;
 309   if (bt == T_OBJECT) {
 310     const TypeOopPtr* field_type;
 311     if (!field->type()->is_loaded()) {
 312       field_type = TypeInstPtr::BOTTOM;
 313     } else {
 314       field_type = TypeOopPtr::make_from_klass(field->type()->as_klass());
 315     }
 316     store = store_oop_to_object(control(), obj, adr, adr_type, val, field_type, bt, mo);
 317   } else {
 318     bool needs_atomic_access = is_vol || AlwaysAtomicAccesses;
 319     store = store_to_memory(control(), adr, val, bt, adr_type, mo, needs_atomic_access);
 320   }
 321 
 322   // If reference is volatile, prevent following volatiles ops from
 323   // floating up before the volatile write.
 324   if (is_vol) {
 325     // If not multiple copy atomic, we do the MemBarVolatile before the load.
 326     if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {
 327       insert_mem_bar(Op_MemBarVolatile); // Use fat membar
 328     }
 329     // Remember we wrote a volatile field.
 330     // For not multiple copy atomic cpu (ppc64) a barrier should be issued
 331     // in constructors which have such stores. See do_exits() in parse1.cpp.
 332     if (is_field) {
 333       set_wrote_volatile(true);
 334     }
 335   }
 336 
 337   // If the field is final, the rules of Java say we are in <init> or <clinit>.
 338   // Note the presence of writes to final non-static fields, so that we
 339   // can insert a memory barrier later on to keep the writes from floating