src/share/vm/opto/compile.cpp

Print this page

        

*** 665,684 **** _print_inlining_output(NULL), _interpreter_frame_size(0) { C = this; CompileWrapper cw(this); ! #ifndef PRODUCT ! if (TimeCompiler2) { tty->print(" "); target->holder()->name()->print(); tty->print("."); target->print_short_name(); tty->print(" "); } ! TraceTime t1("Total compilation time", &_t_totalCompilation, TimeCompiler, TimeCompiler2); ! TraceTime t2(NULL, &_t_methodCompilation, TimeCompiler, false); bool print_opto_assembly = PrintOptoAssembly || _method->has_option("PrintOptoAssembly"); if (!print_opto_assembly) { bool print_assembly = (PrintAssembly || _method->should_print_assembly()); if (print_assembly && !Disassembler::can_decode()) { tty->print_cr("PrintAssembly request changed to PrintOptoAssembly"); --- 665,686 ---- _print_inlining_output(NULL), _interpreter_frame_size(0) { C = this; CompileWrapper cw(this); ! ! if (CITimeVerbose) { tty->print(" "); target->holder()->name()->print(); tty->print("."); target->print_short_name(); tty->print(" "); } ! TraceTime t1("Total compilation time", &_t_totalCompilation, CITime, CITimeVerbose); ! TraceTime t2(NULL, &_t_methodCompilation, CITime, false); ! ! #ifndef PRODUCT bool print_opto_assembly = PrintOptoAssembly || _method->has_option("PrintOptoAssembly"); if (!print_opto_assembly) { bool print_assembly = (PrintAssembly || _method->should_print_assembly()); if (print_assembly && !Disassembler::can_decode()) { tty->print_cr("PrintAssembly request changed to PrintOptoAssembly");
*** 724,734 **** PhaseGVN gvn(node_arena(), estimated_size); set_initial_gvn(&gvn); print_inlining_init(); { // Scope for timing the parser ! TracePhase t3("parse", &_t_parser, true); // Put top into the hash table ASAP. initial_gvn()->transform_no_reclaim(top()); // Set up tf(), start(), and find a CallGenerator. --- 726,736 ---- PhaseGVN gvn(node_arena(), estimated_size); set_initial_gvn(&gvn); print_inlining_init(); { // Scope for timing the parser ! TracePhase t3("parse", &timers[_t_parser]); // Put top into the hash table ASAP. initial_gvn()->transform_no_reclaim(top()); // Set up tf(), start(), and find a CallGenerator.
*** 886,896 **** #ifndef PRODUCT if (OptoNoExecute) { record_method_not_compilable("+OptoNoExecute"); // Flag as failed return; } ! TracePhase t2("install_code", &_t_registerMethod, TimeCompiler); #endif if (is_osr_compilation()) { _code_offsets.set_value(CodeOffsets::Verified_Entry, 0); _code_offsets.set_value(CodeOffsets::OSR_Entry, _first_block_size); --- 888,898 ---- #ifndef PRODUCT if (OptoNoExecute) { record_method_not_compilable("+OptoNoExecute"); // Flag as failed return; } ! TracePhase t2("install_code", &_t_registerMethod); #endif if (is_osr_compilation()) { _code_offsets.set_value(CodeOffsets::Verified_Entry, 0); _code_offsets.set_value(CodeOffsets::OSR_Entry, _first_block_size);
*** 975,987 **** _print_inlining_output(NULL), _allowed_reasons(0), _interpreter_frame_size(0) { C = this; #ifndef PRODUCT - TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false); - TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false); set_print_assembly(PrintFrameConverterAssembly); set_parsed_irreducible_loop(false); #endif set_has_irreducible_loop(false); // no loops --- 977,990 ---- _print_inlining_output(NULL), _allowed_reasons(0), _interpreter_frame_size(0) { C = this; + TraceTime t1(NULL, &_t_totalCompilation, CITime, false); + TraceTime t2(NULL, &_t_stubCompilation, CITime, false); + #ifndef PRODUCT set_print_assembly(PrintFrameConverterAssembly); set_parsed_irreducible_loop(false); #endif set_has_irreducible_loop(false); // no loops
*** 2032,2042 **** //------------------------------Optimize--------------------------------------- // Given a graph, optimize it. void Compile::Optimize() { ! TracePhase t1("optimizer", &_t_optimizer, true); #ifndef PRODUCT if (env()->break_at_compile()) { BREAKPOINT; } --- 2035,2045 ---- //------------------------------Optimize--------------------------------------- // Given a graph, optimize it. void Compile::Optimize() { ! TracePhase t1("optimizer", &timers[_t_optimizer]); #ifndef PRODUCT if (env()->break_at_compile()) { BREAKPOINT; }
*** 2058,2086 **** PhaseIterGVN igvn(initial_gvn()); #ifdef ASSERT _modified_nodes = new (comp_arena()) Unique_Node_List(comp_arena()); #endif { ! NOT_PRODUCT( TracePhase t2("iterGVN", &_t_iterGVN, TimeCompiler); ) igvn.optimize(); } print_method(PHASE_ITER_GVN1, 2); if (failing()) return; { ! NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); ) inline_incrementally(igvn); } print_method(PHASE_INCREMENTAL_INLINE, 2); if (failing()) return; if (eliminate_boxing()) { ! NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); ) // Inline valueOf() methods now. inline_boxing_calls(igvn); if (AlwaysIncrementalInline) { inline_incrementally(igvn); --- 2061,2089 ---- PhaseIterGVN igvn(initial_gvn()); #ifdef ASSERT _modified_nodes = new (comp_arena()) Unique_Node_List(comp_arena()); #endif { ! TracePhase t2("iterGVN", &timers[_t_iterGVN]); igvn.optimize(); } print_method(PHASE_ITER_GVN1, 2); if (failing()) return; { ! TracePhase t2("incrementalInline", &timers[_t_incrInline]); inline_incrementally(igvn); } print_method(PHASE_INCREMENTAL_INLINE, 2); if (failing()) return; if (eliminate_boxing()) { ! TracePhase t2("incrementalInline", &timers[_t_incrInline]); // Inline valueOf() methods now. inline_boxing_calls(igvn); if (AlwaysIncrementalInline) { inline_incrementally(igvn);
*** 2103,2113 **** // Perform escape analysis if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) { if (has_loops()) { // Cleanup graph (remove dead nodes). ! TracePhase t2("idealLoop", &_t_idealLoop, true); PhaseIdealLoop ideal_loop( igvn, false, true ); if (major_progress()) print_method(PHASE_PHASEIDEAL_BEFORE_EA, 2); if (failing()) return; } ConnectionGraph::do_analysis(this, &igvn); --- 2106,2116 ---- // Perform escape analysis if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) { if (has_loops()) { // Cleanup graph (remove dead nodes). ! TracePhase t2("idealLoop", &timers[_t_idealLoop]); PhaseIdealLoop ideal_loop( igvn, false, true ); if (major_progress()) print_method(PHASE_PHASEIDEAL_BEFORE_EA, 2); if (failing()) return; } ConnectionGraph::do_analysis(this, &igvn);
*** 2119,2129 **** print_method(PHASE_ITER_GVN_AFTER_EA, 2); if (failing()) return; if (congraph() != NULL && macro_count() > 0) { ! NOT_PRODUCT( TracePhase t2("macroEliminate", &_t_macroEliminate, TimeCompiler); ) PhaseMacroExpand mexp(igvn); mexp.eliminate_macro_nodes(); igvn.set_delay_transform(false); igvn.optimize(); --- 2122,2132 ---- print_method(PHASE_ITER_GVN_AFTER_EA, 2); if (failing()) return; if (congraph() != NULL && macro_count() > 0) { ! TracePhase t2("macroEliminate", &timers[_t_macroEliminate]); PhaseMacroExpand mexp(igvn); mexp.eliminate_macro_nodes(); igvn.set_delay_transform(false); igvn.optimize();
*** 2138,2190 **** // Set loop opts counter loop_opts_cnt = num_loop_opts(); if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) { { ! TracePhase t2("idealLoop", &_t_idealLoop, true); PhaseIdealLoop ideal_loop( igvn, true ); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP1, 2); if (failing()) return; } // Loop opts pass if partial peeling occurred in previous pass if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) { ! TracePhase t3("idealLoop", &_t_idealLoop, true); PhaseIdealLoop ideal_loop( igvn, false ); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP2, 2); if (failing()) return; } // Loop opts pass for loop-unrolling before CCP if(major_progress() && (loop_opts_cnt > 0)) { ! TracePhase t4("idealLoop", &_t_idealLoop, true); PhaseIdealLoop ideal_loop( igvn, false ); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP3, 2); } if (!failing()) { // Verify that last round of loop opts produced a valid graph ! NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); ) PhaseIdealLoop::verify(igvn); } } if (failing()) return; // Conditional Constant Propagation; PhaseCCP ccp( &igvn ); assert( true, "Break here to ccp.dump_nodes_and_types(_root,999,1)"); { ! TracePhase t2("ccp", &_t_ccp, true); ccp.do_transform(); } print_method(PHASE_CPP1, 2); assert( true, "Break here to ccp.dump_old2new_map()"); // Iterative Global Value Numbering, including ideal transforms { ! NOT_PRODUCT( TracePhase t2("iterGVN2", &_t_iterGVN2, TimeCompiler); ) igvn = ccp; igvn.optimize(); } print_method(PHASE_ITER_GVN2, 2); --- 2141,2193 ---- // Set loop opts counter loop_opts_cnt = num_loop_opts(); if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) { { ! TracePhase t2("idealLoop", &timers[_t_idealLoop]); PhaseIdealLoop ideal_loop( igvn, true ); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP1, 2); if (failing()) return; } // Loop opts pass if partial peeling occurred in previous pass if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) { ! TracePhase t3("idealLoop", &timers[_t_idealLoop]); PhaseIdealLoop ideal_loop( igvn, false ); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP2, 2); if (failing()) return; } // Loop opts pass for loop-unrolling before CCP if(major_progress() && (loop_opts_cnt > 0)) { ! TracePhase t4("idealLoop", &timers[_t_idealLoop]); PhaseIdealLoop ideal_loop( igvn, false ); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP3, 2); } if (!failing()) { // Verify that last round of loop opts produced a valid graph ! TracePhase t2("idealLoopVerify", &timers[_t_idealLoopVerify]); PhaseIdealLoop::verify(igvn); } } if (failing()) return; // Conditional Constant Propagation; PhaseCCP ccp( &igvn ); assert( true, "Break here to ccp.dump_nodes_and_types(_root,999,1)"); { ! TracePhase t2("ccp", &timers[_t_ccp]); ccp.do_transform(); } print_method(PHASE_CPP1, 2); assert( true, "Break here to ccp.dump_old2new_map()"); // Iterative Global Value Numbering, including ideal transforms { ! TracePhase t2("iterGVN2", &timers[_t_iterGVN2]); igvn = ccp; igvn.optimize(); } print_method(PHASE_ITER_GVN2, 2);
*** 2194,2204 **** // Loop transforms on the ideal graph. Range Check Elimination, // peeling, unrolling, etc. if(loop_opts_cnt > 0) { debug_only( int cnt = 0; ); while(major_progress() && (loop_opts_cnt > 0)) { ! TracePhase t2("idealLoop", &_t_idealLoop, true); assert( cnt++ < 40, "infinite cycle in loop optimization" ); PhaseIdealLoop ideal_loop( igvn, true); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP_ITERATIONS, 2); if (failing()) return; --- 2197,2207 ---- // Loop transforms on the ideal graph. Range Check Elimination, // peeling, unrolling, etc. if(loop_opts_cnt > 0) { debug_only( int cnt = 0; ); while(major_progress() && (loop_opts_cnt > 0)) { ! TracePhase t2("idealLoop", &timers[_t_idealLoop]); assert( cnt++ < 40, "infinite cycle in loop optimization" ); PhaseIdealLoop ideal_loop( igvn, true); loop_opts_cnt--; if (major_progress()) print_method(PHASE_PHASEIDEALLOOP_ITERATIONS, 2); if (failing()) return;
*** 2206,2221 **** } { // Verify that all previous optimizations produced a valid graph // at least to this point, even if no loop optimizations were done. ! NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); ) PhaseIdealLoop::verify(igvn); } { ! NOT_PRODUCT( TracePhase t2("macroExpand", &_t_macroExpand, TimeCompiler); ) PhaseMacroExpand mex(igvn); if (mex.expand_macro_nodes()) { assert(failing(), "must bail out w/ explicit message"); return; } --- 2209,2224 ---- } { // Verify that all previous optimizations produced a valid graph // at least to this point, even if no loop optimizations were done. ! TracePhase t2("idealLoopVerify", &timers[_t_idealLoopVerify]); PhaseIdealLoop::verify(igvn); } { ! TracePhase t2("macroExpand", &timers[_t_macroExpand]); PhaseMacroExpand mex(igvn); if (mex.expand_macro_nodes()) { assert(failing(), "must bail out w/ explicit message"); return; }
*** 2225,2235 **** } // (End scope of igvn; run destructor if necessary for asserts.) process_print_inlining(); // A method with only infinite loops has no edges entering loops from root { ! NOT_PRODUCT( TracePhase t2("graphReshape", &_t_graphReshaping, TimeCompiler); ) if (final_graph_reshaping()) { assert(failing(), "must bail out w/ explicit message"); return; } } --- 2228,2238 ---- } // (End scope of igvn; run destructor if necessary for asserts.) process_print_inlining(); // A method with only infinite loops has no edges entering loops from root { ! TracePhase t2("graphReshape", &timers[_t_graphReshaping]); if (final_graph_reshaping()) { assert(failing(), "must bail out w/ explicit message"); return; } }
*** 2256,2266 **** NOT_PRODUCT( verify_graph_edges(); ) Matcher matcher; _matcher = &matcher; { ! TracePhase t2("matcher", &_t_matcher, true); matcher.match(); } // In debug mode can dump m._nodes.dump() for mapping of ideal to machine // nodes. Mapping is only valid at the root of each matched subtree. NOT_PRODUCT( verify_graph_edges(); ) --- 2259,2269 ---- NOT_PRODUCT( verify_graph_edges(); ) Matcher matcher; _matcher = &matcher; { ! TracePhase t2("matcher", &timers[_t_matcher]); matcher.match(); } // In debug mode can dump m._nodes.dump() for mapping of ideal to machine // nodes. Mapping is only valid at the root of each matched subtree. NOT_PRODUCT( verify_graph_edges(); )
*** 2273,2283 **** // Build a proper-looking CFG PhaseCFG cfg(node_arena(), root(), matcher); _cfg = &cfg; { ! NOT_PRODUCT( TracePhase t2("scheduler", &_t_scheduler, TimeCompiler); ) bool success = cfg.do_global_code_motion(); if (!success) { return; } --- 2276,2286 ---- // Build a proper-looking CFG PhaseCFG cfg(node_arena(), root(), matcher); _cfg = &cfg; { ! TracePhase t2("scheduler", &timers[_t_scheduler]); bool success = cfg.do_global_code_motion(); if (!success) { return; }
*** 2287,2297 **** } PhaseChaitin regalloc(unique(), cfg, matcher); _regalloc = &regalloc; { ! TracePhase t2("regalloc", &_t_registerAllocation, true); // Perform register allocation. After Chaitin, use-def chains are // no longer accurate (at spill code) and so must be ignored. // Node->LRG->reg mappings are still accurate. _regalloc->Register_Allocate(); --- 2290,2300 ---- } PhaseChaitin regalloc(unique(), cfg, matcher); _regalloc = &regalloc; { ! TracePhase t2("regalloc", &timers[_t_registerAllocation]); // Perform register allocation. After Chaitin, use-def chains are // no longer accurate (at spill code) and so must be ignored. // Node->LRG->reg mappings are still accurate. _regalloc->Register_Allocate();
*** 2304,2314 **** // Prior to register allocation we kept empty basic blocks in case the // the allocator needed a place to spill. After register allocation we // are not adding any new instructions. If any basic block is empty, we // can now safely remove it. { ! NOT_PRODUCT( TracePhase t2("blockOrdering", &_t_blockOrdering, TimeCompiler); ) cfg.remove_empty_blocks(); if (do_freq_based_layout()) { PhaseBlockLayout layout(cfg); } else { cfg.set_loop_alignment(); --- 2307,2317 ---- // Prior to register allocation we kept empty basic blocks in case the // the allocator needed a place to spill. After register allocation we // are not adding any new instructions. If any basic block is empty, we // can now safely remove it. { ! TracePhase t2("blockOrdering", &timers[_t_blockOrdering]); cfg.remove_empty_blocks(); if (do_freq_based_layout()) { PhaseBlockLayout layout(cfg); } else { cfg.set_loop_alignment();
*** 2316,2341 **** cfg.fixup_flow(); } // Apply peephole optimizations if( OptoPeephole ) { ! NOT_PRODUCT( TracePhase t2("peephole", &_t_peephole, TimeCompiler); ) PhasePeephole peep( _regalloc, cfg); peep.do_transform(); } // Do late expand if CPU requires this. if (Matcher::require_postalloc_expand) { ! NOT_PRODUCT(TracePhase t2c("postalloc_expand", &_t_postalloc_expand, true)); cfg.postalloc_expand(_regalloc); } // Convert Nodes to instruction bits in a buffer { ! // %%%% workspace merge brought two timers together for one job ! TracePhase t2a("output", &_t_output, true); ! NOT_PRODUCT( TraceTime t2b(NULL, &_t_codeGeneration, TimeCompiler, false); ) Output(); } print_method(PHASE_FINAL_CODE); --- 2319,2342 ---- cfg.fixup_flow(); } // Apply peephole optimizations if( OptoPeephole ) { ! TracePhase t2("peephole", &timers[_t_peephole]); PhasePeephole peep( _regalloc, cfg); peep.do_transform(); } // Do late expand if CPU requires this. if (Matcher::require_postalloc_expand) { ! TracePhase t2c("postalloc_expand", &timers[_t_postalloc_expand]); cfg.postalloc_expand(_regalloc); } // Convert Nodes to instruction bits in a buffer { ! TraceTime t2b("output", &timers[_t_output], CITime); Output(); } print_method(PHASE_FINAL_CODE);
*** 3536,3550 **** C->print_method(PHASE_FAILURE); } _root = NULL; // flush the graph, too } ! Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator, bool dolog) ! : TraceTime(NULL, accumulator, false NOT_PRODUCT( || TimeCompiler ), false), ! _phase_name(name), _dolog(dolog) { ! if (dolog) { C = Compile::current(); _log = C->log(); } else { C = NULL; _log = NULL; --- 3537,3551 ---- C->print_method(PHASE_FAILURE); } _root = NULL; // flush the graph, too } ! Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator) ! : TraceTime(name, accumulator, CITime, CITimeVerbose), ! _phase_name(name), _dolog(CITimeVerbose) { ! if (_dolog) { C = Compile::current(); _log = C->log(); } else { C = NULL; _log = NULL;