src/share/vm/opto/connode.hpp

Thu, 28 Jun 2012 17:03:16 -0400

author
zgu
date
Thu, 28 Jun 2012 17:03:16 -0400
changeset 3900
d2a62e0f25eb
parent 3099
c124e2e7463e
child 4115
e626685e9f6c
permissions
-rw-r--r--

6995781: Native Memory Tracking (Phase 1)
7151532: DCmd for hotspot native memory tracking
Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd
Reviewed-by: acorn, coleenp, fparain

     1 /*
     2  * Copyright (c) 1997, 2010, 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  */
    25 #ifndef SHARE_VM_OPTO_CONNODE_HPP
    26 #define SHARE_VM_OPTO_CONNODE_HPP
    28 #include "opto/node.hpp"
    29 #include "opto/opcodes.hpp"
    30 #include "opto/type.hpp"
    32 class PhaseTransform;
    33 class MachNode;
    35 //------------------------------ConNode----------------------------------------
    36 // Simple constants
    37 class ConNode : public TypeNode {
    38 public:
    39   ConNode( const Type *t ) : TypeNode(t,1) {
    40     init_req(0, (Node*)Compile::current()->root());
    41     init_flags(Flag_is_Con);
    42   }
    43   virtual int  Opcode() const;
    44   virtual uint hash() const;
    45   virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
    46   virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
    48   // Polymorphic factory method:
    49   static ConNode* make( Compile* C, const Type *t );
    50 };
    52 //------------------------------ConINode---------------------------------------
    53 // Simple integer constants
    54 class ConINode : public ConNode {
    55 public:
    56   ConINode( const TypeInt *t ) : ConNode(t) {}
    57   virtual int Opcode() const;
    59   // Factory method:
    60   static ConINode* make( Compile* C, int con ) {
    61     return new (C, 1) ConINode( TypeInt::make(con) );
    62   }
    64 };
    66 //------------------------------ConPNode---------------------------------------
    67 // Simple pointer constants
    68 class ConPNode : public ConNode {
    69 public:
    70   ConPNode( const TypePtr *t ) : ConNode(t) {}
    71   virtual int Opcode() const;
    73   // Factory methods:
    74   static ConPNode* make( Compile *C ,address con ) {
    75     if (con == NULL)
    76       return new (C, 1) ConPNode( TypePtr::NULL_PTR ) ;
    77     else
    78       return new (C, 1) ConPNode( TypeRawPtr::make(con) );
    79   }
    80 };
    83 //------------------------------ConNNode--------------------------------------
    84 // Simple narrow oop constants
    85 class ConNNode : public ConNode {
    86 public:
    87   ConNNode( const TypeNarrowOop *t ) : ConNode(t) {}
    88   virtual int Opcode() const;
    89 };
    92 //------------------------------ConLNode---------------------------------------
    93 // Simple long constants
    94 class ConLNode : public ConNode {
    95 public:
    96   ConLNode( const TypeLong *t ) : ConNode(t) {}
    97   virtual int Opcode() const;
    99   // Factory method:
   100   static ConLNode* make( Compile *C ,jlong con ) {
   101     return new (C, 1) ConLNode( TypeLong::make(con) );
   102   }
   104 };
   106 //------------------------------ConFNode---------------------------------------
   107 // Simple float constants
   108 class ConFNode : public ConNode {
   109 public:
   110   ConFNode( const TypeF *t ) : ConNode(t) {}
   111   virtual int Opcode() const;
   113   // Factory method:
   114   static ConFNode* make( Compile *C, float con  ) {
   115     return new (C, 1) ConFNode( TypeF::make(con) );
   116   }
   118 };
   120 //------------------------------ConDNode---------------------------------------
   121 // Simple double constants
   122 class ConDNode : public ConNode {
   123 public:
   124   ConDNode( const TypeD *t ) : ConNode(t) {}
   125   virtual int Opcode() const;
   127   // Factory method:
   128   static ConDNode* make( Compile *C, double con ) {
   129     return new (C, 1) ConDNode( TypeD::make(con) );
   130   }
   132 };
   134 //------------------------------BinaryNode-------------------------------------
   135 // Place holder for the 2 conditional inputs to a CMove.  CMove needs 4
   136 // inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some
   137 // compare), and the 2 values to select between.  The Matcher requires a
   138 // binary tree so we break it down like this:
   139 //     (CMove (Binary bol cmp) (Binary src1 src2))
   140 class BinaryNode : public Node {
   141 public:
   142   BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { }
   143   virtual int Opcode() const;
   144   virtual uint ideal_reg() const { return 0; }
   145 };
   147 //------------------------------CMoveNode--------------------------------------
   148 // Conditional move
   149 class CMoveNode : public TypeNode {
   150 public:
   151   enum { Control,               // When is it safe to do this cmove?
   152          Condition,             // Condition controlling the cmove
   153          IfFalse,               // Value if condition is false
   154          IfTrue };              // Value if condition is true
   155   CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4)
   156   {
   157     init_class_id(Class_CMove);
   158     // all inputs are nullified in Node::Node(int)
   159     // init_req(Control,NULL);
   160     init_req(Condition,bol);
   161     init_req(IfFalse,left);
   162     init_req(IfTrue,right);
   163   }
   164   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   165   virtual const Type *Value( PhaseTransform *phase ) const;
   166   virtual Node *Identity( PhaseTransform *phase );
   167   static CMoveNode *make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t );
   168   // Helper function to spot cmove graph shapes
   169   static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b );
   170 };
   172 //------------------------------CMoveDNode-------------------------------------
   173 class CMoveDNode : public CMoveNode {
   174 public:
   175   CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){}
   176   virtual int Opcode() const;
   177   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   178 };
   180 //------------------------------CMoveFNode-------------------------------------
   181 class CMoveFNode : public CMoveNode {
   182 public:
   183   CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {}
   184   virtual int Opcode() const;
   185   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   186 };
   188 //------------------------------CMoveINode-------------------------------------
   189 class CMoveINode : public CMoveNode {
   190 public:
   191   CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){}
   192   virtual int Opcode() const;
   193   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   194 };
   196 //------------------------------CMoveLNode-------------------------------------
   197 class CMoveLNode : public CMoveNode {
   198 public:
   199   CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){}
   200   virtual int Opcode() const;
   201 };
   203 //------------------------------CMovePNode-------------------------------------
   204 class CMovePNode : public CMoveNode {
   205 public:
   206   CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
   207   virtual int Opcode() const;
   208 };
   210 //------------------------------CMoveNNode-------------------------------------
   211 class CMoveNNode : public CMoveNode {
   212 public:
   213   CMoveNNode( Node *c, Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
   214   virtual int Opcode() const;
   215 };
   217 //------------------------------ConstraintCastNode-----------------------------
   218 // cast to a different range
   219 class ConstraintCastNode: public TypeNode {
   220 public:
   221   ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) {
   222     init_class_id(Class_ConstraintCast);
   223     init_req(1, n);
   224   }
   225   virtual Node *Identity( PhaseTransform *phase );
   226   virtual const Type *Value( PhaseTransform *phase ) const;
   227   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   228   virtual int Opcode() const;
   229   virtual uint ideal_reg() const = 0;
   230   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
   231 };
   233 //------------------------------CastIINode-------------------------------------
   234 // cast integer to integer (different range)
   235 class CastIINode: public ConstraintCastNode {
   236 public:
   237   CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
   238   virtual int Opcode() const;
   239   virtual uint ideal_reg() const { return Op_RegI; }
   240 };
   242 //------------------------------CastPPNode-------------------------------------
   243 // cast pointer to pointer (different type)
   244 class CastPPNode: public ConstraintCastNode {
   245 public:
   246   CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {}
   247   virtual int Opcode() const;
   248   virtual uint ideal_reg() const { return Op_RegP; }
   249   virtual Node *Ideal_DU_postCCP( PhaseCCP * );
   250 };
   252 //------------------------------CheckCastPPNode--------------------------------
   253 // for _checkcast, cast pointer to pointer (different type), without JOIN,
   254 class CheckCastPPNode: public TypeNode {
   255 public:
   256   CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) {
   257     init_class_id(Class_CheckCastPP);
   258     init_req(0, c);
   259     init_req(1, n);
   260   }
   262   virtual Node *Identity( PhaseTransform *phase );
   263   virtual const Type *Value( PhaseTransform *phase ) const;
   264   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   265   virtual int   Opcode() const;
   266   virtual uint  ideal_reg() const { return Op_RegP; }
   267   // No longer remove CheckCast after CCP as it gives me a place to hang
   268   // the proper address type - which is required to compute anti-deps.
   269   //virtual Node *Ideal_DU_postCCP( PhaseCCP * );
   270 };
   273 //------------------------------EncodeP--------------------------------
   274 // Encodes an oop pointers into its compressed form
   275 // Takes an extra argument which is the real heap base as a long which
   276 // may be useful for code generation in the backend.
   277 class EncodePNode : public TypeNode {
   278  public:
   279   EncodePNode(Node* value, const Type* type):
   280     TypeNode(type, 2) {
   281     init_class_id(Class_EncodeP);
   282     init_req(0, NULL);
   283     init_req(1, value);
   284   }
   285   virtual int Opcode() const;
   286   virtual Node *Identity( PhaseTransform *phase );
   287   virtual const Type *Value( PhaseTransform *phase ) const;
   288   virtual uint  ideal_reg() const { return Op_RegN; }
   290   virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
   291 };
   293 //------------------------------DecodeN--------------------------------
   294 // Converts a narrow oop into a real oop ptr.
   295 // Takes an extra argument which is the real heap base as a long which
   296 // may be useful for code generation in the backend.
   297 class DecodeNNode : public TypeNode {
   298  public:
   299   DecodeNNode(Node* value, const Type* type):
   300     TypeNode(type, 2) {
   301     init_class_id(Class_DecodeN);
   302     init_req(0, NULL);
   303     init_req(1, value);
   304   }
   305   virtual int Opcode() const;
   306   virtual Node *Identity( PhaseTransform *phase );
   307   virtual const Type *Value( PhaseTransform *phase ) const;
   308   virtual uint  ideal_reg() const { return Op_RegP; }
   309 };
   311 //------------------------------Conv2BNode-------------------------------------
   312 // Convert int/pointer to a Boolean.  Map zero to zero, all else to 1.
   313 class Conv2BNode : public Node {
   314 public:
   315   Conv2BNode( Node *i ) : Node(0,i) {}
   316   virtual int Opcode() const;
   317   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
   318   virtual Node *Identity( PhaseTransform *phase );
   319   virtual const Type *Value( PhaseTransform *phase ) const;
   320   virtual uint  ideal_reg() const { return Op_RegI; }
   321 };
   323 // The conversions operations are all Alpha sorted.  Please keep it that way!
   324 //------------------------------ConvD2FNode------------------------------------
   325 // Convert double to float
   326 class ConvD2FNode : public Node {
   327 public:
   328   ConvD2FNode( Node *in1 ) : Node(0,in1) {}
   329   virtual int Opcode() const;
   330   virtual const Type *bottom_type() const { return Type::FLOAT; }
   331   virtual const Type *Value( PhaseTransform *phase ) const;
   332   virtual Node *Identity( PhaseTransform *phase );
   333   virtual uint  ideal_reg() const { return Op_RegF; }
   334 };
   336 //------------------------------ConvD2INode------------------------------------
   337 // Convert Double to Integer
   338 class ConvD2INode : public Node {
   339 public:
   340   ConvD2INode( Node *in1 ) : Node(0,in1) {}
   341   virtual int Opcode() const;
   342   virtual const Type *bottom_type() const { return TypeInt::INT; }
   343   virtual const Type *Value( PhaseTransform *phase ) const;
   344   virtual Node *Identity( PhaseTransform *phase );
   345   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   346   virtual uint  ideal_reg() const { return Op_RegI; }
   347 };
   349 //------------------------------ConvD2LNode------------------------------------
   350 // Convert Double to Long
   351 class ConvD2LNode : public Node {
   352 public:
   353   ConvD2LNode( Node *dbl ) : Node(0,dbl) {}
   354   virtual int Opcode() const;
   355   virtual const Type *bottom_type() const { return TypeLong::LONG; }
   356   virtual const Type *Value( PhaseTransform *phase ) const;
   357   virtual Node *Identity( PhaseTransform *phase );
   358   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   359   virtual uint ideal_reg() const { return Op_RegL; }
   360 };
   362 //------------------------------ConvF2DNode------------------------------------
   363 // Convert Float to a Double.
   364 class ConvF2DNode : public Node {
   365 public:
   366   ConvF2DNode( Node *in1 ) : Node(0,in1) {}
   367   virtual int Opcode() const;
   368   virtual const Type *bottom_type() const { return Type::DOUBLE; }
   369   virtual const Type *Value( PhaseTransform *phase ) const;
   370   virtual uint  ideal_reg() const { return Op_RegD; }
   371 };
   373 //------------------------------ConvF2INode------------------------------------
   374 // Convert float to integer
   375 class ConvF2INode : public Node {
   376 public:
   377   ConvF2INode( Node *in1 ) : Node(0,in1) {}
   378   virtual int Opcode() const;
   379   virtual const Type *bottom_type() const { return TypeInt::INT; }
   380   virtual const Type *Value( PhaseTransform *phase ) const;
   381   virtual Node *Identity( PhaseTransform *phase );
   382   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   383   virtual uint  ideal_reg() const { return Op_RegI; }
   384 };
   386 //------------------------------ConvF2LNode------------------------------------
   387 // Convert float to long
   388 class ConvF2LNode : public Node {
   389 public:
   390   ConvF2LNode( Node *in1 ) : Node(0,in1) {}
   391   virtual int Opcode() const;
   392   virtual const Type *bottom_type() const { return TypeLong::LONG; }
   393   virtual const Type *Value( PhaseTransform *phase ) const;
   394   virtual Node *Identity( PhaseTransform *phase );
   395   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   396   virtual uint  ideal_reg() const { return Op_RegL; }
   397 };
   399 //------------------------------ConvI2DNode------------------------------------
   400 // Convert Integer to Double
   401 class ConvI2DNode : public Node {
   402 public:
   403   ConvI2DNode( Node *in1 ) : Node(0,in1) {}
   404   virtual int Opcode() const;
   405   virtual const Type *bottom_type() const { return Type::DOUBLE; }
   406   virtual const Type *Value( PhaseTransform *phase ) const;
   407   virtual uint  ideal_reg() const { return Op_RegD; }
   408 };
   410 //------------------------------ConvI2FNode------------------------------------
   411 // Convert Integer to Float
   412 class ConvI2FNode : public Node {
   413 public:
   414   ConvI2FNode( Node *in1 ) : Node(0,in1) {}
   415   virtual int Opcode() const;
   416   virtual const Type *bottom_type() const { return Type::FLOAT; }
   417   virtual const Type *Value( PhaseTransform *phase ) const;
   418   virtual Node *Identity( PhaseTransform *phase );
   419   virtual uint  ideal_reg() const { return Op_RegF; }
   420 };
   422 //------------------------------ConvI2LNode------------------------------------
   423 // Convert integer to long
   424 class ConvI2LNode : public TypeNode {
   425 public:
   426   ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT)
   427     : TypeNode(t, 2)
   428   { init_req(1, in1); }
   429   virtual int Opcode() const;
   430   virtual const Type *Value( PhaseTransform *phase ) const;
   431   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   432   virtual uint  ideal_reg() const { return Op_RegL; }
   433 };
   435 //------------------------------ConvL2DNode------------------------------------
   436 // Convert Long to Double
   437 class ConvL2DNode : public Node {
   438 public:
   439   ConvL2DNode( Node *in1 ) : Node(0,in1) {}
   440   virtual int Opcode() const;
   441   virtual const Type *bottom_type() const { return Type::DOUBLE; }
   442   virtual const Type *Value( PhaseTransform *phase ) const;
   443   virtual uint ideal_reg() const { return Op_RegD; }
   444 };
   446 //------------------------------ConvL2FNode------------------------------------
   447 // Convert Long to Float
   448 class ConvL2FNode : public Node {
   449 public:
   450   ConvL2FNode( Node *in1 ) : Node(0,in1) {}
   451   virtual int Opcode() const;
   452   virtual const Type *bottom_type() const { return Type::FLOAT; }
   453   virtual const Type *Value( PhaseTransform *phase ) const;
   454   virtual uint  ideal_reg() const { return Op_RegF; }
   455 };
   457 //------------------------------ConvL2INode------------------------------------
   458 // Convert long to integer
   459 class ConvL2INode : public Node {
   460 public:
   461   ConvL2INode( Node *in1 ) : Node(0,in1) {}
   462   virtual int Opcode() const;
   463   virtual const Type *bottom_type() const { return TypeInt::INT; }
   464   virtual Node *Identity( PhaseTransform *phase );
   465   virtual const Type *Value( PhaseTransform *phase ) const;
   466   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   467   virtual uint  ideal_reg() const { return Op_RegI; }
   468 };
   470 //------------------------------CastX2PNode-------------------------------------
   471 // convert a machine-pointer-sized integer to a raw pointer
   472 class CastX2PNode : public Node {
   473 public:
   474   CastX2PNode( Node *n ) : Node(NULL, n) {}
   475   virtual int Opcode() const;
   476   virtual const Type *Value( PhaseTransform *phase ) const;
   477   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   478   virtual Node *Identity( PhaseTransform *phase );
   479   virtual uint ideal_reg() const { return Op_RegP; }
   480   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
   481 };
   483 //------------------------------CastP2XNode-------------------------------------
   484 // Used in both 32-bit and 64-bit land.
   485 // Used for card-marks and unsafe pointer math.
   486 class CastP2XNode : public Node {
   487 public:
   488   CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
   489   virtual int Opcode() const;
   490   virtual const Type *Value( PhaseTransform *phase ) const;
   491   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   492   virtual Node *Identity( PhaseTransform *phase );
   493   virtual uint ideal_reg() const { return Op_RegX; }
   494   virtual const Type *bottom_type() const { return TypeX_X; }
   495   // Return false to keep node from moving away from an associated card mark.
   496   virtual bool depends_only_on_test() const { return false; }
   497 };
   499 //------------------------------ThreadLocalNode--------------------------------
   500 // Ideal Node which returns the base of ThreadLocalStorage.
   501 class ThreadLocalNode : public Node {
   502 public:
   503   ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {}
   504   virtual int Opcode() const;
   505   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;}
   506   virtual uint ideal_reg() const { return Op_RegP; }
   507 };
   509 //------------------------------LoadReturnPCNode-------------------------------
   510 class LoadReturnPCNode: public Node {
   511 public:
   512   LoadReturnPCNode(Node *c) : Node(c) { }
   513   virtual int Opcode() const;
   514   virtual uint ideal_reg() const { return Op_RegP; }
   515 };
   518 //-----------------------------RoundFloatNode----------------------------------
   519 class RoundFloatNode: public Node {
   520 public:
   521   RoundFloatNode(Node* c, Node *in1): Node(c, in1) {}
   522   virtual int   Opcode() const;
   523   virtual const Type *bottom_type() const { return Type::FLOAT; }
   524   virtual uint  ideal_reg() const { return Op_RegF; }
   525   virtual Node *Identity( PhaseTransform *phase );
   526   virtual const Type *Value( PhaseTransform *phase ) const;
   527 };
   530 //-----------------------------RoundDoubleNode---------------------------------
   531 class RoundDoubleNode: public Node {
   532 public:
   533   RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {}
   534   virtual int   Opcode() const;
   535   virtual const Type *bottom_type() const { return Type::DOUBLE; }
   536   virtual uint  ideal_reg() const { return Op_RegD; }
   537   virtual Node *Identity( PhaseTransform *phase );
   538   virtual const Type *Value( PhaseTransform *phase ) const;
   539 };
   541 //------------------------------Opaque1Node------------------------------------
   542 // A node to prevent unwanted optimizations.  Allows constant folding.
   543 // Stops value-numbering, Ideal calls or Identity functions.
   544 class Opaque1Node : public Node {
   545   virtual uint hash() const ;                  // { return NO_HASH; }
   546   virtual uint cmp( const Node &n ) const;
   547 public:
   548   Opaque1Node( Compile* C, Node *n ) : Node(0,n) {
   549     // Put it on the Macro nodes list to removed during macro nodes expansion.
   550     init_flags(Flag_is_macro);
   551     C->add_macro_node(this);
   552   }
   553   // Special version for the pre-loop to hold the original loop limit
   554   // which is consumed by range check elimination.
   555   Opaque1Node( Compile* C, Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {
   556     // Put it on the Macro nodes list to removed during macro nodes expansion.
   557     init_flags(Flag_is_macro);
   558     C->add_macro_node(this);
   559   }
   560   Node* original_loop_limit() { return req()==3 ? in(2) : NULL; }
   561   virtual int Opcode() const;
   562   virtual const Type *bottom_type() const { return TypeInt::INT; }
   563   virtual Node *Identity( PhaseTransform *phase );
   564 };
   566 //------------------------------Opaque2Node------------------------------------
   567 // A node to prevent unwanted optimizations.  Allows constant folding.  Stops
   568 // value-numbering, most Ideal calls or Identity functions.  This Node is
   569 // specifically designed to prevent the pre-increment value of a loop trip
   570 // counter from being live out of the bottom of the loop (hence causing the
   571 // pre- and post-increment values both being live and thus requiring an extra
   572 // temp register and an extra move).  If we "accidentally" optimize through
   573 // this kind of a Node, we'll get slightly pessimal, but correct, code.  Thus
   574 // it's OK to be slightly sloppy on optimizations here.
   575 class Opaque2Node : public Node {
   576   virtual uint hash() const ;                  // { return NO_HASH; }
   577   virtual uint cmp( const Node &n ) const;
   578 public:
   579   Opaque2Node( Compile* C, Node *n ) : Node(0,n) {
   580     // Put it on the Macro nodes list to removed during macro nodes expansion.
   581     init_flags(Flag_is_macro);
   582     C->add_macro_node(this);
   583   }
   584   virtual int Opcode() const;
   585   virtual const Type *bottom_type() const { return TypeInt::INT; }
   586 };
   588 //----------------------PartialSubtypeCheckNode--------------------------------
   589 // The 2nd slow-half of a subtype check.  Scan the subklass's 2ndary superklass
   590 // array for an instance of the superklass.  Set a hidden internal cache on a
   591 // hit (cache is checked with exposed code in gen_subtype_check()).  Return
   592 // not zero for a miss or zero for a hit.
   593 class PartialSubtypeCheckNode : public Node {
   594 public:
   595   PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {}
   596   virtual int Opcode() const;
   597   virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
   598   virtual uint ideal_reg() const { return Op_RegP; }
   599 };
   601 //
   602 class MoveI2FNode : public Node {
   603  public:
   604   MoveI2FNode( Node *value ) : Node(0,value) {}
   605   virtual int Opcode() const;
   606   virtual const Type *bottom_type() const { return Type::FLOAT; }
   607   virtual uint ideal_reg() const { return Op_RegF; }
   608   virtual const Type* Value( PhaseTransform *phase ) const;
   609 };
   611 class MoveL2DNode : public Node {
   612  public:
   613   MoveL2DNode( Node *value ) : Node(0,value) {}
   614   virtual int Opcode() const;
   615   virtual const Type *bottom_type() const { return Type::DOUBLE; }
   616   virtual uint ideal_reg() const { return Op_RegD; }
   617   virtual const Type* Value( PhaseTransform *phase ) const;
   618 };
   620 class MoveF2INode : public Node {
   621  public:
   622   MoveF2INode( Node *value ) : Node(0,value) {}
   623   virtual int Opcode() const;
   624   virtual const Type *bottom_type() const { return TypeInt::INT; }
   625   virtual uint ideal_reg() const { return Op_RegI; }
   626   virtual const Type* Value( PhaseTransform *phase ) const;
   627 };
   629 class MoveD2LNode : public Node {
   630  public:
   631   MoveD2LNode( Node *value ) : Node(0,value) {}
   632   virtual int Opcode() const;
   633   virtual const Type *bottom_type() const { return TypeLong::LONG; }
   634   virtual uint ideal_reg() const { return Op_RegL; }
   635   virtual const Type* Value( PhaseTransform *phase ) const;
   636 };
   638 //---------- CountBitsNode -----------------------------------------------------
   639 class CountBitsNode : public Node {
   640 public:
   641   CountBitsNode(Node* in1) : Node(0, in1) {}
   642   const Type* bottom_type() const { return TypeInt::INT; }
   643   virtual uint ideal_reg() const { return Op_RegI; }
   644 };
   646 //---------- CountLeadingZerosINode --------------------------------------------
   647 // Count leading zeros (0-bit count starting from MSB) of an integer.
   648 class CountLeadingZerosINode : public CountBitsNode {
   649 public:
   650   CountLeadingZerosINode(Node* in1) : CountBitsNode(in1) {}
   651   virtual int Opcode() const;
   652   virtual const Type* Value(PhaseTransform* phase) const;
   653 };
   655 //---------- CountLeadingZerosLNode --------------------------------------------
   656 // Count leading zeros (0-bit count starting from MSB) of a long.
   657 class CountLeadingZerosLNode : public CountBitsNode {
   658 public:
   659   CountLeadingZerosLNode(Node* in1) : CountBitsNode(in1) {}
   660   virtual int Opcode() const;
   661   virtual const Type* Value(PhaseTransform* phase) const;
   662 };
   664 //---------- CountTrailingZerosINode -------------------------------------------
   665 // Count trailing zeros (0-bit count starting from LSB) of an integer.
   666 class CountTrailingZerosINode : public CountBitsNode {
   667 public:
   668   CountTrailingZerosINode(Node* in1) : CountBitsNode(in1) {}
   669   virtual int Opcode() const;
   670   virtual const Type* Value(PhaseTransform* phase) const;
   671 };
   673 //---------- CountTrailingZerosLNode -------------------------------------------
   674 // Count trailing zeros (0-bit count starting from LSB) of a long.
   675 class CountTrailingZerosLNode : public CountBitsNode {
   676 public:
   677   CountTrailingZerosLNode(Node* in1) : CountBitsNode(in1) {}
   678   virtual int Opcode() const;
   679   virtual const Type* Value(PhaseTransform* phase) const;
   680 };
   682 //---------- PopCountINode -----------------------------------------------------
   683 // Population count (bit count) of an integer.
   684 class PopCountINode : public CountBitsNode {
   685 public:
   686   PopCountINode(Node* in1) : CountBitsNode(in1) {}
   687   virtual int Opcode() const;
   688 };
   690 //---------- PopCountLNode -----------------------------------------------------
   691 // Population count (bit count) of a long.
   692 class PopCountLNode : public CountBitsNode {
   693 public:
   694   PopCountLNode(Node* in1) : CountBitsNode(in1) {}
   695   virtual int Opcode() const;
   696 };
   698 #endif // SHARE_VM_OPTO_CONNODE_HPP

mercurial