8225490: Miscellaneous changes imported from jsr166 CVS 2019-09

Reviewed-by: martin, alanb
This commit is contained in:
Doug Lea 2019-09-14 11:26:26 -07:00
parent 9275097a02
commit eb1eadb69f
46 changed files with 622 additions and 640 deletions

View file

@ -385,7 +385,7 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
* cases where old nodes can be reused because their next fields
* won't change. On average, only about one-sixth of them need
* cloning when a table doubles. The nodes they replace will be
* garbage collectable as soon as they are no longer referenced by
* garbage collectible as soon as they are no longer referenced by
* any reader thread that may be in the midst of concurrently
* traversing table. Upon transfer, the old table bin contains
* only a special forwarding node (with hash field "MOVED") that
@ -3286,9 +3286,8 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
return true;
}
private static final Unsafe U = Unsafe.getUnsafe();
private static final long LOCKSTATE
= U.objectFieldOffset(TreeBin.class, "lockState");
= U.objectFieldOffset(TreeBin.class, "lockState");
}
/* ----------------Table Traversal -------------- */
@ -6345,28 +6344,20 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
// Unsafe mechanics
private static final Unsafe U = Unsafe.getUnsafe();
private static final long SIZECTL;
private static final long TRANSFERINDEX;
private static final long BASECOUNT;
private static final long CELLSBUSY;
private static final long CELLVALUE;
private static final int ABASE;
private static final long SIZECTL
= U.objectFieldOffset(ConcurrentHashMap.class, "sizeCtl");
private static final long TRANSFERINDEX
= U.objectFieldOffset(ConcurrentHashMap.class, "transferIndex");
private static final long BASECOUNT
= U.objectFieldOffset(ConcurrentHashMap.class, "baseCount");
private static final long CELLSBUSY
= U.objectFieldOffset(ConcurrentHashMap.class, "cellsBusy");
private static final long CELLVALUE
= U.objectFieldOffset(CounterCell.class, "value");
private static final int ABASE = U.arrayBaseOffset(Node[].class);
private static final int ASHIFT;
static {
SIZECTL = U.objectFieldOffset
(ConcurrentHashMap.class, "sizeCtl");
TRANSFERINDEX = U.objectFieldOffset
(ConcurrentHashMap.class, "transferIndex");
BASECOUNT = U.objectFieldOffset
(ConcurrentHashMap.class, "baseCount");
CELLSBUSY = U.objectFieldOffset
(ConcurrentHashMap.class, "cellsBusy");
CELLVALUE = U.objectFieldOffset
(CounterCell.class, "value");
ABASE = U.arrayBaseOffset(Node[].class);
int scale = U.arrayIndexScale(Node[].class);
if ((scale & (scale - 1)) != 0)
throw new ExceptionInInitializerError("array index scale not a power of two");