src/share/vm/opto/macro.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/macro.cpp

Print this page
rev 7884 : 8073480: C2 should optimize explicit range checks
Summary: explicit range checks should be recognized by C2
Reviewed-by:


2518         // Remove it from macro list and put on IGVN worklist to optimize.
2519         C->remove_macro_node(n);
2520         _igvn._worklist.push(n);
2521         success = true;
2522       } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) {
2523         _igvn.replace_node(n, n->in(1));
2524         success = true;
2525 #if INCLUDE_RTM_OPT
2526       } else if ((n->Opcode() == Op_Opaque3) && ((Opaque3Node*)n)->rtm_opt()) {
2527         assert(C->profile_rtm(), "should be used only in rtm deoptimization code");
2528         assert((n->outcnt() == 1) && n->unique_out()->is_Cmp(), "");
2529         Node* cmp = n->unique_out();
2530 #ifdef ASSERT
2531         // Validate graph.
2532         assert((cmp->outcnt() == 1) && cmp->unique_out()->is_Bool(), "");
2533         BoolNode* bol = cmp->unique_out()->as_Bool();
2534         assert((bol->outcnt() == 1) && bol->unique_out()->is_If() &&
2535                (bol->_test._test == BoolTest::ne), "");
2536         IfNode* ifn = bol->unique_out()->as_If();
2537         assert((ifn->outcnt() == 2) &&
2538                ifn->proj_out(1)->is_uncommon_trap_proj(Deoptimization::Reason_rtm_state_change), "");
2539 #endif
2540         Node* repl = n->in(1);
2541         if (!_has_locks) {
2542           // Remove RTM state check if there are no locks in the code.
2543           // Replace input to compare the same value.
2544           repl = (cmp->in(1) == n) ? cmp->in(2) : cmp->in(1);
2545         }
2546         _igvn.replace_node(n, repl);
2547         success = true;
2548 #endif
2549       }
2550       assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
2551       progress = progress || success;
2552     }
2553   }
2554 
2555   // expand arraycopy "macro" nodes first
2556   // For ReduceBulkZeroing, we must first process all arraycopy nodes
2557   // before the allocate nodes are expanded.
2558   int macro_idx = C->macro_count() - 1;




2518         // Remove it from macro list and put on IGVN worklist to optimize.
2519         C->remove_macro_node(n);
2520         _igvn._worklist.push(n);
2521         success = true;
2522       } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) {
2523         _igvn.replace_node(n, n->in(1));
2524         success = true;
2525 #if INCLUDE_RTM_OPT
2526       } else if ((n->Opcode() == Op_Opaque3) && ((Opaque3Node*)n)->rtm_opt()) {
2527         assert(C->profile_rtm(), "should be used only in rtm deoptimization code");
2528         assert((n->outcnt() == 1) && n->unique_out()->is_Cmp(), "");
2529         Node* cmp = n->unique_out();
2530 #ifdef ASSERT
2531         // Validate graph.
2532         assert((cmp->outcnt() == 1) && cmp->unique_out()->is_Bool(), "");
2533         BoolNode* bol = cmp->unique_out()->as_Bool();
2534         assert((bol->outcnt() == 1) && bol->unique_out()->is_If() &&
2535                (bol->_test._test == BoolTest::ne), "");
2536         IfNode* ifn = bol->unique_out()->as_If();
2537         assert((ifn->outcnt() == 2) &&
2538                ifn->proj_out(1)->is_uncommon_trap_proj(Deoptimization::Reason_rtm_state_change) != NULL, "");
2539 #endif
2540         Node* repl = n->in(1);
2541         if (!_has_locks) {
2542           // Remove RTM state check if there are no locks in the code.
2543           // Replace input to compare the same value.
2544           repl = (cmp->in(1) == n) ? cmp->in(2) : cmp->in(1);
2545         }
2546         _igvn.replace_node(n, repl);
2547         success = true;
2548 #endif
2549       }
2550       assert(success == (C->macro_count() < old_macro_count), "elimination reduces macro count");
2551       progress = progress || success;
2552     }
2553   }
2554 
2555   // expand arraycopy "macro" nodes first
2556   // For ReduceBulkZeroing, we must first process all arraycopy nodes
2557   // before the allocate nodes are expanded.
2558   int macro_idx = C->macro_count() - 1;


src/share/vm/opto/macro.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File