< prev index next >

src/hotspot/share/opto/node.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_OPTO_NODE_HPP
  26 #define SHARE_VM_OPTO_NODE_HPP
  27 
  28 #include "libadt/vectset.hpp"
  29 #include "opto/compile.hpp"
  30 #include "opto/type.hpp"
  31 
  32 // Portions of code courtesy of Clifford Click
  33 
  34 // Optimization - Graph Style
  35 
  36 
  37 class AbstractLockNode;
  38 class AddNode;
  39 class AddPNode;
  40 class AliasInfo;
  41 class AllocateArrayNode;
  42 class AllocateNode;
  43 class ArrayCopyNode;
  44 class Block;
  45 class BoolNode;
  46 class BoxLockNode;


 125 class Node_Stack;
 126 class NullCheckNode;
 127 class OopMap;
 128 class ParmNode;
 129 class PCTableNode;
 130 class PhaseCCP;
 131 class PhaseGVN;
 132 class PhaseIterGVN;
 133 class PhaseRegAlloc;
 134 class PhaseTransform;
 135 class PhaseValues;
 136 class PhiNode;
 137 class Pipeline;
 138 class ProjNode;
 139 class RangeCheckNode;
 140 class RegMask;
 141 class RegionNode;
 142 class RootNode;
 143 class SafePointNode;
 144 class SafePointScalarObjectNode;
 145 class ShenandoahBarrierNode;
 146 class StartNode;
 147 class State;
 148 class StoreNode;
 149 class SubNode;
 150 class Type;
 151 class TypeNode;
 152 class UnlockNode;
 153 class VectorNode;
 154 class LoadVectorNode;
 155 class StoreVectorNode;
 156 class VectorSet;
 157 typedef void (*NFunc)(Node&,void*);
 158 extern "C" {
 159   typedef int (*C_sort_func_t)(const void *, const void *);
 160 }
 161 
 162 // The type of all node counts and indexes.
 163 // It must hold at least 16 bits, but must also be fast to load and store.
 164 // This type, if less than 32 bits, could limit the number of possible nodes.
 165 // (To make this type platform-specific, move to globalDefinitions_xxx.hpp.)


 659       DEFINE_CLASS_ID(MachTemp,         Mach, 3)
 660       DEFINE_CLASS_ID(MachConstantBase, Mach, 4)
 661       DEFINE_CLASS_ID(MachConstant,     Mach, 5)
 662         DEFINE_CLASS_ID(MachJump,       MachConstant, 0)
 663       DEFINE_CLASS_ID(MachMerge,        Mach, 6)
 664       DEFINE_CLASS_ID(MachMemBar,       Mach, 7)
 665 
 666     DEFINE_CLASS_ID(Type,  Node, 2)
 667       DEFINE_CLASS_ID(Phi,   Type, 0)
 668       DEFINE_CLASS_ID(ConstraintCast, Type, 1)
 669         DEFINE_CLASS_ID(CastII, ConstraintCast, 0)
 670         DEFINE_CLASS_ID(CheckCastPP, ConstraintCast, 1)
 671       DEFINE_CLASS_ID(CMove, Type, 3)
 672       DEFINE_CLASS_ID(SafePointScalarObject, Type, 4)
 673       DEFINE_CLASS_ID(DecodeNarrowPtr, Type, 5)
 674         DEFINE_CLASS_ID(DecodeN, DecodeNarrowPtr, 0)
 675         DEFINE_CLASS_ID(DecodeNKlass, DecodeNarrowPtr, 1)
 676       DEFINE_CLASS_ID(EncodeNarrowPtr, Type, 6)
 677         DEFINE_CLASS_ID(EncodeP, EncodeNarrowPtr, 0)
 678         DEFINE_CLASS_ID(EncodePKlass, EncodeNarrowPtr, 1)
 679       DEFINE_CLASS_ID(ShenandoahBarrier, Type, 7)
 680 
 681     DEFINE_CLASS_ID(Proj,  Node, 3)
 682       DEFINE_CLASS_ID(CatchProj, Proj, 0)
 683       DEFINE_CLASS_ID(JumpProj,  Proj, 1)
 684       DEFINE_CLASS_ID(IfProj,    Proj, 2)
 685         DEFINE_CLASS_ID(IfTrue,    IfProj, 0)
 686         DEFINE_CLASS_ID(IfFalse,   IfProj, 1)
 687       DEFINE_CLASS_ID(Parm,      Proj, 4)
 688       DEFINE_CLASS_ID(MachProj,  Proj, 5)
 689 
 690     DEFINE_CLASS_ID(Mem,   Node, 4)
 691       DEFINE_CLASS_ID(Load,  Mem, 0)
 692         DEFINE_CLASS_ID(LoadVector,  Load, 0)
 693           DEFINE_CLASS_ID(LoadBarrierSlowReg, Load, 1)
 694           DEFINE_CLASS_ID(LoadBarrierWeakSlowReg, Load, 2)
 695       DEFINE_CLASS_ID(Store, Mem, 1)
 696         DEFINE_CLASS_ID(StoreVector, Store, 0)
 697       DEFINE_CLASS_ID(LoadStore, Mem, 2)
 698         DEFINE_CLASS_ID(LoadStoreConditional, LoadStore, 0)
 699           DEFINE_CLASS_ID(CompareAndSwap, LoadStoreConditional, 0)


 858   DEFINE_CLASS_QUERY(MachTemp)
 859   DEFINE_CLASS_QUERY(MachMemBar)
 860   DEFINE_CLASS_QUERY(MachMerge)
 861   DEFINE_CLASS_QUERY(Mem)
 862   DEFINE_CLASS_QUERY(MemBar)
 863   DEFINE_CLASS_QUERY(MemBarStoreStore)
 864   DEFINE_CLASS_QUERY(MergeMem)
 865   DEFINE_CLASS_QUERY(Mul)
 866   DEFINE_CLASS_QUERY(Multi)
 867   DEFINE_CLASS_QUERY(MultiBranch)
 868   DEFINE_CLASS_QUERY(OuterStripMinedLoop)
 869   DEFINE_CLASS_QUERY(OuterStripMinedLoopEnd)
 870   DEFINE_CLASS_QUERY(Parm)
 871   DEFINE_CLASS_QUERY(PCTable)
 872   DEFINE_CLASS_QUERY(Phi)
 873   DEFINE_CLASS_QUERY(Proj)
 874   DEFINE_CLASS_QUERY(Region)
 875   DEFINE_CLASS_QUERY(Root)
 876   DEFINE_CLASS_QUERY(SafePoint)
 877   DEFINE_CLASS_QUERY(SafePointScalarObject)
 878   DEFINE_CLASS_QUERY(ShenandoahBarrier)
 879   DEFINE_CLASS_QUERY(Start)
 880   DEFINE_CLASS_QUERY(Store)
 881   DEFINE_CLASS_QUERY(Sub)
 882   DEFINE_CLASS_QUERY(Type)
 883   DEFINE_CLASS_QUERY(Vector)
 884   DEFINE_CLASS_QUERY(LoadVector)
 885   DEFINE_CLASS_QUERY(StoreVector)
 886   DEFINE_CLASS_QUERY(Unlock)
 887 
 888   #undef DEFINE_CLASS_QUERY
 889 
 890   // duplicate of is_MachSpillCopy()
 891   bool is_SpillCopy () const {
 892     return ((_class_id & ClassMask_MachSpillCopy) == Class_MachSpillCopy);
 893   }
 894 
 895   bool is_Con () const { return (_flags & Flag_is_Con) != 0; }
 896   // The data node which is safe to leave in dead loop during IGVN optimization.
 897   bool is_dead_loop_safe() const {
 898     return is_Phi() || (is_Proj() && in(0) == NULL) ||


1725   void set_type(const Type* t) {
1726     assert(t != NULL, "sanity");
1727     debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
1728     *(const Type**)&_type = t;   // cast away const-ness
1729     // If this node is in the hash table, make sure it doesn't need a rehash.
1730     assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code");
1731   }
1732   const Type* type() const { assert(_type != NULL, "sanity"); return _type; };
1733   TypeNode( const Type *t, uint required ) : Node(required), _type(t) {
1734     init_class_id(Class_Type);
1735   }
1736   virtual const Type* Value(PhaseGVN* phase) const;
1737   virtual const Type *bottom_type() const;
1738   virtual       uint  ideal_reg() const;
1739 #ifndef PRODUCT
1740   virtual void dump_spec(outputStream *st) const;
1741   virtual void dump_compact_spec(outputStream *st) const;
1742 #endif
1743 };
1744 
1745 #endif // SHARE_VM_OPTO_NODE_HPP
   1 /*
   2  * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
   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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_OPTO_NODE_HPP
  26 #define SHARE_OPTO_NODE_HPP
  27 
  28 #include "libadt/vectset.hpp"
  29 #include "opto/compile.hpp"
  30 #include "opto/type.hpp"
  31 
  32 // Portions of code courtesy of Clifford Click
  33 
  34 // Optimization - Graph Style
  35 
  36 
  37 class AbstractLockNode;
  38 class AddNode;
  39 class AddPNode;
  40 class AliasInfo;
  41 class AllocateArrayNode;
  42 class AllocateNode;
  43 class ArrayCopyNode;
  44 class Block;
  45 class BoolNode;
  46 class BoxLockNode;


 125 class Node_Stack;
 126 class NullCheckNode;
 127 class OopMap;
 128 class ParmNode;
 129 class PCTableNode;
 130 class PhaseCCP;
 131 class PhaseGVN;
 132 class PhaseIterGVN;
 133 class PhaseRegAlloc;
 134 class PhaseTransform;
 135 class PhaseValues;
 136 class PhiNode;
 137 class Pipeline;
 138 class ProjNode;
 139 class RangeCheckNode;
 140 class RegMask;
 141 class RegionNode;
 142 class RootNode;
 143 class SafePointNode;
 144 class SafePointScalarObjectNode;

 145 class StartNode;
 146 class State;
 147 class StoreNode;
 148 class SubNode;
 149 class Type;
 150 class TypeNode;
 151 class UnlockNode;
 152 class VectorNode;
 153 class LoadVectorNode;
 154 class StoreVectorNode;
 155 class VectorSet;
 156 typedef void (*NFunc)(Node&,void*);
 157 extern "C" {
 158   typedef int (*C_sort_func_t)(const void *, const void *);
 159 }
 160 
 161 // The type of all node counts and indexes.
 162 // It must hold at least 16 bits, but must also be fast to load and store.
 163 // This type, if less than 32 bits, could limit the number of possible nodes.
 164 // (To make this type platform-specific, move to globalDefinitions_xxx.hpp.)


 658       DEFINE_CLASS_ID(MachTemp,         Mach, 3)
 659       DEFINE_CLASS_ID(MachConstantBase, Mach, 4)
 660       DEFINE_CLASS_ID(MachConstant,     Mach, 5)
 661         DEFINE_CLASS_ID(MachJump,       MachConstant, 0)
 662       DEFINE_CLASS_ID(MachMerge,        Mach, 6)
 663       DEFINE_CLASS_ID(MachMemBar,       Mach, 7)
 664 
 665     DEFINE_CLASS_ID(Type,  Node, 2)
 666       DEFINE_CLASS_ID(Phi,   Type, 0)
 667       DEFINE_CLASS_ID(ConstraintCast, Type, 1)
 668         DEFINE_CLASS_ID(CastII, ConstraintCast, 0)
 669         DEFINE_CLASS_ID(CheckCastPP, ConstraintCast, 1)
 670       DEFINE_CLASS_ID(CMove, Type, 3)
 671       DEFINE_CLASS_ID(SafePointScalarObject, Type, 4)
 672       DEFINE_CLASS_ID(DecodeNarrowPtr, Type, 5)
 673         DEFINE_CLASS_ID(DecodeN, DecodeNarrowPtr, 0)
 674         DEFINE_CLASS_ID(DecodeNKlass, DecodeNarrowPtr, 1)
 675       DEFINE_CLASS_ID(EncodeNarrowPtr, Type, 6)
 676         DEFINE_CLASS_ID(EncodeP, EncodeNarrowPtr, 0)
 677         DEFINE_CLASS_ID(EncodePKlass, EncodeNarrowPtr, 1)

 678 
 679     DEFINE_CLASS_ID(Proj,  Node, 3)
 680       DEFINE_CLASS_ID(CatchProj, Proj, 0)
 681       DEFINE_CLASS_ID(JumpProj,  Proj, 1)
 682       DEFINE_CLASS_ID(IfProj,    Proj, 2)
 683         DEFINE_CLASS_ID(IfTrue,    IfProj, 0)
 684         DEFINE_CLASS_ID(IfFalse,   IfProj, 1)
 685       DEFINE_CLASS_ID(Parm,      Proj, 4)
 686       DEFINE_CLASS_ID(MachProj,  Proj, 5)
 687 
 688     DEFINE_CLASS_ID(Mem,   Node, 4)
 689       DEFINE_CLASS_ID(Load,  Mem, 0)
 690         DEFINE_CLASS_ID(LoadVector,  Load, 0)
 691           DEFINE_CLASS_ID(LoadBarrierSlowReg, Load, 1)
 692           DEFINE_CLASS_ID(LoadBarrierWeakSlowReg, Load, 2)
 693       DEFINE_CLASS_ID(Store, Mem, 1)
 694         DEFINE_CLASS_ID(StoreVector, Store, 0)
 695       DEFINE_CLASS_ID(LoadStore, Mem, 2)
 696         DEFINE_CLASS_ID(LoadStoreConditional, LoadStore, 0)
 697           DEFINE_CLASS_ID(CompareAndSwap, LoadStoreConditional, 0)


 856   DEFINE_CLASS_QUERY(MachTemp)
 857   DEFINE_CLASS_QUERY(MachMemBar)
 858   DEFINE_CLASS_QUERY(MachMerge)
 859   DEFINE_CLASS_QUERY(Mem)
 860   DEFINE_CLASS_QUERY(MemBar)
 861   DEFINE_CLASS_QUERY(MemBarStoreStore)
 862   DEFINE_CLASS_QUERY(MergeMem)
 863   DEFINE_CLASS_QUERY(Mul)
 864   DEFINE_CLASS_QUERY(Multi)
 865   DEFINE_CLASS_QUERY(MultiBranch)
 866   DEFINE_CLASS_QUERY(OuterStripMinedLoop)
 867   DEFINE_CLASS_QUERY(OuterStripMinedLoopEnd)
 868   DEFINE_CLASS_QUERY(Parm)
 869   DEFINE_CLASS_QUERY(PCTable)
 870   DEFINE_CLASS_QUERY(Phi)
 871   DEFINE_CLASS_QUERY(Proj)
 872   DEFINE_CLASS_QUERY(Region)
 873   DEFINE_CLASS_QUERY(Root)
 874   DEFINE_CLASS_QUERY(SafePoint)
 875   DEFINE_CLASS_QUERY(SafePointScalarObject)

 876   DEFINE_CLASS_QUERY(Start)
 877   DEFINE_CLASS_QUERY(Store)
 878   DEFINE_CLASS_QUERY(Sub)
 879   DEFINE_CLASS_QUERY(Type)
 880   DEFINE_CLASS_QUERY(Vector)
 881   DEFINE_CLASS_QUERY(LoadVector)
 882   DEFINE_CLASS_QUERY(StoreVector)
 883   DEFINE_CLASS_QUERY(Unlock)
 884 
 885   #undef DEFINE_CLASS_QUERY
 886 
 887   // duplicate of is_MachSpillCopy()
 888   bool is_SpillCopy () const {
 889     return ((_class_id & ClassMask_MachSpillCopy) == Class_MachSpillCopy);
 890   }
 891 
 892   bool is_Con () const { return (_flags & Flag_is_Con) != 0; }
 893   // The data node which is safe to leave in dead loop during IGVN optimization.
 894   bool is_dead_loop_safe() const {
 895     return is_Phi() || (is_Proj() && in(0) == NULL) ||


1722   void set_type(const Type* t) {
1723     assert(t != NULL, "sanity");
1724     debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
1725     *(const Type**)&_type = t;   // cast away const-ness
1726     // If this node is in the hash table, make sure it doesn't need a rehash.
1727     assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code");
1728   }
1729   const Type* type() const { assert(_type != NULL, "sanity"); return _type; };
1730   TypeNode( const Type *t, uint required ) : Node(required), _type(t) {
1731     init_class_id(Class_Type);
1732   }
1733   virtual const Type* Value(PhaseGVN* phase) const;
1734   virtual const Type *bottom_type() const;
1735   virtual       uint  ideal_reg() const;
1736 #ifndef PRODUCT
1737   virtual void dump_spec(outputStream *st) const;
1738   virtual void dump_compact_spec(outputStream *st) const;
1739 #endif
1740 };
1741 
1742 #endif // SHARE_OPTO_NODE_HPP
< prev index next >