cfgnode.hpp revision 2667
1879N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A// Portions of code courtesy of Clifford Click 0N/A// Optimization - Graph Style 0N/A//------------------------------RegionNode------------------------------------- 0N/A// The class of RegionNodes, which can be mapped to basic blocks in the 0N/A// program. Their inputs point to Control sources. PhiNodes (described 0N/A// below) have an input point to a RegionNode. Merged data inputs to PhiNodes 0N/A// correspond 1-to-1 with RegionNode inputs. The zero input of a PhiNode is 0N/A// the RegionNode, and the zero input of the RegionNode is itself. 0N/A // Node layout (parallels PhiNode): 0N/A // Is this region node unreachable from root? 0N/A virtual bool is_CFG ()
const {
return true; }
0N/A//------------------------------JProjNode-------------------------------------- 0N/A// jump projection for node that produces multiple control-flow paths 0N/A//------------------------------PhiNode---------------------------------------- 0N/A// PhiNodes merge values from different Control paths. Slot 0 points to the 0N/A// controlling RegionNode. Other slots map 1-for-1 with incoming control flow 0N/A// paths to the RegionNode. For speed reasons (to avoid another pass) we 0N/A// can turn PhiNodes into copys in-place by NULL'ing out their RegionNode 64N/A // Array elements references have the same alias_idx but different offset. 0N/A // Size is bigger to hold the _adr_type field. 0N/A // Determine if CMoveNode::is_cmove_id can be used at this join point. 0N/A // Node layout (parallels RegionNode): 0N/A enum {
Region,
// Control input is the Phi's region. 0N/A // create a new phi with in edges matching r and set (initially) to x 0N/A // extra type arguments override the new phi's bottom_type and adr_type 0N/A // create a new phi with narrowed memory type 0N/A // like make(r, x), but does not initialize the in edges to x 0N/A // The node is a real phi if _in[0] is a Region node. 64N/A // Determine a unique non-trivial input, if any. 64N/A // Ignore casts if it helps. Return NULL on failure. 0N/A // Check for a simple dead loop. 0N/A // Is it unsafe data loop? It becomes a dead loop if this phi node removed. 0N/A//------------------------------GotoNode--------------------------------------- 0N/A// GotoNodes perform direct branches. 0N/A//------------------------------CProjNode-------------------------------------- 0N/A// control projection for node that produces multiple control-flow paths 0N/A//---------------------------MultiBranchNode----------------------------------- 0N/A// This class defines a MultiBranchNode, a MultiNode which yields multiple 0N/A// control values. These are distinguished from other types of MultiNodes 0N/A// which yield multiple values, but control is always and only projection #0. 127N/A // returns required number of users to be well formed. 0N/A//------------------------------IfNode----------------------------------------- 0N/A// Output selected Control, based on a boolean test 0N/A // Size is bigger to hold the probability field. However, _prob does not 0N/A // change the semantics so it does not appear in the hash & cmp functions. 0N/A // Degrees of branch prediction probability by order of magnitude: 0N/A // PROB_UNLIKELY_1e(N) is a 1 in 1eN chance. 0N/A // PROB_LIKELY_1e(N) is a 1 - PROB_UNLIKELY_1e(N) 0N/A // Maximum and minimum branch prediction probabilties 0N/A // 1 in 1,000,000 (magnitude 6) 0N/A // Although PROB_NEVER == PROB_MIN and PROB_ALWAYS == PROB_MAX 0N/A // they are used to distinguish different situations: 0N/A // The name PROB_MAX (PROB_MIN) is for probabilities which correspond to 0N/A // very likely (unlikely) but with a concrete possibility of a rare 0N/A // contrary case. These constants would be used for pinning 0N/A // measurements, and as measures for assertions that have high 0N/A // confidence, but some evidence of occasional failure. 0N/A // The name PROB_ALWAYS (PROB_NEVER) is to stand for situations for which 0N/A // there is no evidence at all that the contrary case has ever occurred. 0N/A // Static branch prediction probabilities 0N/A // 1 in 10 (magnitude 1) 0N/A // Fair probability 50/50 0N/A // Unknown probability sentinel 0N/A // Probability "constructors", to distinguish as a probability any manifest 0N/A // constant without a names 0N/A // Other probabilities in use, but without a unique name, are documented 0N/A // here for lack of a better place: 0N/A // 1 in 1000 probabilities (magnitude 3): 0N/A // threshold for converting to conditional move 0N/A // likelihood of null check failure if a null HAS been seen before 0N/A // likelihood of slow path taken in library calls 0N/A // 1 in 10,000 probabilities (magnitude 4): 0N/A // threshold for making an uncommon trap probability more extreme 0N/A // threshold for for making a null check implicit 0N/A // likelihood of needing a gc if eden top moves during an allocation 0N/A // likelihood of a predicted call failure 0N/A // 1 in 100,000 probabilities (magnitude 5): 0N/A // threshold for ignoring counts when estimating path frequency 0N/A // likelihood of FP clipping failure 0N/A // likelihood of catching an exception from a try block 0N/A // likelihood of null check failure if a null has NOT been seen before 0N/A // Magic manifest probabilities such as 0.83, 0.7, ... can be found in 0N/A // gen_subtype_check() and catch_inline_exceptions(). 0N/A float _prob;
// Probability of true path being taken. 17N/A // Takes the type of val and filters it through the test represented 17N/A // by if_proj and returns a more refined type if one is produced. 17N/A // Returns NULL is it couldn't improve the type. 0N/A//------------------------------PCTableNode------------------------------------ 0N/A// Build an indirect branch table. Given a control and a table index, 0N/A// control is passed to the Projection matching the table index. Used to 0N/A// implement switch statements and exception-handling capabilities. 0N/A// Undefined behavior if passed-in index is not inside the table. 0N/A//------------------------------JumpNode--------------------------------------- 0N/A// Indirect branch. Uses PCTable above to implement a switch statement. 0N/A// It emits as a table load and local branch. 0N/A//------------------------------CatchNode-------------------------------------- 0N/A// Helper node to fork exceptions. "Catch" catches any exceptions thrown by 0N/A// a just-prior call. Looks like a PCTableNode but emits no code - just the 0N/A// table. The table lookup and branch is implemented by RethrowNode. 0N/A// CatchProjNode controls which exception handler is targetted after a call. 0N/A// It is passed in the bci of the target handler, or no_handler_bci in case 0N/A// the projection doesn't lead to an exception handler. 0N/A//---------------------------------CreateExNode-------------------------------- 0N/A// Helper node to create the exception coming back from a call 0N/A//------------------------------NeverBranchNode------------------------------- 0N/A// The never-taken branch. Used to give the appearance of exiting infinite 0N/A// loops to those algorithms that like all paths to be reachable. Encodes 0N/A virtual bool pinned()
const {
return true; };
1879N/A#
endif // SHARE_VM_OPTO_CFGNODE_HPP