comparison src/share/vm/opto/library_call.cpp @ 20420:d8847542f83a

8054927: Missing MemNode::acquire ordering in some volatile Load nodes Summary: Fixed memory ordering parameter and added missing barriers for volatile loads. Reviewed-by: roland, iveresov
author kvn
date Wed, 13 Aug 2014 13:05:04 -0700
parents 411e30e5fbb8
children 166d744df0de
comparison
equal deleted inserted replaced
20419:2219e830b668 20420:d8847542f83a
2648 // of safe & unsafe memory. Otherwise fails in a CTW of rt.jar 2648 // of safe & unsafe memory. Otherwise fails in a CTW of rt.jar
2649 // around 5701, class sun/reflect/UnsafeBooleanFieldAccessorImpl. 2649 // around 5701, class sun/reflect/UnsafeBooleanFieldAccessorImpl.
2650 if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder); 2650 if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder);
2651 2651
2652 if (!is_store) { 2652 if (!is_store) {
2653 Node* p = make_load(control(), adr, value_type, type, adr_type, MemNode::unordered, is_volatile); 2653 MemNode::MemOrd mo = is_volatile ? MemNode::acquire : MemNode::unordered;
2654 Node* p = make_load(control(), adr, value_type, type, adr_type, mo, is_volatile);
2654 // load value 2655 // load value
2655 switch (type) { 2656 switch (type) {
2656 case T_BOOLEAN: 2657 case T_BOOLEAN:
2657 case T_CHAR: 2658 case T_CHAR:
2658 case T_BYTE: 2659 case T_BYTE:
5910 type = TypeOopPtr::make_from_klass(field_klass->as_klass()); 5911 type = TypeOopPtr::make_from_klass(field_klass->as_klass());
5911 } else { 5912 } else {
5912 type = Type::get_const_basic_type(bt); 5913 type = Type::get_const_basic_type(bt);
5913 } 5914 }
5914 5915
5916 if (support_IRIW_for_not_multiple_copy_atomic_cpu && is_vol) {
5917 insert_mem_bar(Op_MemBarVolatile); // StoreLoad barrier
5918 }
5915 // Build the load. 5919 // Build the load.
5916 Node* loadedField = make_load(NULL, adr, type, bt, adr_type, MemNode::unordered, is_vol); 5920 MemNode::MemOrd mo = is_vol ? MemNode::acquire : MemNode::unordered;
5921 Node* loadedField = make_load(NULL, adr, type, bt, adr_type, mo, is_vol);
5922 // If reference is volatile, prevent following memory ops from
5923 // floating up past the volatile read. Also prevents commoning
5924 // another volatile read.
5925 if (is_vol) {
5926 // Memory barrier includes bogus read of value to force load BEFORE membar
5927 insert_mem_bar(Op_MemBarAcquire, loadedField);
5928 }
5917 return loadedField; 5929 return loadedField;
5918 } 5930 }
5919 5931
5920 5932
5921 //------------------------------inline_aescrypt_Block----------------------- 5933 //------------------------------inline_aescrypt_Block-----------------------