1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/opto/phase.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,126 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_OPTO_PHASE_HPP 1.29 +#define SHARE_VM_OPTO_PHASE_HPP 1.30 + 1.31 +#include "libadt/port.hpp" 1.32 +#include "runtime/timer.hpp" 1.33 + 1.34 +class Compile; 1.35 + 1.36 +//------------------------------Phase------------------------------------------ 1.37 +// Most optimizations are done in Phases. Creating a phase does any long 1.38 +// running analysis required, and caches the analysis in internal data 1.39 +// structures. Later the analysis is queried using transform() calls to 1.40 +// guide transforming the program. When the Phase is deleted, so is any 1.41 +// cached analysis info. This basic Phase class mostly contains timing and 1.42 +// memory management code. 1.43 +class Phase : public StackObj { 1.44 +public: 1.45 + enum PhaseNumber { 1.46 + Compiler, // Top-level compiler phase 1.47 + Parser, // Parse bytecodes 1.48 + Remove_Useless, // Remove useless nodes 1.49 + Optimistic, // Optimistic analysis phase 1.50 + GVN, // Pessimistic global value numbering phase 1.51 + Ins_Select, // Instruction selection phase 1.52 + CFG, // Build a CFG 1.53 + BlockLayout, // Linear ordering of blocks 1.54 + Register_Allocation, // Register allocation, duh 1.55 + LIVE, // Dragon-book LIVE range problem 1.56 + StringOpts, // StringBuilder related optimizations 1.57 + Interference_Graph, // Building the IFG 1.58 + Coalesce, // Coalescing copies 1.59 + Ideal_Loop, // Find idealized trip-counted loops 1.60 + Macro_Expand, // Expand macro nodes 1.61 + Peephole, // Apply peephole optimizations 1.62 + last_phase 1.63 + }; 1.64 +protected: 1.65 + enum PhaseNumber _pnum; // Phase number (for stat gathering) 1.66 + 1.67 +#ifndef PRODUCT 1.68 + static int _total_bytes_compiled; 1.69 + 1.70 + // accumulated timers 1.71 + static elapsedTimer _t_totalCompilation; 1.72 + static elapsedTimer _t_methodCompilation; 1.73 + static elapsedTimer _t_stubCompilation; 1.74 +#endif 1.75 + 1.76 +// The next timers used for LogCompilation 1.77 + static elapsedTimer _t_parser; 1.78 + static elapsedTimer _t_optimizer; 1.79 +public: 1.80 + // ConnectionGraph can't be Phase since it is used after EA done. 1.81 + static elapsedTimer _t_escapeAnalysis; 1.82 + static elapsedTimer _t_connectionGraph; 1.83 +protected: 1.84 + static elapsedTimer _t_idealLoop; 1.85 + static elapsedTimer _t_ccp; 1.86 + static elapsedTimer _t_matcher; 1.87 + static elapsedTimer _t_registerAllocation; 1.88 + static elapsedTimer _t_output; 1.89 + 1.90 +#ifndef PRODUCT 1.91 + static elapsedTimer _t_graphReshaping; 1.92 + static elapsedTimer _t_scheduler; 1.93 + static elapsedTimer _t_blockOrdering; 1.94 + static elapsedTimer _t_macroEliminate; 1.95 + static elapsedTimer _t_macroExpand; 1.96 + static elapsedTimer _t_peephole; 1.97 + static elapsedTimer _t_postalloc_expand; 1.98 + static elapsedTimer _t_codeGeneration; 1.99 + static elapsedTimer _t_registerMethod; 1.100 + static elapsedTimer _t_temporaryTimer1; 1.101 + static elapsedTimer _t_temporaryTimer2; 1.102 + static elapsedTimer _t_idealLoopVerify; 1.103 + 1.104 +// Subtimers for _t_optimizer 1.105 + static elapsedTimer _t_iterGVN; 1.106 + static elapsedTimer _t_iterGVN2; 1.107 + static elapsedTimer _t_incrInline; 1.108 + 1.109 +// Subtimers for _t_registerAllocation 1.110 + static elapsedTimer _t_ctorChaitin; 1.111 + static elapsedTimer _t_buildIFGphysical; 1.112 + static elapsedTimer _t_computeLive; 1.113 + static elapsedTimer _t_regAllocSplit; 1.114 + static elapsedTimer _t_postAllocCopyRemoval; 1.115 + static elapsedTimer _t_fixupSpills; 1.116 + 1.117 +// Subtimers for _t_output 1.118 + static elapsedTimer _t_instrSched; 1.119 + static elapsedTimer _t_buildOopMaps; 1.120 +#endif 1.121 +public: 1.122 + Compile * C; 1.123 + Phase( PhaseNumber pnum ); 1.124 +#ifndef PRODUCT 1.125 + static void print_timers(); 1.126 +#endif 1.127 +}; 1.128 + 1.129 +#endif // SHARE_VM_OPTO_PHASE_HPP