< prev index next >

src/hotspot/share/opto/parse2.cpp

Print this page

   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm_io.h"
  27 #include "ci/ciMethodData.hpp"

  28 #include "classfile/vmSymbols.hpp"
  29 #include "compiler/compileLog.hpp"
  30 #include "interpreter/linkResolver.hpp"
  31 #include "memory/resourceArea.hpp"
  32 #include "memory/universe.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "opto/addnode.hpp"
  35 #include "opto/castnode.hpp"
  36 #include "opto/convertnode.hpp"
  37 #include "opto/divnode.hpp"
  38 #include "opto/idealGraphPrinter.hpp"


  39 #include "opto/matcher.hpp"
  40 #include "opto/memnode.hpp"
  41 #include "opto/mulnode.hpp"
  42 #include "opto/opaquenode.hpp"
  43 #include "opto/parse.hpp"
  44 #include "opto/runtime.hpp"
  45 #include "runtime/deoptimization.hpp"
  46 #include "runtime/sharedRuntime.hpp"
  47 
  48 #ifndef PRODUCT
  49 extern int explicit_null_checks_inserted,
  50            explicit_null_checks_elided;
  51 #endif
  52 

















  53 //---------------------------------array_load----------------------------------
  54 void Parse::array_load(BasicType bt) {
  55   const Type* elemtype = Type::TOP;
  56   bool big_val = bt == T_DOUBLE || bt == T_LONG;
  57   Node* adr = array_addressing(bt, 0, elemtype);
  58   if (stopped())  return;     // guaranteed null or range check
  59 
  60   pop();                      // index (already used)
  61   Node* array = pop();        // the array itself


























































































  62 
  63   if (elemtype == TypeInt::BOOL) {
  64     bt = T_BOOLEAN;
  65   }
  66   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
  67 
  68   Node* ld = access_load_at(array, adr, adr_type, elemtype, bt,
  69                             IN_HEAP | IS_ARRAY | C2_CONTROL_DEPENDENT_LOAD);
  70   if (big_val) {
  71     push_pair(ld);
  72   } else {
  73     push(ld);

  74   }

  75 }
  76 
  77 
  78 //--------------------------------array_store----------------------------------
  79 void Parse::array_store(BasicType bt) {
  80   const Type* elemtype = Type::TOP;
  81   bool big_val = bt == T_DOUBLE || bt == T_LONG;
  82   Node* adr = array_addressing(bt, big_val ? 2 : 1, elemtype);
  83   if (stopped())  return;     // guaranteed null or range check

  84   if (bt == T_OBJECT) {
  85     array_store_check();
  86     if (stopped()) {
  87       return;
  88     }
  89   }
  90   Node* val;                  // Oop to store
  91   if (big_val) {
  92     val = pop_pair();
  93   } else {
  94     val = pop();
  95   }
  96   pop();                      // index (already used)
  97   Node* array = pop();        // the array itself
  98 
  99   if (elemtype == TypeInt::BOOL) {
 100     bt = T_BOOLEAN;





























































































































 101   }
 102   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
 103 
 104   access_store_at(array, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY);
 105 }
 106 
 107 
 108 //------------------------------array_addressing-------------------------------
 109 // Pull array and index from the stack.  Compute pointer-to-element.
 110 Node* Parse::array_addressing(BasicType type, int vals, const Type*& elemtype) {
 111   Node *idx   = peek(0+vals);   // Get from stack without popping
 112   Node *ary   = peek(1+vals);   // in case of exception
 113 
 114   // Null check the array base, with correct stack contents
 115   ary = null_check(ary, T_ARRAY);
 116   // Compile-time detect of null-exception?
 117   if (stopped())  return top();
 118 
 119   const TypeAryPtr* arytype  = _gvn.type(ary)->is_aryptr();
 120   const TypeInt*    sizetype = arytype->size();
 121   elemtype = arytype->elem();
 122 
 123   if (UseUniqueSubclasses) {
 124     const Type* el = elemtype->make_ptr();

 184       if (C->allow_range_check_smearing()) {
 185         // Do not use builtin_throw, since range checks are sometimes
 186         // made more stringent by an optimistic transformation.
 187         // This creates "tentative" range checks at this point,
 188         // which are not guaranteed to throw exceptions.
 189         // See IfNode::Ideal, is_range_check, adjust_check.
 190         uncommon_trap(Deoptimization::Reason_range_check,
 191                       Deoptimization::Action_make_not_entrant,
 192                       NULL, "range_check");
 193       } else {
 194         // If we have already recompiled with the range-check-widening
 195         // heroic optimization turned off, then we must really be throwing
 196         // range check exceptions.
 197         builtin_throw(Deoptimization::Reason_range_check, idx);
 198       }
 199     }
 200   }
 201   // Check for always knowing you are throwing a range-check exception
 202   if (stopped())  return top();
 203 




















































































































 204   // Make array address computation control dependent to prevent it
 205   // from floating above the range check during loop optimizations.
 206   Node* ptr = array_element_address(ary, idx, type, sizetype, control());
 207   assert(ptr != top(), "top should go hand-in-hand with stopped");
 208 
 209   return ptr;
 210 }
 211 
 212 
 213 // returns IfNode
 214 IfNode* Parse::jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt) {
 215   Node   *cmp = _gvn.transform(new CmpINode(a, b)); // two cases: shiftcount > 32 and shiftcount <= 32
 216   Node   *tst = _gvn.transform(new BoolNode(cmp, mask));
 217   IfNode *iff = create_and_map_if(control(), tst, prob, cnt);
 218   return iff;
 219 }
 220 
 221 
 222 // sentinel value for the target bci to mark never taken branches
 223 // (according to profiling)

1403   // Generate real control flow
1404   Node   *tst = _gvn.transform( new BoolNode( c, btest ) );
1405 
1406   // Sanity check the probability value
1407   assert(prob > 0.0f,"Bad probability in Parser");
1408  // Need xform to put node in hash table
1409   IfNode *iff = create_and_xform_if( control(), tst, prob, cnt );
1410   assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser");
1411   // True branch
1412   { PreserveJVMState pjvms(this);
1413     Node* iftrue  = _gvn.transform( new IfTrueNode (iff) );
1414     set_control(iftrue);
1415 
1416     if (stopped()) {            // Path is dead?
1417       NOT_PRODUCT(explicit_null_checks_elided++);
1418       if (C->eliminate_boxing()) {
1419         // Mark the successor block as parsed
1420         branch_block->next_path_num();
1421       }
1422     } else {                    // Path is live.
1423       adjust_map_after_if(btest, c, prob, branch_block, next_block);
1424       if (!stopped()) {
1425         merge(target_bci);
1426       }
1427     }
1428   }
1429 
1430   // False branch
1431   Node* iffalse = _gvn.transform( new IfFalseNode(iff) );
1432   set_control(iffalse);
1433 
1434   if (stopped()) {              // Path is dead?
1435     NOT_PRODUCT(explicit_null_checks_elided++);
1436     if (C->eliminate_boxing()) {
1437       // Mark the successor block as parsed
1438       next_block->next_path_num();
1439     }
1440   } else  {                     // Path is live.
1441     adjust_map_after_if(BoolTest(btest).negate(), c, 1.0-prob,
1442                         next_block, branch_block);
1443   }
1444 }
1445 
1446 //------------------------------------do_if------------------------------------
1447 void Parse::do_if(BoolTest::mask btest, Node* c) {
1448   int target_bci = iter().get_dest();
1449 
1450   Block* branch_block = successor_for_bci(target_bci);
1451   Block* next_block   = successor_for_bci(iter().next_bci());
1452 
1453   float cnt;
1454   float prob = branch_prediction(cnt, btest, target_bci, c);
1455   float untaken_prob = 1.0 - prob;
1456 
1457   if (prob == PROB_UNKNOWN) {
1458     if (PrintOpto && Verbose) {
1459       tty->print_cr("Never-taken edge stops compilation at bci %d", bci());
1460     }
1461     repush_if_args(); // to gather stats on loop
1462     uncommon_trap(Deoptimization::Reason_unreached,
1463                   Deoptimization::Action_reinterpret,
1464                   NULL, "cold");
1465     if (C->eliminate_boxing()) {
1466       // Mark the successor blocks as parsed
1467       branch_block->next_path_num();

1511   }
1512 
1513   // Generate real control flow
1514   float true_prob = (taken_if_true ? prob : untaken_prob);
1515   IfNode* iff = create_and_map_if(control(), tst, true_prob, cnt);
1516   assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser");
1517   Node* taken_branch   = new IfTrueNode(iff);
1518   Node* untaken_branch = new IfFalseNode(iff);
1519   if (!taken_if_true) {  // Finish conversion to canonical form
1520     Node* tmp      = taken_branch;
1521     taken_branch   = untaken_branch;
1522     untaken_branch = tmp;
1523   }
1524 
1525   // Branch is taken:
1526   { PreserveJVMState pjvms(this);
1527     taken_branch = _gvn.transform(taken_branch);
1528     set_control(taken_branch);
1529 
1530     if (stopped()) {
1531       if (C->eliminate_boxing()) {
1532         // Mark the successor block as parsed
1533         branch_block->next_path_num();
1534       }
1535     } else {
1536       adjust_map_after_if(taken_btest, c, prob, branch_block, next_block);
1537       if (!stopped()) {
1538         merge(target_bci);








1539       }
1540     }
1541   }
1542 
1543   untaken_branch = _gvn.transform(untaken_branch);
1544   set_control(untaken_branch);
1545 
1546   // Branch not taken.
1547   if (stopped()) {
1548     if (C->eliminate_boxing()) {
1549       // Mark the successor block as parsed
1550       next_block->next_path_num();
1551     }
1552   } else {
1553     adjust_map_after_if(untaken_btest, c, untaken_prob,
1554                         next_block, branch_block);

































































































































































































































































































































































































1555   }
1556 }
1557 
1558 bool Parse::path_is_suitable_for_uncommon_trap(float prob) const {
1559   // Don't want to speculate on uncommon traps when running with -Xcomp
1560   if (!UseInterpreter) {
1561     return false;
1562   }
1563   return (seems_never_taken(prob) && seems_stable_comparison());
1564 }
1565 
1566 void Parse::maybe_add_predicate_after_if(Block* path) {
1567   if (path->is_SEL_head() && path->preds_parsed() == 0) {
1568     // Add predicates at bci of if dominating the loop so traps can be
1569     // recorded on the if's profile data
1570     int bc_depth = repush_if_args();
1571     add_empty_predicates();
1572     dec_sp(bc_depth);
1573     path->set_has_predicates();
1574   }
1575 }
1576 
1577 
1578 //----------------------------adjust_map_after_if------------------------------
1579 // Adjust the JVM state to reflect the result of taking this path.
1580 // Basically, it means inspecting the CmpNode controlling this
1581 // branch, seeing how it constrains a tested value, and then
1582 // deciding if it's worth our while to encode this constraint
1583 // as graph nodes in the current abstract interpretation map.
1584 void Parse::adjust_map_after_if(BoolTest::mask btest, Node* c, float prob,
1585                                 Block* path, Block* other_path) {
1586   if (!c->is_Cmp()) {
1587     maybe_add_predicate_after_if(path);
1588     return;
1589   }
1590 
1591   if (stopped() || btest == BoolTest::illegal) {
1592     return;                             // nothing to do
1593   }
1594 
1595   bool is_fallthrough = (path == successor_for_bci(iter().next_bci()));
1596 
1597   if (path_is_suitable_for_uncommon_trap(prob)) {
1598     repush_if_args();
1599     uncommon_trap(Deoptimization::Reason_unstable_if,
1600                   Deoptimization::Action_reinterpret,
1601                   NULL,
1602                   (is_fallthrough ? "taken always" : "taken never"));
1603     return;
1604   }
1605 

1775   if (c->Opcode() == Op_CmpP &&
1776       (c->in(1)->Opcode() == Op_LoadKlass || c->in(1)->Opcode() == Op_DecodeNKlass) &&
1777       c->in(2)->is_Con()) {
1778     Node* load_klass = NULL;
1779     Node* decode = NULL;
1780     if (c->in(1)->Opcode() == Op_DecodeNKlass) {
1781       decode = c->in(1);
1782       load_klass = c->in(1)->in(1);
1783     } else {
1784       load_klass = c->in(1);
1785     }
1786     if (load_klass->in(2)->is_AddP()) {
1787       Node* addp = load_klass->in(2);
1788       Node* obj = addp->in(AddPNode::Address);
1789       const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
1790       if (obj_type->speculative_type_not_null() != NULL) {
1791         ciKlass* k = obj_type->speculative_type();
1792         inc_sp(2);
1793         obj = maybe_cast_profiled_obj(obj, k);
1794         dec_sp(2);




1795         // Make the CmpP use the casted obj
1796         addp = basic_plus_adr(obj, addp->in(AddPNode::Offset));
1797         load_klass = load_klass->clone();
1798         load_klass->set_req(2, addp);
1799         load_klass = _gvn.transform(load_klass);
1800         if (decode != NULL) {
1801           decode = decode->clone();
1802           decode->set_req(1, load_klass);
1803           load_klass = _gvn.transform(decode);
1804         }
1805         c = c->clone();
1806         c->set_req(1, load_klass);
1807         c = _gvn.transform(c);
1808       }
1809     }
1810   }
1811   return c;
1812 }
1813 
1814 //------------------------------do_one_bytecode--------------------------------

2622     // See if we can get some profile data and hand it off to the next block
2623     Block *target_block = block()->successor_for_bci(target_bci);
2624     if (target_block->pred_count() != 1)  break;
2625     ciMethodData* methodData = method()->method_data();
2626     if (!methodData->is_mature())  break;
2627     ciProfileData* data = methodData->bci_to_data(bci());
2628     assert(data != NULL && data->is_JumpData(), "need JumpData for taken branch");
2629     int taken = ((ciJumpData*)data)->taken();
2630     taken = method()->scale_count(taken);
2631     target_block->set_count(taken);
2632     break;
2633   }
2634 
2635   case Bytecodes::_ifnull:    btest = BoolTest::eq; goto handle_if_null;
2636   case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null;
2637   handle_if_null:
2638     // If this is a backwards branch in the bytecodes, add Safepoint
2639     maybe_add_safepoint(iter().get_dest());
2640     a = null();
2641     b = pop();
2642     if (!_gvn.type(b)->speculative_maybe_null() &&
2643         !too_many_traps(Deoptimization::Reason_speculate_null_check)) {
2644       inc_sp(1);
2645       Node* null_ctl = top();
2646       b = null_check_oop(b, &null_ctl, true, true, true);
2647       assert(null_ctl->is_top(), "no null control here");
2648       dec_sp(1);
2649     } else if (_gvn.type(b)->speculative_always_null() &&
2650                !too_many_traps(Deoptimization::Reason_speculate_null_assert)) {
2651       inc_sp(1);
2652       b = null_assert(b);
2653       dec_sp(1);
2654     }
2655     c = _gvn.transform( new CmpPNode(b, a) );





2656     do_ifnull(btest, c);
2657     break;
2658 
2659   case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp;
2660   case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp;
2661   handle_if_acmp:
2662     // If this is a backwards branch in the bytecodes, add Safepoint
2663     maybe_add_safepoint(iter().get_dest());
2664     a = pop();
2665     b = pop();
2666     c = _gvn.transform( new CmpPNode(b, a) );
2667     c = optimize_cmp_with_klass(c);
2668     do_if(btest, c);
2669     break;
2670 
2671   case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx;
2672   case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx;
2673   case Bytecodes::_iflt: btest = BoolTest::lt; goto handle_ifxx;
2674   case Bytecodes::_ifle: btest = BoolTest::le; goto handle_ifxx;
2675   case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx;
2676   case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx;
2677   handle_ifxx:
2678     // If this is a backwards branch in the bytecodes, add Safepoint
2679     maybe_add_safepoint(iter().get_dest());
2680     a = _gvn.intcon(0);
2681     b = pop();
2682     c = _gvn.transform( new CmpINode(b, a) );
2683     do_if(btest, c);
2684     break;
2685 
2686   case Bytecodes::_if_icmpeq: btest = BoolTest::eq; goto handle_if_icmp;
2687   case Bytecodes::_if_icmpne: btest = BoolTest::ne; goto handle_if_icmp;
2688   case Bytecodes::_if_icmplt: btest = BoolTest::lt; goto handle_if_icmp;

2703     break;
2704 
2705   case Bytecodes::_lookupswitch:
2706     do_lookupswitch();
2707     break;
2708 
2709   case Bytecodes::_invokestatic:
2710   case Bytecodes::_invokedynamic:
2711   case Bytecodes::_invokespecial:
2712   case Bytecodes::_invokevirtual:
2713   case Bytecodes::_invokeinterface:
2714     do_call();
2715     break;
2716   case Bytecodes::_checkcast:
2717     do_checkcast();
2718     break;
2719   case Bytecodes::_instanceof:
2720     do_instanceof();
2721     break;
2722   case Bytecodes::_anewarray:
2723     do_anewarray();
2724     break;
2725   case Bytecodes::_newarray:
2726     do_newarray((BasicType)iter().get_index());
2727     break;
2728   case Bytecodes::_multianewarray:
2729     do_multianewarray();
2730     break;
2731   case Bytecodes::_new:
2732     do_new();
2733     break;






2734 
2735   case Bytecodes::_jsr:
2736   case Bytecodes::_jsr_w:
2737     do_jsr();
2738     break;
2739 
2740   case Bytecodes::_ret:
2741     do_ret();
2742     break;
2743 
2744 
2745   case Bytecodes::_monitorenter:
2746     do_monitor_enter();
2747     break;
2748 
2749   case Bytecodes::_monitorexit:
2750     do_monitor_exit();
2751     break;
2752 
2753   case Bytecodes::_breakpoint:

   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "jvm_io.h"
  27 #include "ci/ciMethodData.hpp"
  28 #include "ci/ciSymbols.hpp"
  29 #include "classfile/vmSymbols.hpp"
  30 #include "compiler/compileLog.hpp"
  31 #include "interpreter/linkResolver.hpp"
  32 #include "memory/resourceArea.hpp"
  33 #include "memory/universe.hpp"
  34 #include "oops/oop.inline.hpp"
  35 #include "opto/addnode.hpp"
  36 #include "opto/castnode.hpp"
  37 #include "opto/convertnode.hpp"
  38 #include "opto/divnode.hpp"
  39 #include "opto/idealGraphPrinter.hpp"
  40 #include "opto/idealKit.hpp"
  41 #include "opto/inlinetypenode.hpp"
  42 #include "opto/matcher.hpp"
  43 #include "opto/memnode.hpp"
  44 #include "opto/mulnode.hpp"
  45 #include "opto/opaquenode.hpp"
  46 #include "opto/parse.hpp"
  47 #include "opto/runtime.hpp"
  48 #include "runtime/deoptimization.hpp"
  49 #include "runtime/sharedRuntime.hpp"
  50 
  51 #ifndef PRODUCT
  52 extern int explicit_null_checks_inserted,
  53            explicit_null_checks_elided;
  54 #endif
  55 
  56 Node* Parse::record_profile_for_speculation_at_array_load(Node* ld) {
  57   // Feed unused profile data to type speculation
  58   if (UseTypeSpeculation && UseArrayLoadStoreProfile) {
  59     ciKlass* array_type = NULL;
  60     ciKlass* element_type = NULL;
  61     ProfilePtrKind element_ptr = ProfileMaybeNull;
  62     bool flat_array = true;
  63     bool null_free_array = true;
  64     method()->array_access_profiled_type(bci(), array_type, element_type, element_ptr, flat_array, null_free_array);
  65     if (element_type != NULL || element_ptr != ProfileMaybeNull) {
  66       ld = record_profile_for_speculation(ld, element_type, element_ptr);
  67     }
  68   }
  69   return ld;
  70 }
  71 
  72 
  73 //---------------------------------array_load----------------------------------
  74 void Parse::array_load(BasicType bt) {
  75   const Type* elemtype = Type::TOP;

  76   Node* adr = array_addressing(bt, 0, elemtype);
  77   if (stopped())  return;     // guaranteed null or range check
  78 
  79   Node* idx = pop();
  80   Node* ary = pop();
  81 
  82   // Handle inline type arrays
  83   const TypeOopPtr* elemptr = elemtype->make_oopptr();
  84   const TypeAryPtr* ary_t = _gvn.type(ary)->is_aryptr();
  85   if (ary_t->is_flat()) {
  86     // Load from flattened inline type array
  87     Node* vt = InlineTypeNode::make_from_flattened(this, elemtype->inline_klass(), ary, adr);
  88     push(vt);
  89     return;
  90   } else if (ary_t->is_null_free()) {
  91     // Load from non-flattened inline type array (elements can never be null)
  92     bt = T_INLINE_TYPE;
  93   } else if (!ary_t->is_not_flat()) {
  94     // Cannot statically determine if array is flattened, emit runtime check
  95     assert(UseFlatArray && is_reference_type(bt) && elemptr->can_be_inline_type() && !ary_t->klass_is_exact() && !ary_t->is_not_null_free() &&
  96            (!elemptr->is_inlinetypeptr() || elemptr->inline_klass()->flatten_array()), "array can't be flattened");
  97     IdealKit ideal(this);
  98     IdealVariable res(ideal);
  99     ideal.declarations_done();
 100     ideal.if_then(flat_array_test(ary, /* flat = */ false)); {
 101       // non-flattened
 102       assert(ideal.ctrl()->in(0)->as_If()->is_flat_array_check(&_gvn), "Should be found");
 103       sync_kit(ideal);
 104       const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
 105       Node* ld = access_load_at(ary, adr, adr_type, elemptr, bt,
 106                                 IN_HEAP | IS_ARRAY | C2_CONTROL_DEPENDENT_LOAD);
 107       if (elemptr->is_inlinetypeptr()) {
 108         assert(elemptr->maybe_null(), "null free array should be handled above");
 109         ld = InlineTypeNode::make_from_oop(this, ld, elemptr->inline_klass(), false);
 110       }
 111       ideal.sync_kit(this);
 112       ideal.set(res, ld);
 113     } ideal.else_(); {
 114       // flattened
 115       sync_kit(ideal);
 116       if (elemptr->is_inlinetypeptr()) {
 117         // Element type is known, cast and load from flattened representation
 118         ciInlineKlass* vk = elemptr->inline_klass();
 119         assert(vk->flatten_array() && elemptr->maybe_null(), "never/always flat - should be optimized");
 120         ciArrayKlass* array_klass = ciArrayKlass::make(vk, /* null_free */ true);
 121         const TypeAryPtr* arytype = TypeOopPtr::make_from_klass(array_klass)->isa_aryptr();
 122         Node* cast = _gvn.transform(new CheckCastPPNode(control(), ary, arytype));
 123         Node* casted_adr = array_element_address(cast, idx, T_INLINE_TYPE, ary_t->size(), control());
 124         // Re-execute flattened array load if buffering triggers deoptimization
 125         PreserveReexecuteState preexecs(this);
 126         jvms()->set_should_reexecute(true);
 127         inc_sp(2);
 128         Node* vt = InlineTypeNode::make_from_flattened(this, vk, cast, casted_adr)->buffer(this, false);
 129         ideal.set(res, vt);
 130         ideal.sync_kit(this);
 131       } else {
 132         // Element type is unknown, emit runtime call
 133 
 134         // Below membars keep this access to an unknown flattened array correctly
 135         // ordered with other unknown and known flattened array accesses.
 136         insert_mem_bar_volatile(Op_MemBarCPUOrder, C->get_alias_index(TypeAryPtr::INLINES));
 137 
 138         Node* call = NULL;
 139         {
 140           // Re-execute flattened array load if runtime call triggers deoptimization
 141           PreserveReexecuteState preexecs(this);
 142           jvms()->set_bci(_bci);
 143           jvms()->set_should_reexecute(true);
 144           inc_sp(2);
 145           kill_dead_locals();
 146           call = make_runtime_call(RC_NO_LEAF | RC_NO_IO,
 147                                    OptoRuntime::load_unknown_inline_type(),
 148                                    OptoRuntime::load_unknown_inline_Java(),
 149                                    NULL, TypeRawPtr::BOTTOM,
 150                                    ary, idx);
 151         }
 152         make_slow_call_ex(call, env()->Throwable_klass(), false);
 153         Node* buffer = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
 154 
 155         insert_mem_bar_volatile(Op_MemBarCPUOrder, C->get_alias_index(TypeAryPtr::INLINES));
 156 
 157         // Keep track of the information that the inline type is flattened in arrays
 158         const Type* unknown_value = elemptr->is_instptr()->cast_to_flatten_array();
 159         buffer = _gvn.transform(new CheckCastPPNode(control(), buffer, unknown_value));
 160 
 161         ideal.sync_kit(this);
 162         ideal.set(res, buffer);
 163       }
 164     } ideal.end_if();
 165     sync_kit(ideal);
 166     Node* ld = _gvn.transform(ideal.value(res));
 167     ld = record_profile_for_speculation_at_array_load(ld);
 168     push_node(bt, ld);
 169     return;
 170   }
 171 
 172   if (elemtype == TypeInt::BOOL) {
 173     bt = T_BOOLEAN;
 174   }
 175   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
 176   Node* ld = access_load_at(ary, adr, adr_type, elemtype, bt,

 177                             IN_HEAP | IS_ARRAY | C2_CONTROL_DEPENDENT_LOAD);
 178   ld = record_profile_for_speculation_at_array_load(ld);
 179   // Loading a non-flattened inline type
 180   if (elemptr != NULL && elemptr->is_inlinetypeptr()) {
 181     assert(!ary_t->is_null_free() || !elemptr->maybe_null(), "inline type array elements should never be null");
 182     ld = InlineTypeNode::make_from_oop(this, ld, elemptr->inline_klass(), !elemptr->maybe_null());
 183   }
 184   push_node(bt, ld);
 185 }
 186 
 187 
 188 //--------------------------------array_store----------------------------------
 189 void Parse::array_store(BasicType bt) {
 190   const Type* elemtype = Type::TOP;
 191   Node* adr = array_addressing(bt, type2size[bt], elemtype);

 192   if (stopped())  return;     // guaranteed null or range check
 193   Node* cast_val = NULL;
 194   if (bt == T_OBJECT) {
 195     cast_val = array_store_check(adr, elemtype);
 196     if (stopped()) return;


 197   }
 198   Node* val = pop_node(bt); // Value to store
 199   Node* idx = pop();        // Index in the array
 200   Node* ary = pop();        // The array itself
 201 
 202   const TypeAryPtr* ary_t = _gvn.type(ary)->is_aryptr();
 203   const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
 204   assert(adr->as_AddP()->in(AddPNode::Base) == ary, "inconsistent address base");

 205 
 206   if (elemtype == TypeInt::BOOL) {
 207     bt = T_BOOLEAN;
 208   } else if (bt == T_OBJECT) {
 209     elemtype = elemtype->make_oopptr();
 210     const Type* tval = _gvn.type(cast_val);
 211     // We may have lost type information for 'val' here due to the casts
 212     // emitted by the array_store_check code (see JDK-6312651)
 213     // TODO Remove this code once JDK-6312651 is in.
 214     const Type* tval_init = _gvn.type(val);
 215     // Based on the value to be stored, try to determine if the array is not null-free and/or not flat.
 216     // This is only legal for non-null stores because the array_store_check always passes for null, even
 217     // if the array is null-free. Null stores are handled in GraphKit::gen_inline_array_null_guard().
 218     bool not_inline = !tval->isa_inlinetype() &&
 219                       ((!tval_init->maybe_null() && !tval_init->is_oopptr()->can_be_inline_type()) ||
 220                        (!tval->maybe_null() && !tval->is_oopptr()->can_be_inline_type()));
 221     bool not_flattened = not_inline || ((tval_init->is_inlinetypeptr() || tval_init->isa_inlinetype()) && !tval_init->inline_klass()->flatten_array());
 222     if (!ary_t->is_not_null_free() && not_inline) {
 223       // Storing a non-inline type, mark array as not null-free (-> not flat).
 224       ary_t = ary_t->cast_to_not_null_free();
 225       Node* cast = _gvn.transform(new CheckCastPPNode(control(), ary, ary_t));
 226       replace_in_map(ary, cast);
 227       ary = cast;
 228     } else if (!ary_t->is_not_flat() && not_flattened) {
 229       // Storing a non-flattened value, mark array as not flat.
 230       ary_t = ary_t->cast_to_not_flat();
 231       Node* cast = _gvn.transform(new CheckCastPPNode(control(), ary, ary_t));
 232       replace_in_map(ary, cast);
 233       ary = cast;
 234     }
 235 
 236     if (ary_t->is_flat()) {
 237       // Store to flattened inline type array
 238       assert(!tval->maybe_null(), "should be guaranteed by array store check");
 239       // Re-execute flattened array store if buffering triggers deoptimization
 240       PreserveReexecuteState preexecs(this);
 241       inc_sp(3);
 242       jvms()->set_should_reexecute(true);
 243       cast_val->as_InlineTypeBase()->store_flattened(this, ary, adr, NULL, 0, MO_UNORDERED | IN_HEAP | IS_ARRAY);
 244       return;
 245     } else if (ary_t->is_null_free()) {
 246       // Store to non-flattened inline type array (elements can never be null)
 247       assert(!tval->maybe_null(), "should be guaranteed by array store check");
 248       if (elemtype->inline_klass()->is_empty()) {
 249         // Ignore empty inline stores, array is already initialized.
 250         return;
 251       }
 252     } else if (!ary_t->is_not_flat() && (tval != TypePtr::NULL_PTR || StressReflectiveCode)) {
 253       // Array might be flattened, emit runtime checks (for NULL, a simple inline_array_null_guard is sufficient).
 254       assert(UseFlatArray && !not_flattened && elemtype->is_oopptr()->can_be_inline_type() &&
 255              !ary_t->klass_is_exact() && !ary_t->is_not_null_free(), "array can't be flattened");
 256       IdealKit ideal(this);
 257       ideal.if_then(flat_array_test(ary, /* flat = */ false)); {
 258         // non-flattened
 259         assert(ideal.ctrl()->in(0)->as_If()->is_flat_array_check(&_gvn), "Should be found");
 260         sync_kit(ideal);
 261         Node* cast_ary = inline_array_null_guard(ary, cast_val, 3);
 262         inc_sp(3);
 263         access_store_at(cast_ary, adr, adr_type, cast_val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY, false);
 264         dec_sp(3);
 265         ideal.sync_kit(this);
 266       } ideal.else_(); {
 267         sync_kit(ideal);
 268         Node* val = cast_val;
 269         // flattened
 270         if (!val->is_InlineType() && tval->maybe_null()) {
 271           // Add null check
 272           Node* null_ctl = top();
 273           val = null_check_oop(val, &null_ctl);
 274           if (null_ctl != top()) {
 275             PreserveJVMState pjvms(this);
 276             inc_sp(3);
 277             set_control(null_ctl);
 278             uncommon_trap(Deoptimization::Reason_null_check, Deoptimization::Action_none);
 279             dec_sp(3);
 280           }
 281         }
 282         // Try to determine the inline klass
 283         ciInlineKlass* vk = NULL;
 284         if (tval->isa_inlinetype() || tval->is_inlinetypeptr()) {
 285           vk = tval->inline_klass();
 286         } else if (tval_init->isa_inlinetype() || tval_init->is_inlinetypeptr()) {
 287           vk = tval_init->inline_klass();
 288         } else if (elemtype->is_inlinetypeptr()) {
 289           vk = elemtype->inline_klass();
 290         }
 291         Node* casted_ary = ary;
 292         if (vk != NULL && !stopped()) {
 293           // Element type is known, cast and store to flattened representation
 294           assert(vk->flatten_array() && elemtype->maybe_null(), "never/always flat - should be optimized");
 295           ciArrayKlass* array_klass = ciArrayKlass::make(vk, /* null_free */ true);
 296           const TypeAryPtr* arytype = TypeOopPtr::make_from_klass(array_klass)->isa_aryptr();
 297           casted_ary = _gvn.transform(new CheckCastPPNode(control(), casted_ary, arytype));
 298           Node* casted_adr = array_element_address(casted_ary, idx, T_OBJECT, arytype->size(), control());
 299           if (!val->is_InlineType()) {
 300             assert(!gvn().type(val)->maybe_null(), "inline type array elements should never be null");
 301             val = InlineTypeNode::make_from_oop(this, val, vk);
 302           }
 303           // Re-execute flattened array store if buffering triggers deoptimization
 304           PreserveReexecuteState preexecs(this);
 305           inc_sp(3);
 306           jvms()->set_should_reexecute(true);
 307           val->as_InlineTypeBase()->store_flattened(this, casted_ary, casted_adr, NULL, 0, MO_UNORDERED | IN_HEAP | IS_ARRAY);
 308         } else if (!stopped()) {
 309           // Element type is unknown, emit runtime call
 310 
 311           // Below membars keep this access to an unknown flattened array correctly
 312           // ordered with other unknown and known flattened array accesses.
 313           insert_mem_bar_volatile(Op_MemBarCPUOrder, C->get_alias_index(TypeAryPtr::INLINES));
 314 
 315           make_runtime_call(RC_LEAF,
 316                             OptoRuntime::store_unknown_inline_type(),
 317                             CAST_FROM_FN_PTR(address, OptoRuntime::store_unknown_inline),
 318                             "store_unknown_inline", TypeRawPtr::BOTTOM,
 319                             val, casted_ary, idx);
 320 
 321           insert_mem_bar_volatile(Op_MemBarCPUOrder, C->get_alias_index(TypeAryPtr::INLINES));
 322         }
 323         ideal.sync_kit(this);
 324       }
 325       ideal.end_if();
 326       sync_kit(ideal);
 327       return;
 328     } else if (!ary_t->is_not_null_free()) {
 329       // Array is not flattened but may be null free
 330       assert(elemtype->is_oopptr()->can_be_inline_type() && !ary_t->klass_is_exact(), "array can't be null-free");
 331       ary = inline_array_null_guard(ary, cast_val, 3, true);
 332     }
 333   }
 334   inc_sp(3);
 335   access_store_at(ary, adr, adr_type, val, elemtype, bt, MO_UNORDERED | IN_HEAP | IS_ARRAY);
 336   dec_sp(3);
 337 }
 338 
 339 
 340 //------------------------------array_addressing-------------------------------
 341 // Pull array and index from the stack.  Compute pointer-to-element.
 342 Node* Parse::array_addressing(BasicType type, int vals, const Type*& elemtype) {
 343   Node *idx   = peek(0+vals);   // Get from stack without popping
 344   Node *ary   = peek(1+vals);   // in case of exception
 345 
 346   // Null check the array base, with correct stack contents
 347   ary = null_check(ary, T_ARRAY);
 348   // Compile-time detect of null-exception?
 349   if (stopped())  return top();
 350 
 351   const TypeAryPtr* arytype  = _gvn.type(ary)->is_aryptr();
 352   const TypeInt*    sizetype = arytype->size();
 353   elemtype = arytype->elem();
 354 
 355   if (UseUniqueSubclasses) {
 356     const Type* el = elemtype->make_ptr();

 416       if (C->allow_range_check_smearing()) {
 417         // Do not use builtin_throw, since range checks are sometimes
 418         // made more stringent by an optimistic transformation.
 419         // This creates "tentative" range checks at this point,
 420         // which are not guaranteed to throw exceptions.
 421         // See IfNode::Ideal, is_range_check, adjust_check.
 422         uncommon_trap(Deoptimization::Reason_range_check,
 423                       Deoptimization::Action_make_not_entrant,
 424                       NULL, "range_check");
 425       } else {
 426         // If we have already recompiled with the range-check-widening
 427         // heroic optimization turned off, then we must really be throwing
 428         // range check exceptions.
 429         builtin_throw(Deoptimization::Reason_range_check, idx);
 430       }
 431     }
 432   }
 433   // Check for always knowing you are throwing a range-check exception
 434   if (stopped())  return top();
 435 
 436   // This could be an access to an inline type array. We can't tell if it's
 437   // flat or not. Knowing the exact type avoids runtime checks and leads to
 438   // a much simpler graph shape. Check profile information.
 439   if (!arytype->is_flat() && !arytype->is_not_flat()) {
 440     // First check the speculative type
 441     Deoptimization::DeoptReason reason = Deoptimization::Reason_speculate_class_check;
 442     ciKlass* array_type = arytype->speculative_type();
 443     if (too_many_traps_or_recompiles(reason) || array_type == NULL) {
 444       // No speculative type, check profile data at this bci
 445       array_type = NULL;
 446       reason = Deoptimization::Reason_class_check;
 447       if (UseArrayLoadStoreProfile && !too_many_traps_or_recompiles(reason)) {
 448         ciKlass* element_type = NULL;
 449         ProfilePtrKind element_ptr = ProfileMaybeNull;
 450         bool flat_array = true;
 451         bool null_free_array = true;
 452         method()->array_access_profiled_type(bci(), array_type, element_type, element_ptr, flat_array, null_free_array);
 453       }
 454     }
 455     if (array_type != NULL) {
 456       // Speculate that this array has the exact type reported by profile data
 457       Node* better_ary = NULL;
 458       DEBUG_ONLY(Node* old_control = control();)
 459       Node* slow_ctl = type_check_receiver(ary, array_type, 1.0, &better_ary);
 460       if (stopped()) {
 461         // The check always fails and therefore profile information is incorrect. Don't use it.
 462         assert(old_control == slow_ctl, "type check should have been removed");
 463         set_control(slow_ctl);
 464       } else if (!slow_ctl->is_top()) {
 465         { PreserveJVMState pjvms(this);
 466           set_control(slow_ctl);
 467           uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
 468         }
 469         replace_in_map(ary, better_ary);
 470         ary = better_ary;
 471         arytype  = _gvn.type(ary)->is_aryptr();
 472         elemtype = arytype->elem();
 473       }
 474     }
 475   } else if (UseTypeSpeculation && UseArrayLoadStoreProfile) {
 476     // No need to speculate: feed profile data at this bci for the
 477     // array to type speculation
 478     ciKlass* array_type = NULL;
 479     ciKlass* element_type = NULL;
 480     ProfilePtrKind element_ptr = ProfileMaybeNull;
 481     bool flat_array = true;
 482     bool null_free_array = true;
 483     method()->array_access_profiled_type(bci(), array_type, element_type, element_ptr, flat_array, null_free_array);
 484     if (array_type != NULL) {
 485       ary = record_profile_for_speculation(ary, array_type, ProfileMaybeNull);
 486     }
 487   }
 488 
 489   // We have no exact array type from profile data. Check profile data
 490   // for a non null-free or non flat array. Non null-free implies non
 491   // flat so check this one first. Speculating on a non null-free
 492   // array doesn't help aaload but could be profitable for a
 493   // subsequent aastore.
 494   if (!arytype->is_null_free() && !arytype->is_not_null_free()) {
 495     bool null_free_array = true;
 496     Deoptimization::DeoptReason reason = Deoptimization::Reason_none;
 497     if (arytype->speculative() != NULL &&
 498         arytype->speculative()->is_aryptr()->is_not_null_free() &&
 499         !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_class_check)) {
 500       null_free_array = false;
 501       reason = Deoptimization::Reason_speculate_class_check;
 502     } else if (UseArrayLoadStoreProfile && !too_many_traps_or_recompiles(Deoptimization::Reason_class_check)) {
 503       ciKlass* array_type = NULL;
 504       ciKlass* element_type = NULL;
 505       ProfilePtrKind element_ptr = ProfileMaybeNull;
 506       bool flat_array = true;
 507       method()->array_access_profiled_type(bci(), array_type, element_type, element_ptr, flat_array, null_free_array);
 508       reason = Deoptimization::Reason_class_check;
 509     }
 510     if (!null_free_array) {
 511       { // Deoptimize if null-free array
 512         BuildCutout unless(this, null_free_array_test(load_object_klass(ary), /* null_free = */ false), PROB_MAX);
 513         uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
 514       }
 515       assert(!stopped(), "null-free array should have been caught earlier");
 516       Node* better_ary = _gvn.transform(new CheckCastPPNode(control(), ary, arytype->cast_to_not_null_free()));
 517       replace_in_map(ary, better_ary);
 518       ary = better_ary;
 519       arytype = _gvn.type(ary)->is_aryptr();
 520     }
 521   }
 522 
 523   if (!arytype->is_flat() && !arytype->is_not_flat()) {
 524     bool flat_array = true;
 525     Deoptimization::DeoptReason reason = Deoptimization::Reason_none;
 526     if (arytype->speculative() != NULL &&
 527         arytype->speculative()->is_aryptr()->is_not_flat() &&
 528         !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_class_check)) {
 529       flat_array = false;
 530       reason = Deoptimization::Reason_speculate_class_check;
 531     } else if (UseArrayLoadStoreProfile && !too_many_traps_or_recompiles(reason)) {
 532       ciKlass* array_type = NULL;
 533       ciKlass* element_type = NULL;
 534       ProfilePtrKind element_ptr = ProfileMaybeNull;
 535       bool null_free_array = true;
 536       method()->array_access_profiled_type(bci(), array_type, element_type, element_ptr, flat_array, null_free_array);
 537       reason = Deoptimization::Reason_class_check;
 538     }
 539     if (!flat_array) {
 540       { // Deoptimize if flat array
 541         BuildCutout unless(this, flat_array_test(ary, /* flat = */ false), PROB_MAX);
 542         uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
 543       }
 544       assert(!stopped(), "flat array should have been caught earlier");
 545       Node* better_ary = _gvn.transform(new CheckCastPPNode(control(), ary, arytype->cast_to_not_flat()));
 546       replace_in_map(ary, better_ary);
 547       ary = better_ary;
 548       arytype = _gvn.type(ary)->is_aryptr();
 549     }
 550   }
 551 
 552   // Make array address computation control dependent to prevent it
 553   // from floating above the range check during loop optimizations.
 554   Node* ptr = array_element_address(ary, idx, type, sizetype, control());
 555   assert(ptr != top(), "top should go hand-in-hand with stopped");
 556 
 557   return ptr;
 558 }
 559 
 560 
 561 // returns IfNode
 562 IfNode* Parse::jump_if_fork_int(Node* a, Node* b, BoolTest::mask mask, float prob, float cnt) {
 563   Node   *cmp = _gvn.transform(new CmpINode(a, b)); // two cases: shiftcount > 32 and shiftcount <= 32
 564   Node   *tst = _gvn.transform(new BoolNode(cmp, mask));
 565   IfNode *iff = create_and_map_if(control(), tst, prob, cnt);
 566   return iff;
 567 }
 568 
 569 
 570 // sentinel value for the target bci to mark never taken branches
 571 // (according to profiling)

1751   // Generate real control flow
1752   Node   *tst = _gvn.transform( new BoolNode( c, btest ) );
1753 
1754   // Sanity check the probability value
1755   assert(prob > 0.0f,"Bad probability in Parser");
1756  // Need xform to put node in hash table
1757   IfNode *iff = create_and_xform_if( control(), tst, prob, cnt );
1758   assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser");
1759   // True branch
1760   { PreserveJVMState pjvms(this);
1761     Node* iftrue  = _gvn.transform( new IfTrueNode (iff) );
1762     set_control(iftrue);
1763 
1764     if (stopped()) {            // Path is dead?
1765       NOT_PRODUCT(explicit_null_checks_elided++);
1766       if (C->eliminate_boxing()) {
1767         // Mark the successor block as parsed
1768         branch_block->next_path_num();
1769       }
1770     } else {                    // Path is live.
1771       adjust_map_after_if(btest, c, prob, branch_block);
1772       if (!stopped()) {
1773         merge(target_bci);
1774       }
1775     }
1776   }
1777 
1778   // False branch
1779   Node* iffalse = _gvn.transform( new IfFalseNode(iff) );
1780   set_control(iffalse);
1781 
1782   if (stopped()) {              // Path is dead?
1783     NOT_PRODUCT(explicit_null_checks_elided++);
1784     if (C->eliminate_boxing()) {
1785       // Mark the successor block as parsed
1786       next_block->next_path_num();
1787     }
1788   } else  {                     // Path is live.
1789     adjust_map_after_if(BoolTest(btest).negate(), c, 1.0-prob, next_block);

1790   }
1791 }
1792 
1793 //------------------------------------do_if------------------------------------
1794 void Parse::do_if(BoolTest::mask btest, Node* c, bool new_path, Node** ctrl_taken) {
1795   int target_bci = iter().get_dest();
1796 
1797   Block* branch_block = successor_for_bci(target_bci);
1798   Block* next_block   = successor_for_bci(iter().next_bci());
1799 
1800   float cnt;
1801   float prob = branch_prediction(cnt, btest, target_bci, c);
1802   float untaken_prob = 1.0 - prob;
1803 
1804   if (prob == PROB_UNKNOWN) {
1805     if (PrintOpto && Verbose) {
1806       tty->print_cr("Never-taken edge stops compilation at bci %d", bci());
1807     }
1808     repush_if_args(); // to gather stats on loop
1809     uncommon_trap(Deoptimization::Reason_unreached,
1810                   Deoptimization::Action_reinterpret,
1811                   NULL, "cold");
1812     if (C->eliminate_boxing()) {
1813       // Mark the successor blocks as parsed
1814       branch_block->next_path_num();

1858   }
1859 
1860   // Generate real control flow
1861   float true_prob = (taken_if_true ? prob : untaken_prob);
1862   IfNode* iff = create_and_map_if(control(), tst, true_prob, cnt);
1863   assert(iff->_prob > 0.0f,"Optimizer made bad probability in parser");
1864   Node* taken_branch   = new IfTrueNode(iff);
1865   Node* untaken_branch = new IfFalseNode(iff);
1866   if (!taken_if_true) {  // Finish conversion to canonical form
1867     Node* tmp      = taken_branch;
1868     taken_branch   = untaken_branch;
1869     untaken_branch = tmp;
1870   }
1871 
1872   // Branch is taken:
1873   { PreserveJVMState pjvms(this);
1874     taken_branch = _gvn.transform(taken_branch);
1875     set_control(taken_branch);
1876 
1877     if (stopped()) {
1878       if (C->eliminate_boxing() && !new_path) {
1879         // Mark the successor block as parsed (if we haven't created a new path)
1880         branch_block->next_path_num();
1881       }
1882     } else {
1883       adjust_map_after_if(taken_btest, c, prob, branch_block);
1884       if (!stopped()) {
1885         if (new_path) {
1886           // Merge by using a new path
1887           merge_new_path(target_bci);
1888         } else if (ctrl_taken != NULL) {
1889           // Don't merge but save taken branch to be wired by caller
1890           *ctrl_taken = control();
1891         } else {
1892           merge(target_bci);
1893         }
1894       }
1895     }
1896   }
1897 
1898   untaken_branch = _gvn.transform(untaken_branch);
1899   set_control(untaken_branch);
1900 
1901   // Branch not taken.
1902   if (stopped() && ctrl_taken == NULL) {
1903     if (C->eliminate_boxing()) {
1904       // Mark the successor block as parsed (if caller does not re-wire control flow)
1905       next_block->next_path_num();
1906     }
1907   } else {
1908     adjust_map_after_if(untaken_btest, c, untaken_prob, next_block);
1909   }
1910 }
1911 
1912 
1913 static ProfilePtrKind speculative_ptr_kind(const TypeOopPtr* t) {
1914   if (t->speculative() == NULL) {
1915     return ProfileUnknownNull;
1916   }
1917   if (t->speculative_always_null()) {
1918     return ProfileAlwaysNull;
1919   }
1920   if (t->speculative_maybe_null()) {
1921     return ProfileMaybeNull;
1922   }
1923   return ProfileNeverNull;
1924 }
1925 
1926 void Parse::acmp_always_null_input(Node* input, const TypeOopPtr* tinput, BoolTest::mask btest, Node* eq_region) {
1927   inc_sp(2);
1928   Node* cast = null_check_common(input, T_OBJECT, true, NULL,
1929                                  !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_null_check) &&
1930                                  speculative_ptr_kind(tinput) == ProfileAlwaysNull);
1931   dec_sp(2);
1932   if (btest == BoolTest::ne) {
1933     {
1934       PreserveJVMState pjvms(this);
1935       replace_in_map(input, cast);
1936       int target_bci = iter().get_dest();
1937       merge(target_bci);
1938     }
1939     record_for_igvn(eq_region);
1940     set_control(_gvn.transform(eq_region));
1941   } else {
1942     replace_in_map(input, cast);
1943   }
1944 }
1945 
1946 Node* Parse::acmp_null_check(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, Node*& null_ctl) {
1947   inc_sp(2);
1948   null_ctl = top();
1949   Node* cast = null_check_oop(input, &null_ctl,
1950                               input_ptr == ProfileNeverNull || (input_ptr == ProfileUnknownNull && !too_many_traps_or_recompiles(Deoptimization::Reason_null_check)),
1951                               false,
1952                               speculative_ptr_kind(tinput) == ProfileNeverNull &&
1953                               !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_null_check));
1954   dec_sp(2);
1955   assert(!stopped(), "null input should have been caught earlier");
1956   if (cast->is_InlineType()) {
1957     cast = cast->as_InlineType()->get_oop();
1958   }
1959   return cast;
1960 }
1961 
1962 void Parse::acmp_known_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, ciKlass* input_type, BoolTest::mask btest, Node* eq_region) {
1963   Node* ne_region = new RegionNode(1);
1964   Node* null_ctl;
1965   Node* cast = acmp_null_check(input, tinput, input_ptr, null_ctl);
1966   ne_region->add_req(null_ctl);
1967 
1968   Node* slow_ctl = type_check_receiver(cast, input_type, 1.0, &cast);
1969   {
1970     PreserveJVMState pjvms(this);
1971     inc_sp(2);
1972     set_control(slow_ctl);
1973     Deoptimization::DeoptReason reason;
1974     if (tinput->speculative_type() != NULL && !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_class_check)) {
1975       reason = Deoptimization::Reason_speculate_class_check;
1976     } else {
1977       reason = Deoptimization::Reason_class_check;
1978     }
1979     uncommon_trap_exact(reason, Deoptimization::Action_maybe_recompile);
1980   }
1981   ne_region->add_req(control());
1982 
1983   record_for_igvn(ne_region);
1984   set_control(_gvn.transform(ne_region));
1985   if (btest == BoolTest::ne) {
1986     {
1987       PreserveJVMState pjvms(this);
1988       if (null_ctl == top()) {
1989         replace_in_map(input, cast);
1990       }
1991       int target_bci = iter().get_dest();
1992       merge(target_bci);
1993     }
1994     record_for_igvn(eq_region);
1995     set_control(_gvn.transform(eq_region));
1996   } else {
1997     if (null_ctl == top()) {
1998       replace_in_map(input, cast);
1999     }
2000     set_control(_gvn.transform(ne_region));
2001   }
2002 }
2003 
2004 void Parse::acmp_unknown_non_inline_type_input(Node* input, const TypeOopPtr* tinput, ProfilePtrKind input_ptr, BoolTest::mask btest, Node* eq_region) {
2005   Node* ne_region = new RegionNode(1);
2006   Node* null_ctl;
2007   Node* cast = acmp_null_check(input, tinput, input_ptr, null_ctl);
2008   ne_region->add_req(null_ctl);
2009 
2010   {
2011     BuildCutout unless(this, inline_type_test(cast, /* is_inline = */ false), PROB_MAX);
2012     inc_sp(2);
2013     uncommon_trap_exact(Deoptimization::Reason_class_check, Deoptimization::Action_maybe_recompile);
2014   }
2015 
2016   ne_region->add_req(control());
2017 
2018   record_for_igvn(ne_region);
2019   set_control(_gvn.transform(ne_region));
2020   if (btest == BoolTest::ne) {
2021     {
2022       PreserveJVMState pjvms(this);
2023       if (null_ctl == top()) {
2024         replace_in_map(input, cast);
2025       }
2026       int target_bci = iter().get_dest();
2027       merge(target_bci);
2028     }
2029     record_for_igvn(eq_region);
2030     set_control(_gvn.transform(eq_region));
2031   } else {
2032     if (null_ctl == top()) {
2033       replace_in_map(input, cast);
2034     }
2035     set_control(_gvn.transform(ne_region));
2036   }
2037 }
2038 
2039 void Parse::do_acmp(BoolTest::mask btest, Node* left, Node* right) {
2040   ciKlass* left_type = NULL;
2041   ciKlass* right_type = NULL;
2042   ProfilePtrKind left_ptr = ProfileUnknownNull;
2043   ProfilePtrKind right_ptr = ProfileUnknownNull;
2044   bool left_inline_type = true;
2045   bool right_inline_type = true;
2046 
2047   // Leverage profiling at acmp
2048   if (UseACmpProfile) {
2049     method()->acmp_profiled_type(bci(), left_type, right_type, left_ptr, right_ptr, left_inline_type, right_inline_type);
2050     if (too_many_traps_or_recompiles(Deoptimization::Reason_class_check)) {
2051       left_type = NULL;
2052       right_type = NULL;
2053       left_inline_type = true;
2054       right_inline_type = true;
2055     }
2056     if (too_many_traps_or_recompiles(Deoptimization::Reason_null_check)) {
2057       left_ptr = ProfileUnknownNull;
2058       right_ptr = ProfileUnknownNull;
2059     }
2060   }
2061 
2062   if (UseTypeSpeculation) {
2063     record_profile_for_speculation(left, left_type, left_ptr);
2064     record_profile_for_speculation(right, right_type, right_ptr);
2065   }
2066 
2067   if (!EnableValhalla) {
2068     Node* cmp = CmpP(left, right);
2069     cmp = optimize_cmp_with_klass(cmp);
2070     do_if(btest, cmp);
2071     return;
2072   }
2073 
2074   // Check for equality before potentially allocating
2075   if (left == right) {
2076     do_if(btest, makecon(TypeInt::CC_EQ));
2077     return;
2078   }
2079 
2080   // Allocate inline type operands and re-execute on deoptimization
2081   if (left->is_InlineType()) {
2082     PreserveReexecuteState preexecs(this);
2083     inc_sp(2);
2084     jvms()->set_should_reexecute(true);
2085     left = left->as_InlineType()->buffer(this)->get_oop();
2086   }
2087   if (right->is_InlineType()) {
2088     PreserveReexecuteState preexecs(this);
2089     inc_sp(2);
2090     jvms()->set_should_reexecute(true);
2091     right = right->as_InlineType()->buffer(this)->get_oop();
2092   }
2093 
2094   // First, do a normal pointer comparison
2095   const TypeOopPtr* tleft = _gvn.type(left)->isa_oopptr();
2096   const TypeOopPtr* tright = _gvn.type(right)->isa_oopptr();
2097   Node* cmp = CmpP(left, right);
2098   cmp = optimize_cmp_with_klass(cmp);
2099   if (tleft == NULL || !tleft->can_be_inline_type() ||
2100       tright == NULL || !tright->can_be_inline_type()) {
2101     // This is sufficient, if one of the operands can't be an inline type
2102     do_if(btest, cmp);
2103     return;
2104   }
2105   Node* eq_region = NULL;
2106   if (btest == BoolTest::eq) {
2107     do_if(btest, cmp, true);
2108     if (stopped()) {
2109       return;
2110     }
2111   } else {
2112     assert(btest == BoolTest::ne, "only eq or ne");
2113     Node* is_not_equal = NULL;
2114     eq_region = new RegionNode(3);
2115     {
2116       PreserveJVMState pjvms(this);
2117       do_if(btest, cmp, false, &is_not_equal);
2118       if (!stopped()) {
2119         eq_region->init_req(1, control());
2120       }
2121     }
2122     if (is_not_equal == NULL || is_not_equal->is_top()) {
2123       record_for_igvn(eq_region);
2124       set_control(_gvn.transform(eq_region));
2125       return;
2126     }
2127     set_control(is_not_equal);
2128   }
2129 
2130   // Prefer speculative types if available
2131   if (!too_many_traps_or_recompiles(Deoptimization::Reason_speculate_class_check)) {
2132     if (tleft->speculative_type() != NULL) {
2133       left_type = tleft->speculative_type();
2134     }
2135     if (tright->speculative_type() != NULL) {
2136       right_type = tright->speculative_type();
2137     }
2138   }
2139 
2140   if (speculative_ptr_kind(tleft) != ProfileMaybeNull && speculative_ptr_kind(tleft) != ProfileUnknownNull) {
2141     ProfilePtrKind speculative_left_ptr = speculative_ptr_kind(tleft);
2142     if (speculative_left_ptr == ProfileAlwaysNull && !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_null_assert)) {
2143       left_ptr = speculative_left_ptr;
2144     } else if (speculative_left_ptr == ProfileNeverNull && !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_null_check)) {
2145       left_ptr = speculative_left_ptr;
2146     }
2147   }
2148   if (speculative_ptr_kind(tright) != ProfileMaybeNull && speculative_ptr_kind(tright) != ProfileUnknownNull) {
2149     ProfilePtrKind speculative_right_ptr = speculative_ptr_kind(tright);
2150     if (speculative_right_ptr == ProfileAlwaysNull && !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_null_assert)) {
2151       right_ptr = speculative_right_ptr;
2152     } else if (speculative_right_ptr == ProfileNeverNull && !too_many_traps_or_recompiles(Deoptimization::Reason_speculate_null_check)) {
2153       right_ptr = speculative_right_ptr;
2154     }
2155   }
2156 
2157   if (left_ptr == ProfileAlwaysNull) {
2158     // Comparison with null. Assert the input is indeed null and we're done.
2159     acmp_always_null_input(left, tleft, btest, eq_region);
2160     return;
2161   }
2162   if (right_ptr == ProfileAlwaysNull) {
2163     // Comparison with null. Assert the input is indeed null and we're done.
2164     acmp_always_null_input(right, tright, btest, eq_region);
2165     return;
2166   }
2167   if (left_type != NULL && !left_type->is_inlinetype()) {
2168     // Comparison with an object of known type
2169     acmp_known_non_inline_type_input(left, tleft, left_ptr, left_type, btest, eq_region);
2170     return;
2171   }
2172   if (right_type != NULL && !right_type->is_inlinetype()) {
2173     // Comparison with an object of known type
2174     acmp_known_non_inline_type_input(right, tright, right_ptr, right_type, btest, eq_region);
2175     return;
2176   }
2177   if (!left_inline_type) {
2178     // Comparison with an object known not to be an inline type
2179     acmp_unknown_non_inline_type_input(left, tleft, left_ptr, btest, eq_region);
2180     return;
2181   }
2182   if (!right_inline_type) {
2183     // Comparison with an object known not to be an inline type
2184     acmp_unknown_non_inline_type_input(right, tright, right_ptr, btest, eq_region);
2185     return;
2186   }
2187 
2188   // Pointers are not equal, check if first operand is non-null
2189   Node* ne_region = new RegionNode(6);
2190   Node* null_ctl;
2191   Node* not_null_right = acmp_null_check(right, tright, right_ptr, null_ctl);
2192   ne_region->init_req(1, null_ctl);
2193 
2194   // First operand is non-null, check if it is an inline type
2195   Node* is_value = inline_type_test(not_null_right);
2196   IfNode* is_value_iff = create_and_map_if(control(), is_value, PROB_FAIR, COUNT_UNKNOWN);
2197   Node* not_value = _gvn.transform(new IfFalseNode(is_value_iff));
2198   ne_region->init_req(2, not_value);
2199   set_control(_gvn.transform(new IfTrueNode(is_value_iff)));
2200 
2201   // The first operand is an inline type, check if the second operand is non-null
2202   Node* not_null_left = acmp_null_check(left, tleft, left_ptr, null_ctl);
2203   ne_region->init_req(3, null_ctl);
2204 
2205   // Check if both operands are of the same class.
2206   Node* kls_left = load_object_klass(not_null_left);
2207   Node* kls_right = load_object_klass(not_null_right);
2208   Node* kls_cmp = CmpP(kls_left, kls_right);
2209   Node* kls_bol = _gvn.transform(new BoolNode(kls_cmp, BoolTest::ne));
2210   IfNode* kls_iff = create_and_map_if(control(), kls_bol, PROB_FAIR, COUNT_UNKNOWN);
2211   Node* kls_ne = _gvn.transform(new IfTrueNode(kls_iff));
2212   set_control(_gvn.transform(new IfFalseNode(kls_iff)));
2213   ne_region->init_req(4, kls_ne);
2214 
2215   if (stopped()) {
2216     record_for_igvn(ne_region);
2217     set_control(_gvn.transform(ne_region));
2218     if (btest == BoolTest::ne) {
2219       {
2220         PreserveJVMState pjvms(this);
2221         int target_bci = iter().get_dest();
2222         merge(target_bci);
2223       }
2224       record_for_igvn(eq_region);
2225       set_control(_gvn.transform(eq_region));
2226     }
2227     return;
2228   }
2229 
2230   // Both operands are values types of the same class, we need to perform a
2231   // substitutability test. Delegate to PrimitiveObjectMethods::isSubstitutable().
2232   Node* ne_io_phi = PhiNode::make(ne_region, i_o());
2233   Node* mem = reset_memory();
2234   Node* ne_mem_phi = PhiNode::make(ne_region, mem);
2235 
2236   Node* eq_io_phi = NULL;
2237   Node* eq_mem_phi = NULL;
2238   if (eq_region != NULL) {
2239     eq_io_phi = PhiNode::make(eq_region, i_o());
2240     eq_mem_phi = PhiNode::make(eq_region, mem);
2241   }
2242 
2243   set_all_memory(mem);
2244 
2245   kill_dead_locals();
2246   ciMethod* subst_method = ciEnv::current()->PrimitiveObjectMethods_klass()->find_method(ciSymbols::isSubstitutable_name(), ciSymbols::object_object_boolean_signature());
2247   CallStaticJavaNode *call = new CallStaticJavaNode(C, TypeFunc::make(subst_method), SharedRuntime::get_resolve_static_call_stub(), subst_method);
2248   call->set_override_symbolic_info(true);
2249   call->init_req(TypeFunc::Parms, not_null_left);
2250   call->init_req(TypeFunc::Parms+1, not_null_right);
2251   inc_sp(2);
2252   set_edges_for_java_call(call, false, false);
2253   Node* ret = set_results_for_java_call(call, false, true);
2254   dec_sp(2);
2255 
2256   // Test the return value of PrimitiveObjectMethods::isSubstitutable()
2257   Node* subst_cmp = _gvn.transform(new CmpINode(ret, intcon(1)));
2258   Node* ctl = C->top();
2259   if (btest == BoolTest::eq) {
2260     PreserveJVMState pjvms(this);
2261     do_if(btest, subst_cmp);
2262     if (!stopped()) {
2263       ctl = control();
2264     }
2265   } else {
2266     assert(btest == BoolTest::ne, "only eq or ne");
2267     PreserveJVMState pjvms(this);
2268     do_if(btest, subst_cmp, false, &ctl);
2269     if (!stopped()) {
2270       eq_region->init_req(2, control());
2271       eq_io_phi->init_req(2, i_o());
2272       eq_mem_phi->init_req(2, reset_memory());
2273     }
2274   }
2275   ne_region->init_req(5, ctl);
2276   ne_io_phi->init_req(5, i_o());
2277   ne_mem_phi->init_req(5, reset_memory());
2278 
2279   record_for_igvn(ne_region);
2280   set_control(_gvn.transform(ne_region));
2281   set_i_o(_gvn.transform(ne_io_phi));
2282   set_all_memory(_gvn.transform(ne_mem_phi));
2283 
2284   if (btest == BoolTest::ne) {
2285     {
2286       PreserveJVMState pjvms(this);
2287       int target_bci = iter().get_dest();
2288       merge(target_bci);
2289     }
2290 
2291     record_for_igvn(eq_region);
2292     set_control(_gvn.transform(eq_region));
2293     set_i_o(_gvn.transform(eq_io_phi));
2294     set_all_memory(_gvn.transform(eq_mem_phi));
2295   }
2296 }
2297 
2298 bool Parse::path_is_suitable_for_uncommon_trap(float prob) const {
2299   // Don't want to speculate on uncommon traps when running with -Xcomp
2300   if (!UseInterpreter) {
2301     return false;
2302   }
2303   return (seems_never_taken(prob) && seems_stable_comparison());
2304 }
2305 
2306 void Parse::maybe_add_predicate_after_if(Block* path) {
2307   if (path->is_SEL_head() && path->preds_parsed() == 0) {
2308     // Add predicates at bci of if dominating the loop so traps can be
2309     // recorded on the if's profile data
2310     int bc_depth = repush_if_args();
2311     add_empty_predicates();
2312     dec_sp(bc_depth);
2313     path->set_has_predicates();
2314   }
2315 }
2316 
2317 
2318 //----------------------------adjust_map_after_if------------------------------
2319 // Adjust the JVM state to reflect the result of taking this path.
2320 // Basically, it means inspecting the CmpNode controlling this
2321 // branch, seeing how it constrains a tested value, and then
2322 // deciding if it's worth our while to encode this constraint
2323 // as graph nodes in the current abstract interpretation map.
2324 void Parse::adjust_map_after_if(BoolTest::mask btest, Node* c, float prob, Block* path) {

2325   if (!c->is_Cmp()) {
2326     maybe_add_predicate_after_if(path);
2327     return;
2328   }
2329 
2330   if (stopped() || btest == BoolTest::illegal) {
2331     return;                             // nothing to do
2332   }
2333 
2334   bool is_fallthrough = (path == successor_for_bci(iter().next_bci()));
2335 
2336   if (path_is_suitable_for_uncommon_trap(prob)) {
2337     repush_if_args();
2338     uncommon_trap(Deoptimization::Reason_unstable_if,
2339                   Deoptimization::Action_reinterpret,
2340                   NULL,
2341                   (is_fallthrough ? "taken always" : "taken never"));
2342     return;
2343   }
2344 

2514   if (c->Opcode() == Op_CmpP &&
2515       (c->in(1)->Opcode() == Op_LoadKlass || c->in(1)->Opcode() == Op_DecodeNKlass) &&
2516       c->in(2)->is_Con()) {
2517     Node* load_klass = NULL;
2518     Node* decode = NULL;
2519     if (c->in(1)->Opcode() == Op_DecodeNKlass) {
2520       decode = c->in(1);
2521       load_klass = c->in(1)->in(1);
2522     } else {
2523       load_klass = c->in(1);
2524     }
2525     if (load_klass->in(2)->is_AddP()) {
2526       Node* addp = load_klass->in(2);
2527       Node* obj = addp->in(AddPNode::Address);
2528       const TypeOopPtr* obj_type = _gvn.type(obj)->is_oopptr();
2529       if (obj_type->speculative_type_not_null() != NULL) {
2530         ciKlass* k = obj_type->speculative_type();
2531         inc_sp(2);
2532         obj = maybe_cast_profiled_obj(obj, k);
2533         dec_sp(2);
2534         if (obj->is_InlineType()) {
2535           assert(obj->as_InlineType()->is_allocated(&_gvn), "must be allocated");
2536           obj = obj->as_InlineType()->get_oop();
2537         }
2538         // Make the CmpP use the casted obj
2539         addp = basic_plus_adr(obj, addp->in(AddPNode::Offset));
2540         load_klass = load_klass->clone();
2541         load_klass->set_req(2, addp);
2542         load_klass = _gvn.transform(load_klass);
2543         if (decode != NULL) {
2544           decode = decode->clone();
2545           decode->set_req(1, load_klass);
2546           load_klass = _gvn.transform(decode);
2547         }
2548         c = c->clone();
2549         c->set_req(1, load_klass);
2550         c = _gvn.transform(c);
2551       }
2552     }
2553   }
2554   return c;
2555 }
2556 
2557 //------------------------------do_one_bytecode--------------------------------

3365     // See if we can get some profile data and hand it off to the next block
3366     Block *target_block = block()->successor_for_bci(target_bci);
3367     if (target_block->pred_count() != 1)  break;
3368     ciMethodData* methodData = method()->method_data();
3369     if (!methodData->is_mature())  break;
3370     ciProfileData* data = methodData->bci_to_data(bci());
3371     assert(data != NULL && data->is_JumpData(), "need JumpData for taken branch");
3372     int taken = ((ciJumpData*)data)->taken();
3373     taken = method()->scale_count(taken);
3374     target_block->set_count(taken);
3375     break;
3376   }
3377 
3378   case Bytecodes::_ifnull:    btest = BoolTest::eq; goto handle_if_null;
3379   case Bytecodes::_ifnonnull: btest = BoolTest::ne; goto handle_if_null;
3380   handle_if_null:
3381     // If this is a backwards branch in the bytecodes, add Safepoint
3382     maybe_add_safepoint(iter().get_dest());
3383     a = null();
3384     b = pop();
3385     if (b->is_InlineType()) {
3386       // Return constant false because 'b' is always non-null
3387       c = _gvn.makecon(TypeInt::CC_GT);
3388     } else {
3389       if (!_gvn.type(b)->speculative_maybe_null() &&
3390           !too_many_traps(Deoptimization::Reason_speculate_null_check)) {
3391         inc_sp(1);
3392         Node* null_ctl = top();
3393         b = null_check_oop(b, &null_ctl, true, true, true);
3394         assert(null_ctl->is_top(), "no null control here");
3395         dec_sp(1);
3396       } else if (_gvn.type(b)->speculative_always_null() &&
3397                  !too_many_traps(Deoptimization::Reason_speculate_null_assert)) {
3398         inc_sp(1);
3399         b = null_assert(b);
3400         dec_sp(1);
3401       }
3402       c = _gvn.transform( new CmpPNode(b, a) );
3403     }
3404     do_ifnull(btest, c);
3405     break;
3406 
3407   case Bytecodes::_if_acmpeq: btest = BoolTest::eq; goto handle_if_acmp;
3408   case Bytecodes::_if_acmpne: btest = BoolTest::ne; goto handle_if_acmp;
3409   handle_if_acmp:
3410     // If this is a backwards branch in the bytecodes, add Safepoint
3411     maybe_add_safepoint(iter().get_dest());
3412     a = pop();
3413     b = pop();
3414     do_acmp(btest, b, a);


3415     break;
3416 
3417   case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx;
3418   case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx;
3419   case Bytecodes::_iflt: btest = BoolTest::lt; goto handle_ifxx;
3420   case Bytecodes::_ifle: btest = BoolTest::le; goto handle_ifxx;
3421   case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx;
3422   case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx;
3423   handle_ifxx:
3424     // If this is a backwards branch in the bytecodes, add Safepoint
3425     maybe_add_safepoint(iter().get_dest());
3426     a = _gvn.intcon(0);
3427     b = pop();
3428     c = _gvn.transform( new CmpINode(b, a) );
3429     do_if(btest, c);
3430     break;
3431 
3432   case Bytecodes::_if_icmpeq: btest = BoolTest::eq; goto handle_if_icmp;
3433   case Bytecodes::_if_icmpne: btest = BoolTest::ne; goto handle_if_icmp;
3434   case Bytecodes::_if_icmplt: btest = BoolTest::lt; goto handle_if_icmp;

3449     break;
3450 
3451   case Bytecodes::_lookupswitch:
3452     do_lookupswitch();
3453     break;
3454 
3455   case Bytecodes::_invokestatic:
3456   case Bytecodes::_invokedynamic:
3457   case Bytecodes::_invokespecial:
3458   case Bytecodes::_invokevirtual:
3459   case Bytecodes::_invokeinterface:
3460     do_call();
3461     break;
3462   case Bytecodes::_checkcast:
3463     do_checkcast();
3464     break;
3465   case Bytecodes::_instanceof:
3466     do_instanceof();
3467     break;
3468   case Bytecodes::_anewarray:
3469     do_newarray();
3470     break;
3471   case Bytecodes::_newarray:
3472     do_newarray((BasicType)iter().get_index());
3473     break;
3474   case Bytecodes::_multianewarray:
3475     do_multianewarray();
3476     break;
3477   case Bytecodes::_new:
3478     do_new();
3479     break;
3480   case Bytecodes::_defaultvalue:
3481     do_defaultvalue();
3482     break;
3483   case Bytecodes::_withfield:
3484     do_withfield();
3485     break;
3486 
3487   case Bytecodes::_jsr:
3488   case Bytecodes::_jsr_w:
3489     do_jsr();
3490     break;
3491 
3492   case Bytecodes::_ret:
3493     do_ret();
3494     break;
3495 
3496 
3497   case Bytecodes::_monitorenter:
3498     do_monitor_enter();
3499     break;
3500 
3501   case Bytecodes::_monitorexit:
3502     do_monitor_exit();
3503     break;
3504 
3505   case Bytecodes::_breakpoint:
< prev index next >