提交 6579dce6 编写于 作者: T thartmann

8160122: Backport of JDK-8159244 used wrong version of the JDK 9 fix

Summary: Correct backport of 8159244.
Reviewed-by: kvn
上级 3954c6dd
......@@ -1641,16 +1641,11 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
}
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();
}
......
......@@ -27,6 +27,7 @@ import java.util.Arrays;
/*
* @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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册