diff --git a/src/share/vm/c1/c1_GraphBuilder.cpp b/src/share/vm/c1/c1_GraphBuilder.cpp index e103fbf44e2750c7e3eb0d7a16649808d6ab1239..0c3f32bcdab4cdc078a18bbe2638dc3c9d8d54ea 100644 --- a/src/share/vm/c1/c1_GraphBuilder.cpp +++ b/src/share/vm/c1/c1_GraphBuilder.cpp @@ -1165,11 +1165,11 @@ void GraphBuilder::_goto(int from_bci, int to_bci) { Goto *x = new Goto(block_at(to_bci), to_bci <= from_bci); if (is_profiling()) { compilation()->set_would_profile(true); - } - if (profile_branches()) { - x->set_profiled_method(method()); x->set_profiled_bci(bci()); - x->set_should_profile(true); + if (profile_branches()) { + x->set_profiled_method(method()); + x->set_should_profile(true); + } } append(x); } @@ -1203,9 +1203,9 @@ void GraphBuilder::if_node(Value x, If::Condition cond, Value y, ValueStack* sta Goto *goto_node = i->as_Goto(); if (goto_node != NULL) { compilation()->set_would_profile(true); + goto_node->set_profiled_bci(bci()); if (profile_branches()) { goto_node->set_profiled_method(method()); - goto_node->set_profiled_bci(bci()); goto_node->set_should_profile(true); // Find out which successor is used. if (goto_node->default_sux() == tsux) { diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp index c2c2f7c7fa81593971249fea99e168c6970dd40a..f9099e940f7b3cf8aa922e8837413ea29b7e3a72 100644 --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -2493,7 +2493,7 @@ void LIRGenerator::do_Goto(Goto* x) { // increment backedge counter if needed CodeEmitInfo* info = state_for(x, state); - increment_backedge_counter(info, info->stack()->bci()); + increment_backedge_counter(info, x->profiled_bci()); CodeEmitInfo* safepoint_info = state_for(x, state); __ safepoint(safepoint_poll_register(), safepoint_info); }