533 |
|
int sc = (int)((1L + (4L * es) / 3) >>> SEGMENT_BITS); |
534 |
|
if (sc < MIN_SEGMENT_CAPACITY) |
535 |
|
sc = MIN_SEGMENT_CAPACITY; |
536 |
< |
else if (sc > MAX_SEGMENT_CAPACITY) |
537 |
< |
sc = MAX_SEGMENT_CAPACITY; |
538 |
< |
this.initialSegmentCapacity = sc; |
536 |
> |
int capacity = MIN_SEGMENT_CAPACITY; // ensure power of two |
537 |
> |
while (capacity < sc) |
538 |
> |
capacity <<= 1; |
539 |
> |
if (capacity > MAX_SEGMENT_CAPACITY) |
540 |
> |
capacity = MAX_SEGMENT_CAPACITY; |
541 |
> |
this.initialSegmentCapacity = capacity; |
542 |
|
} |
543 |
|
this.segments = (Segment[])new Segment[NSEGMENTS]; |
544 |
|
} |
959 |
|
while (p != null) { |
960 |
|
Node n = p.getLinkage(); |
961 |
|
if (p.get() != null && p.getValue() != null) { |
962 |
+ |
pred = p; |
963 |
+ |
p = n; |
964 |
+ |
} |
965 |
+ |
else { |
966 |
|
if (pred == null) |
967 |
|
tab[i] = n; |
968 |
|
else |
970 |
|
seg.decrementCount(); |
971 |
|
p = n; |
972 |
|
} |
966 |
– |
else { |
967 |
– |
pred = p; |
968 |
– |
p = n; |
969 |
– |
} |
973 |
|
} |
974 |
|
} |
975 |
|
} finally { |
3034 |
|
// Fenced store into segment table array. Unneeded when we have Fences |
3035 |
|
static final void storeNode(Node[] table, |
3036 |
|
int i, Node r) { |
3037 |
< |
_unsafe.putOrderedObject(table, (i << tableShift) + tableBase, r); |
3037 |
> |
long nodeOffset = ((long) i << tableShift) + tableBase; |
3038 |
> |
_unsafe.putOrderedObject(table, nodeOffset, r); |
3039 |
|
} |
3040 |
|
|
3041 |
|
static final void storeSegment(Segment[] segs, |
3042 |
|
int i, Segment s) { |
3043 |
< |
_unsafe.putOrderedObject(segs, (i << segmentsShift) + segmentsBase, s); |
3043 |
> |
long segmentOffset = ((long) i << segmentsShift) + segmentsBase; |
3044 |
> |
_unsafe.putOrderedObject(segs, segmentOffset, s); |
3045 |
|
} |
3046 |
|
|
3047 |
|
|