@@ -979,25 +979,28 @@ void Parse::do_exits() {
979
979
// Rather than put a barrier on only those writes which are required
980
980
// to complete, we force all writes to complete.
981
981
//
982
- // 2. On PPC64, also add MemBarRelease for constructors which write
983
- // volatile fields. As support_IRIW_for_not_multiple_copy_atomic_cpu
984
- // is set on PPC64, no sync instruction is issued after volatile
985
- // stores. We want to guarantee the same behavior as on platforms
986
- // with total store order, although this is not required by the Java
987
- // memory model. So as with finals, we add a barrier here.
988
- //
989
- // 3. Experimental VM option is used to force the barrier if any field
982
+ // 2. Experimental VM option is used to force the barrier if any field
990
983
// was written out in the constructor.
991
984
//
985
+ // 3. On processors which are not CPU_MULTI_COPY_ATOMIC (e.g. PPC64),
986
+ // support_IRIW_for_not_multiple_copy_atomic_cpu selects that
987
+ // MemBarVolatile is used before volatile load instead of after volatile
988
+ // store, so there's no barrier after the store.
989
+ // We want to guarantee the same behavior as on platforms with total store
990
+ // order, although this is not required by the Java memory model.
991
+ // In this case, we want to enforce visibility of volatile field
992
+ // initializations which are performed in constructors.
993
+ // So as with finals, we add a barrier here.
994
+ //
992
995
// "All bets are off" unless the first publication occurs after a
993
996
// normal return from the constructor. We do not attempt to detect
994
997
// such unusual early publications. But no barrier is needed on
995
998
// exceptional returns, since they cannot publish normally.
996
999
//
997
1000
if (method ()->is_initializer () &&
998
- (wrote_final () ||
999
- PPC64_ONLY ( wrote_volatile () ||)
1000
- (AlwaysSafeConstructors && wrote_fields ()))) {
1001
+ (wrote_final () ||
1002
+ (AlwaysSafeConstructors && wrote_fields ()) ||
1003
+ (support_IRIW_for_not_multiple_copy_atomic_cpu && wrote_volatile ()))) {
1001
1004
_exits.insert_mem_bar (Op_MemBarRelease, alloc_with_final ());
1002
1005
1003
1006
// If Memory barrier is created for final fields write
0 commit comments