< prev index next >

src/share/vm/opto/callnode.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, 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  *


 968   {
 969 #ifndef PRODUCT
 970     _counter = NULL;
 971 #endif
 972   }
 973   virtual int Opcode() const = 0;
 974   Node *   obj_node() const       {return in(TypeFunc::Parms + 0); }
 975   Node *   box_node() const       {return in(TypeFunc::Parms + 1); }
 976   Node *   fastlock_node() const  {return in(TypeFunc::Parms + 2); }
 977   void     set_box_node(Node* box) { set_req(TypeFunc::Parms + 1, box); }
 978 
 979   const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;}
 980 
 981   virtual uint size_of() const { return sizeof(*this); }
 982 
 983   bool is_eliminated()  const { return (_kind != Regular); }
 984   bool is_non_esc_obj() const { return (_kind == NonEscObj); }
 985   bool is_coarsened()   const { return (_kind == Coarsened); }
 986   bool is_nested()      const { return (_kind == Nested); }
 987 



 988   void set_non_esc_obj() { _kind = NonEscObj; set_eliminated_lock_counter(); }
 989   void set_coarsened()   { _kind = Coarsened; set_eliminated_lock_counter(); }
 990   void set_nested()      { _kind = Nested; set_eliminated_lock_counter(); }
 991 
 992   // locking does not modify its arguments
 993   virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase){ return false;}
 994 
 995 #ifndef PRODUCT
 996   void create_lock_counter(JVMState* s);
 997   NamedCounter* counter() const { return _counter; }
 998 #endif
 999 };
1000 
1001 //------------------------------Lock---------------------------------------
1002 // High-level lock operation
1003 //
1004 // This is a subclass of CallNode because it is a macro node which gets expanded
1005 // into a code sequence containing a call.  This node takes 3 "parameters":
1006 //    0  -  object to lock
1007 //    1 -   a BoxLockNode


1028 
1029   virtual int Opcode() const;
1030   virtual uint size_of() const; // Size is bigger
1031   LockNode(Compile* C, const TypeFunc *tf) : AbstractLockNode( tf ) {
1032     init_class_id(Class_Lock);
1033     init_flags(Flag_is_macro);
1034     C->add_macro_node(this);
1035   }
1036   virtual bool        guaranteed_safepoint()  { return false; }
1037 
1038   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
1039   // Expansion modifies the JVMState, so we need to clone it
1040   virtual void  clone_jvms(Compile* C) {
1041     if (jvms() != NULL) {
1042       set_jvms(jvms()->clone_deep(C));
1043       jvms()->set_map_deep(this);
1044     }
1045   }
1046 
1047   bool is_nested_lock_region(); // Is this Lock nested?



1048 };
1049 
1050 //------------------------------Unlock---------------------------------------
1051 // High-level unlock operation
1052 class UnlockNode : public AbstractLockNode {




1053 public:
1054   virtual int Opcode() const;
1055   virtual uint size_of() const; // Size is bigger
1056   UnlockNode(Compile* C, const TypeFunc *tf) : AbstractLockNode( tf ) {




1057     init_class_id(Class_Unlock);
1058     init_flags(Flag_is_macro);
1059     C->add_macro_node(this);
1060   }
1061   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
1062   // unlock is never a safepoint
1063   virtual bool        guaranteed_safepoint()  { return false; }








1064 };
1065 
1066 class GraphKit;
1067 
1068 class ArrayCopyNode : public CallNode {
1069 private:
1070 
1071   // What kind of arraycopy variant is this?
1072   enum {
1073     None,            // not set yet
1074     ArrayCopy,       // System.arraycopy()
1075     CloneBasic,      // A clone that can be copied by 64 bit chunks
1076     CloneOop,        // An oop array clone
1077     CopyOf,          // Arrays.copyOf()
1078     CopyOfRange      // Arrays.copyOfRange()
1079   } _kind;
1080 
1081 #ifndef PRODUCT
1082   static const char* _kind_names[CopyOfRange+1];
1083 #endif


   1 /*
   2  * Copyright (c) 1997, 2015, 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  *


 968   {
 969 #ifndef PRODUCT
 970     _counter = NULL;
 971 #endif
 972   }
 973   virtual int Opcode() const = 0;
 974   Node *   obj_node() const       {return in(TypeFunc::Parms + 0); }
 975   Node *   box_node() const       {return in(TypeFunc::Parms + 1); }
 976   Node *   fastlock_node() const  {return in(TypeFunc::Parms + 2); }
 977   void     set_box_node(Node* box) { set_req(TypeFunc::Parms + 1, box); }
 978 
 979   const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;}
 980 
 981   virtual uint size_of() const { return sizeof(*this); }
 982 
 983   bool is_eliminated()  const { return (_kind != Regular); }
 984   bool is_non_esc_obj() const { return (_kind == NonEscObj); }
 985   bool is_coarsened()   const { return (_kind == Coarsened); }
 986   bool is_nested()      const { return (_kind == Nested); }
 987 
 988   const char * kind_as_string() const;
 989   void log_lock_optimization(Phase* phase, const char * tag) const;
 990 
 991   void set_non_esc_obj() { _kind = NonEscObj; set_eliminated_lock_counter(); }
 992   void set_coarsened()   { _kind = Coarsened; set_eliminated_lock_counter(); }
 993   void set_nested()      { _kind = Nested; set_eliminated_lock_counter(); }
 994 
 995   // locking does not modify its arguments
 996   virtual bool may_modify(const TypeOopPtr *t_oop, PhaseTransform *phase){ return false;}
 997 
 998 #ifndef PRODUCT
 999   void create_lock_counter(JVMState* s);
1000   NamedCounter* counter() const { return _counter; }
1001 #endif
1002 };
1003 
1004 //------------------------------Lock---------------------------------------
1005 // High-level lock operation
1006 //
1007 // This is a subclass of CallNode because it is a macro node which gets expanded
1008 // into a code sequence containing a call.  This node takes 3 "parameters":
1009 //    0  -  object to lock
1010 //    1 -   a BoxLockNode


1031 
1032   virtual int Opcode() const;
1033   virtual uint size_of() const; // Size is bigger
1034   LockNode(Compile* C, const TypeFunc *tf) : AbstractLockNode( tf ) {
1035     init_class_id(Class_Lock);
1036     init_flags(Flag_is_macro);
1037     C->add_macro_node(this);
1038   }
1039   virtual bool        guaranteed_safepoint()  { return false; }
1040 
1041   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
1042   // Expansion modifies the JVMState, so we need to clone it
1043   virtual void  clone_jvms(Compile* C) {
1044     if (jvms() != NULL) {
1045       set_jvms(jvms()->clone_deep(C));
1046       jvms()->set_map_deep(this);
1047     }
1048   }
1049 
1050   bool is_nested_lock_region(); // Is this Lock nested?
1051 #ifdef ASSERT
1052   bool is_nested_lock_region_debug(Phase * p); // Why isn't this Lock nested?
1053 #endif
1054 };
1055 
1056 //------------------------------Unlock---------------------------------------
1057 // High-level unlock operation
1058 class UnlockNode : public AbstractLockNode {
1059 private:
1060 #ifdef ASSERT
1061   JVMState* const _dbg_jvms;      // Pointer to list of JVM State objects
1062 #endif
1063 public:
1064   virtual int Opcode() const;
1065   virtual uint size_of() const; // Size is bigger
1066   UnlockNode(Compile* C, const TypeFunc *tf) : AbstractLockNode( tf )
1067 #ifdef ASSERT
1068     , _dbg_jvms(NULL)
1069 #endif
1070   {
1071     init_class_id(Class_Unlock);
1072     init_flags(Flag_is_macro);
1073     C->add_macro_node(this);
1074   }
1075   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
1076   // unlock is never a safepoint
1077   virtual bool        guaranteed_safepoint()  { return false; }
1078 #ifdef ASSERT
1079   void set_dbg_jvms(JVMState* s) {
1080     *(JVMState**)&_dbg_jvms = s;  // override const attribute in the accessor
1081   }
1082   JVMState* dbg_jvms() const { return _dbg_jvms; }
1083 #else
1084   JVMState* dbg_jvms() const { return NULL; }
1085 #endif
1086 };
1087 
1088 class GraphKit;
1089 
1090 class ArrayCopyNode : public CallNode {
1091 private:
1092 
1093   // What kind of arraycopy variant is this?
1094   enum {
1095     None,            // not set yet
1096     ArrayCopy,       // System.arraycopy()
1097     CloneBasic,      // A clone that can be copied by 64 bit chunks
1098     CloneOop,        // An oop array clone
1099     CopyOf,          // Arrays.copyOf()
1100     CopyOfRange      // Arrays.copyOfRange()
1101   } _kind;
1102 
1103 #ifndef PRODUCT
1104   static const char* _kind_names[CopyOfRange+1];
1105 #endif


< prev index next >