src/share/vm/c1/c1_GraphBuilder.cpp
Print this page
*** 1393,1402 ****
--- 1393,1408 ----
if (RegisterFinalizersAtInit &&
method()->intrinsic_id() == vmIntrinsics::_Object_init) {
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) {
assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
*** 1412,1421 ****
--- 1418,1431 ----
if (method()->is_synchronized()) {
assert(state()->locks_size() == 1, "receiver must be locked here");
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.
set_state(state()->caller_state()->copy_for_parsing());
if (x != NULL) {
*** 1431,1441 ****
// The current bci() is in the wrong scope, so use the bci() of
// the continuation point.
append_with_bci(goto_callee, scope_data()->continuation()->bci());
incr_num_returns();
-
return;
}
state()->truncate_stack(0);
if (method()->is_synchronized()) {
--- 1441,1450 ----
*** 1447,1456 ****
--- 1456,1469 ----
receiver = append(new Constant(new ClassConstant(method()->holder())));
}
append_split(new MonitorExit(receiver, state()->unlock()));
}
+ if (need_mem_bar) {
+ append(new MemBar(lir_membar_storestore));
+ }
+
append(new Return(x));
}
void GraphBuilder::access_field(Bytecodes::Code code) {
*** 1479,1488 ****
--- 1492,1504 ----
} else {
obj = new Constant(new InstanceConstant(holder->java_mirror()));
}
}
+ if (field->is_final() && (code == Bytecodes::_putfield)) {
+ scope()->set_wrote_final();
+ }
const int offset = !needs_patching ? field->offset() : -1;
switch (code) {
case Bytecodes::_getstatic: {
// check for compile-time constants, i.e., initialized static final fields