--- old/src/share/vm/opto/parse1.cpp 2015-11-08 05:58:29.248653726 -0800 +++ new/src/share/vm/opto/parse1.cpp 2015-11-08 05:58:28.972653730 -0800 @@ -967,10 +967,19 @@ } // Any method can write a @Stable field; insert memory barriers after - // those also. If there is a predecessor allocation node, bind the - // barrier there. + // those also. Can't bind predecessor allocation node with barrier. + // Because allocation doesn't always dominate MemBarRelease. Example + // foo(StableFieldObject s) { + // if (s != null) return s; + // s = new StableFieldObject(); + // s.stable = 1; + // } + // MemBarRelease inserted at exit is not dominated by allocation + // (early return path might take) and will trigger assertion when + // verify_dominance, because use (MemBarRelease) is not dominate by + // def (allocation). if (wrote_stable()) { - _exits.insert_mem_bar(Op_MemBarRelease, alloc_with_final()); + _exits.insert_mem_bar(Op_MemBarRelease); #ifndef PRODUCT if (PrintOpto && (Verbose || WizardMode)) { method()->print_name();