8230434: [C1, C2] Release barrier for volatile field stores in constructors implemented inconsistently

Reviewed-by: shade, lucy
This commit is contained in:
Martin Doerr 2019-09-04 14:21:54 +02:00
parent f7d0ece0a1
commit b0e727124f
2 changed files with 18 additions and 14 deletions

View file

@ -1467,11 +1467,12 @@ void GraphBuilder::method_return(Value x, bool ignore_return) {
call_register_finalizer();
}
// The conditions for a memory barrier are described in Parse::do_exits().
bool need_mem_bar = false;
if (method()->name() == ciSymbol::object_initializer_name() &&
(scope()->wrote_final() || (AlwaysSafeConstructors && scope()->wrote_fields())
|| (support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile())
)){
(scope()->wrote_final() ||
(AlwaysSafeConstructors && scope()->wrote_fields()) ||
(support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile()))) {
need_mem_bar = true;
}