diff options
author | kvn <none@none> | 2011-03-21 11:28:14 -0700 |
---|---|---|
committer | kvn <none@none> | 2011-03-21 11:28:14 -0700 |
commit | 73ca1b6ce8807c6f82056410d89ee2db3fcf6518 (patch) | |
tree | e41da43e88066096d0d72eb4a747a6e596911030 /src/share/vm/opto/graphKit.cpp | |
parent | 913215a6f1f34e97f77dd04e375162cbc26e6400 (diff) |
7008866: Missing loop predicate for loop with multiple entries
Summary: Add predicates when loop head bytecode is parsed instead of when back branch bytecode is parsed.
Reviewed-by: never
Diffstat (limited to 'src/share/vm/opto/graphKit.cpp')
-rw-r--r-- | src/share/vm/opto/graphKit.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp index 80101d2da..b20513e67 100644 --- a/src/share/vm/opto/graphKit.cpp +++ b/src/share/vm/opto/graphKit.cpp @@ -3338,6 +3338,49 @@ InitializeNode* AllocateNode::initialization() { return NULL; } +//----------------------------- loop predicates --------------------------- + +//------------------------------add_predicate_impl---------------------------- +void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs) { + // Too many traps seen? + if (too_many_traps(reason)) { +#ifdef ASSERT + if (TraceLoopPredicate) { + int tc = C->trap_count(reason); + tty->print("too many traps=%s tcount=%d in ", + Deoptimization::trap_reason_name(reason), tc); + method()->print(); // which method has too many predicate traps + tty->cr(); + } +#endif + // We cannot afford to take more traps here, + // do not generate predicate. + return; + } + + Node *cont = _gvn.intcon(1); + Node* opq = _gvn.transform(new (C, 2) Opaque1Node(C, cont)); + Node *bol = _gvn.transform(new (C, 2) Conv2BNode(opq)); + IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN); + Node* iffalse = _gvn.transform(new (C, 1) IfFalseNode(iff)); + C->add_predicate_opaq(opq); + { + PreserveJVMState pjvms(this); + set_control(iffalse); + _sp += nargs; + uncommon_trap(reason, Deoptimization::Action_maybe_recompile); + } + Node* iftrue = _gvn.transform(new (C, 1) IfTrueNode(iff)); + set_control(iftrue); +} + +//------------------------------add_predicate--------------------------------- +void GraphKit::add_predicate(int nargs) { + if (UseLoopPredicate) { + add_predicate_impl(Deoptimization::Reason_predicate, nargs); + } +} + //----------------------------- store barriers ---------------------------- #define __ ideal. |