comparison src/share/vm/c1/c1_GraphBuilder.cpp @ 14663:3edd4a71588b

8031818: Experimental VM flag for enforcing safe object construction Summary: -XX:+AlwaysSafeConstructors to unconditionally emit the trailing constructor barrier. Reviewed-by: kvn, roland
author shade
date Mon, 03 Mar 2014 15:31:27 +0400
parents 96d2c94bbdd0
children 1179450ad3ee
comparison
equal deleted inserted replaced
14662:3c3953fb3f2a 14663:3edd4a71588b
1434 call_register_finalizer(); 1434 call_register_finalizer();
1435 } 1435 }
1436 1436
1437 bool need_mem_bar = false; 1437 bool need_mem_bar = false;
1438 if (method()->name() == ciSymbol::object_initializer_name() && 1438 if (method()->name() == ciSymbol::object_initializer_name() &&
1439 scope()->wrote_final()) { 1439 (scope()->wrote_final() || (AlwaysSafeConstructors && scope()->wrote_fields()))) {
1440 need_mem_bar = true; 1440 need_mem_bar = true;
1441 } 1441 }
1442 1442
1443 // Check to see whether we are inlining. If so, Return 1443 // Check to see whether we are inlining. If so, Return
1444 // instructions become Gotos to the continuation point. 1444 // instructions become Gotos to the continuation point.
1546 } 1546 }
1547 } 1547 }
1548 1548
1549 if (field->is_final() && (code == Bytecodes::_putfield)) { 1549 if (field->is_final() && (code == Bytecodes::_putfield)) {
1550 scope()->set_wrote_final(); 1550 scope()->set_wrote_final();
1551 }
1552
1553 if (code == Bytecodes::_putfield) {
1554 scope()->set_wrote_fields();
1551 } 1555 }
1552 1556
1553 const int offset = !needs_patching ? field->offset() : -1; 1557 const int offset = !needs_patching ? field->offset() : -1;
1554 switch (code) { 1558 switch (code) {
1555 case Bytecodes::_getstatic: { 1559 case Bytecodes::_getstatic: {