src/share/vm/opto/graphKit.cpp

changeset 2665
9dc311b8473e
parent 2349
5ddfcf4b079e
child 2708
1d1603768966
child 2726
07acc51c1d2a
child 2781
e1162778c1c8
     1.1 --- a/src/share/vm/opto/graphKit.cpp	Mon Mar 21 02:30:49 2011 -0700
     1.2 +++ b/src/share/vm/opto/graphKit.cpp	Mon Mar 21 11:28:14 2011 -0700
     1.3 @@ -3338,6 +3338,49 @@
     1.4    return NULL;
     1.5  }
     1.6  
     1.7 +//----------------------------- loop predicates ---------------------------
     1.8 +
     1.9 +//------------------------------add_predicate_impl----------------------------
    1.10 +void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs) {
    1.11 +  // Too many traps seen?
    1.12 +  if (too_many_traps(reason)) {
    1.13 +#ifdef ASSERT
    1.14 +    if (TraceLoopPredicate) {
    1.15 +      int tc = C->trap_count(reason);
    1.16 +      tty->print("too many traps=%s tcount=%d in ",
    1.17 +                    Deoptimization::trap_reason_name(reason), tc);
    1.18 +      method()->print(); // which method has too many predicate traps
    1.19 +      tty->cr();
    1.20 +    }
    1.21 +#endif
    1.22 +    // We cannot afford to take more traps here,
    1.23 +    // do not generate predicate.
    1.24 +    return;
    1.25 +  }
    1.26 +
    1.27 +  Node *cont    = _gvn.intcon(1);
    1.28 +  Node* opq     = _gvn.transform(new (C, 2) Opaque1Node(C, cont));
    1.29 +  Node *bol     = _gvn.transform(new (C, 2) Conv2BNode(opq));
    1.30 +  IfNode* iff   = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN);
    1.31 +  Node* iffalse = _gvn.transform(new (C, 1) IfFalseNode(iff));
    1.32 +  C->add_predicate_opaq(opq);
    1.33 +  {
    1.34 +    PreserveJVMState pjvms(this);
    1.35 +    set_control(iffalse);
    1.36 +    _sp += nargs;
    1.37 +    uncommon_trap(reason, Deoptimization::Action_maybe_recompile);
    1.38 +  }
    1.39 +  Node* iftrue = _gvn.transform(new (C, 1) IfTrueNode(iff));
    1.40 +  set_control(iftrue);
    1.41 +}
    1.42 +
    1.43 +//------------------------------add_predicate---------------------------------
    1.44 +void GraphKit::add_predicate(int nargs) {
    1.45 +  if (UseLoopPredicate) {
    1.46 +    add_predicate_impl(Deoptimization::Reason_predicate, nargs);
    1.47 +  }
    1.48 +}
    1.49 +
    1.50  //----------------------------- store barriers ----------------------------
    1.51  #define __ ideal.
    1.52  

mercurial