src/share/vm/opto/parse3.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/parse3.cpp

Print this page
rev 7391 : 8077504: Unsafe load can loose control dependency and cause crash
Summary: Node::depends_only_on_test() should return false for Unsafe loads
Reviewed-by: kvn, adinn


 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)) {




 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, LoadNode::DependsOnlyOnTest, 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)) {


src/share/vm/opto/parse3.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File