1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp Wed Feb 22 14:00:34 2012 -0500 1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Tue Feb 21 13:14:55 2012 -0500 1.3 @@ -1418,6 +1418,12 @@ 1.4 call_register_finalizer(); 1.5 } 1.6 1.7 + bool need_mem_bar = false; 1.8 + if (method()->name() == ciSymbol::object_initializer_name() && 1.9 + scope()->wrote_final()) { 1.10 + need_mem_bar = true; 1.11 + } 1.12 + 1.13 // Check to see whether we are inlining. If so, Return 1.14 // instructions become Gotos to the continuation point. 1.15 if (continuation() != NULL) { 1.16 @@ -1437,6 +1443,10 @@ 1.17 monitorexit(state()->lock_at(0), SynchronizationEntryBCI); 1.18 } 1.19 1.20 + if (need_mem_bar) { 1.21 + append(new MemBar(lir_membar_storestore)); 1.22 + } 1.23 + 1.24 // State at end of inlined method is the state of the caller 1.25 // without the method parameters on stack, including the 1.26 // return value, if any, of the inlined method on operand stack. 1.27 @@ -1456,7 +1466,6 @@ 1.28 // the continuation point. 1.29 append_with_bci(goto_callee, scope_data()->continuation()->bci()); 1.30 incr_num_returns(); 1.31 - 1.32 return; 1.33 } 1.34 1.35 @@ -1472,6 +1481,10 @@ 1.36 append_split(new MonitorExit(receiver, state()->unlock())); 1.37 } 1.38 1.39 + if (need_mem_bar) { 1.40 + append(new MemBar(lir_membar_storestore)); 1.41 + } 1.42 + 1.43 append(new Return(x)); 1.44 } 1.45 1.46 @@ -1504,6 +1517,9 @@ 1.47 } 1.48 } 1.49 1.50 + if (field->is_final() && (code == Bytecodes::_putfield)) { 1.51 + scope()->set_wrote_final(); 1.52 + } 1.53 1.54 const int offset = !needs_patching ? field->offset() : -1; 1.55 switch (code) {