src/share/vm/opto/compile.cpp

Print this page

        

@@ -665,20 +665,22 @@
                   _print_inlining_output(NULL),
                   _interpreter_frame_size(0) {
   C = this;
 
   CompileWrapper cw(this);
-#ifndef PRODUCT
-  if (TimeCompiler2) {
+
+  if (CITimeVerbose) {
     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);
+  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,11 +726,11 @@
   PhaseGVN gvn(node_arena(), estimated_size);
   set_initial_gvn(&gvn);
 
   print_inlining_init();
   { // Scope for timing the parser
-    TracePhase t3("parse", &_t_parser, true);
+    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,11 +888,11 @@
 #ifndef PRODUCT
     if (OptoNoExecute) {
       record_method_not_compilable("+OptoNoExecute");  // Flag as failed
       return;
     }
-    TracePhase t2("install_code", &_t_registerMethod, TimeCompiler);
+    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,13 +977,14 @@
     _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
-  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
 

@@ -2032,11 +2035,11 @@
 
 
 //------------------------------Optimize---------------------------------------
 // Given a graph, optimize it.
 void Compile::Optimize() {
-  TracePhase t1("optimizer", &_t_optimizer, true);
+  TracePhase t1("optimizer", &timers[_t_optimizer]);
 
 #ifndef PRODUCT
   if (env()->break_at_compile()) {
     BREAKPOINT;
   }

@@ -2058,29 +2061,29 @@
   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); )
+    TracePhase t2("iterGVN", &timers[_t_iterGVN]);
     igvn.optimize();
   }
 
   print_method(PHASE_ITER_GVN1, 2);
 
   if (failing())  return;
 
   {
-    NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
+    TracePhase t2("incrementalInline", &timers[_t_incrInline]);
     inline_incrementally(igvn);
   }
 
   print_method(PHASE_INCREMENTAL_INLINE, 2);
 
   if (failing())  return;
 
   if (eliminate_boxing()) {
-    NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
+    TracePhase t2("incrementalInline", &timers[_t_incrInline]);
     // Inline valueOf() methods now.
     inline_boxing_calls(igvn);
 
     if (AlwaysIncrementalInline) {
       inline_incrementally(igvn);

@@ -2103,11 +2106,11 @@
 
   // 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);
+      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,11 +2122,11 @@
     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); )
+      TracePhase t2("macroEliminate", &timers[_t_macroEliminate]);
       PhaseMacroExpand mexp(igvn);
       mexp.eliminate_macro_nodes();
       igvn.set_delay_transform(false);
 
       igvn.optimize();

@@ -2138,53 +2141,53 @@
 
   // 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);
+      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", &_t_idealLoop, true);
+      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", &_t_idealLoop, true);
+      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
-      NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); )
+      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", &_t_ccp, true);
+    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
   {
-    NOT_PRODUCT( TracePhase t2("iterGVN2", &_t_iterGVN2, TimeCompiler); )
+    TracePhase t2("iterGVN2", &timers[_t_iterGVN2]);
     igvn = ccp;
     igvn.optimize();
   }
 
   print_method(PHASE_ITER_GVN2, 2);

@@ -2194,11 +2197,11 @@
   // 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);
+      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,16 +2209,16 @@
   }
 
   {
     // 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); )
+    TracePhase t2("idealLoopVerify", &timers[_t_idealLoopVerify]);
     PhaseIdealLoop::verify(igvn);
   }
 
   {
-    NOT_PRODUCT( TracePhase t2("macroExpand", &_t_macroExpand, TimeCompiler); )
+    TracePhase t2("macroExpand", &timers[_t_macroExpand]);
     PhaseMacroExpand  mex(igvn);
     if (mex.expand_macro_nodes()) {
       assert(failing(), "must bail out w/ explicit message");
       return;
     }

@@ -2225,11 +2228,11 @@
  } // (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); )
+    TracePhase t2("graphReshape", &timers[_t_graphReshaping]);
     if (final_graph_reshaping()) {
       assert(failing(), "must bail out w/ explicit message");
       return;
     }
   }

@@ -2256,11 +2259,11 @@
   NOT_PRODUCT( verify_graph_edges(); )
 
   Matcher matcher;
   _matcher = &matcher;
   {
-    TracePhase t2("matcher", &_t_matcher, true);
+    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,11 +2276,11 @@
 
   // Build a proper-looking CFG
   PhaseCFG cfg(node_arena(), root(), matcher);
   _cfg = &cfg;
   {
-    NOT_PRODUCT( TracePhase t2("scheduler", &_t_scheduler, TimeCompiler); )
+    TracePhase t2("scheduler", &timers[_t_scheduler]);
     bool success = cfg.do_global_code_motion();
     if (!success) {
       return;
     }
 

@@ -2287,11 +2290,11 @@
   }
 
   PhaseChaitin regalloc(unique(), cfg, matcher);
   _regalloc = &regalloc;
   {
-    TracePhase t2("regalloc", &_t_registerAllocation, true);
+    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,11 +2307,11 @@
   // 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); )
+    TracePhase t2("blockOrdering", &timers[_t_blockOrdering]);
     cfg.remove_empty_blocks();
     if (do_freq_based_layout()) {
       PhaseBlockLayout layout(cfg);
     } else {
       cfg.set_loop_alignment();

@@ -2316,26 +2319,24 @@
     cfg.fixup_flow();
   }
 
   // Apply peephole optimizations
   if( OptoPeephole ) {
-    NOT_PRODUCT( TracePhase t2("peephole", &_t_peephole, TimeCompiler); )
+    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) {
-    NOT_PRODUCT(TracePhase t2c("postalloc_expand", &_t_postalloc_expand, true));
+    TracePhase t2c("postalloc_expand", &timers[_t_postalloc_expand]);
     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); )
+    TraceTime t2b("output", &timers[_t_output], CITime);
     Output();
   }
 
   print_method(PHASE_FINAL_CODE);
 

@@ -3536,15 +3537,15 @@
     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)
+Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator)
+  : TraceTime(name, accumulator, CITime, CITimeVerbose),
+    _phase_name(name), _dolog(CITimeVerbose)
 {
-  if (dolog) {
+  if (_dolog) {
     C = Compile::current();
     _log = C->log();
   } else {
     C = NULL;
     _log = NULL;