changeset 47932:065700a01c96

8180437: Remaining renames of CAS misnomer "swap" => "set" Reviewed-by: martin
author psandoz
date Fri, 17 Nov 2017 12:09:56 -0800
parents 0545aafc7136
children d13a28b0cdee
files src/java.base/share/classes/java/lang/invoke/VarForm.java src/java.base/share/classes/java/lang/invoke/VarHandle.java src/java.base/share/classes/java/lang/invoke/VarHandles.java src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java
diffstat 4 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/invoke/VarForm.java	Fri Nov 17 09:29:47 2017 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/VarForm.java	Fri Nov 17 12:09:56 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
 
         // (Receiver, <Intermediates>, Value, Value)boolean
         l.add(value);
-        methodType_table[VarHandle.AccessType.COMPARE_AND_SWAP.ordinal()] =
+        methodType_table[VarHandle.AccessType.COMPARE_AND_SET.ordinal()] =
                 MethodType.methodType(boolean.class, l).erase();
 
         // (Receiver, <Intermediates>, Value, Value)Value
--- a/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Fri Nov 17 09:29:47 2017 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandle.java	Fri Nov 17 12:09:56 2017 -0800
@@ -30,7 +30,6 @@
 import jdk.internal.vm.annotation.ForceInline;
 import jdk.internal.vm.annotation.Stable;
 
-import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -46,7 +45,7 @@
  * non-static fields, array elements, or components of an off-heap data
  * structure.  Access to such variables is supported under various
  * <em>access modes</em>, including plain read/write access, volatile
- * read/write access, and compare-and-swap.
+ * read/write access, and compare-and-set.
  *
  * <p>VarHandles are immutable and have no visible state.  VarHandles cannot be
  * subclassed by the user.
@@ -1529,7 +1528,7 @@
     enum AccessType {
         GET(Object.class),
         SET(void.class),
-        COMPARE_AND_SWAP(boolean.class),
+        COMPARE_AND_SET(boolean.class),
         COMPARE_AND_EXCHANGE(Object.class),
         GET_AND_UPDATE(Object.class);
 
@@ -1555,7 +1554,7 @@
                     i = fillParameters(ps, receiver, intermediate);
                     ps[i] = value;
                     return MethodType.methodType(void.class, ps);
-                case COMPARE_AND_SWAP:
+                case COMPARE_AND_SET:
                     ps = allocateParameters(2, receiver, intermediate);
                     i = fillParameters(ps, receiver, intermediate);
                     ps[i++] = value;
@@ -1652,7 +1651,7 @@
          * method
          * {@link VarHandle#compareAndSet VarHandle.compareAndSet}
          */
-        COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SWAP),
+        COMPARE_AND_SET("compareAndSet", AccessType.COMPARE_AND_SET),
         /**
          * The access mode whose access is specified by the corresponding
          * method
@@ -1676,25 +1675,25 @@
          * method
          * {@link VarHandle#weakCompareAndSetPlain VarHandle.weakCompareAndSetPlain}
          */
-        WEAK_COMPARE_AND_SET_PLAIN("weakCompareAndSetPlain", AccessType.COMPARE_AND_SWAP),
+        WEAK_COMPARE_AND_SET_PLAIN("weakCompareAndSetPlain", AccessType.COMPARE_AND_SET),
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet}
          */
-        WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP),
+        WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SET),
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire}
          */
-        WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP),
+        WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SET),
         /**
          * The access mode whose access is specified by the corresponding
          * method
          * {@link VarHandle#weakCompareAndSetRelease VarHandle.weakCompareAndSetRelease}
          */
-        WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SWAP),
+        WEAK_COMPARE_AND_SET_RELEASE("weakCompareAndSetRelease", AccessType.COMPARE_AND_SET),
         /**
          * The access mode whose access is specified by the corresponding
          * method
--- a/src/java.base/share/classes/java/lang/invoke/VarHandles.java	Fri Nov 17 09:29:47 2017 -0800
+++ b/src/java.base/share/classes/java/lang/invoke/VarHandles.java	Fri Nov 17 12:09:56 2017 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -313,7 +313,7 @@
 //
 //            void set(Object value);
 //
-//            boolean compareAndSwap(Object actualValue, Object expectedValue);
+//            boolean compareAndSet(Object actualValue, Object expectedValue);
 //
 //            Object compareAndExchange(Object actualValue, Object expectedValue);
 //
--- a/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Fri Nov 17 09:29:47 2017 -0800
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Fri Nov 17 12:09:56 2017 -0800
@@ -58,7 +58,7 @@
     ConstantPool getConstantPool(Class<?> klass);
 
     /**
-     * Compare-And-Swap the AnnotationType instance corresponding to this class.
+     * Compare-And-Set the AnnotationType instance corresponding to this class.
      * (This method only applies to annotation types.)
      */
     boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType);