Mercurial > hg > truffle
comparison src/share/vm/opto/compile.cpp @ 20327:411e30e5fbb8
8026796: Make replace_in_map() on parent maps generic
Summary: propagate node replacements along control flow edges to callers
Reviewed-by: kvn, vlivanov
author | roland |
---|---|
date | Wed, 13 Aug 2014 11:00:22 +0200 |
parents | 0bf37f737702 |
children | 833b0f92429a |
comparison
equal
deleted
inserted
replaced
20326:da00a41842a5 | 20327:411e30e5fbb8 |
---|---|
389 // Disconnect all useless nodes by disconnecting those at the boundary. | 389 // Disconnect all useless nodes by disconnecting those at the boundary. |
390 void Compile::remove_useless_nodes(Unique_Node_List &useful) { | 390 void Compile::remove_useless_nodes(Unique_Node_List &useful) { |
391 uint next = 0; | 391 uint next = 0; |
392 while (next < useful.size()) { | 392 while (next < useful.size()) { |
393 Node *n = useful.at(next++); | 393 Node *n = useful.at(next++); |
394 if (n->is_SafePoint()) { | |
395 // We're done with a parsing phase. Replaced nodes are not valid | |
396 // beyond that point. | |
397 n->as_SafePoint()->delete_replaced_nodes(); | |
398 } | |
394 // Use raw traversal of out edges since this code removes out edges | 399 // Use raw traversal of out edges since this code removes out edges |
395 int max = n->outcnt(); | 400 int max = n->outcnt(); |
396 for (int j = 0; j < max; ++j) { | 401 for (int j = 0; j < max; ++j) { |
397 Node* child = n->raw_out(j); | 402 Node* child = n->raw_out(j); |
398 if (! useful.member(child)) { | 403 if (! useful.member(child)) { |
668 _number_of_mh_late_inlines(0), | 673 _number_of_mh_late_inlines(0), |
669 _inlining_progress(false), | 674 _inlining_progress(false), |
670 _inlining_incrementally(false), | 675 _inlining_incrementally(false), |
671 _print_inlining_list(NULL), | 676 _print_inlining_list(NULL), |
672 _print_inlining_idx(0), | 677 _print_inlining_idx(0), |
673 _preserve_jvm_state(0), | |
674 _interpreter_frame_size(0) { | 678 _interpreter_frame_size(0) { |
675 C = this; | 679 C = this; |
676 | 680 |
677 CompileWrapper cw(this); | 681 CompileWrapper cw(this); |
678 #ifndef PRODUCT | 682 #ifndef PRODUCT |
780 if (cg == NULL) { | 784 if (cg == NULL) { |
781 record_method_not_compilable_all_tiers("cannot parse method"); | 785 record_method_not_compilable_all_tiers("cannot parse method"); |
782 return; | 786 return; |
783 } | 787 } |
784 JVMState* jvms = build_start_state(start(), tf()); | 788 JVMState* jvms = build_start_state(start(), tf()); |
785 if ((jvms = cg->generate(jvms, NULL)) == NULL) { | 789 if ((jvms = cg->generate(jvms)) == NULL) { |
786 record_method_not_compilable("method parse failed"); | 790 record_method_not_compilable("method parse failed"); |
787 return; | 791 return; |
788 } | 792 } |
789 GraphKit kit(jvms); | 793 GraphKit kit(jvms); |
790 | 794 |
975 _number_of_mh_late_inlines(0), | 979 _number_of_mh_late_inlines(0), |
976 _inlining_progress(false), | 980 _inlining_progress(false), |
977 _inlining_incrementally(false), | 981 _inlining_incrementally(false), |
978 _print_inlining_list(NULL), | 982 _print_inlining_list(NULL), |
979 _print_inlining_idx(0), | 983 _print_inlining_idx(0), |
980 _preserve_jvm_state(0), | |
981 _allowed_reasons(0), | 984 _allowed_reasons(0), |
982 _interpreter_frame_size(0) { | 985 _interpreter_frame_size(0) { |
983 C = this; | 986 C = this; |
984 | 987 |
985 #ifndef PRODUCT | 988 #ifndef PRODUCT |
1908 | 1911 |
1909 assert( igvn._worklist.size() == 0, "should be done with igvn" ); | 1912 assert( igvn._worklist.size() == 0, "should be done with igvn" ); |
1910 for_igvn()->clear(); | 1913 for_igvn()->clear(); |
1911 gvn->replace_with(&igvn); | 1914 gvn->replace_with(&igvn); |
1912 | 1915 |
1916 _late_inlines_pos = _late_inlines.length(); | |
1917 | |
1913 while (_boxing_late_inlines.length() > 0) { | 1918 while (_boxing_late_inlines.length() > 0) { |
1914 CallGenerator* cg = _boxing_late_inlines.pop(); | 1919 CallGenerator* cg = _boxing_late_inlines.pop(); |
1915 cg->do_late_inline(); | 1920 cg->do_late_inline(); |
1916 if (failing()) return; | 1921 if (failing()) return; |
1917 } | 1922 } |
1971 while(inlining_progress() && _late_inlines.length() > 0) { | 1976 while(inlining_progress() && _late_inlines.length() > 0) { |
1972 | 1977 |
1973 if (live_nodes() > (uint)LiveNodeCountInliningCutoff) { | 1978 if (live_nodes() > (uint)LiveNodeCountInliningCutoff) { |
1974 if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) { | 1979 if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) { |
1975 // PhaseIdealLoop is expensive so we only try it once we are | 1980 // PhaseIdealLoop is expensive so we only try it once we are |
1976 // out of loop and we only try it again if the previous helped | 1981 // out of live nodes and we only try it again if the previous |
1977 // got the number of nodes down significantly | 1982 // helped got the number of nodes down significantly |
1978 PhaseIdealLoop ideal_loop( igvn, false, true ); | 1983 PhaseIdealLoop ideal_loop( igvn, false, true ); |
1979 if (failing()) return; | 1984 if (failing()) return; |
1980 low_live_nodes = live_nodes(); | 1985 low_live_nodes = live_nodes(); |
1981 _major_progress = true; | 1986 _major_progress = true; |
1982 } | 1987 } |
2063 | 2068 |
2064 if (eliminate_boxing()) { | 2069 if (eliminate_boxing()) { |
2065 NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); ) | 2070 NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); ) |
2066 // Inline valueOf() methods now. | 2071 // Inline valueOf() methods now. |
2067 inline_boxing_calls(igvn); | 2072 inline_boxing_calls(igvn); |
2073 | |
2074 if (AlwaysIncrementalInline) { | |
2075 inline_incrementally(igvn); | |
2076 } | |
2068 | 2077 |
2069 print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2); | 2078 print_method(PHASE_INCREMENTAL_BOXING_INLINE, 2); |
2070 | 2079 |
2071 if (failing()) return; | 2080 if (failing()) return; |
2072 } | 2081 } |