hotspot/src/share/vm/opto/library_call.cpp
changeset 45514 0fc9cc73ce45
parent 44634 cf2e2a4c3358
child 45766 4b5557c9b656
child 46458 3c12af929e7d
equal deleted inserted replaced
45513:5431282d8ce1 45514:0fc9cc73ce45
   647   case vmIntrinsics::_putIntOpaque:             return inline_unsafe_access( is_store, T_INT,      Opaque, false);
   647   case vmIntrinsics::_putIntOpaque:             return inline_unsafe_access( is_store, T_INT,      Opaque, false);
   648   case vmIntrinsics::_putLongOpaque:            return inline_unsafe_access( is_store, T_LONG,     Opaque, false);
   648   case vmIntrinsics::_putLongOpaque:            return inline_unsafe_access( is_store, T_LONG,     Opaque, false);
   649   case vmIntrinsics::_putFloatOpaque:           return inline_unsafe_access( is_store, T_FLOAT,    Opaque, false);
   649   case vmIntrinsics::_putFloatOpaque:           return inline_unsafe_access( is_store, T_FLOAT,    Opaque, false);
   650   case vmIntrinsics::_putDoubleOpaque:          return inline_unsafe_access( is_store, T_DOUBLE,   Opaque, false);
   650   case vmIntrinsics::_putDoubleOpaque:          return inline_unsafe_access( is_store, T_DOUBLE,   Opaque, false);
   651 
   651 
   652   case vmIntrinsics::_compareAndSwapObject:             return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap,      Volatile);
   652   case vmIntrinsics::_compareAndSetObject:              return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap,      Volatile);
   653   case vmIntrinsics::_compareAndSwapByte:               return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap,      Volatile);
   653   case vmIntrinsics::_compareAndSetByte:                return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap,      Volatile);
   654   case vmIntrinsics::_compareAndSwapShort:              return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap,      Volatile);
   654   case vmIntrinsics::_compareAndSetShort:               return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap,      Volatile);
   655   case vmIntrinsics::_compareAndSwapInt:                return inline_unsafe_load_store(T_INT,    LS_cmp_swap,      Volatile);
   655   case vmIntrinsics::_compareAndSetInt:                 return inline_unsafe_load_store(T_INT,    LS_cmp_swap,      Volatile);
   656   case vmIntrinsics::_compareAndSwapLong:               return inline_unsafe_load_store(T_LONG,   LS_cmp_swap,      Volatile);
   656   case vmIntrinsics::_compareAndSetLong:                return inline_unsafe_load_store(T_LONG,   LS_cmp_swap,      Volatile);
   657 
   657 
   658   case vmIntrinsics::_weakCompareAndSwapObject:         return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
   658   case vmIntrinsics::_weakCompareAndSetObjectPlain:     return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
   659   case vmIntrinsics::_weakCompareAndSwapObjectAcquire:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
   659   case vmIntrinsics::_weakCompareAndSetObjectAcquire:   return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
   660   case vmIntrinsics::_weakCompareAndSwapObjectRelease:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
   660   case vmIntrinsics::_weakCompareAndSetObjectRelease:   return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
   661   case vmIntrinsics::_weakCompareAndSwapObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
   661   case vmIntrinsics::_weakCompareAndSetObject:          return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
   662   case vmIntrinsics::_weakCompareAndSwapByte:           return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Relaxed);
   662   case vmIntrinsics::_weakCompareAndSetBytePlain:       return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Relaxed);
   663   case vmIntrinsics::_weakCompareAndSwapByteAcquire:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Acquire);
   663   case vmIntrinsics::_weakCompareAndSetByteAcquire:     return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Acquire);
   664   case vmIntrinsics::_weakCompareAndSwapByteRelease:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Release);
   664   case vmIntrinsics::_weakCompareAndSetByteRelease:     return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Release);
   665   case vmIntrinsics::_weakCompareAndSwapByteVolatile:   return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Volatile);
   665   case vmIntrinsics::_weakCompareAndSetByte:            return inline_unsafe_load_store(T_BYTE,   LS_cmp_swap_weak, Volatile);
   666   case vmIntrinsics::_weakCompareAndSwapShort:          return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Relaxed);
   666   case vmIntrinsics::_weakCompareAndSetShortPlain:      return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Relaxed);
   667   case vmIntrinsics::_weakCompareAndSwapShortAcquire:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Acquire);
   667   case vmIntrinsics::_weakCompareAndSetShortAcquire:    return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Acquire);
   668   case vmIntrinsics::_weakCompareAndSwapShortRelease:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Release);
   668   case vmIntrinsics::_weakCompareAndSetShortRelease:    return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Release);
   669   case vmIntrinsics::_weakCompareAndSwapShortVolatile:  return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Volatile);
   669   case vmIntrinsics::_weakCompareAndSetShort:           return inline_unsafe_load_store(T_SHORT,  LS_cmp_swap_weak, Volatile);
   670   case vmIntrinsics::_weakCompareAndSwapInt:            return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Relaxed);
   670   case vmIntrinsics::_weakCompareAndSetIntPlain:        return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Relaxed);
   671   case vmIntrinsics::_weakCompareAndSwapIntAcquire:     return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Acquire);
   671   case vmIntrinsics::_weakCompareAndSetIntAcquire:      return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Acquire);
   672   case vmIntrinsics::_weakCompareAndSwapIntRelease:     return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Release);
   672   case vmIntrinsics::_weakCompareAndSetIntRelease:      return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Release);
   673   case vmIntrinsics::_weakCompareAndSwapIntVolatile:    return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Volatile);
   673   case vmIntrinsics::_weakCompareAndSetInt:             return inline_unsafe_load_store(T_INT,    LS_cmp_swap_weak, Volatile);
   674   case vmIntrinsics::_weakCompareAndSwapLong:           return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Relaxed);
   674   case vmIntrinsics::_weakCompareAndSetLongPlain:       return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Relaxed);
   675   case vmIntrinsics::_weakCompareAndSwapLongAcquire:    return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Acquire);
   675   case vmIntrinsics::_weakCompareAndSetLongAcquire:     return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Acquire);
   676   case vmIntrinsics::_weakCompareAndSwapLongRelease:    return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Release);
   676   case vmIntrinsics::_weakCompareAndSetLongRelease:     return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Release);
   677   case vmIntrinsics::_weakCompareAndSwapLongVolatile:   return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Volatile);
   677   case vmIntrinsics::_weakCompareAndSetLong:            return inline_unsafe_load_store(T_LONG,   LS_cmp_swap_weak, Volatile);
   678 
   678 
   679   case vmIntrinsics::_compareAndExchangeObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Volatile);
   679   case vmIntrinsics::_compareAndExchangeObject:         return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Volatile);
   680   case vmIntrinsics::_compareAndExchangeObjectAcquire:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Acquire);
   680   case vmIntrinsics::_compareAndExchangeObjectAcquire:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Acquire);
   681   case vmIntrinsics::_compareAndExchangeObjectRelease:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Release);
   681   case vmIntrinsics::_compareAndExchangeObjectRelease:  return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange,  Release);
   682   case vmIntrinsics::_compareAndExchangeByteVolatile:   return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Volatile);
   682   case vmIntrinsics::_compareAndExchangeByte:           return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Volatile);
   683   case vmIntrinsics::_compareAndExchangeByteAcquire:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Acquire);
   683   case vmIntrinsics::_compareAndExchangeByteAcquire:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Acquire);
   684   case vmIntrinsics::_compareAndExchangeByteRelease:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Release);
   684   case vmIntrinsics::_compareAndExchangeByteRelease:    return inline_unsafe_load_store(T_BYTE,   LS_cmp_exchange,  Release);
   685   case vmIntrinsics::_compareAndExchangeShortVolatile:  return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Volatile);
   685   case vmIntrinsics::_compareAndExchangeShort:          return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Volatile);
   686   case vmIntrinsics::_compareAndExchangeShortAcquire:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Acquire);
   686   case vmIntrinsics::_compareAndExchangeShortAcquire:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Acquire);
   687   case vmIntrinsics::_compareAndExchangeShortRelease:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Release);
   687   case vmIntrinsics::_compareAndExchangeShortRelease:   return inline_unsafe_load_store(T_SHORT,  LS_cmp_exchange,  Release);
   688   case vmIntrinsics::_compareAndExchangeIntVolatile:    return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Volatile);
   688   case vmIntrinsics::_compareAndExchangeInt:            return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Volatile);
   689   case vmIntrinsics::_compareAndExchangeIntAcquire:     return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Acquire);
   689   case vmIntrinsics::_compareAndExchangeIntAcquire:     return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Acquire);
   690   case vmIntrinsics::_compareAndExchangeIntRelease:     return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Release);
   690   case vmIntrinsics::_compareAndExchangeIntRelease:     return inline_unsafe_load_store(T_INT,    LS_cmp_exchange,  Release);
   691   case vmIntrinsics::_compareAndExchangeLongVolatile:   return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Volatile);
   691   case vmIntrinsics::_compareAndExchangeLong:           return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Volatile);
   692   case vmIntrinsics::_compareAndExchangeLongAcquire:    return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Acquire);
   692   case vmIntrinsics::_compareAndExchangeLongAcquire:    return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Acquire);
   693   case vmIntrinsics::_compareAndExchangeLongRelease:    return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Release);
   693   case vmIntrinsics::_compareAndExchangeLongRelease:    return inline_unsafe_load_store(T_LONG,   LS_cmp_exchange,  Release);
   694 
   694 
   695   case vmIntrinsics::_getAndAddByte:                    return inline_unsafe_load_store(T_BYTE,   LS_get_add,       Volatile);
   695   case vmIntrinsics::_getAndAddByte:                    return inline_unsafe_load_store(T_BYTE,   LS_get_add,       Volatile);
   696   case vmIntrinsics::_getAndAddShort:                   return inline_unsafe_load_store(T_SHORT,  LS_get_add,       Volatile);
   696   case vmIntrinsics::_getAndAddShort:                   return inline_unsafe_load_store(T_SHORT,  LS_get_add,       Volatile);
  2585 //----------------------------inline_unsafe_load_store----------------------------
  2585 //----------------------------inline_unsafe_load_store----------------------------
  2586 // This method serves a couple of different customers (depending on LoadStoreKind):
  2586 // This method serves a couple of different customers (depending on LoadStoreKind):
  2587 //
  2587 //
  2588 // LS_cmp_swap:
  2588 // LS_cmp_swap:
  2589 //
  2589 //
  2590 //   boolean compareAndSwapObject(Object o, long offset, Object expected, Object x);
  2590 //   boolean compareAndSetObject(Object o, long offset, Object expected, Object x);
  2591 //   boolean compareAndSwapInt(   Object o, long offset, int    expected, int    x);
  2591 //   boolean compareAndSetInt(   Object o, long offset, int    expected, int    x);
  2592 //   boolean compareAndSwapLong(  Object o, long offset, long   expected, long   x);
  2592 //   boolean compareAndSetLong(  Object o, long offset, long   expected, long   x);
  2593 //
  2593 //
  2594 // LS_cmp_swap_weak:
  2594 // LS_cmp_swap_weak:
  2595 //
  2595 //
  2596 //   boolean weakCompareAndSwapObject(       Object o, long offset, Object expected, Object x);
  2596 //   boolean weakCompareAndSetObject(       Object o, long offset, Object expected, Object x);
  2597 //   boolean weakCompareAndSwapObjectAcquire(Object o, long offset, Object expected, Object x);
  2597 //   boolean weakCompareAndSetObjectPlain(  Object o, long offset, Object expected, Object x);
  2598 //   boolean weakCompareAndSwapObjectRelease(Object o, long offset, Object expected, Object x);
  2598 //   boolean weakCompareAndSetObjectAcquire(Object o, long offset, Object expected, Object x);
       
  2599 //   boolean weakCompareAndSetObjectRelease(Object o, long offset, Object expected, Object x);
  2599 //
  2600 //
  2600 //   boolean weakCompareAndSwapInt(          Object o, long offset, int    expected, int    x);
  2601 //   boolean weakCompareAndSetInt(          Object o, long offset, int    expected, int    x);
  2601 //   boolean weakCompareAndSwapIntAcquire(   Object o, long offset, int    expected, int    x);
  2602 //   boolean weakCompareAndSetIntPlain(     Object o, long offset, int    expected, int    x);
  2602 //   boolean weakCompareAndSwapIntRelease(   Object o, long offset, int    expected, int    x);
  2603 //   boolean weakCompareAndSetIntAcquire(   Object o, long offset, int    expected, int    x);
       
  2604 //   boolean weakCompareAndSetIntRelease(   Object o, long offset, int    expected, int    x);
  2603 //
  2605 //
  2604 //   boolean weakCompareAndSwapLong(         Object o, long offset, long   expected, long   x);
  2606 //   boolean weakCompareAndSetLong(         Object o, long offset, long   expected, long   x);
  2605 //   boolean weakCompareAndSwapLongAcquire(  Object o, long offset, long   expected, long   x);
  2607 //   boolean weakCompareAndSetLongPlain(    Object o, long offset, long   expected, long   x);
  2606 //   boolean weakCompareAndSwapLongRelease(  Object o, long offset, long   expected, long   x);
  2608 //   boolean weakCompareAndSetLongAcquire(  Object o, long offset, long   expected, long   x);
       
  2609 //   boolean weakCompareAndSetLongRelease(  Object o, long offset, long   expected, long   x);
  2607 //
  2610 //
  2608 // LS_cmp_exchange:
  2611 // LS_cmp_exchange:
  2609 //
  2612 //
  2610 //   Object compareAndExchangeObjectVolatile(Object o, long offset, Object expected, Object x);
  2613 //   Object compareAndExchangeObjectVolatile(Object o, long offset, Object expected, Object x);
  2611 //   Object compareAndExchangeObjectAcquire( Object o, long offset, Object expected, Object x);
  2614 //   Object compareAndExchangeObjectAcquire( Object o, long offset, Object expected, Object x);
  4963   int saved_reexecute_sp = -1;
  4966   int saved_reexecute_sp = -1;
  4964   JVMState* saved_jvms = arraycopy_restore_alloc_state(alloc, saved_reexecute_sp);
  4967   JVMState* saved_jvms = arraycopy_restore_alloc_state(alloc, saved_reexecute_sp);
  4965   // See arraycopy_restore_alloc_state() comment
  4968   // See arraycopy_restore_alloc_state() comment
  4966   // if alloc == NULL we don't have to worry about a tightly coupled allocation so we can emit all needed guards
  4969   // if alloc == NULL we don't have to worry about a tightly coupled allocation so we can emit all needed guards
  4967   // if saved_jvms != NULL (then alloc != NULL) then we can handle guards and a tightly coupled allocation
  4970   // if saved_jvms != NULL (then alloc != NULL) then we can handle guards and a tightly coupled allocation
  4968   // if saved_jvms == NULL and alloc != NULL, we can’t emit any guards
  4971   // if saved_jvms == NULL and alloc != NULL, we can't emit any guards
  4969   bool can_emit_guards = (alloc == NULL || saved_jvms != NULL);
  4972   bool can_emit_guards = (alloc == NULL || saved_jvms != NULL);
  4970 
  4973 
  4971   // The following tests must be performed
  4974   // The following tests must be performed
  4972   // (1) src and dest are arrays.
  4975   // (1) src and dest are arrays.
  4973   // (2) src and dest arrays must have elements of the same BasicType
  4976   // (2) src and dest arrays must have elements of the same BasicType