< prev index next >

src/hotspot/share/opto/parse1.cpp

Print this page
rev 55090 : secret-sfac


1042   //    publishes the reference to the newly constructed object. Rather
1043   //    than wait for the publication, we simply block the writes here.
1044   //    Rather than put a barrier on only those writes which are required
1045   //    to complete, we force all writes to complete.
1046   //
1047   // 2. On PPC64, also add MemBarRelease for constructors which write
1048   //    volatile fields. As support_IRIW_for_not_multiple_copy_atomic_cpu
1049   //    is set on PPC64, no sync instruction is issued after volatile
1050   //    stores. We want to guarantee the same behavior as on platforms
1051   //    with total store order, although this is not required by the Java
1052   //    memory model. So as with finals, we add a barrier here.
1053   //
1054   // 3. Experimental VM option is used to force the barrier if any field
1055   //    was written out in the constructor.
1056   //
1057   // "All bets are off" unless the first publication occurs after a
1058   // normal return from the constructor.  We do not attempt to detect
1059   // such unusual early publications.  But no barrier is needed on
1060   // exceptional returns, since they cannot publish normally.
1061   //
1062   if (method()->is_initializer() &&
1063         (wrote_final() ||
1064            PPC64_ONLY(wrote_volatile() ||)
1065            (AlwaysSafeConstructors && wrote_fields()))) {
1066     _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
1067 
1068     // If Memory barrier is created for final fields write
1069     // and allocation node does not escape the initialize method,
1070     // then barrier introduced by allocation node can be removed.
1071     if (DoEscapeAnalysis && alloc_with_final()) {
1072       AllocateNode *alloc = AllocateNode::Ideal_allocation(alloc_with_final(), &_gvn);
1073       alloc->compute_MemBar_redundancy(method());
1074     }
1075     if (PrintOpto && (Verbose || WizardMode)) {
1076       method()->print_name();
1077       tty->print_cr(" writes finals and needs a memory barrier");
1078     }
1079   }
1080 
1081   // Any method can write a @Stable field; insert memory barriers
1082   // after those also. Can't bind predecessor allocation node (if any)




1042   //    publishes the reference to the newly constructed object. Rather
1043   //    than wait for the publication, we simply block the writes here.
1044   //    Rather than put a barrier on only those writes which are required
1045   //    to complete, we force all writes to complete.
1046   //
1047   // 2. On PPC64, also add MemBarRelease for constructors which write
1048   //    volatile fields. As support_IRIW_for_not_multiple_copy_atomic_cpu
1049   //    is set on PPC64, no sync instruction is issued after volatile
1050   //    stores. We want to guarantee the same behavior as on platforms
1051   //    with total store order, although this is not required by the Java
1052   //    memory model. So as with finals, we add a barrier here.
1053   //
1054   // 3. Experimental VM option is used to force the barrier if any field
1055   //    was written out in the constructor.
1056   //
1057   // "All bets are off" unless the first publication occurs after a
1058   // normal return from the constructor.  We do not attempt to detect
1059   // such unusual early publications.  But no barrier is needed on
1060   // exceptional returns, since they cannot publish normally.
1061   //
1062   if (method()->is_object_constructor_or_class_initializer() &&
1063         (wrote_final() ||
1064            PPC64_ONLY(wrote_volatile() ||)
1065            (AlwaysSafeConstructors && wrote_fields()))) {
1066     _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final());
1067 
1068     // If Memory barrier is created for final fields write
1069     // and allocation node does not escape the initialize method,
1070     // then barrier introduced by allocation node can be removed.
1071     if (DoEscapeAnalysis && alloc_with_final()) {
1072       AllocateNode *alloc = AllocateNode::Ideal_allocation(alloc_with_final(), &_gvn);
1073       alloc->compute_MemBar_redundancy(method());
1074     }
1075     if (PrintOpto && (Verbose || WizardMode)) {
1076       method()->print_name();
1077       tty->print_cr(" writes finals and needs a memory barrier");
1078     }
1079   }
1080 
1081   // Any method can write a @Stable field; insert memory barriers
1082   // after those also. Can't bind predecessor allocation node (if any)


< prev index next >