mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 06:14:49 +02:00
7120481: storeStore barrier in constructor with final field
Issue storestore barrier before constructor return if the constructor write final field. Reviewed-by: dholmes, jrose, roland, coleenp
This commit is contained in:
parent
a94cb97f4a
commit
3e904497b1
18 changed files with 155 additions and 1 deletions
|
@ -1418,6 +1418,12 @@ void GraphBuilder::method_return(Value x) {
|
|||
call_register_finalizer();
|
||||
}
|
||||
|
||||
bool need_mem_bar = false;
|
||||
if (method()->name() == ciSymbol::object_initializer_name() &&
|
||||
scope()->wrote_final()) {
|
||||
need_mem_bar = true;
|
||||
}
|
||||
|
||||
// Check to see whether we are inlining. If so, Return
|
||||
// instructions become Gotos to the continuation point.
|
||||
if (continuation() != NULL) {
|
||||
|
@ -1437,6 +1443,10 @@ void GraphBuilder::method_return(Value x) {
|
|||
monitorexit(state()->lock_at(0), SynchronizationEntryBCI);
|
||||
}
|
||||
|
||||
if (need_mem_bar) {
|
||||
append(new MemBar(lir_membar_storestore));
|
||||
}
|
||||
|
||||
// State at end of inlined method is the state of the caller
|
||||
// without the method parameters on stack, including the
|
||||
// return value, if any, of the inlined method on operand stack.
|
||||
|
@ -1456,7 +1466,6 @@ void GraphBuilder::method_return(Value x) {
|
|||
// the continuation point.
|
||||
append_with_bci(goto_callee, scope_data()->continuation()->bci());
|
||||
incr_num_returns();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1472,6 +1481,10 @@ void GraphBuilder::method_return(Value x) {
|
|||
append_split(new MonitorExit(receiver, state()->unlock()));
|
||||
}
|
||||
|
||||
if (need_mem_bar) {
|
||||
append(new MemBar(lir_membar_storestore));
|
||||
}
|
||||
|
||||
append(new Return(x));
|
||||
}
|
||||
|
||||
|
@ -1504,6 +1517,9 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
|
|||
}
|
||||
}
|
||||
|
||||
if (field->is_final() && (code == Bytecodes::_putfield)) {
|
||||
scope()->set_wrote_final();
|
||||
}
|
||||
|
||||
const int offset = !needs_patching ? field->offset() : -1;
|
||||
switch (code) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue