0N/A/*
3845N/A * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
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 *
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 *
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.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_OPTO_NODE_HPP
1879N/A#define SHARE_VM_OPTO_NODE_HPP
1879N/A
1879N/A#include "libadt/port.hpp"
1879N/A#include "libadt/vectset.hpp"
1879N/A#include "opto/compile.hpp"
1879N/A#include "opto/type.hpp"
1879N/A
0N/A// Portions of code courtesy of Clifford Click
0N/A
0N/A// Optimization - Graph Style
0N/A
0N/A
0N/Aclass AbstractLockNode;
0N/Aclass AddNode;
0N/Aclass AddPNode;
0N/Aclass AliasInfo;
0N/Aclass AllocateArrayNode;
0N/Aclass AllocateNode;
0N/Aclass Block;
0N/Aclass Block_Array;
0N/Aclass BoolNode;
0N/Aclass BoxLockNode;
0N/Aclass CMoveNode;
0N/Aclass CallDynamicJavaNode;
0N/Aclass CallJavaNode;
0N/Aclass CallLeafNode;
0N/Aclass CallNode;
0N/Aclass CallRuntimeNode;
0N/Aclass CallStaticJavaNode;
0N/Aclass CatchNode;
0N/Aclass CatchProjNode;
0N/Aclass CheckCastPPNode;
1100N/Aclass ClearArrayNode;
0N/Aclass CmpNode;
0N/Aclass CodeBuffer;
0N/Aclass ConstraintCastNode;
0N/Aclass ConNode;
0N/Aclass CountedLoopNode;
0N/Aclass CountedLoopEndNode;
168N/Aclass DecodeNNode;
168N/Aclass EncodePNode;
0N/Aclass FastLockNode;
0N/Aclass FastUnlockNode;
0N/Aclass IfNode;
2667N/Aclass IfFalseNode;
2667N/Aclass IfTrueNode;
0N/Aclass InitializeNode;
0N/Aclass JVMState;
0N/Aclass JumpNode;
0N/Aclass JumpProjNode;
0N/Aclass LoadNode;
0N/Aclass LoadStoreNode;
0N/Aclass LockNode;
0N/Aclass LoopNode;
2678N/Aclass MachBranchNode;
0N/Aclass MachCallDynamicJavaNode;
0N/Aclass MachCallJavaNode;
0N/Aclass MachCallLeafNode;
0N/Aclass MachCallNode;
0N/Aclass MachCallRuntimeNode;
0N/Aclass MachCallStaticJavaNode;
1915N/Aclass MachConstantBaseNode;
1915N/Aclass MachConstantNode;
2667N/Aclass MachGotoNode;
0N/Aclass MachIfNode;
0N/Aclass MachNode;
0N/Aclass MachNullCheckNode;
2667N/Aclass MachProjNode;
0N/Aclass MachReturnNode;
0N/Aclass MachSafePointNode;
0N/Aclass MachSpillCopyNode;
0N/Aclass MachTempNode;
0N/Aclass Matcher;
0N/Aclass MemBarNode;
3043N/Aclass MemBarStoreStoreNode;
0N/Aclass MemNode;
0N/Aclass MergeMemNode;
3845N/Aclass MulNode;
0N/Aclass MultiNode;
0N/Aclass MultiBranchNode;
0N/Aclass NeverBranchNode;
0N/Aclass Node;
0N/Aclass Node_Array;
0N/Aclass Node_List;
0N/Aclass Node_Stack;
0N/Aclass NullCheckNode;
0N/Aclass OopMap;
33N/Aclass ParmNode;
0N/Aclass PCTableNode;
0N/Aclass PhaseCCP;
0N/Aclass PhaseGVN;
0N/Aclass PhaseIterGVN;
0N/Aclass PhaseRegAlloc;
0N/Aclass PhaseTransform;
0N/Aclass PhaseValues;
0N/Aclass PhiNode;
0N/Aclass Pipeline;
0N/Aclass ProjNode;
0N/Aclass RegMask;
0N/Aclass RegionNode;
0N/Aclass RootNode;
0N/Aclass SafePointNode;
63N/Aclass SafePointScalarObjectNode;
0N/Aclass StartNode;
0N/Aclass State;
0N/Aclass StoreNode;
0N/Aclass SubNode;
0N/Aclass Type;
0N/Aclass TypeNode;
0N/Aclass UnlockNode;
2667N/Aclass VectorNode;
3845N/Aclass LoadVectorNode;
3845N/Aclass StoreVectorNode;
0N/Aclass VectorSet;
0N/Atypedef void (*NFunc)(Node&,void*);
0N/Aextern "C" {
0N/A typedef int (*C_sort_func_t)(const void *, const void *);
0N/A}
0N/A
0N/A// The type of all node counts and indexes.
0N/A// It must hold at least 16 bits, but must also be fast to load and store.
0N/A// This type, if less than 32 bits, could limit the number of possible nodes.
0N/A// (To make this type platform-specific, move to globalDefinitions_xxx.hpp.)
0N/Atypedef unsigned int node_idx_t;
0N/A
0N/A
0N/A#ifndef OPTO_DU_ITERATOR_ASSERT
0N/A#ifdef ASSERT
0N/A#define OPTO_DU_ITERATOR_ASSERT 1
0N/A#else
0N/A#define OPTO_DU_ITERATOR_ASSERT 0
0N/A#endif
0N/A#endif //OPTO_DU_ITERATOR_ASSERT
0N/A
0N/A#if OPTO_DU_ITERATOR_ASSERT
0N/Aclass DUIterator;
0N/Aclass DUIterator_Fast;
0N/Aclass DUIterator_Last;
0N/A#else
0N/Atypedef uint DUIterator;
0N/Atypedef Node** DUIterator_Fast;
0N/Atypedef Node** DUIterator_Last;
0N/A#endif
0N/A
0N/A// Node Sentinel
0N/A#define NodeSentinel (Node*)-1
0N/A
0N/A// Unknown count frequency
0N/A#define COUNT_UNKNOWN (-1.0f)
0N/A
0N/A//------------------------------Node-------------------------------------------
0N/A// Nodes define actions in the program. They create values, which have types.
0N/A// They are both vertices in a directed graph and program primitives. Nodes
0N/A// are labeled; the label is the "opcode", the primitive function in the lambda
0N/A// calculus sense that gives meaning to the Node. Node inputs are ordered (so
0N/A// that "a-b" is different from "b-a"). The inputs to a Node are the inputs to
0N/A// the Node's function. These inputs also define a Type equation for the Node.
0N/A// Solving these Type equations amounts to doing dataflow analysis.
0N/A// Control and data are uniformly represented in the graph. Finally, Nodes
0N/A// have a unique dense integer index which is used to index into side arrays
0N/A// whenever I have phase-specific information.
0N/A
0N/Aclass Node {
2772N/A friend class VMStructs;
2772N/A
0N/A // Lots of restrictions on cloning Nodes
0N/A Node(const Node&); // not defined; linker error to use these
0N/A Node &operator=(const Node &rhs);
0N/A
0N/Apublic:
0N/A friend class Compile;
0N/A #if OPTO_DU_ITERATOR_ASSERT
0N/A friend class DUIterator_Common;
0N/A friend class DUIterator;
0N/A friend class DUIterator_Fast;
0N/A friend class DUIterator_Last;
0N/A #endif
0N/A
0N/A // Because Nodes come and go, I define an Arena of Node structures to pull
0N/A // from. This should allow fast access to node creation & deletion. This
0N/A // field is a local cache of a value defined in some "program fragment" for
0N/A // which these Nodes are just a part of.
0N/A
0N/A // New Operator that takes a Compile pointer, this will eventually
0N/A // be the "new" New operator.
0N/A inline void* operator new( size_t x, Compile* C) {
0N/A Node* n = (Node*)C->node_arena()->Amalloc_D(x);
0N/A#ifdef ASSERT
0N/A n->_in = (Node**)n; // magic cookie for assertion check
0N/A#endif
0N/A n->_out = (Node**)C;
0N/A return (void*)n;
0N/A }
0N/A
0N/A // Delete is a NOP
0N/A void operator delete( void *ptr ) {}
0N/A // Fancy destructor; eagerly attempt to reclaim Node numberings and storage
0N/A void destruct();
0N/A
0N/A // Create a new Node. Required is the number is of inputs required for
0N/A // semantic correctness.
0N/A Node( uint required );
0N/A
0N/A // Create a new Node with given input edges.
0N/A // This version requires use of the "edge-count" new.
0N/A // E.g. new (C,3) FooNode( C, NULL, left, right );
0N/A Node( Node *n0 );
0N/A Node( Node *n0, Node *n1 );
0N/A Node( Node *n0, Node *n1, Node *n2 );
0N/A Node( Node *n0, Node *n1, Node *n2, Node *n3 );
0N/A Node( Node *n0, Node *n1, Node *n2, Node *n3, Node *n4 );
0N/A Node( Node *n0, Node *n1, Node *n2, Node *n3, Node *n4, Node *n5 );
0N/A Node( Node *n0, Node *n1, Node *n2, Node *n3,
0N/A Node *n4, Node *n5, Node *n6 );
0N/A
0N/A // Clone an inherited Node given only the base Node type.
0N/A Node* clone() const;
0N/A
0N/A // Clone a Node, immediately supplying one or two new edges.
0N/A // The first and second arguments, if non-null, replace in(1) and in(2),
0N/A // respectively.
0N/A Node* clone_with_data_edge(Node* in1, Node* in2 = NULL) const {
0N/A Node* nn = clone();
0N/A if (in1 != NULL) nn->set_req(1, in1);
0N/A if (in2 != NULL) nn->set_req(2, in2);
0N/A return nn;
0N/A }
0N/A
0N/Aprivate:
0N/A // Shared setup for the above constructors.
0N/A // Handles all interactions with Compile::current.
0N/A // Puts initial values in all Node fields except _idx.
0N/A // Returns the initial value for _idx, which cannot
0N/A // be initialized by assignment.
0N/A inline int Init(int req, Compile* C);
0N/A
0N/A//----------------- input edge handling
0N/Aprotected:
0N/A friend class PhaseCFG; // Access to address of _in array elements
0N/A Node **_in; // Array of use-def references to Nodes
0N/A Node **_out; // Array of def-use references to Nodes
0N/A
605N/A // Input edges are split into two categories. Required edges are required
0N/A // for semantic correctness; order is important and NULLs are allowed.
0N/A // Precedence edges are used to help determine execution order and are
0N/A // added, e.g., for scheduling purposes. They are unordered and not
0N/A // duplicated; they have no embedded NULLs. Edges from 0 to _cnt-1
0N/A // are required, from _cnt to _max-1 are precedence edges.
0N/A node_idx_t _cnt; // Total number of required Node inputs.
0N/A
0N/A node_idx_t _max; // Actual length of input array.
0N/A
0N/A // Output edges are an unordered list of def-use edges which exactly
0N/A // correspond to required input edges which point from other nodes
0N/A // to this one. Thus the count of the output edges is the number of
0N/A // users of this node.
0N/A node_idx_t _outcnt; // Total number of Node outputs.
0N/A
0N/A node_idx_t _outmax; // Actual length of output array.
0N/A
0N/A // Grow the actual input array to the next larger power-of-2 bigger than len.
0N/A void grow( uint len );
0N/A // Grow the output array to the next larger power-of-2 bigger than len.
0N/A void out_grow( uint len );
0N/A
0N/A public:
0N/A // Each Node is assigned a unique small/dense number. This number is used
0N/A // to index into auxiliary arrays of data and bitvectors.
0N/A // It is declared const to defend against inadvertant assignment,
0N/A // since it is used by clients as a naked field.
0N/A const node_idx_t _idx;
0N/A
0N/A // Get the (read-only) number of input edges
0N/A uint req() const { return _cnt; }
0N/A uint len() const { return _max; }
0N/A // Get the (read-only) number of output edges
0N/A uint outcnt() const { return _outcnt; }
0N/A
0N/A#if OPTO_DU_ITERATOR_ASSERT
0N/A // Iterate over the out-edges of this node. Deletions are illegal.
0N/A inline DUIterator outs() const;
0N/A // Use this when the out array might have changed to suppress asserts.
0N/A inline DUIterator& refresh_out_pos(DUIterator& i) const;
0N/A // Does the node have an out at this position? (Used for iteration.)
0N/A inline bool has_out(DUIterator& i) const;
0N/A inline Node* out(DUIterator& i) const;
0N/A // Iterate over the out-edges of this node. All changes are illegal.
0N/A inline DUIterator_Fast fast_outs(DUIterator_Fast& max) const;
0N/A inline Node* fast_out(DUIterator_Fast& i) const;
0N/A // Iterate over the out-edges of this node, deleting one at a time.
0N/A inline DUIterator_Last last_outs(DUIterator_Last& min) const;
0N/A inline Node* last_out(DUIterator_Last& i) const;
0N/A // The inline bodies of all these methods are after the iterator definitions.
0N/A#else
0N/A // Iterate over the out-edges of this node. Deletions are illegal.
0N/A // This iteration uses integral indexes, to decouple from array reallocations.
0N/A DUIterator outs() const { return 0; }
0N/A // Use this when the out array might have changed to suppress asserts.
0N/A DUIterator refresh_out_pos(DUIterator i) const { return i; }
0N/A
0N/A // Reference to the i'th output Node. Error if out of bounds.
0N/A Node* out(DUIterator i) const { assert(i < _outcnt, "oob"); return _out[i]; }
0N/A // Does the node have an out at this position? (Used for iteration.)
0N/A bool has_out(DUIterator i) const { return i < _outcnt; }
0N/A
0N/A // Iterate over the out-edges of this node. All changes are illegal.
0N/A // This iteration uses a pointer internal to the out array.
0N/A DUIterator_Fast fast_outs(DUIterator_Fast& max) const {
0N/A Node** out = _out;
0N/A // Assign a limit pointer to the reference argument:
0N/A max = out + (ptrdiff_t)_outcnt;
0N/A // Return the base pointer:
0N/A return out;
0N/A }
0N/A Node* fast_out(DUIterator_Fast i) const { return *i; }
0N/A // Iterate over the out-edges of this node, deleting one at a time.
0N/A // This iteration uses a pointer internal to the out array.
0N/A DUIterator_Last last_outs(DUIterator_Last& min) const {
0N/A Node** out = _out;
0N/A // Assign a limit pointer to the reference argument:
0N/A min = out;
0N/A // Return the pointer to the start of the iteration:
0N/A return out + (ptrdiff_t)_outcnt - 1;
0N/A }
0N/A Node* last_out(DUIterator_Last i) const { return *i; }
0N/A#endif
0N/A
0N/A // Reference to the i'th input Node. Error if out of bounds.
3934N/A Node* in(uint i) const { assert(i < _max, err_msg_res("oob: i=%d, _max=%d", i, _max)); return _in[i]; }
0N/A // Reference to the i'th output Node. Error if out of bounds.
0N/A // Use this accessor sparingly. We are going trying to use iterators instead.
0N/A Node* raw_out(uint i) const { assert(i < _outcnt,"oob"); return _out[i]; }
0N/A // Return the unique out edge.
0N/A Node* unique_out() const { assert(_outcnt==1,"not unique"); return _out[0]; }
0N/A // Delete out edge at position 'i' by moving last out edge to position 'i'
0N/A void raw_del_out(uint i) {
0N/A assert(i < _outcnt,"oob");
0N/A assert(_outcnt > 0,"oob");
0N/A #if OPTO_DU_ITERATOR_ASSERT
0N/A // Record that a change happened here.
0N/A debug_only(_last_del = _out[i]; ++_del_tick);
0N/A #endif
0N/A _out[i] = _out[--_outcnt];
0N/A // Smash the old edge so it can't be used accidentally.
0N/A debug_only(_out[_outcnt] = (Node *)(uintptr_t)0xdeadbeef);
0N/A }
0N/A
0N/A#ifdef ASSERT
0N/A bool is_dead() const;
0N/A#define is_not_dead(n) ((n) == NULL || !VerifyIterativeGVN || !((n)->is_dead()))
0N/A#endif
4321N/A // Check whether node has become unreachable
4321N/A bool is_unreachable(PhaseIterGVN &igvn) const;
0N/A
0N/A // Set a required input edge, also updates corresponding output edge
0N/A void add_req( Node *n ); // Append a NEW required input
0N/A void add_req_batch( Node* n, uint m ); // Append m NEW required inputs (all n).
0N/A void del_req( uint idx ); // Delete required edge & compact
0N/A void ins_req( uint i, Node *n ); // Insert a NEW required input
0N/A void set_req( uint i, Node *n ) {
0N/A assert( is_not_dead(n), "can not use dead node");
3934N/A assert( i < _cnt, err_msg_res("oob: i=%d, _cnt=%d", i, _cnt));
0N/A assert( !VerifyHashTableKeys || _hash_lock == 0,
0N/A "remove node from hash table before modifying it");
0N/A Node** p = &_in[i]; // cache this._in, across the del_out call
0N/A if (*p != NULL) (*p)->del_out((Node *)this);
0N/A (*p) = n;
0N/A if (n != NULL) n->add_out((Node *)this);
0N/A }
0N/A // Light version of set_req() to init inputs after node creation.
0N/A void init_req( uint i, Node *n ) {
0N/A assert( i == 0 && this == n ||
0N/A is_not_dead(n), "can not use dead node");
0N/A assert( i < _cnt, "oob");
0N/A assert( !VerifyHashTableKeys || _hash_lock == 0,
0N/A "remove node from hash table before modifying it");
0N/A assert( _in[i] == NULL, "sanity");
0N/A _in[i] = n;
0N/A if (n != NULL) n->add_out((Node *)this);
0N/A }
0N/A // Find first occurrence of n among my edges:
0N/A int find_edge(Node* n);
0N/A int replace_edge(Node* old, Node* neww);
0N/A // NULL out all inputs to eliminate incoming Def-Use edges.
0N/A // Return the number of edges between 'n' and 'this'
4123N/A int disconnect_inputs(Node *n, Compile *c);
0N/A
0N/A // Quickly, return true if and only if I am Compile::current()->top().
0N/A bool is_top() const {
0N/A assert((this == (Node*) Compile::current()->top()) == (_out == NULL), "");
0N/A return (_out == NULL);
0N/A }
0N/A // Reaffirm invariants for is_top. (Only from Compile::set_cached_top_node.)
0N/A void setup_is_top();
0N/A
0N/A // Strip away casting. (It is depth-limited.)
0N/A Node* uncast() const;
3058N/A // Return whether two Nodes are equivalent, after stripping casting.
3058N/A bool eqv_uncast(const Node* n) const {
3058N/A return (this->uncast() == n->uncast());
3058N/A }
0N/A
0N/Aprivate:
0N/A static Node* uncast_helper(const Node* n);
0N/A
0N/A // Add an output edge to the end of the list
0N/A void add_out( Node *n ) {
0N/A if (is_top()) return;
0N/A if( _outcnt == _outmax ) out_grow(_outcnt);
0N/A _out[_outcnt++] = n;
0N/A }
0N/A // Delete an output edge
0N/A void del_out( Node *n ) {
0N/A if (is_top()) return;
0N/A Node** outp = &_out[_outcnt];
0N/A // Find and remove n
0N/A do {
0N/A assert(outp > _out, "Missing Def-Use edge");
0N/A } while (*--outp != n);
0N/A *outp = _out[--_outcnt];
0N/A // Smash the old edge so it can't be used accidentally.
0N/A debug_only(_out[_outcnt] = (Node *)(uintptr_t)0xdeadbeef);
0N/A // Record that a change happened here.
0N/A #if OPTO_DU_ITERATOR_ASSERT
0N/A debug_only(_last_del = n; ++_del_tick);
0N/A #endif
0N/A }
0N/A
0N/Apublic:
0N/A // Globally replace this node by a given new node, updating all uses.
0N/A void replace_by(Node* new_node);
168N/A // Globally replace this node by a given new node, updating all uses
168N/A // and cutting input edges of old node.
4123N/A void subsume_by(Node* new_node, Compile* c) {
168N/A replace_by(new_node);
4123N/A disconnect_inputs(NULL, c);
168N/A }
0N/A void set_req_X( uint i, Node *n, PhaseIterGVN *igvn );
0N/A // Find the one non-null required input. RegionNode only
0N/A Node *nonnull_req() const;
0N/A // Add or remove precedence edges
0N/A void add_prec( Node *n );
0N/A void rm_prec( uint i );
0N/A void set_prec( uint i, Node *n ) {
0N/A assert( is_not_dead(n), "can not use dead node");
0N/A assert( i >= _cnt, "not a precedence edge");
0N/A if (_in[i] != NULL) _in[i]->del_out((Node *)this);
0N/A _in[i] = n;
0N/A if (n != NULL) n->add_out((Node *)this);
0N/A }
0N/A // Set this node's index, used by cisc_version to replace current node
0N/A void set_idx(uint new_idx) {
0N/A const node_idx_t* ref = &_idx;
0N/A *(node_idx_t*)ref = new_idx;
0N/A }
0N/A // Swap input edge order. (Edge indexes i1 and i2 are usually 1 and 2.)
0N/A void swap_edges(uint i1, uint i2) {
0N/A debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
0N/A // Def-Use info is unchanged
0N/A Node* n1 = in(i1);
0N/A Node* n2 = in(i2);
0N/A _in[i1] = n2;
0N/A _in[i2] = n1;
0N/A // If this node is in the hash table, make sure it doesn't need a rehash.
0N/A assert(check_hash == NO_HASH || check_hash == hash(), "edge swap must preserve hash code");
0N/A }
0N/A
0N/A // Iterators over input Nodes for a Node X are written as:
0N/A // for( i = 0; i < X.req(); i++ ) ... X[i] ...
0N/A // NOTE: Required edges can contain embedded NULL pointers.
0N/A
0N/A//----------------- Other Node Properties
0N/A
0N/A // Generate class id for some ideal nodes to avoid virtual query
0N/A // methods is_<Node>().
0N/A // Class id is the set of bits corresponded to the node class and all its
0N/A // super classes so that queries for super classes are also valid.
0N/A // Subclasses of the same super class have different assigned bit
0N/A // (the third parameter in the macro DEFINE_CLASS_ID).
0N/A // Classes with deeper hierarchy are declared first.
0N/A // Classes with the same hierarchy depth are sorted by usage frequency.
0N/A //
0N/A // The query method masks the bits to cut off bits of subclasses
0N/A // and then compare the result with the class id
0N/A // (see the macro DEFINE_CLASS_QUERY below).
0N/A //
0N/A // Class_MachCall=30, ClassMask_MachCall=31
0N/A // 12 8 4 0
0N/A // 0 0 0 0 0 0 0 0 1 1 1 1 0
0N/A // | | | |
0N/A // | | | Bit_Mach=2
0N/A // | | Bit_MachReturn=4
0N/A // | Bit_MachSafePoint=8
0N/A // Bit_MachCall=16
0N/A //
0N/A // Class_CountedLoop=56, ClassMask_CountedLoop=63
0N/A // 12 8 4 0
0N/A // 0 0 0 0 0 0 0 1 1 1 0 0 0
0N/A // | | |
0N/A // | | Bit_Region=8
0N/A // | Bit_Loop=16
0N/A // Bit_CountedLoop=32
0N/A
0N/A #define DEFINE_CLASS_ID(cl, supcl, subn) \
0N/A Bit_##cl = (Class_##supcl == 0) ? 1 << subn : (Bit_##supcl) << (1 + subn) , \
0N/A Class_##cl = Class_##supcl + Bit_##cl , \
0N/A ClassMask_##cl = ((Bit_##cl << 1) - 1) ,
0N/A
0N/A // This enum is used only for C2 ideal and mach nodes with is_<node>() methods
0N/A // so that it's values fits into 16 bits.
0N/A enum NodeClasses {
0N/A Bit_Node = 0x0000,
0N/A Class_Node = 0x0000,
0N/A ClassMask_Node = 0xFFFF,
0N/A
0N/A DEFINE_CLASS_ID(Multi, Node, 0)
0N/A DEFINE_CLASS_ID(SafePoint, Multi, 0)
0N/A DEFINE_CLASS_ID(Call, SafePoint, 0)
0N/A DEFINE_CLASS_ID(CallJava, Call, 0)
0N/A DEFINE_CLASS_ID(CallStaticJava, CallJava, 0)
0N/A DEFINE_CLASS_ID(CallDynamicJava, CallJava, 1)
0N/A DEFINE_CLASS_ID(CallRuntime, Call, 1)
0N/A DEFINE_CLASS_ID(CallLeaf, CallRuntime, 0)
0N/A DEFINE_CLASS_ID(Allocate, Call, 2)
0N/A DEFINE_CLASS_ID(AllocateArray, Allocate, 0)
0N/A DEFINE_CLASS_ID(AbstractLock, Call, 3)
0N/A DEFINE_CLASS_ID(Lock, AbstractLock, 0)
0N/A DEFINE_CLASS_ID(Unlock, AbstractLock, 1)
0N/A DEFINE_CLASS_ID(MultiBranch, Multi, 1)
0N/A DEFINE_CLASS_ID(PCTable, MultiBranch, 0)
0N/A DEFINE_CLASS_ID(Catch, PCTable, 0)
0N/A DEFINE_CLASS_ID(Jump, PCTable, 1)
0N/A DEFINE_CLASS_ID(If, MultiBranch, 1)
0N/A DEFINE_CLASS_ID(CountedLoopEnd, If, 0)
0N/A DEFINE_CLASS_ID(NeverBranch, MultiBranch, 2)
0N/A DEFINE_CLASS_ID(Start, Multi, 2)
0N/A DEFINE_CLASS_ID(MemBar, Multi, 3)
3043N/A DEFINE_CLASS_ID(Initialize, MemBar, 0)
3043N/A DEFINE_CLASS_ID(MemBarStoreStore, MemBar, 1)
0N/A
0N/A DEFINE_CLASS_ID(Mach, Node, 1)
0N/A DEFINE_CLASS_ID(MachReturn, Mach, 0)
0N/A DEFINE_CLASS_ID(MachSafePoint, MachReturn, 0)
0N/A DEFINE_CLASS_ID(MachCall, MachSafePoint, 0)
0N/A DEFINE_CLASS_ID(MachCallJava, MachCall, 0)
0N/A DEFINE_CLASS_ID(MachCallStaticJava, MachCallJava, 0)
0N/A DEFINE_CLASS_ID(MachCallDynamicJava, MachCallJava, 1)
0N/A DEFINE_CLASS_ID(MachCallRuntime, MachCall, 1)
0N/A DEFINE_CLASS_ID(MachCallLeaf, MachCallRuntime, 0)
2678N/A DEFINE_CLASS_ID(MachBranch, Mach, 1)
2678N/A DEFINE_CLASS_ID(MachIf, MachBranch, 0)
2678N/A DEFINE_CLASS_ID(MachGoto, MachBranch, 1)
2678N/A DEFINE_CLASS_ID(MachNullCheck, MachBranch, 2)
2678N/A DEFINE_CLASS_ID(MachSpillCopy, Mach, 2)
2678N/A DEFINE_CLASS_ID(MachTemp, Mach, 3)
2678N/A DEFINE_CLASS_ID(MachConstantBase, Mach, 4)
2678N/A DEFINE_CLASS_ID(MachConstant, Mach, 5)
0N/A
2667N/A DEFINE_CLASS_ID(Type, Node, 2)
0N/A DEFINE_CLASS_ID(Phi, Type, 0)
0N/A DEFINE_CLASS_ID(ConstraintCast, Type, 1)
0N/A DEFINE_CLASS_ID(CheckCastPP, Type, 2)
0N/A DEFINE_CLASS_ID(CMove, Type, 3)
63N/A DEFINE_CLASS_ID(SafePointScalarObject, Type, 4)
168N/A DEFINE_CLASS_ID(DecodeN, Type, 5)
168N/A DEFINE_CLASS_ID(EncodeP, Type, 6)
0N/A
2667N/A DEFINE_CLASS_ID(Proj, Node, 3)
2667N/A DEFINE_CLASS_ID(CatchProj, Proj, 0)
2667N/A DEFINE_CLASS_ID(JumpProj, Proj, 1)
2667N/A DEFINE_CLASS_ID(IfTrue, Proj, 2)
2667N/A DEFINE_CLASS_ID(IfFalse, Proj, 3)
2667N/A DEFINE_CLASS_ID(Parm, Proj, 4)
2667N/A DEFINE_CLASS_ID(MachProj, Proj, 5)
2667N/A
2667N/A DEFINE_CLASS_ID(Mem, Node, 4)
0N/A DEFINE_CLASS_ID(Load, Mem, 0)
3845N/A DEFINE_CLASS_ID(LoadVector, Load, 0)
0N/A DEFINE_CLASS_ID(Store, Mem, 1)
3845N/A DEFINE_CLASS_ID(StoreVector, Store, 0)
0N/A DEFINE_CLASS_ID(LoadStore, Mem, 2)
0N/A
2667N/A DEFINE_CLASS_ID(Region, Node, 5)
2667N/A DEFINE_CLASS_ID(Loop, Region, 0)
2667N/A DEFINE_CLASS_ID(Root, Loop, 0)
2667N/A DEFINE_CLASS_ID(CountedLoop, Loop, 1)
2667N/A
2667N/A DEFINE_CLASS_ID(Sub, Node, 6)
2667N/A DEFINE_CLASS_ID(Cmp, Sub, 0)
2667N/A DEFINE_CLASS_ID(FastLock, Cmp, 0)
2667N/A DEFINE_CLASS_ID(FastUnlock, Cmp, 1)
2667N/A
0N/A DEFINE_CLASS_ID(MergeMem, Node, 7)
0N/A DEFINE_CLASS_ID(Bool, Node, 8)
0N/A DEFINE_CLASS_ID(AddP, Node, 9)
0N/A DEFINE_CLASS_ID(BoxLock, Node, 10)
0N/A DEFINE_CLASS_ID(Add, Node, 11)
3845N/A DEFINE_CLASS_ID(Mul, Node, 12)
3845N/A DEFINE_CLASS_ID(Vector, Node, 13)
3845N/A DEFINE_CLASS_ID(ClearArray, Node, 14)
0N/A
1100N/A _max_classes = ClassMask_ClearArray
0N/A };
0N/A #undef DEFINE_CLASS_ID
0N/A
0N/A // Flags are sorted by usage frequency.
0N/A enum NodeFlags {
0N/A Flag_is_Copy = 0x01, // should be first bit to avoid shift
2667N/A Flag_rematerialize = Flag_is_Copy << 1,
0N/A Flag_needs_anti_dependence_check = Flag_rematerialize << 1,
0N/A Flag_is_macro = Flag_needs_anti_dependence_check << 1,
0N/A Flag_is_Con = Flag_is_macro << 1,
0N/A Flag_is_cisc_alternate = Flag_is_Con << 1,
2678N/A Flag_is_dead_loop_safe = Flag_is_cisc_alternate << 1,
0N/A Flag_may_be_short_branch = Flag_is_dead_loop_safe << 1,
2676N/A Flag_avoid_back_to_back = Flag_may_be_short_branch << 1,
2963N/A Flag_has_call = Flag_avoid_back_to_back << 1,
4321N/A Flag_is_expensive = Flag_has_call << 1,
4321N/A _max_flags = (Flag_is_expensive << 1) - 1 // allow flags combination
0N/A };
0N/A
0N/Aprivate:
0N/A jushort _class_id;
0N/A jushort _flags;
0N/A
0N/Aprotected:
0N/A // These methods should be called from constructors only.
0N/A void init_class_id(jushort c) {
0N/A assert(c <= _max_classes, "invalid node class");
0N/A _class_id = c; // cast out const
0N/A }
0N/A void init_flags(jushort fl) {
0N/A assert(fl <= _max_flags, "invalid node flag");
0N/A _flags |= fl;
0N/A }
0N/A void clear_flag(jushort fl) {
0N/A assert(fl <= _max_flags, "invalid node flag");
0N/A _flags &= ~fl;
0N/A }
0N/A
0N/Apublic:
0N/A const jushort class_id() const { return _class_id; }
0N/A
0N/A const jushort flags() const { return _flags; }
0N/A
0N/A // Return a dense integer opcode number
0N/A virtual int Opcode() const;
0N/A
0N/A // Virtual inherited Node size
0N/A virtual uint size_of() const;
0N/A
0N/A // Other interesting Node properties
1080N/A #define DEFINE_CLASS_QUERY(type) \
1080N/A bool is_##type() const { \
0N/A return ((_class_id & ClassMask_##type) == Class_##type); \
1080N/A } \
1080N/A type##Node *as_##type() const { \
1080N/A assert(is_##type(), "invalid node class"); \
1080N/A return (type##Node*)this; \
1080N/A } \
1080N/A type##Node* isa_##type() const { \
1080N/A return (is_##type()) ? as_##type() : NULL; \
0N/A }
0N/A
0N/A DEFINE_CLASS_QUERY(AbstractLock)
0N/A DEFINE_CLASS_QUERY(Add)
0N/A DEFINE_CLASS_QUERY(AddP)
0N/A DEFINE_CLASS_QUERY(Allocate)
0N/A DEFINE_CLASS_QUERY(AllocateArray)
0N/A DEFINE_CLASS_QUERY(Bool)
0N/A DEFINE_CLASS_QUERY(BoxLock)
2667N/A DEFINE_CLASS_QUERY(Call)
0N/A DEFINE_CLASS_QUERY(CallDynamicJava)
0N/A DEFINE_CLASS_QUERY(CallJava)
0N/A DEFINE_CLASS_QUERY(CallLeaf)
0N/A DEFINE_CLASS_QUERY(CallRuntime)
0N/A DEFINE_CLASS_QUERY(CallStaticJava)
0N/A DEFINE_CLASS_QUERY(Catch)
0N/A DEFINE_CLASS_QUERY(CatchProj)
0N/A DEFINE_CLASS_QUERY(CheckCastPP)
0N/A DEFINE_CLASS_QUERY(ConstraintCast)
1100N/A DEFINE_CLASS_QUERY(ClearArray)
0N/A DEFINE_CLASS_QUERY(CMove)
0N/A DEFINE_CLASS_QUERY(Cmp)
0N/A DEFINE_CLASS_QUERY(CountedLoop)
0N/A DEFINE_CLASS_QUERY(CountedLoopEnd)
168N/A DEFINE_CLASS_QUERY(DecodeN)
168N/A DEFINE_CLASS_QUERY(EncodeP)
0N/A DEFINE_CLASS_QUERY(FastLock)
0N/A DEFINE_CLASS_QUERY(FastUnlock)
0N/A DEFINE_CLASS_QUERY(If)
0N/A DEFINE_CLASS_QUERY(IfFalse)
0N/A DEFINE_CLASS_QUERY(IfTrue)
0N/A DEFINE_CLASS_QUERY(Initialize)
0N/A DEFINE_CLASS_QUERY(Jump)
0N/A DEFINE_CLASS_QUERY(JumpProj)
0N/A DEFINE_CLASS_QUERY(Load)
0N/A DEFINE_CLASS_QUERY(LoadStore)
0N/A DEFINE_CLASS_QUERY(Lock)
0N/A DEFINE_CLASS_QUERY(Loop)
0N/A DEFINE_CLASS_QUERY(Mach)
2678N/A DEFINE_CLASS_QUERY(MachBranch)
0N/A DEFINE_CLASS_QUERY(MachCall)
0N/A DEFINE_CLASS_QUERY(MachCallDynamicJava)
0N/A DEFINE_CLASS_QUERY(MachCallJava)
0N/A DEFINE_CLASS_QUERY(MachCallLeaf)
0N/A DEFINE_CLASS_QUERY(MachCallRuntime)
0N/A DEFINE_CLASS_QUERY(MachCallStaticJava)
1915N/A DEFINE_CLASS_QUERY(MachConstantBase)
1915N/A DEFINE_CLASS_QUERY(MachConstant)
2667N/A DEFINE_CLASS_QUERY(MachGoto)
0N/A DEFINE_CLASS_QUERY(MachIf)
0N/A DEFINE_CLASS_QUERY(MachNullCheck)
2667N/A DEFINE_CLASS_QUERY(MachProj)
0N/A DEFINE_CLASS_QUERY(MachReturn)
0N/A DEFINE_CLASS_QUERY(MachSafePoint)
0N/A DEFINE_CLASS_QUERY(MachSpillCopy)
0N/A DEFINE_CLASS_QUERY(MachTemp)
0N/A DEFINE_CLASS_QUERY(Mem)
0N/A DEFINE_CLASS_QUERY(MemBar)
3043N/A DEFINE_CLASS_QUERY(MemBarStoreStore)
0N/A DEFINE_CLASS_QUERY(MergeMem)
3845N/A DEFINE_CLASS_QUERY(Mul)
0N/A DEFINE_CLASS_QUERY(Multi)
0N/A DEFINE_CLASS_QUERY(MultiBranch)
33N/A DEFINE_CLASS_QUERY(Parm)
0N/A DEFINE_CLASS_QUERY(PCTable)
0N/A DEFINE_CLASS_QUERY(Phi)
0N/A DEFINE_CLASS_QUERY(Proj)
0N/A DEFINE_CLASS_QUERY(Region)
0N/A DEFINE_CLASS_QUERY(Root)
0N/A DEFINE_CLASS_QUERY(SafePoint)
63N/A DEFINE_CLASS_QUERY(SafePointScalarObject)
0N/A DEFINE_CLASS_QUERY(Start)
0N/A DEFINE_CLASS_QUERY(Store)
0N/A DEFINE_CLASS_QUERY(Sub)
0N/A DEFINE_CLASS_QUERY(Type)
2667N/A DEFINE_CLASS_QUERY(Vector)
3845N/A DEFINE_CLASS_QUERY(LoadVector)
3845N/A DEFINE_CLASS_QUERY(StoreVector)
0N/A DEFINE_CLASS_QUERY(Unlock)
0N/A
0N/A #undef DEFINE_CLASS_QUERY
0N/A
0N/A // duplicate of is_MachSpillCopy()
0N/A bool is_SpillCopy () const {
0N/A return ((_class_id & ClassMask_MachSpillCopy) == Class_MachSpillCopy);
0N/A }
0N/A
0N/A bool is_Con () const { return (_flags & Flag_is_Con) != 0; }
0N/A // The data node which is safe to leave in dead loop during IGVN optimization.
0N/A bool is_dead_loop_safe() const {
126N/A return is_Phi() || (is_Proj() && in(0) == NULL) ||
126N/A ((_flags & (Flag_is_dead_loop_safe | Flag_is_Con)) != 0 &&
126N/A (!is_Proj() || !in(0)->is_Allocate()));
0N/A }
0N/A
0N/A // is_Copy() returns copied edge index (0 or 1)
0N/A uint is_Copy() const { return (_flags & Flag_is_Copy); }
0N/A
0N/A virtual bool is_CFG() const { return false; }
0N/A
0N/A // If this node is control-dependent on a test, can it be
0N/A // rerouted to a dominating equivalent test? This is usually
0N/A // true of non-CFG nodes, but can be false for operations which
0N/A // depend for their correct sequencing on more than one test.
0N/A // (In that case, hoisting to a dominating test may silently
0N/A // skip some other important test.)
0N/A virtual bool depends_only_on_test() const { assert(!is_CFG(), ""); return true; };
0N/A
0N/A // When building basic blocks, I need to have a notion of block beginning
0N/A // Nodes, next block selector Nodes (block enders), and next block
0N/A // projections. These calls need to work on their machine equivalents. The
0N/A // Ideal beginning Nodes are RootNode, RegionNode and StartNode.
0N/A bool is_block_start() const {
0N/A if ( is_Region() )
0N/A return this == (const Node*)in(0);
0N/A else
2667N/A return is_Start();
0N/A }
0N/A
0N/A // The Ideal control projection Nodes are IfTrue/IfFalse, JumpProjNode, Root,
0N/A // Goto and Return. This call also returns the block ending Node.
0N/A virtual const Node *is_block_proj() const;
0N/A
0N/A // The node is a "macro" node which needs to be expanded before matching
0N/A bool is_macro() const { return (_flags & Flag_is_macro) != 0; }
4321N/A // The node is expensive: the best control is set during loop opts
4321N/A bool is_expensive() const { return (_flags & Flag_is_expensive) != 0 && in(0) != NULL; }
0N/A
0N/A//----------------- Optimization
0N/A
0N/A // Get the worst-case Type output for this Node.
0N/A virtual const class Type *bottom_type() const;
0N/A
0N/A // If we find a better type for a node, try to record it permanently.
0N/A // Return true if this node actually changed.
0N/A // Be sure to do the hash_delete game in the "rehash" variant.
0N/A void raise_bottom_type(const Type* new_type);
0N/A
0N/A // Get the address type with which this node uses and/or defs memory,
0N/A // or NULL if none. The address type is conservatively wide.
0N/A // Returns non-null for calls, membars, loads, stores, etc.
0N/A // Returns TypePtr::BOTTOM if the node touches memory "broadly".
0N/A virtual const class TypePtr *adr_type() const { return NULL; }
0N/A
0N/A // Return an existing node which computes the same function as this node.
0N/A // The optimistic combined algorithm requires this to return a Node which
0N/A // is a small number of steps away (e.g., one of my inputs).
0N/A virtual Node *Identity( PhaseTransform *phase );
0N/A
0N/A // Return the set of values this Node can take on at runtime.
0N/A virtual const Type *Value( PhaseTransform *phase ) const;
0N/A
0N/A // Return a node which is more "ideal" than the current node.
0N/A // The invariants on this call are subtle. If in doubt, read the
0N/A // treatise in node.cpp above the default implemention AND TEST WITH
0N/A // +VerifyIterativeGVN!
0N/A virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
0N/A
0N/A // Some nodes have specific Ideal subgraph transformations only if they are
0N/A // unique users of specific nodes. Such nodes should be put on IGVN worklist
0N/A // for the transformations to happen.
0N/A bool has_special_unique_user() const;
0N/A
119N/A // Skip Proj and CatchProj nodes chains. Check for Null and Top.
119N/A Node* find_exact_control(Node* ctrl);
119N/A
119N/A // Check if 'this' node dominates or equal to 'sub'.
119N/A bool dominates(Node* sub, Node_List &nlist);
119N/A
0N/Aprotected:
0N/A bool remove_dead_region(PhaseGVN *phase, bool can_reshape);
0N/Apublic:
0N/A
0N/A // Idealize graph, using DU info. Done after constant propagation
0N/A virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
0N/A
0N/A // See if there is valid pipeline info
0N/A static const Pipeline *pipeline_class();
0N/A virtual const Pipeline *pipeline() const;
0N/A
0N/A // Compute the latency from the def to this instruction of the ith input node
0N/A uint latency(uint i);
0N/A
0N/A // Hash & compare functions, for pessimistic value numbering
0N/A
0N/A // If the hash function returns the special sentinel value NO_HASH,
0N/A // the node is guaranteed never to compare equal to any other node.
605N/A // If we accidentally generate a hash with value NO_HASH the node
0N/A // won't go into the table and we'll lose a little optimization.
0N/A enum { NO_HASH = 0 };
0N/A virtual uint hash() const;
0N/A virtual uint cmp( const Node &n ) const;
0N/A
0N/A // Operation appears to be iteratively computed (such as an induction variable)
0N/A // It is possible for this operation to return false for a loop-varying
0N/A // value, if it appears (by local graph inspection) to be computed by a simple conditional.
0N/A bool is_iteratively_computed();
0N/A
0N/A // Determine if a node is Counted loop induction variable.
0N/A // The method is defined in loopnode.cpp.
0N/A const Node* is_loop_iv() const;
0N/A
0N/A // Return a node with opcode "opc" and same inputs as "this" if one can
0N/A // be found; Otherwise return NULL;
0N/A Node* find_similar(int opc);
0N/A
0N/A // Return the unique control out if only one. Null if none or more than one.
0N/A Node* unique_ctrl_out();
0N/A
0N/A//----------------- Code Generation
0N/A
0N/A // Ideal register class for Matching. Zero means unmatched instruction
0N/A // (these are cloned instead of converted to machine nodes).
0N/A virtual uint ideal_reg() const;
0N/A
0N/A static const uint NotAMachineReg; // must be > max. machine register
0N/A
0N/A // Do we Match on this edge index or not? Generally false for Control
0N/A // and true for everything else. Weird for calls & returns.
0N/A virtual uint match_edge(uint idx) const;
0N/A
0N/A // Register class output is returned in
0N/A virtual const RegMask &out_RegMask() const;
0N/A // Register class input is expected in
0N/A virtual const RegMask &in_RegMask(uint) const;
0N/A // Should we clone rather than spill this instruction?
0N/A bool rematerialize() const;
0N/A
0N/A // Return JVM State Object if this Node carries debug info, or NULL otherwise
0N/A virtual JVMState* jvms() const;
0N/A
0N/A // Print as assembly
0N/A virtual void format( PhaseRegAlloc *, outputStream* st = tty ) const;
0N/A // Emit bytes starting at parameter 'ptr'
0N/A // Bump 'ptr' by the number of output bytes
0N/A virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
0N/A // Size of instruction in bytes
0N/A virtual uint size(PhaseRegAlloc *ra_) const;
0N/A
0N/A // Convenience function to extract an integer constant from a node.
0N/A // If it is not an integer constant (either Con, CastII, or Mach),
0N/A // return value_if_unknown.
0N/A jint find_int_con(jint value_if_unknown) const {
0N/A const TypeInt* t = find_int_type();
0N/A return (t != NULL && t->is_con()) ? t->get_con() : value_if_unknown;
0N/A }
0N/A // Return the constant, knowing it is an integer constant already
0N/A jint get_int() const {
0N/A const TypeInt* t = find_int_type();
0N/A guarantee(t != NULL, "must be con");
0N/A return t->get_con();
0N/A }
0N/A // Here's where the work is done. Can produce non-constant int types too.
0N/A const TypeInt* find_int_type() const;
0N/A
0N/A // Same thing for long (and intptr_t, via type.hpp):
0N/A jlong get_long() const {
0N/A const TypeLong* t = find_long_type();
0N/A guarantee(t != NULL, "must be con");
0N/A return t->get_con();
0N/A }
0N/A jlong find_long_con(jint value_if_unknown) const {
0N/A const TypeLong* t = find_long_type();
0N/A return (t != NULL && t->is_con()) ? t->get_con() : value_if_unknown;
0N/A }
0N/A const TypeLong* find_long_type() const;
0N/A
4505N/A const TypePtr* get_ptr_type() const;
4505N/A
0N/A // These guys are called by code generated by ADLC:
0N/A intptr_t get_ptr() const;
113N/A intptr_t get_narrowcon() const;
0N/A jdouble getd() const;
0N/A jfloat getf() const;
0N/A
0N/A // Nodes which are pinned into basic blocks
0N/A virtual bool pinned() const { return false; }
0N/A
0N/A // Nodes which use memory without consuming it, hence need antidependences
0N/A // More specifically, needs_anti_dependence_check returns true iff the node
0N/A // (a) does a load, and (b) does not perform a store (except perhaps to a
0N/A // stack slot or some other unaliased location).
0N/A bool needs_anti_dependence_check() const;
0N/A
0N/A // Return which operand this instruction may cisc-spill. In other words,
0N/A // return operand position that can convert from reg to memory access
0N/A virtual int cisc_operand() const { return AdlcVMDeps::Not_cisc_spillable; }
0N/A bool is_cisc_alternate() const { return (_flags & Flag_is_cisc_alternate) != 0; }
0N/A
0N/A//----------------- Graph walking
0N/Apublic:
0N/A // Walk and apply member functions recursively.
0N/A // Supplied (this) pointer is root.
0N/A void walk(NFunc pre, NFunc post, void *env);
0N/A static void nop(Node &, void*); // Dummy empty function
0N/A static void packregion( Node &n, void* );
0N/Aprivate:
0N/A void walk_(NFunc pre, NFunc post, void *env, VectorSet &visited);
0N/A
0N/A//----------------- Printing, etc
0N/Apublic:
0N/A#ifndef PRODUCT
0N/A Node* find(int idx) const; // Search the graph for the given idx.
0N/A Node* find_ctrl(int idx) const; // Search control ancestors for the given idx.
4312N/A void dump() const { dump("\n"); } // Print this node.
4312N/A void dump(const char* suffix, outputStream *st = tty) const;// Print this node.
0N/A void dump(int depth) const; // Print this node, recursively to depth d
0N/A void dump_ctrl(int depth) const; // Print control nodes, to depth d
4312N/A virtual void dump_req(outputStream *st = tty) const; // Print required-edge info
4312N/A virtual void dump_prec(outputStream *st = tty) const; // Print precedence-edge info
4312N/A virtual void dump_out(outputStream *st = tty) const; // Print the output edge info
0N/A virtual void dump_spec(outputStream *st) const {}; // Print per-node info
0N/A void verify_edges(Unique_Node_List &visited); // Verify bi-directional edges
0N/A void verify() const; // Check Def-Use info for my subgraph
0N/A static void verify_recur(const Node *n, int verify_depth, VectorSet &old_space, VectorSet &new_space);
0N/A
0N/A // This call defines a class-unique string used to identify class instances
0N/A virtual const char *Name() const;
0N/A
0N/A void dump_format(PhaseRegAlloc *ra) const; // debug access to MachNode::format(...)
0N/A // RegMask Print Functions
0N/A void dump_in_regmask(int idx) { in_RegMask(idx).dump(); }
0N/A void dump_out_regmask() { out_RegMask().dump(); }
0N/A static int _in_dump_cnt;
0N/A static bool in_dump() { return _in_dump_cnt > 0; }
0N/A void fast_dump() const {
0N/A tty->print("%4d: %-17s", _idx, Name());
0N/A for (uint i = 0; i < len(); i++)
0N/A if (in(i))
0N/A tty->print(" %4d", in(i)->_idx);
0N/A else
0N/A tty->print(" NULL");
0N/A tty->print("\n");
0N/A }
0N/A#endif
0N/A#ifdef ASSERT
0N/A void verify_construction();
0N/A bool verify_jvms(const JVMState* jvms) const;
0N/A int _debug_idx; // Unique value assigned to every node.
0N/A int debug_idx() const { return _debug_idx; }
0N/A void set_debug_idx( int debug_idx ) { _debug_idx = debug_idx; }
0N/A
0N/A Node* _debug_orig; // Original version of this, if any.
0N/A Node* debug_orig() const { return _debug_orig; }
0N/A void set_debug_orig(Node* orig); // _debug_orig = orig
0N/A
0N/A int _hash_lock; // Barrier to modifications of nodes in the hash table
0N/A void enter_hash_lock() { ++_hash_lock; assert(_hash_lock < 99, "in too many hash tables?"); }
0N/A void exit_hash_lock() { --_hash_lock; assert(_hash_lock >= 0, "mispaired hash locks"); }
0N/A
0N/A static void init_NodeProperty();
0N/A
0N/A #if OPTO_DU_ITERATOR_ASSERT
0N/A const Node* _last_del; // The last deleted node.
0N/A uint _del_tick; // Bumped when a deletion happens..
0N/A #endif
0N/A#endif
0N/A};
0N/A
0N/A//-----------------------------------------------------------------------------
0N/A// Iterators over DU info, and associated Node functions.
0N/A
0N/A#if OPTO_DU_ITERATOR_ASSERT
0N/A
0N/A// Common code for assertion checking on DU iterators.
0N/Aclass DUIterator_Common VALUE_OBJ_CLASS_SPEC {
0N/A#ifdef ASSERT
0N/A protected:
0N/A bool _vdui; // cached value of VerifyDUIterators
0N/A const Node* _node; // the node containing the _out array
0N/A uint _outcnt; // cached node->_outcnt
0N/A uint _del_tick; // cached node->_del_tick
0N/A Node* _last; // last value produced by the iterator
0N/A
0N/A void sample(const Node* node); // used by c'tor to set up for verifies
0N/A void verify(const Node* node, bool at_end_ok = false);
0N/A void verify_resync();
0N/A void reset(const DUIterator_Common& that);
0N/A
0N/A// The VDUI_ONLY macro protects code conditionalized on VerifyDUIterators
0N/A #define I_VDUI_ONLY(i,x) { if ((i)._vdui) { x; } }
0N/A#else
0N/A #define I_VDUI_ONLY(i,x) { }
0N/A#endif //ASSERT
0N/A};
0N/A
0N/A#define VDUI_ONLY(x) I_VDUI_ONLY(*this, x)
0N/A
0N/A// Default DU iterator. Allows appends onto the out array.
0N/A// Allows deletion from the out array only at the current point.
0N/A// Usage:
0N/A// for (DUIterator i = x->outs(); x->has_out(i); i++) {
0N/A// Node* y = x->out(i);
0N/A// ...
0N/A// }
0N/A// Compiles in product mode to a unsigned integer index, which indexes
0N/A// onto a repeatedly reloaded base pointer of x->_out. The loop predicate
0N/A// also reloads x->_outcnt. If you delete, you must perform "--i" just
0N/A// before continuing the loop. You must delete only the last-produced
0N/A// edge. You must delete only a single copy of the last-produced edge,
0N/A// or else you must delete all copies at once (the first time the edge
0N/A// is produced by the iterator).
0N/Aclass DUIterator : public DUIterator_Common {
0N/A friend class Node;
0N/A
0N/A // This is the index which provides the product-mode behavior.
0N/A // Whatever the product-mode version of the system does to the
0N/A // DUI index is done to this index. All other fields in
0N/A // this class are used only for assertion checking.
0N/A uint _idx;
0N/A
0N/A #ifdef ASSERT
0N/A uint _refresh_tick; // Records the refresh activity.
0N/A
0N/A void sample(const Node* node); // Initialize _refresh_tick etc.
0N/A void verify(const Node* node, bool at_end_ok = false);
0N/A void verify_increment(); // Verify an increment operation.
0N/A void verify_resync(); // Verify that we can back up over a deletion.
0N/A void verify_finish(); // Verify that the loop terminated properly.
0N/A void refresh(); // Resample verification info.
0N/A void reset(const DUIterator& that); // Resample after assignment.
0N/A #endif
0N/A
0N/A DUIterator(const Node* node, int dummy_to_avoid_conversion)
0N/A { _idx = 0; debug_only(sample(node)); }
0N/A
0N/A public:
0N/A // initialize to garbage; clear _vdui to disable asserts
0N/A DUIterator()
0N/A { /*initialize to garbage*/ debug_only(_vdui = false); }
0N/A
0N/A void operator++(int dummy_to_specify_postfix_op)
0N/A { _idx++; VDUI_ONLY(verify_increment()); }
0N/A
0N/A void operator--()
0N/A { VDUI_ONLY(verify_resync()); --_idx; }
0N/A
0N/A ~DUIterator()
0N/A { VDUI_ONLY(verify_finish()); }
0N/A
0N/A void operator=(const DUIterator& that)
0N/A { _idx = that._idx; debug_only(reset(that)); }
0N/A};
0N/A
0N/ADUIterator Node::outs() const
0N/A { return DUIterator(this, 0); }
0N/ADUIterator& Node::refresh_out_pos(DUIterator& i) const
0N/A { I_VDUI_ONLY(i, i.refresh()); return i; }
0N/Abool Node::has_out(DUIterator& i) const
0N/A { I_VDUI_ONLY(i, i.verify(this,true));return i._idx < _outcnt; }
0N/ANode* Node::out(DUIterator& i) const
0N/A { I_VDUI_ONLY(i, i.verify(this)); return debug_only(i._last=) _out[i._idx]; }
0N/A
0N/A
0N/A// Faster DU iterator. Disallows insertions into the out array.
0N/A// Allows deletion from the out array only at the current point.
0N/A// Usage:
0N/A// for (DUIterator_Fast imax, i = x->fast_outs(imax); i < imax; i++) {
0N/A// Node* y = x->fast_out(i);
0N/A// ...
0N/A// }
0N/A// Compiles in product mode to raw Node** pointer arithmetic, with
0N/A// no reloading of pointers from the original node x. If you delete,
0N/A// you must perform "--i; --imax" just before continuing the loop.
0N/A// If you delete multiple copies of the same edge, you must decrement
0N/A// imax, but not i, multiple times: "--i, imax -= num_edges".
0N/Aclass DUIterator_Fast : public DUIterator_Common {
0N/A friend class Node;
0N/A friend class DUIterator_Last;
0N/A
0N/A // This is the pointer which provides the product-mode behavior.
0N/A // Whatever the product-mode version of the system does to the
0N/A // DUI pointer is done to this pointer. All other fields in
0N/A // this class are used only for assertion checking.
0N/A Node** _outp;
0N/A
0N/A #ifdef ASSERT
0N/A void verify(const Node* node, bool at_end_ok = false);
0N/A void verify_limit();
0N/A void verify_resync();
0N/A void verify_relimit(uint n);
0N/A void reset(const DUIterator_Fast& that);
0N/A #endif
0N/A
0N/A // Note: offset must be signed, since -1 is sometimes passed
0N/A DUIterator_Fast(const Node* node, ptrdiff_t offset)
0N/A { _outp = node->_out + offset; debug_only(sample(node)); }
0N/A
0N/A public:
0N/A // initialize to garbage; clear _vdui to disable asserts
0N/A DUIterator_Fast()
0N/A { /*initialize to garbage*/ debug_only(_vdui = false); }
0N/A
0N/A void operator++(int dummy_to_specify_postfix_op)
0N/A { _outp++; VDUI_ONLY(verify(_node, true)); }
0N/A
0N/A void operator--()
0N/A { VDUI_ONLY(verify_resync()); --_outp; }
0N/A
0N/A void operator-=(uint n) // applied to the limit only
0N/A { _outp -= n; VDUI_ONLY(verify_relimit(n)); }
0N/A
0N/A bool operator<(DUIterator_Fast& limit) {
0N/A I_VDUI_ONLY(*this, this->verify(_node, true));
0N/A I_VDUI_ONLY(limit, limit.verify_limit());
0N/A return _outp < limit._outp;
0N/A }
0N/A
0N/A void operator=(const DUIterator_Fast& that)
0N/A { _outp = that._outp; debug_only(reset(that)); }
0N/A};
0N/A
0N/ADUIterator_Fast Node::fast_outs(DUIterator_Fast& imax) const {
0N/A // Assign a limit pointer to the reference argument:
0N/A imax = DUIterator_Fast(this, (ptrdiff_t)_outcnt);
0N/A // Return the base pointer:
0N/A return DUIterator_Fast(this, 0);
0N/A}
0N/ANode* Node::fast_out(DUIterator_Fast& i) const {
0N/A I_VDUI_ONLY(i, i.verify(this));
0N/A return debug_only(i._last=) *i._outp;
0N/A}
0N/A
0N/A
0N/A// Faster DU iterator. Requires each successive edge to be removed.
0N/A// Does not allow insertion of any edges.
0N/A// Usage:
0N/A// for (DUIterator_Last imin, i = x->last_outs(imin); i >= imin; i -= num_edges) {
0N/A// Node* y = x->last_out(i);
0N/A// ...
0N/A// }
0N/A// Compiles in product mode to raw Node** pointer arithmetic, with
0N/A// no reloading of pointers from the original node x.
0N/Aclass DUIterator_Last : private DUIterator_Fast {
0N/A friend class Node;
0N/A
0N/A #ifdef ASSERT
0N/A void verify(const Node* node, bool at_end_ok = false);
0N/A void verify_limit();
0N/A void verify_step(uint num_edges);
0N/A #endif
0N/A
0N/A // Note: offset must be signed, since -1 is sometimes passed
0N/A DUIterator_Last(const Node* node, ptrdiff_t offset)
0N/A : DUIterator_Fast(node, offset) { }
0N/A
0N/A void operator++(int dummy_to_specify_postfix_op) {} // do not use
0N/A void operator<(int) {} // do not use
0N/A
0N/A public:
0N/A DUIterator_Last() { }
0N/A // initialize to garbage
0N/A
0N/A void operator--()
0N/A { _outp--; VDUI_ONLY(verify_step(1)); }
0N/A
0N/A void operator-=(uint n)
0N/A { _outp -= n; VDUI_ONLY(verify_step(n)); }
0N/A
0N/A bool operator>=(DUIterator_Last& limit) {
0N/A I_VDUI_ONLY(*this, this->verify(_node, true));
0N/A I_VDUI_ONLY(limit, limit.verify_limit());
0N/A return _outp >= limit._outp;
0N/A }
0N/A
0N/A void operator=(const DUIterator_Last& that)
0N/A { DUIterator_Fast::operator=(that); }
0N/A};
0N/A
0N/ADUIterator_Last Node::last_outs(DUIterator_Last& imin) const {
0N/A // Assign a limit pointer to the reference argument:
0N/A imin = DUIterator_Last(this, 0);
0N/A // Return the initial pointer:
0N/A return DUIterator_Last(this, (ptrdiff_t)_outcnt - 1);
0N/A}
0N/ANode* Node::last_out(DUIterator_Last& i) const {
0N/A I_VDUI_ONLY(i, i.verify(this));
0N/A return debug_only(i._last=) *i._outp;
0N/A}
0N/A
0N/A#endif //OPTO_DU_ITERATOR_ASSERT
0N/A
0N/A#undef I_VDUI_ONLY
0N/A#undef VDUI_ONLY
0N/A
1080N/A// An Iterator that truly follows the iterator pattern. Doesn't
1080N/A// support deletion but could be made to.
1080N/A//
1080N/A// for (SimpleDUIterator i(n); i.has_next(); i.next()) {
1080N/A// Node* m = i.get();
1080N/A//
1080N/Aclass SimpleDUIterator : public StackObj {
1080N/A private:
1080N/A Node* node;
1080N/A DUIterator_Fast i;
1080N/A DUIterator_Fast imax;
1080N/A public:
1080N/A SimpleDUIterator(Node* n): node(n), i(n->fast_outs(imax)) {}
1080N/A bool has_next() { return i < imax; }
1080N/A void next() { i++; }
1080N/A Node* get() { return node->fast_out(i); }
1080N/A};
1080N/A
0N/A
0N/A//-----------------------------------------------------------------------------
0N/A// Map dense integer indices to Nodes. Uses classic doubling-array trick.
0N/A// Abstractly provides an infinite array of Node*'s, initialized to NULL.
0N/A// Note that the constructor just zeros things, and since I use Arena
0N/A// allocation I do not need a destructor to reclaim storage.
0N/Aclass Node_Array : public ResourceObj {
2772N/A friend class VMStructs;
0N/Aprotected:
0N/A Arena *_a; // Arena to allocate in
0N/A uint _max;
0N/A Node **_nodes;
0N/A void grow( uint i ); // Grow array node to fit
0N/Apublic:
0N/A Node_Array(Arena *a) : _a(a), _max(OptoNodeListSize) {
0N/A _nodes = NEW_ARENA_ARRAY( a, Node *, OptoNodeListSize );
0N/A for( int i = 0; i < OptoNodeListSize; i++ ) {
0N/A _nodes[i] = NULL;
0N/A }
0N/A }
0N/A
0N/A Node_Array(Node_Array *na) : _a(na->_a), _max(na->_max), _nodes(na->_nodes) {}
0N/A Node *operator[] ( uint i ) const // Lookup, or NULL for not mapped
0N/A { return (i<_max) ? _nodes[i] : (Node*)NULL; }
0N/A Node *at( uint i ) const { assert(i<_max,"oob"); return _nodes[i]; }
0N/A Node **adr() { return _nodes; }
0N/A // Extend the mapping: index i maps to Node *n.
0N/A void map( uint i, Node *n ) { if( i>=_max ) grow(i); _nodes[i] = n; }
0N/A void insert( uint i, Node *n );
0N/A void remove( uint i ); // Remove, preserving order
0N/A void sort( C_sort_func_t func);
0N/A void reset( Arena *new_a ); // Zap mapping to empty; reclaim storage
0N/A void clear(); // Set all entries to NULL, keep storage
0N/A uint Size() const { return _max; }
0N/A void dump() const;
0N/A};
0N/A
0N/Aclass Node_List : public Node_Array {
2772N/A friend class VMStructs;
0N/A uint _cnt;
0N/Apublic:
0N/A Node_List() : Node_Array(Thread::current()->resource_area()), _cnt(0) {}
0N/A Node_List(Arena *a) : Node_Array(a), _cnt(0) {}
1080N/A bool contains(Node* n) {
1080N/A for (uint e = 0; e < size(); e++) {
1080N/A if (at(e) == n) return true;
1080N/A }
1080N/A return false;
1080N/A }
0N/A void insert( uint i, Node *n ) { Node_Array::insert(i,n); _cnt++; }
0N/A void remove( uint i ) { Node_Array::remove(i); _cnt--; }
0N/A void push( Node *b ) { map(_cnt++,b); }
0N/A void yank( Node *n ); // Find and remove
0N/A Node *pop() { return _nodes[--_cnt]; }
0N/A Node *rpop() { Node *b = _nodes[0]; _nodes[0]=_nodes[--_cnt]; return b;}
0N/A void clear() { _cnt = 0; Node_Array::clear(); } // retain storage
0N/A uint size() const { return _cnt; }
0N/A void dump() const;
0N/A};
0N/A
0N/A//------------------------------Unique_Node_List-------------------------------
0N/Aclass Unique_Node_List : public Node_List {
2772N/A friend class VMStructs;
0N/A VectorSet _in_worklist;
0N/A uint _clock_index; // Index in list where to pop from next
0N/Apublic:
0N/A Unique_Node_List() : Node_List(), _in_worklist(Thread::current()->resource_area()), _clock_index(0) {}
0N/A Unique_Node_List(Arena *a) : Node_List(a), _in_worklist(a), _clock_index(0) {}
0N/A
0N/A void remove( Node *n );
0N/A bool member( Node *n ) { return _in_worklist.test(n->_idx) != 0; }
0N/A VectorSet &member_set(){ return _in_worklist; }
0N/A
0N/A void push( Node *b ) {
0N/A if( !_in_worklist.test_set(b->_idx) )
0N/A Node_List::push(b);
0N/A }
0N/A Node *pop() {
0N/A if( _clock_index >= size() ) _clock_index = 0;
0N/A Node *b = at(_clock_index);
400N/A map( _clock_index, Node_List::pop());
400N/A if (size() != 0) _clock_index++; // Always start from 0
0N/A _in_worklist >>= b->_idx;
0N/A return b;
0N/A }
0N/A Node *remove( uint i ) {
0N/A Node *b = Node_List::at(i);
0N/A _in_worklist >>= b->_idx;
0N/A map(i,Node_List::pop());
0N/A return b;
0N/A }
0N/A void yank( Node *n ) { _in_worklist >>= n->_idx; Node_List::yank(n); }
0N/A void clear() {
0N/A _in_worklist.Clear(); // Discards storage but grows automatically
0N/A Node_List::clear();
0N/A _clock_index = 0;
0N/A }
0N/A
0N/A // Used after parsing to remove useless nodes before Iterative GVN
0N/A void remove_useless_nodes(VectorSet &useful);
0N/A
0N/A#ifndef PRODUCT
0N/A void print_set() const { _in_worklist.print(); }
0N/A#endif
0N/A};
0N/A
0N/A// Inline definition of Compile::record_for_igvn must be deferred to this point.
0N/Ainline void Compile::record_for_igvn(Node* n) {
0N/A _for_igvn->push(n);
0N/A}
0N/A
0N/A//------------------------------Node_Stack-------------------------------------
0N/Aclass Node_Stack {
2772N/A friend class VMStructs;
0N/Aprotected:
0N/A struct INode {
0N/A Node *node; // Processed node
0N/A uint indx; // Index of next node's child
0N/A };
0N/A INode *_inode_top; // tos, stack grows up
0N/A INode *_inode_max; // End of _inodes == _inodes + _max
0N/A INode *_inodes; // Array storage for the stack
0N/A Arena *_a; // Arena to allocate in
0N/A void grow();
0N/Apublic:
0N/A Node_Stack(int size) {
0N/A size_t max = (size > OptoNodeListSize) ? size : OptoNodeListSize;
0N/A _a = Thread::current()->resource_area();
0N/A _inodes = NEW_ARENA_ARRAY( _a, INode, max );
0N/A _inode_max = _inodes + max;
0N/A _inode_top = _inodes - 1; // stack is empty
0N/A }
0N/A
0N/A Node_Stack(Arena *a, int size) : _a(a) {
0N/A size_t max = (size > OptoNodeListSize) ? size : OptoNodeListSize;
0N/A _inodes = NEW_ARENA_ARRAY( _a, INode, max );
0N/A _inode_max = _inodes + max;
0N/A _inode_top = _inodes - 1; // stack is empty
0N/A }
0N/A
0N/A void pop() {
0N/A assert(_inode_top >= _inodes, "node stack underflow");
0N/A --_inode_top;
0N/A }
0N/A void push(Node *n, uint i) {
0N/A ++_inode_top;
0N/A if (_inode_top >= _inode_max) grow();
0N/A INode *top = _inode_top; // optimization
0N/A top->node = n;
0N/A top->indx = i;
0N/A }
0N/A Node *node() const {
0N/A return _inode_top->node;
0N/A }
0N/A Node* node_at(uint i) const {
0N/A assert(_inodes + i <= _inode_top, "in range");
0N/A return _inodes[i].node;
0N/A }
0N/A uint index() const {
0N/A return _inode_top->indx;
0N/A }
247N/A uint index_at(uint i) const {
247N/A assert(_inodes + i <= _inode_top, "in range");
247N/A return _inodes[i].indx;
247N/A }
0N/A void set_node(Node *n) {
0N/A _inode_top->node = n;
0N/A }
0N/A void set_index(uint i) {
0N/A _inode_top->indx = i;
0N/A }
0N/A uint size_max() const { return (uint)pointer_delta(_inode_max, _inodes, sizeof(INode)); } // Max size
40N/A uint size() const { return (uint)pointer_delta((_inode_top+1), _inodes, sizeof(INode)); } // Current size
0N/A bool is_nonempty() const { return (_inode_top >= _inodes); }
0N/A bool is_empty() const { return (_inode_top < _inodes); }
0N/A void clear() { _inode_top = _inodes - 1; } // retain storage
2613N/A
2613N/A // Node_Stack is used to map nodes.
2613N/A Node* find(uint idx) const;
0N/A};
0N/A
0N/A
0N/A//-----------------------------Node_Notes--------------------------------------
0N/A// Debugging or profiling annotations loosely and sparsely associated
0N/A// with some nodes. See Compile::node_notes_at for the accessor.
0N/Aclass Node_Notes VALUE_OBJ_CLASS_SPEC {
2772N/A friend class VMStructs;
0N/A JVMState* _jvms;
0N/A
0N/Apublic:
0N/A Node_Notes(JVMState* jvms = NULL) {
0N/A _jvms = jvms;
0N/A }
0N/A
0N/A JVMState* jvms() { return _jvms; }
0N/A void set_jvms(JVMState* x) { _jvms = x; }
0N/A
0N/A // True if there is nothing here.
0N/A bool is_clear() {
0N/A return (_jvms == NULL);
0N/A }
0N/A
0N/A // Make there be nothing here.
0N/A void clear() {
0N/A _jvms = NULL;
0N/A }
0N/A
0N/A // Make a new, clean node notes.
0N/A static Node_Notes* make(Compile* C) {
0N/A Node_Notes* nn = NEW_ARENA_ARRAY(C->comp_arena(), Node_Notes, 1);
0N/A nn->clear();
0N/A return nn;
0N/A }
0N/A
0N/A Node_Notes* clone(Compile* C) {
0N/A Node_Notes* nn = NEW_ARENA_ARRAY(C->comp_arena(), Node_Notes, 1);
0N/A (*nn) = (*this);
0N/A return nn;
0N/A }
0N/A
0N/A // Absorb any information from source.
0N/A bool update_from(Node_Notes* source) {
0N/A bool changed = false;
0N/A if (source != NULL) {
0N/A if (source->jvms() != NULL) {
0N/A set_jvms(source->jvms());
0N/A changed = true;
0N/A }
0N/A }
0N/A return changed;
0N/A }
0N/A};
0N/A
0N/A// Inlined accessors for Compile::node_nodes that require the preceding class:
0N/Ainline Node_Notes*
0N/ACompile::locate_node_notes(GrowableArray<Node_Notes*>* arr,
0N/A int idx, bool can_grow) {
0N/A assert(idx >= 0, "oob");
0N/A int block_idx = (idx >> _log2_node_notes_block_size);
0N/A int grow_by = (block_idx - (arr == NULL? 0: arr->length()));
0N/A if (grow_by >= 0) {
0N/A if (!can_grow) return NULL;
0N/A grow_node_notes(arr, grow_by + 1);
0N/A }
0N/A // (Every element of arr is a sub-array of length _node_notes_block_size.)
0N/A return arr->at(block_idx) + (idx & (_node_notes_block_size-1));
0N/A}
0N/A
0N/Ainline bool
0N/ACompile::set_node_notes_at(int idx, Node_Notes* value) {
0N/A if (value == NULL || value->is_clear())
0N/A return false; // nothing to write => write nothing
0N/A Node_Notes* loc = locate_node_notes(_node_note_array, idx, true);
0N/A assert(loc != NULL, "");
0N/A return loc->update_from(value);
0N/A}
0N/A
0N/A
0N/A//------------------------------TypeNode---------------------------------------
0N/A// Node with a Type constant.
0N/Aclass TypeNode : public Node {
0N/Aprotected:
0N/A virtual uint hash() const; // Check the type
0N/A virtual uint cmp( const Node &n ) const;
0N/A virtual uint size_of() const; // Size is bigger
0N/A const Type* const _type;
0N/Apublic:
0N/A void set_type(const Type* t) {
0N/A assert(t != NULL, "sanity");
0N/A debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
0N/A *(const Type**)&_type = t; // cast away const-ness
0N/A // If this node is in the hash table, make sure it doesn't need a rehash.
0N/A assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code");
0N/A }
0N/A const Type* type() const { assert(_type != NULL, "sanity"); return _type; };
0N/A TypeNode( const Type *t, uint required ) : Node(required), _type(t) {
0N/A init_class_id(Class_Type);
0N/A }
0N/A virtual const Type *Value( PhaseTransform *phase ) const;
0N/A virtual const Type *bottom_type() const;
0N/A virtual uint ideal_reg() const;
0N/A#ifndef PRODUCT
0N/A virtual void dump_spec(outputStream *st) const;
0N/A#endif
0N/A};
1879N/A
1879N/A#endif // SHARE_VM_OPTO_NODE_HPP