src/share/vm/opto/locknode.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8031320_8u Sdiff src/share/vm/opto

src/share/vm/opto/locknode.hpp

Print this page
rev 5968 : 8031320: Use Intel RTM instructions for locks
Summary: Use RTM for inflated locks and stack locks.
Reviewed-by: iveresov, twisti, roland, dcubed


  73   }
  74   int stack_slot() const { return _slot; }
  75 
  76   bool is_eliminated() const { return _is_eliminated; }
  77   // mark lock as eliminated.
  78   void set_eliminated()      { _is_eliminated = true; }
  79 
  80   // Is BoxLock node used for one simple lock region?
  81   bool is_simple_lock_region(LockNode** unique_lock, Node* obj);
  82 
  83 #ifndef PRODUCT
  84   virtual void format( PhaseRegAlloc *, outputStream *st ) const;
  85   virtual void dump_spec(outputStream *st) const { st->print("  Lock %d",_slot); }
  86 #endif
  87 };
  88 
  89 //------------------------------FastLockNode-----------------------------------
  90 class FastLockNode: public CmpNode {
  91 private:
  92   BiasedLockingCounters* _counters;


  93 
  94 public:
  95   FastLockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) {
  96     init_req(0,ctrl);
  97     init_class_id(Class_FastLock);
  98     _counters = NULL;


  99   }
 100   Node* obj_node() const { return in(1); }
 101   Node* box_node() const { return in(2); }
 102   void  set_box_node(Node* box) { set_req(2, box); }
 103 
 104   // FastLock and FastUnlockNode do not hash, we need one for each correspoding
 105   // LockNode/UnLockNode to avoid creating Phi's.
 106   virtual uint hash() const ;                  // { return NO_HASH; }

 107   virtual uint cmp( const Node &n ) const ;    // Always fail, except on self
 108   virtual int Opcode() const;
 109   virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; }
 110   const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;}
 111 
 112   void create_lock_counter(JVMState* s);

 113   BiasedLockingCounters* counters() const { return _counters; }


 114 };
 115 
 116 
 117 //------------------------------FastUnlockNode---------------------------------
 118 class FastUnlockNode: public CmpNode {
 119 public:
 120   FastUnlockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) {
 121     init_req(0,ctrl);
 122     init_class_id(Class_FastUnlock);
 123   }
 124   Node* obj_node() const { return in(1); }
 125   Node* box_node() const { return in(2); }
 126 
 127 
 128   // FastLock and FastUnlockNode do not hash, we need one for each correspoding
 129   // LockNode/UnLockNode to avoid creating Phi's.
 130   virtual uint hash() const ;                  // { return NO_HASH; }
 131   virtual uint cmp( const Node &n ) const ;    // Always fail, except on self
 132   virtual int Opcode() const;
 133   virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; }


  73   }
  74   int stack_slot() const { return _slot; }
  75 
  76   bool is_eliminated() const { return _is_eliminated; }
  77   // mark lock as eliminated.
  78   void set_eliminated()      { _is_eliminated = true; }
  79 
  80   // Is BoxLock node used for one simple lock region?
  81   bool is_simple_lock_region(LockNode** unique_lock, Node* obj);
  82 
  83 #ifndef PRODUCT
  84   virtual void format( PhaseRegAlloc *, outputStream *st ) const;
  85   virtual void dump_spec(outputStream *st) const { st->print("  Lock %d",_slot); }
  86 #endif
  87 };
  88 
  89 //------------------------------FastLockNode-----------------------------------
  90 class FastLockNode: public CmpNode {
  91 private:
  92   BiasedLockingCounters*        _counters;
  93   RTMLockingCounters*       _rtm_counters; // RTM lock counters for inflated locks
  94   RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks
  95 
  96 public:
  97   FastLockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) {
  98     init_req(0,ctrl);
  99     init_class_id(Class_FastLock);
 100     _counters = NULL;
 101     _rtm_counters = NULL;
 102     _stack_rtm_counters = NULL;
 103   }
 104   Node* obj_node() const { return in(1); }
 105   Node* box_node() const { return in(2); }
 106   void  set_box_node(Node* box) { set_req(2, box); }
 107 
 108   // FastLock and FastUnlockNode do not hash, we need one for each correspoding
 109   // LockNode/UnLockNode to avoid creating Phi's.
 110   virtual uint hash() const ;                  // { return NO_HASH; }
 111   virtual uint size_of() const;
 112   virtual uint cmp( const Node &n ) const ;    // Always fail, except on self
 113   virtual int Opcode() const;
 114   virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; }
 115   const Type *sub(const Type *t1, const Type *t2) const { return TypeInt::CC;}
 116 
 117   void create_lock_counter(JVMState* s);
 118   void create_rtm_lock_counter(JVMState* state);
 119   BiasedLockingCounters*        counters() const { return _counters; }
 120   RTMLockingCounters*       rtm_counters() const { return _rtm_counters; }
 121   RTMLockingCounters* stack_rtm_counters() const { return _stack_rtm_counters; }
 122 };
 123 
 124 
 125 //------------------------------FastUnlockNode---------------------------------
 126 class FastUnlockNode: public CmpNode {
 127 public:
 128   FastUnlockNode(Node *ctrl, Node *oop, Node *box) : CmpNode(oop,box) {
 129     init_req(0,ctrl);
 130     init_class_id(Class_FastUnlock);
 131   }
 132   Node* obj_node() const { return in(1); }
 133   Node* box_node() const { return in(2); }
 134 
 135 
 136   // FastLock and FastUnlockNode do not hash, we need one for each correspoding
 137   // LockNode/UnLockNode to avoid creating Phi's.
 138   virtual uint hash() const ;                  // { return NO_HASH; }
 139   virtual uint cmp( const Node &n ) const ;    // Always fail, except on self
 140   virtual int Opcode() const;
 141   virtual const Type *Value( PhaseTransform *phase ) const { return TypeInt::CC; }
src/share/vm/opto/locknode.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File