2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2013-12-24 11:48:39 -08:00
|
|
|
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* This code is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 only, as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
* accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License version
|
|
|
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
* or visit www.oracle.com if you need additional information or have any
|
|
|
|
* questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-11-23 13:22:55 -08:00
|
|
|
#ifndef SHARE_VM_OPTO_PHASE_HPP
|
|
|
|
#define SHARE_VM_OPTO_PHASE_HPP
|
|
|
|
|
|
|
|
#include "runtime/timer.hpp"
|
|
|
|
|
2014-08-11 14:12:51 +02:00
|
|
|
class IfNode;
|
|
|
|
class MergeMemNode;
|
|
|
|
class Node;
|
|
|
|
class PhaseGVN;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
//------------------------------Phase------------------------------------------
|
|
|
|
// Most optimizations are done in Phases. Creating a phase does any long
|
|
|
|
// running analysis required, and caches the analysis in internal data
|
|
|
|
// structures. Later the analysis is queried using transform() calls to
|
|
|
|
// guide transforming the program. When the Phase is deleted, so is any
|
|
|
|
// cached analysis info. This basic Phase class mostly contains timing and
|
|
|
|
// memory management code.
|
|
|
|
class Phase : public StackObj {
|
|
|
|
public:
|
|
|
|
enum PhaseNumber {
|
|
|
|
Compiler, // Top-level compiler phase
|
|
|
|
Parser, // Parse bytecodes
|
|
|
|
Remove_Useless, // Remove useless nodes
|
|
|
|
Optimistic, // Optimistic analysis phase
|
|
|
|
GVN, // Pessimistic global value numbering phase
|
|
|
|
Ins_Select, // Instruction selection phase
|
|
|
|
CFG, // Build a CFG
|
2008-11-06 14:59:10 -08:00
|
|
|
BlockLayout, // Linear ordering of blocks
|
2007-12-01 00:00:00 +00:00
|
|
|
Register_Allocation, // Register allocation, duh
|
|
|
|
LIVE, // Dragon-book LIVE range problem
|
2009-11-12 09:24:21 -08:00
|
|
|
StringOpts, // StringBuilder related optimizations
|
2007-12-01 00:00:00 +00:00
|
|
|
Interference_Graph, // Building the IFG
|
|
|
|
Coalesce, // Coalescing copies
|
|
|
|
Ideal_Loop, // Find idealized trip-counted loops
|
|
|
|
Macro_Expand, // Expand macro nodes
|
|
|
|
Peephole, // Apply peephole optimizations
|
|
|
|
last_phase
|
|
|
|
};
|
2014-09-25 12:10:57 +04:00
|
|
|
|
|
|
|
enum PhaseTraceId {
|
|
|
|
_t_parser,
|
|
|
|
_t_optimizer,
|
|
|
|
_t_escapeAnalysis,
|
|
|
|
_t_connectionGraph,
|
|
|
|
_t_macroEliminate,
|
|
|
|
_t_iterGVN,
|
|
|
|
_t_incrInline,
|
|
|
|
_t_incrInline_ideal,
|
|
|
|
_t_incrInline_igvn,
|
|
|
|
_t_incrInline_pru,
|
|
|
|
_t_incrInline_inline,
|
|
|
|
_t_idealLoop,
|
|
|
|
_t_idealLoopVerify,
|
|
|
|
_t_ccp,
|
|
|
|
_t_iterGVN2,
|
|
|
|
_t_macroExpand,
|
|
|
|
_t_graphReshaping,
|
|
|
|
_t_matcher,
|
|
|
|
_t_scheduler,
|
|
|
|
_t_registerAllocation,
|
|
|
|
_t_ctorChaitin,
|
|
|
|
_t_buildIFGvirtual,
|
|
|
|
_t_buildIFGphysical,
|
|
|
|
_t_computeLive,
|
|
|
|
_t_regAllocSplit,
|
|
|
|
_t_postAllocCopyRemoval,
|
2015-01-19 12:29:50 -08:00
|
|
|
_t_mergeMultidefs,
|
2014-09-25 12:10:57 +04:00
|
|
|
_t_fixupSpills,
|
|
|
|
_t_chaitinCompact,
|
|
|
|
_t_chaitinCoalesce1,
|
|
|
|
_t_chaitinCoalesce2,
|
|
|
|
_t_chaitinCoalesce3,
|
|
|
|
_t_chaitinCacheLRG,
|
|
|
|
_t_chaitinSimplify,
|
|
|
|
_t_chaitinSelect,
|
|
|
|
_t_blockOrdering,
|
|
|
|
_t_peephole,
|
|
|
|
_t_postalloc_expand,
|
|
|
|
_t_output,
|
|
|
|
_t_instrSched,
|
|
|
|
_t_buildOopMaps,
|
|
|
|
_t_registerMethod,
|
|
|
|
_t_temporaryTimer1,
|
|
|
|
_t_temporaryTimer2,
|
|
|
|
max_phase_timers
|
|
|
|
};
|
|
|
|
|
|
|
|
static elapsedTimer timers[max_phase_timers];
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
protected:
|
|
|
|
enum PhaseNumber _pnum; // Phase number (for stat gathering)
|
|
|
|
|
|
|
|
static int _total_bytes_compiled;
|
|
|
|
|
|
|
|
// accumulated timers
|
|
|
|
static elapsedTimer _t_totalCompilation;
|
|
|
|
static elapsedTimer _t_methodCompilation;
|
|
|
|
static elapsedTimer _t_stubCompilation;
|
2014-08-11 14:12:51 +02:00
|
|
|
|
|
|
|
// Generate a subtyping check. Takes as input the subtype and supertype.
|
|
|
|
// Returns 2 values: sets the default control() to the true path and
|
|
|
|
// returns the false path. Only reads from constant memory taken from the
|
|
|
|
// default memory; does not write anything. It also doesn't take in an
|
|
|
|
// Object; if you wish to check an Object you need to load the Object's
|
|
|
|
// class prior to coming here.
|
|
|
|
// Used in GraphKit and PhaseMacroExpand
|
|
|
|
static Node* gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, MergeMemNode* mem, PhaseGVN* gvn);
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
public:
|
|
|
|
Compile * C;
|
|
|
|
Phase( PhaseNumber pnum );
|
2014-08-11 14:12:51 +02:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
static void print_timers();
|
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
|
|
|
#endif // SHARE_VM_OPTO_PHASE_HPP
|