src/share/vm/c1/c1_Instruction.hpp

Print this page
rev 3419 : 7023898: Intrinsify AtomicLongFieldUpdater.getAndIncrement()
Summary: use shorter instruction sequences for atomic add and atomic exchange when possible.
Reviewed-by:


  84 class     Intrinsic;
  85 class     BlockBegin;
  86 class     BlockEnd;
  87 class       Goto;
  88 class       If;
  89 class       IfInstanceOf;
  90 class       Switch;
  91 class         TableSwitch;
  92 class         LookupSwitch;
  93 class       Return;
  94 class       Throw;
  95 class       Base;
  96 class   RoundFP;
  97 class   UnsafeOp;
  98 class     UnsafeRawOp;
  99 class       UnsafeGetRaw;
 100 class       UnsafePutRaw;
 101 class     UnsafeObjectOp;
 102 class       UnsafeGetObject;
 103 class       UnsafePutObject;

 104 class       UnsafePrefetch;
 105 class         UnsafePrefetchRead;
 106 class         UnsafePrefetchWrite;
 107 class   ProfileCall;
 108 class   ProfileInvoke;
 109 class   RuntimeCall;
 110 class   MemBar;
 111 
 112 // A Value is a reference to the instruction creating the value
 113 typedef Instruction* Value;
 114 define_array(ValueArray, Value)
 115 define_stack(Values, ValueArray)
 116 
 117 define_array(ValueStackArray, ValueStack*)
 118 define_stack(ValueStackStack, ValueStackArray)
 119 
 120 // BlockClosure is the base class for block traversal/iteration.
 121 
 122 class BlockClosure: public CompilationResourceObj {
 123  public:


 183   virtual void do_InstanceOf     (InstanceOf*      x) = 0;
 184   virtual void do_MonitorEnter   (MonitorEnter*    x) = 0;
 185   virtual void do_MonitorExit    (MonitorExit*     x) = 0;
 186   virtual void do_Intrinsic      (Intrinsic*       x) = 0;
 187   virtual void do_BlockBegin     (BlockBegin*      x) = 0;
 188   virtual void do_Goto           (Goto*            x) = 0;
 189   virtual void do_If             (If*              x) = 0;
 190   virtual void do_IfInstanceOf   (IfInstanceOf*    x) = 0;
 191   virtual void do_TableSwitch    (TableSwitch*     x) = 0;
 192   virtual void do_LookupSwitch   (LookupSwitch*    x) = 0;
 193   virtual void do_Return         (Return*          x) = 0;
 194   virtual void do_Throw          (Throw*           x) = 0;
 195   virtual void do_Base           (Base*            x) = 0;
 196   virtual void do_OsrEntry       (OsrEntry*        x) = 0;
 197   virtual void do_ExceptionObject(ExceptionObject* x) = 0;
 198   virtual void do_RoundFP        (RoundFP*         x) = 0;
 199   virtual void do_UnsafeGetRaw   (UnsafeGetRaw*    x) = 0;
 200   virtual void do_UnsafePutRaw   (UnsafePutRaw*    x) = 0;
 201   virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0;
 202   virtual void do_UnsafePutObject(UnsafePutObject* x) = 0;

 203   virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) = 0;
 204   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
 205   virtual void do_ProfileCall    (ProfileCall*     x) = 0;
 206   virtual void do_ProfileInvoke  (ProfileInvoke*   x) = 0;
 207   virtual void do_RuntimeCall    (RuntimeCall*     x) = 0;
 208   virtual void do_MemBar         (MemBar*          x) = 0;
 209 };
 210 
 211 
 212 // Hashing support
 213 //
 214 // Note: This hash functions affect the performance
 215 //       of ValueMap - make changes carefully!
 216 
 217 #define HASH1(x1            )                    ((intx)(x1))
 218 #define HASH2(x1, x2        )                    ((HASH1(x1        ) << 7) ^ HASH1(x2))
 219 #define HASH3(x1, x2, x3    )                    ((HASH2(x1, x2    ) << 7) ^ HASH1(x3))
 220 #define HASH4(x1, x2, x3, x4)                    ((HASH3(x1, x2, x3) << 7) ^ HASH1(x4))
 221 
 222 


2227 
2228 LEAF(UnsafePutObject, UnsafeObjectOp)
2229  private:
2230   Value _value;                                  // Value to be stored
2231  public:
2232   UnsafePutObject(BasicType basic_type, Value object, Value offset, Value value, bool is_volatile)
2233   : UnsafeObjectOp(basic_type, object, offset, true, is_volatile)
2234     , _value(value)
2235   {
2236     ASSERT_VALUES
2237   }
2238 
2239   // accessors
2240   Value value()                                  { return _value; }
2241 
2242   // generic
2243   virtual void input_values_do(ValueVisitor* f)   { UnsafeObjectOp::input_values_do(f);
2244                                                    f->visit(&_value); }
2245 };
2246 





















2247 
2248 BASE(UnsafePrefetch, UnsafeObjectOp)
2249  public:
2250   UnsafePrefetch(Value object, Value offset)
2251   : UnsafeObjectOp(T_VOID, object, offset, false, false)
2252   {
2253   }
2254 };
2255 
2256 
2257 LEAF(UnsafePrefetchRead, UnsafePrefetch)
2258  public:
2259   UnsafePrefetchRead(Value object, Value offset)
2260   : UnsafePrefetch(object, offset)
2261   {
2262     ASSERT_VALUES
2263   }
2264 };
2265 
2266 




  84 class     Intrinsic;
  85 class     BlockBegin;
  86 class     BlockEnd;
  87 class       Goto;
  88 class       If;
  89 class       IfInstanceOf;
  90 class       Switch;
  91 class         TableSwitch;
  92 class         LookupSwitch;
  93 class       Return;
  94 class       Throw;
  95 class       Base;
  96 class   RoundFP;
  97 class   UnsafeOp;
  98 class     UnsafeRawOp;
  99 class       UnsafeGetRaw;
 100 class       UnsafePutRaw;
 101 class     UnsafeObjectOp;
 102 class       UnsafeGetObject;
 103 class       UnsafePutObject;
 104 class         UnsafeGetAndSetObject;
 105 class       UnsafePrefetch;
 106 class         UnsafePrefetchRead;
 107 class         UnsafePrefetchWrite;
 108 class   ProfileCall;
 109 class   ProfileInvoke;
 110 class   RuntimeCall;
 111 class   MemBar;
 112 
 113 // A Value is a reference to the instruction creating the value
 114 typedef Instruction* Value;
 115 define_array(ValueArray, Value)
 116 define_stack(Values, ValueArray)
 117 
 118 define_array(ValueStackArray, ValueStack*)
 119 define_stack(ValueStackStack, ValueStackArray)
 120 
 121 // BlockClosure is the base class for block traversal/iteration.
 122 
 123 class BlockClosure: public CompilationResourceObj {
 124  public:


 184   virtual void do_InstanceOf     (InstanceOf*      x) = 0;
 185   virtual void do_MonitorEnter   (MonitorEnter*    x) = 0;
 186   virtual void do_MonitorExit    (MonitorExit*     x) = 0;
 187   virtual void do_Intrinsic      (Intrinsic*       x) = 0;
 188   virtual void do_BlockBegin     (BlockBegin*      x) = 0;
 189   virtual void do_Goto           (Goto*            x) = 0;
 190   virtual void do_If             (If*              x) = 0;
 191   virtual void do_IfInstanceOf   (IfInstanceOf*    x) = 0;
 192   virtual void do_TableSwitch    (TableSwitch*     x) = 0;
 193   virtual void do_LookupSwitch   (LookupSwitch*    x) = 0;
 194   virtual void do_Return         (Return*          x) = 0;
 195   virtual void do_Throw          (Throw*           x) = 0;
 196   virtual void do_Base           (Base*            x) = 0;
 197   virtual void do_OsrEntry       (OsrEntry*        x) = 0;
 198   virtual void do_ExceptionObject(ExceptionObject* x) = 0;
 199   virtual void do_RoundFP        (RoundFP*         x) = 0;
 200   virtual void do_UnsafeGetRaw   (UnsafeGetRaw*    x) = 0;
 201   virtual void do_UnsafePutRaw   (UnsafePutRaw*    x) = 0;
 202   virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0;
 203   virtual void do_UnsafePutObject(UnsafePutObject* x) = 0;
 204   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) = 0;
 205   virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) = 0;
 206   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
 207   virtual void do_ProfileCall    (ProfileCall*     x) = 0;
 208   virtual void do_ProfileInvoke  (ProfileInvoke*   x) = 0;
 209   virtual void do_RuntimeCall    (RuntimeCall*     x) = 0;
 210   virtual void do_MemBar         (MemBar*          x) = 0;
 211 };
 212 
 213 
 214 // Hashing support
 215 //
 216 // Note: This hash functions affect the performance
 217 //       of ValueMap - make changes carefully!
 218 
 219 #define HASH1(x1            )                    ((intx)(x1))
 220 #define HASH2(x1, x2        )                    ((HASH1(x1        ) << 7) ^ HASH1(x2))
 221 #define HASH3(x1, x2, x3    )                    ((HASH2(x1, x2    ) << 7) ^ HASH1(x3))
 222 #define HASH4(x1, x2, x3, x4)                    ((HASH3(x1, x2, x3) << 7) ^ HASH1(x4))
 223 
 224 


2229 
2230 LEAF(UnsafePutObject, UnsafeObjectOp)
2231  private:
2232   Value _value;                                  // Value to be stored
2233  public:
2234   UnsafePutObject(BasicType basic_type, Value object, Value offset, Value value, bool is_volatile)
2235   : UnsafeObjectOp(basic_type, object, offset, true, is_volatile)
2236     , _value(value)
2237   {
2238     ASSERT_VALUES
2239   }
2240 
2241   // accessors
2242   Value value()                                  { return _value; }
2243 
2244   // generic
2245   virtual void input_values_do(ValueVisitor* f)   { UnsafeObjectOp::input_values_do(f);
2246                                                    f->visit(&_value); }
2247 };
2248 
2249 LEAF(UnsafeGetAndSetObject, UnsafeObjectOp)
2250  private:
2251   Value _value;                                  // Value to be stored
2252   bool  _is_add;
2253  public:
2254   UnsafeGetAndSetObject(BasicType basic_type, Value object, Value offset, Value value, bool is_add)
2255   : UnsafeObjectOp(basic_type, object, offset, false, false)
2256     , _value(value)
2257     , _is_add(is_add)
2258   {
2259     ASSERT_VALUES
2260   }
2261 
2262   // accessors
2263   bool is_add() const                            { return _is_add; }
2264   Value value()                                  { return _value; }
2265 
2266   // generic
2267   virtual void input_values_do(ValueVisitor* f)   { UnsafeObjectOp::input_values_do(f);
2268                                                    f->visit(&_value); }
2269 };
2270 
2271 BASE(UnsafePrefetch, UnsafeObjectOp)
2272  public:
2273   UnsafePrefetch(Value object, Value offset)
2274   : UnsafeObjectOp(T_VOID, object, offset, false, false)
2275   {
2276   }
2277 };
2278 
2279 
2280 LEAF(UnsafePrefetchRead, UnsafePrefetch)
2281  public:
2282   UnsafePrefetchRead(Value object, Value offset)
2283   : UnsafePrefetch(object, offset)
2284   {
2285     ASSERT_VALUES
2286   }
2287 };
2288 
2289