--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Mon Mar 03 15:54:45 2014 +0400
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Mon Mar 03 15:31:27 2014 +0400
@@ -1436,7 +1436,7 @@
bool need_mem_bar = false;
if (method()->name() == ciSymbol::object_initializer_name() &&
- scope()->wrote_final()) {
+ (scope()->wrote_final() || (AlwaysSafeConstructors && scope()->wrote_fields()))) {
need_mem_bar = true;
}
@@ -1550,6 +1550,10 @@
scope()->set_wrote_final();
}
+ if (code == Bytecodes::_putfield) {
+ scope()->set_wrote_fields();
+ }
+
const int offset = !needs_patching ? field->offset() : -1;
switch (code) {
case Bytecodes::_getstatic: {