提交 91012379 编写于 作者: R rasbold

6726504: handle do_ifxxx calls in parser more uniformly

Summary: make do_ifnull() handling similar to do_if()
Reviewed-by: jrose, kvn
上级 c3b336be
......@@ -479,7 +479,7 @@ class Parse : public GraphKit {
float branch_prediction(float &cnt, BoolTest::mask btest, int target_bci);
bool seems_never_taken(float prob);
void do_ifnull(BoolTest::mask btest);
void do_ifnull(BoolTest::mask btest, Node* c);
void do_if(BoolTest::mask btest, Node* c);
void repush_if_args();
void adjust_map_after_if(BoolTest::mask btest, Node* c, float prob,
......
......@@ -894,7 +894,7 @@ inline void Parse::repush_if_args() {
}
//----------------------------------do_ifnull----------------------------------
void Parse::do_ifnull(BoolTest::mask btest) {
void Parse::do_ifnull(BoolTest::mask btest, Node *c) {
int target_bci = iter().get_dest();
Block* branch_block = successor_for_bci(target_bci);
......@@ -906,8 +906,9 @@ void Parse::do_ifnull(BoolTest::mask btest) {
// (An earlier version of do_ifnull omitted this trap for OSR methods.)
#ifndef PRODUCT
if (PrintOpto && Verbose)
tty->print_cr("Never-taken backedge stops compilation at bci %d",bci());
tty->print_cr("Never-taken edge stops compilation at bci %d",bci());
#endif
repush_if_args(); // to gather stats on loop
// We need to mark this branch as taken so that if we recompile we will
// see that it is possible. In the tiered system the interpreter doesn't
// do profiling and by the time we get to the lower tier from the interpreter
......@@ -928,14 +929,6 @@ void Parse::do_ifnull(BoolTest::mask btest) {
maybe_add_safepoint(target_bci);
explicit_null_checks_inserted++;
Node* a = null();
Node* b = pop();
Node* c = _gvn.transform( new (C, 3) CmpPNode(b, a) );
// Make a cast-away-nullness that is control dependent on the test
const Type *t = _gvn.type(b);
const Type *t_not_null = t->join(TypePtr::NOTNULL);
Node *cast = new (C, 2) CastPPNode(b,t_not_null);
// Generate real control flow
Node *tst = _gvn.transform( new (C, 2) BoolNode( c, btest ) );
......@@ -997,7 +990,7 @@ void Parse::do_if(BoolTest::mask btest, Node* c) {
if (prob == PROB_UNKNOWN) {
#ifndef PRODUCT
if (PrintOpto && Verbose)
tty->print_cr("Never-taken backedge stops compilation at bci %d",bci());
tty->print_cr("Never-taken edge stops compilation at bci %d",bci());
#endif
repush_if_args(); // to gather stats on loop
// We need to mark this branch as taken so that if we recompile we will
......@@ -1016,6 +1009,9 @@ void Parse::do_if(BoolTest::mask btest, Node* c) {
return;
}
// If this is a backwards branch in the bytecodes, add Safepoint
maybe_add_safepoint(target_bci);
// Sanity check the probability value
assert(0.0f < prob && prob < 1.0f,"Bad probability in Parser");
......@@ -2101,18 +2097,18 @@ void Parse::do_one_bytecode() {
break;
}
case Bytecodes::_ifnull:
do_ifnull(BoolTest::eq);
break;
case Bytecodes::_ifnonnull:
do_ifnull(BoolTest::ne);
case Bytecodes::_ifnull: btest = BoolTest::eq; goto handle_if_null;
case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null;
handle_if_null:
a = null();
b = pop();
c = _gvn.transform( new (C, 3) CmpPNode(b, a) );
do_ifnull(btest, c);
break;
case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp;
case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp;
handle_if_acmp:
// If this is a backwards branch in the bytecodes, add Safepoint
maybe_add_safepoint(iter().get_dest());
a = pop();
b = pop();
c = _gvn.transform( new (C, 3) CmpPNode(b, a) );
......@@ -2126,8 +2122,6 @@ void Parse::do_one_bytecode() {
case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx;
case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx;
handle_ifxx:
// If this is a backwards branch in the bytecodes, add Safepoint
maybe_add_safepoint(iter().get_dest());
a = _gvn.intcon(0);
b = pop();
c = _gvn.transform( new (C, 3) CmpINode(b, a) );
......@@ -2141,8 +2135,6 @@ void Parse::do_one_bytecode() {
case Bytecodes::_if_icmpgt: btest = BoolTest::gt; goto handle_if_icmp;
case Bytecodes::_if_icmpge: btest = BoolTest::ge; goto handle_if_icmp;
handle_if_icmp:
// If this is a backwards branch in the bytecodes, add Safepoint
maybe_add_safepoint(iter().get_dest());
a = pop();
b = pop();
c = _gvn.transform( new (C, 3) CmpINode( b, a ) );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册