< prev index next >

src/share/vm/opto/compile.cpp

Print this page
rev 9414 : 8217230: assert(t == t_no_spec) failure in NodeHash::check_no_speculative_types()
Summary: Remove dead node from C2 IR.
Reviewed-by: roland, neliasso


2067     if (failing())  return;
2068 
2069     {
2070       ResourceMark rm;
2071       PhaseRemoveUseless pru(initial_gvn(), for_igvn());
2072     }
2073 
2074     igvn = PhaseIterGVN(gvn);
2075 
2076     igvn.optimize();
2077   }
2078 
2079   set_inlining_incrementally(false);
2080 }
2081 
2082 
2083 // Remove edges from "root" to each SafePoint at a backward branch.
2084 // They were inserted during parsing (see add_safepoint()) to make
2085 // infinite loops without calls or exceptions visible to root, i.e.,
2086 // useful.
2087 void Compile::remove_root_to_sfpts_edges() {
2088   Node *r = root();
2089   if (r != NULL) {
2090     for (uint i = r->req(); i < r->len(); ++i) {
2091       Node *n = r->in(i);
2092       if (n != NULL && n->is_SafePoint()) {
2093         r->rm_prec(i);



2094         --i;
2095       }
2096     }
2097   }
2098 }
2099 
2100 //------------------------------Optimize---------------------------------------
2101 // Given a graph, optimize it.
2102 void Compile::Optimize() {
2103   TracePhase t1("optimizer", &_t_optimizer, true);
2104 
2105 #ifndef PRODUCT
2106   if (env()->break_at_compile()) {
2107     BREAKPOINT;
2108   }
2109 
2110 #endif
2111 
2112   ResourceMark rm;
2113   int          loop_opts_cnt;


2137   print_method(PHASE_INCREMENTAL_INLINE, 2);
2138 
2139   if (failing())  return;
2140 
2141   if (eliminate_boxing()) {
2142     NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
2143     // Inline valueOf() methods now.
2144     inline_boxing_calls(igvn);
2145 
2146     if (AlwaysIncrementalInline) {
2147       inline_incrementally(igvn);
2148     }
2149 
2150     print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2);
2151 
2152     if (failing())  return;
2153   }
2154 
2155   // Now that all inlining is over, cut edge from root to loop
2156   // safepoints
2157   remove_root_to_sfpts_edges();
2158 
2159   // Remove the speculative part of types and clean up the graph from
2160   // the extra CastPP nodes whose only purpose is to carry them. Do
2161   // that early so that optimizations are not disrupted by the extra
2162   // CastPP nodes.
2163   remove_speculative_types(igvn);
2164 
2165   // No more new expensive nodes will be added to the list from here
2166   // so keep only the actual candidates for optimizations.
2167   cleanup_expensive_nodes(igvn);
2168 
2169   if (!failing() && RenumberLiveNodes && live_nodes() + NodeLimitFudgeFactor < unique()) {
2170     NOT_PRODUCT(Compile::TracePhase t2("", &_t_renumberLive, TimeCompiler);)
2171     initial_gvn()->replace_with(&igvn);
2172     for_igvn()->clear();
2173     Unique_Node_List new_worklist(C->comp_arena());
2174     {
2175       ResourceMark rm;
2176       PhaseRenumberLive prl = PhaseRenumberLive(initial_gvn(), for_igvn(), &new_worklist);
2177     }




2067     if (failing())  return;
2068 
2069     {
2070       ResourceMark rm;
2071       PhaseRemoveUseless pru(initial_gvn(), for_igvn());
2072     }
2073 
2074     igvn = PhaseIterGVN(gvn);
2075 
2076     igvn.optimize();
2077   }
2078 
2079   set_inlining_incrementally(false);
2080 }
2081 
2082 
2083 // Remove edges from "root" to each SafePoint at a backward branch.
2084 // They were inserted during parsing (see add_safepoint()) to make
2085 // infinite loops without calls or exceptions visible to root, i.e.,
2086 // useful.
2087 void Compile::remove_root_to_sfpts_edges(PhaseIterGVN& igvn) {
2088   Node *r = root();
2089   if (r != NULL) {
2090     for (uint i = r->req(); i < r->len(); ++i) {
2091       Node *n = r->in(i);
2092       if (n != NULL && n->is_SafePoint()) {
2093         r->rm_prec(i);
2094         if (n->outcnt() == 0) {
2095           igvn.remove_dead_node(n);
2096         }
2097         --i;
2098       }
2099     }
2100   }
2101 }
2102 
2103 //------------------------------Optimize---------------------------------------
2104 // Given a graph, optimize it.
2105 void Compile::Optimize() {
2106   TracePhase t1("optimizer", &_t_optimizer, true);
2107 
2108 #ifndef PRODUCT
2109   if (env()->break_at_compile()) {
2110     BREAKPOINT;
2111   }
2112 
2113 #endif
2114 
2115   ResourceMark rm;
2116   int          loop_opts_cnt;


2140   print_method(PHASE_INCREMENTAL_INLINE, 2);
2141 
2142   if (failing())  return;
2143 
2144   if (eliminate_boxing()) {
2145     NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
2146     // Inline valueOf() methods now.
2147     inline_boxing_calls(igvn);
2148 
2149     if (AlwaysIncrementalInline) {
2150       inline_incrementally(igvn);
2151     }
2152 
2153     print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2);
2154 
2155     if (failing())  return;
2156   }
2157 
2158   // Now that all inlining is over, cut edge from root to loop
2159   // safepoints
2160   remove_root_to_sfpts_edges(igvn);
2161 
2162   // Remove the speculative part of types and clean up the graph from
2163   // the extra CastPP nodes whose only purpose is to carry them. Do
2164   // that early so that optimizations are not disrupted by the extra
2165   // CastPP nodes.
2166   remove_speculative_types(igvn);
2167 
2168   // No more new expensive nodes will be added to the list from here
2169   // so keep only the actual candidates for optimizations.
2170   cleanup_expensive_nodes(igvn);
2171 
2172   if (!failing() && RenumberLiveNodes && live_nodes() + NodeLimitFudgeFactor < unique()) {
2173     NOT_PRODUCT(Compile::TracePhase t2("", &_t_renumberLive, TimeCompiler);)
2174     initial_gvn()->replace_with(&igvn);
2175     for_igvn()->clear();
2176     Unique_Node_List new_worklist(C->comp_arena());
2177     {
2178       ResourceMark rm;
2179       PhaseRenumberLive prl = PhaseRenumberLive(initial_gvn(), for_igvn(), &new_worklist);
2180     }


< prev index next >