author | kvn |
Mon, 01 Feb 2010 16:49:49 -0800 | |
changeset 4754 | 8aef16f24e16 |
parent 3676 | 3bac3e882cd3 |
child 5547 | f4b087cbb361 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
2 |
* Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 |
* have any questions. |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "incls/_precompiled.incl" |
|
26 |
#include "incls/_phase.cpp.incl" |
|
27 |
||
28 |
#ifndef PRODUCT |
|
29 |
int Phase::_total_bytes_compiled = 0; |
|
30 |
||
31 |
elapsedTimer Phase::_t_totalCompilation; |
|
32 |
elapsedTimer Phase::_t_methodCompilation; |
|
33 |
elapsedTimer Phase::_t_stubCompilation; |
|
34 |
#endif |
|
35 |
||
36 |
// The next timers used for LogCompilation |
|
37 |
elapsedTimer Phase::_t_parser; |
|
38 |
elapsedTimer Phase::_t_escapeAnalysis; |
|
39 |
elapsedTimer Phase::_t_optimizer; |
|
40 |
elapsedTimer Phase::_t_idealLoop; |
|
41 |
elapsedTimer Phase::_t_ccp; |
|
42 |
elapsedTimer Phase::_t_matcher; |
|
43 |
elapsedTimer Phase::_t_registerAllocation; |
|
44 |
elapsedTimer Phase::_t_output; |
|
45 |
||
46 |
#ifndef PRODUCT |
|
47 |
elapsedTimer Phase::_t_graphReshaping; |
|
48 |
elapsedTimer Phase::_t_scheduler; |
|
1498 | 49 |
elapsedTimer Phase::_t_blockOrdering; |
1 | 50 |
elapsedTimer Phase::_t_macroExpand; |
51 |
elapsedTimer Phase::_t_peephole; |
|
52 |
elapsedTimer Phase::_t_codeGeneration; |
|
53 |
elapsedTimer Phase::_t_registerMethod; |
|
54 |
elapsedTimer Phase::_t_temporaryTimer1; |
|
55 |
elapsedTimer Phase::_t_temporaryTimer2; |
|
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
56 |
elapsedTimer Phase::_t_idealLoopVerify; |
1 | 57 |
|
58 |
// Subtimers for _t_optimizer |
|
59 |
elapsedTimer Phase::_t_iterGVN; |
|
60 |
elapsedTimer Phase::_t_iterGVN2; |
|
61 |
||
62 |
// Subtimers for _t_registerAllocation |
|
63 |
elapsedTimer Phase::_t_ctorChaitin; |
|
64 |
elapsedTimer Phase::_t_buildIFGphysical; |
|
65 |
elapsedTimer Phase::_t_computeLive; |
|
66 |
elapsedTimer Phase::_t_regAllocSplit; |
|
67 |
elapsedTimer Phase::_t_postAllocCopyRemoval; |
|
68 |
elapsedTimer Phase::_t_fixupSpills; |
|
69 |
||
70 |
// Subtimers for _t_output |
|
71 |
elapsedTimer Phase::_t_instrSched; |
|
72 |
elapsedTimer Phase::_t_buildOopMaps; |
|
73 |
#endif |
|
74 |
||
75 |
//------------------------------Phase------------------------------------------ |
|
76 |
Phase::Phase( PhaseNumber pnum ) : _pnum(pnum), C( pnum == Compiler ? NULL : Compile::current()) { |
|
2131 | 77 |
// Poll for requests from shutdown mechanism to quiesce compiler (4448539, 4448544). |
1 | 78 |
// This is an effective place to poll, since the compiler is full of phases. |
79 |
// In particular, every inlining site uses a recursively created Parse phase. |
|
80 |
CompileBroker::maybe_block(); |
|
81 |
} |
|
82 |
||
83 |
#ifndef PRODUCT |
|
84 |
static const double minimum_reported_time = 0.0001; // seconds |
|
85 |
static const double expected_method_compile_coverage = 0.97; // % |
|
86 |
static const double minimum_meaningful_method_compile = 2.00; // seconds |
|
87 |
||
88 |
void Phase::print_timers() { |
|
89 |
tty->print_cr ("Accumulated compiler times:"); |
|
90 |
tty->print_cr ("---------------------------"); |
|
91 |
tty->print_cr (" Total compilation: %3.3f sec.", Phase::_t_totalCompilation.seconds()); |
|
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
92 |
tty->print (" method compilation : %3.3f sec", Phase::_t_methodCompilation.seconds()); |
1 | 93 |
tty->print ("/%d bytes",_total_bytes_compiled); |
94 |
tty->print_cr (" (%3.0f bytes per sec) ", Phase::_total_bytes_compiled / Phase::_t_methodCompilation.seconds()); |
|
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
95 |
tty->print_cr (" stub compilation : %3.3f sec.", Phase::_t_stubCompilation.seconds()); |
1 | 96 |
tty->print_cr (" Phases:"); |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
97 |
tty->print_cr (" parse : %3.3f sec", Phase::_t_parser.seconds()); |
1 | 98 |
if (DoEscapeAnalysis) { |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
99 |
tty->print_cr (" escape analysis : %3.3f sec", Phase::_t_escapeAnalysis.seconds()); |
1 | 100 |
} |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
101 |
tty->print_cr (" optimizer : %3.3f sec", Phase::_t_optimizer.seconds()); |
1 | 102 |
if( Verbose || WizardMode ) { |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
103 |
tty->print_cr (" iterGVN : %3.3f sec", Phase::_t_iterGVN.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
104 |
tty->print_cr (" idealLoop : %3.3f sec", Phase::_t_idealLoop.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
105 |
tty->print_cr (" idealLoopVerify: %3.3f sec", Phase::_t_idealLoopVerify.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
106 |
tty->print_cr (" ccp : %3.3f sec", Phase::_t_ccp.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
107 |
tty->print_cr (" iterGVN2 : %3.3f sec", Phase::_t_iterGVN2.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
108 |
tty->print_cr (" graphReshape : %3.3f sec", Phase::_t_graphReshaping.seconds()); |
1 | 109 |
double optimizer_subtotal = Phase::_t_iterGVN.seconds() + |
110 |
Phase::_t_idealLoop.seconds() + Phase::_t_ccp.seconds() + |
|
111 |
Phase::_t_graphReshaping.seconds(); |
|
112 |
double percent_of_optimizer = ((optimizer_subtotal == 0.0) ? 0.0 : (optimizer_subtotal / Phase::_t_optimizer.seconds() * 100.0)); |
|
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
113 |
tty->print_cr (" subtotal : %3.3f sec, %3.2f %%", optimizer_subtotal, percent_of_optimizer); |
1 | 114 |
} |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
115 |
tty->print_cr (" matcher : %3.3f sec", Phase::_t_matcher.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
116 |
tty->print_cr (" scheduler : %3.3f sec", Phase::_t_scheduler.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
117 |
tty->print_cr (" regalloc : %3.3f sec", Phase::_t_registerAllocation.seconds()); |
1 | 118 |
if( Verbose || WizardMode ) { |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
119 |
tty->print_cr (" ctorChaitin : %3.3f sec", Phase::_t_ctorChaitin.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
120 |
tty->print_cr (" buildIFG : %3.3f sec", Phase::_t_buildIFGphysical.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
121 |
tty->print_cr (" computeLive : %3.3f sec", Phase::_t_computeLive.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
122 |
tty->print_cr (" regAllocSplit : %3.3f sec", Phase::_t_regAllocSplit.seconds()); |
1 | 123 |
tty->print_cr (" postAllocCopyRemoval: %3.3f sec", Phase::_t_postAllocCopyRemoval.seconds()); |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
124 |
tty->print_cr (" fixupSpills : %3.3f sec", Phase::_t_fixupSpills.seconds()); |
1 | 125 |
double regalloc_subtotal = Phase::_t_ctorChaitin.seconds() + |
126 |
Phase::_t_buildIFGphysical.seconds() + Phase::_t_computeLive.seconds() + |
|
127 |
Phase::_t_regAllocSplit.seconds() + Phase::_t_fixupSpills.seconds() + |
|
128 |
Phase::_t_postAllocCopyRemoval.seconds(); |
|
129 |
double percent_of_regalloc = ((regalloc_subtotal == 0.0) ? 0.0 : (regalloc_subtotal / Phase::_t_registerAllocation.seconds() * 100.0)); |
|
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
130 |
tty->print_cr (" subtotal : %3.3f sec, %3.2f %%", regalloc_subtotal, percent_of_regalloc); |
1 | 131 |
} |
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
132 |
tty->print_cr (" macroExpand : %3.3f sec", Phase::_t_macroExpand.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
133 |
tty->print_cr (" blockOrdering : %3.3f sec", Phase::_t_blockOrdering.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
134 |
tty->print_cr (" peephole : %3.3f sec", Phase::_t_peephole.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
135 |
tty->print_cr (" codeGen : %3.3f sec", Phase::_t_codeGeneration.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
136 |
tty->print_cr (" install_code : %3.3f sec", Phase::_t_registerMethod.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
137 |
tty->print_cr (" -------------- : ----------"); |
1 | 138 |
double phase_subtotal = Phase::_t_parser.seconds() + |
139 |
(DoEscapeAnalysis ? Phase::_t_escapeAnalysis.seconds() : 0.0) + |
|
140 |
Phase::_t_optimizer.seconds() + Phase::_t_graphReshaping.seconds() + |
|
141 |
Phase::_t_matcher.seconds() + Phase::_t_scheduler.seconds() + |
|
1498 | 142 |
Phase::_t_registerAllocation.seconds() + Phase::_t_blockOrdering.seconds() + |
1 | 143 |
Phase::_t_macroExpand.seconds() + Phase::_t_peephole.seconds() + |
144 |
Phase::_t_codeGeneration.seconds() + Phase::_t_registerMethod.seconds(); |
|
145 |
double percent_of_method_compile = ((phase_subtotal == 0.0) ? 0.0 : phase_subtotal / Phase::_t_methodCompilation.seconds()) * 100.0; |
|
146 |
// counters inside Compile::CodeGen include time for adapters and stubs |
|
147 |
// so phase-total can be greater than 100% |
|
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
148 |
tty->print_cr (" total : %3.3f sec, %3.2f %%", phase_subtotal, percent_of_method_compile); |
1 | 149 |
|
150 |
assert( percent_of_method_compile > expected_method_compile_coverage || |
|
151 |
phase_subtotal < minimum_meaningful_method_compile, |
|
152 |
"Must account for method compilation"); |
|
153 |
||
154 |
if( Phase::_t_temporaryTimer1.seconds() > minimum_reported_time ) { |
|
155 |
tty->cr(); |
|
156 |
tty->print_cr (" temporaryTimer1: %3.3f sec", Phase::_t_temporaryTimer1.seconds()); |
|
157 |
} |
|
158 |
if( Phase::_t_temporaryTimer2.seconds() > minimum_reported_time ) { |
|
159 |
tty->cr(); |
|
160 |
tty->print_cr (" temporaryTimer2: %3.3f sec", Phase::_t_temporaryTimer2.seconds()); |
|
161 |
} |
|
3676
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
162 |
tty->print_cr (" output : %3.3f sec", Phase::_t_output.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
163 |
tty->print_cr (" isched : %3.3f sec", Phase::_t_instrSched.seconds()); |
3bac3e882cd3
6862956: PhaseIdealLoop should have a CFG verification mode
never
parents:
2131
diff
changeset
|
164 |
tty->print_cr (" bldOopMaps : %3.3f sec", Phase::_t_buildOopMaps.seconds()); |
1 | 165 |
} |
166 |
#endif |