Mercurial > hg > graal-jvmci-8
changeset 24023:173a1f83c930
8160122: Backport of JDK-8159244 used wrong version of the JDK 9 fix
Summary: Correct backport of 8159244.
Reviewed-by: kvn
author | thartmann |
---|---|
date | Mon, 27 Jun 2016 08:10:51 +0200 |
parents | f22b5be95347 |
children | 649f01d13b2d |
files | src/share/vm/opto/stringopts.cpp test/compiler/stringopts/TestStringObjectInitialization.java |
diffstat | 2 files changed, 6 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/opto/stringopts.cpp Sat Jun 25 20:03:17 2016 +0100 +++ b/src/share/vm/opto/stringopts.cpp Mon Jun 27 08:10:51 2016 +0200 @@ -1641,16 +1641,11 @@ } kit.store_String_value(kit.control(), result, char_array); - // Do not let stores that initialize this object be reordered with - // a subsequent store that would make this object accessible by - // other threads. - // Record what AllocateNode this StoreStore protects so that - // escape analysis can go from the MemBarStoreStoreNode to the - // AllocateNode and eliminate the MemBarStoreStoreNode if possible - // based on the escape status of the AllocateNode. - AllocateNode* alloc = AllocateNode::Ideal_allocation(result, _gvn); - assert(alloc != NULL, "should be newly allocated"); - kit.insert_mem_bar(Op_MemBarStoreStore, alloc->proj_out(AllocateNode::RawAddress)); + // The value field is final. Emit a barrier here to ensure that the effect + // of the initialization is committed to memory before any code publishes + // a reference to the newly constructed object (see Parse::do_exits()). + assert(AllocateNode::Ideal_allocation(result, _gvn) != NULL, "should be newly allocated"); + kit.insert_mem_bar(Op_MemBarRelease, result); } else { result = C->top(); }
--- a/test/compiler/stringopts/TestStringObjectInitialization.java Sat Jun 25 20:03:17 2016 +0100 +++ b/test/compiler/stringopts/TestStringObjectInitialization.java Mon Jun 27 08:10:51 2016 +0200 @@ -27,6 +27,7 @@ /* * @test * @bug 8159244 + * @requires vm.gc == "Parallel" | vm.gc == "null" * @summary Verifies that no partially initialized String object escapes from * C2's String concat optimization in a highly concurrent setting. * This test triggers the bug in about 1 out of 10 runs.