--- jsr166/src/jsr166e/ConcurrentHashMapV8.java 2012/09/21 18:41:30 1.62 +++ jsr166/src/jsr166e/ConcurrentHashMapV8.java 2012/09/29 16:01:22 1.63 @@ -2287,18 +2287,22 @@ public class ConcurrentHashMapV8 int index; // index of bin to use next int baseIndex; // current index of initial table int baseLimit; // index bound for initial table - final int baseSize; // initial table size + int baseSize; // initial table size /** Creates iterator for all entries in the table. */ Traverser(ConcurrentHashMapV8 map) { - this.tab = (this.map = map).table; - baseLimit = baseSize = (tab == null) ? 0 : tab.length; + this.map = map; } /** Creates iterator for split() methods */ Traverser(Traverser it) { - this.map = it.map; - this.tab = it.tab; + ConcurrentHashMapV8 m; Node[] t; + if ((m = this.map = it.map) == null) + t = null; + else if ((t = it.tab) == null && // force parent tab initialization + (t = it.tab = m.table) != null) + it.baseLimit = it.baseSize = t.length; + this.tab = t; this.baseSize = it.baseSize; it.baseLimit = this.index = this.baseIndex = ((this.baseLimit = it.baseLimit) + it.baseIndex + 1) >>> 1; @@ -2315,11 +2319,18 @@ public class ConcurrentHashMapV8 if (e != null) // advance past used/skipped node e = e.next; while (e == null) { // get to next non-null bin + ConcurrentHashMapV8 m; Node[] t; int b, i, n; Object ek; // checks must use locals - if ((b = baseIndex) >= baseLimit || (i = index) < 0 || - (t = tab) == null || i >= (n = t.length)) + if ((t = tab) != null) + n = t.length; + else if ((m = map) != null && (t = tab = m.table) != null) + n = baseLimit = baseSize = t.length; + else break outer; - else if ((e = tabAt(t, i)) != null && e.hash == MOVED) { + if ((b = baseIndex) >= baseLimit || + (i = index) < 0 || i >= n) + break outer; + if ((e = tabAt(t, i)) != null && e.hash == MOVED) { if ((ek = e.key) instanceof TreeBin) e = ((TreeBin)ek).first; else { @@ -4176,7 +4187,7 @@ public class ConcurrentHashMapV8 (ConcurrentHashMapV8 map, BiAction action) { if (action == null) throw new NullPointerException(); - return new ForEachMappingTask(map, action); + return new ForEachMappingTask(map, null, -1, action); } /** @@ -4197,7 +4208,7 @@ public class ConcurrentHashMapV8 if (transformer == null || action == null) throw new NullPointerException(); return new ForEachTransformedMappingTask - (map, transformer, action); + (map, null, -1, transformer, action); } /** @@ -4217,7 +4228,7 @@ public class ConcurrentHashMapV8 BiFun searchFunction) { if (searchFunction == null) throw new NullPointerException(); return new SearchMappingsTask - (map, searchFunction, + (map, null, -1, searchFunction, new AtomicReference()); } @@ -4240,7 +4251,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceMappingsTask - (map, transformer, reducer); + (map, null, -1, null, transformer, reducer); } /** @@ -4264,7 +4275,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceMappingsToDoubleTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4288,7 +4299,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceMappingsToLongTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4311,7 +4322,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceMappingsToIntTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4326,7 +4337,7 @@ public class ConcurrentHashMapV8 (ConcurrentHashMapV8 map, Action action) { if (action == null) throw new NullPointerException(); - return new ForEachKeyTask(map, action); + return new ForEachKeyTask(map, null, -1, action); } /** @@ -4347,7 +4358,7 @@ public class ConcurrentHashMapV8 if (transformer == null || action == null) throw new NullPointerException(); return new ForEachTransformedKeyTask - (map, transformer, action); + (map, null, -1, transformer, action); } /** @@ -4367,7 +4378,7 @@ public class ConcurrentHashMapV8 Fun searchFunction) { if (searchFunction == null) throw new NullPointerException(); return new SearchKeysTask - (map, searchFunction, + (map, null, -1, searchFunction, new AtomicReference()); } @@ -4385,7 +4396,7 @@ public class ConcurrentHashMapV8 BiFun reducer) { if (reducer == null) throw new NullPointerException(); return new ReduceKeysTask - (map, reducer); + (map, null, -1, null, reducer); } /** @@ -4407,7 +4418,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceKeysTask - (map, transformer, reducer); + (map, null, -1, null, transformer, reducer); } /** @@ -4431,7 +4442,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceKeysToDoubleTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4455,7 +4466,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceKeysToLongTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4479,7 +4490,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceKeysToIntTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4493,7 +4504,7 @@ public class ConcurrentHashMapV8 (ConcurrentHashMapV8 map, Action action) { if (action == null) throw new NullPointerException(); - return new ForEachValueTask(map, action); + return new ForEachValueTask(map, null, -1, action); } /** @@ -4513,7 +4524,7 @@ public class ConcurrentHashMapV8 if (transformer == null || action == null) throw new NullPointerException(); return new ForEachTransformedValueTask - (map, transformer, action); + (map, null, -1, transformer, action); } /** @@ -4534,7 +4545,7 @@ public class ConcurrentHashMapV8 Fun searchFunction) { if (searchFunction == null) throw new NullPointerException(); return new SearchValuesTask - (map, searchFunction, + (map, null, -1, searchFunction, new AtomicReference()); } @@ -4552,7 +4563,7 @@ public class ConcurrentHashMapV8 BiFun reducer) { if (reducer == null) throw new NullPointerException(); return new ReduceValuesTask - (map, reducer); + (map, null, -1, null, reducer); } /** @@ -4574,7 +4585,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceValuesTask - (map, transformer, reducer); + (map, null, -1, null, transformer, reducer); } /** @@ -4598,7 +4609,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceValuesToDoubleTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4622,7 +4633,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceValuesToLongTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4646,7 +4657,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceValuesToIntTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4660,7 +4671,7 @@ public class ConcurrentHashMapV8 (ConcurrentHashMapV8 map, Action> action) { if (action == null) throw new NullPointerException(); - return new ForEachEntryTask(map, action); + return new ForEachEntryTask(map, null, -1, action); } /** @@ -4680,7 +4691,7 @@ public class ConcurrentHashMapV8 if (transformer == null || action == null) throw new NullPointerException(); return new ForEachTransformedEntryTask - (map, transformer, action); + (map, null, -1, transformer, action); } /** @@ -4701,7 +4712,7 @@ public class ConcurrentHashMapV8 Fun, ? extends U> searchFunction) { if (searchFunction == null) throw new NullPointerException(); return new SearchEntriesTask - (map, searchFunction, + (map, null, -1, searchFunction, new AtomicReference()); } @@ -4719,7 +4730,7 @@ public class ConcurrentHashMapV8 BiFun, Map.Entry, ? extends Map.Entry> reducer) { if (reducer == null) throw new NullPointerException(); return new ReduceEntriesTask - (map, reducer); + (map, null, -1, null, reducer); } /** @@ -4741,7 +4752,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceEntriesTask - (map, transformer, reducer); + (map, null, -1, null, transformer, reducer); } /** @@ -4765,7 +4776,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceEntriesToDoubleTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4789,7 +4800,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceEntriesToLongTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } /** @@ -4813,7 +4824,7 @@ public class ConcurrentHashMapV8 if (transformer == null || reducer == null) throw new NullPointerException(); return new MapReduceEntriesToIntTask - (map, transformer, basis, reducer); + (map, null, -1, null, transformer, basis, reducer); } } @@ -4832,21 +4843,25 @@ public class ConcurrentHashMapV8 */ @SuppressWarnings("serial") static abstract class BulkTask extends Traverser { final BulkTask parent; // completion target - int batch; // split control + int batch; // split control; -1 for unknown int pending; // completion control - /** Constructor for root tasks */ - BulkTask(ConcurrentHashMapV8 map) { + BulkTask(ConcurrentHashMapV8 map, BulkTask parent, + int batch) { super(map); - this.parent = null; - this.batch = -1; // force call to batch() on execution - } - - /** Constructor for subtasks */ - BulkTask(BulkTask parent, int batch) { - super(parent); this.parent = parent; this.batch = batch; + if (parent != null && map != null) { // split parent + Node[] t; + if ((t = parent.tab) == null && + (t = parent.tab = map.table) != null) + parent.baseLimit = parent.baseSize = t.length; + this.tab = t; + this.baseSize = parent.baseSize; + int hi = this.baseLimit = parent.baseLimit; + parent.baseLimit = this.index = this.baseIndex = + (hi + parent.baseIndex + 1) >>> 1; + } } // FJ methods @@ -4910,11 +4925,15 @@ public class ConcurrentHashMapV8 * dividing by two anyway. */ final int batch() { - int b = batch; - if (b < 0) { - long n = map.counter.sum(); - int sp = getPool().getParallelism() << 3; // slack of 8 - b = batch = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp; + ConcurrentHashMapV8 m; int b; Node[] t; + if ((b = batch) < 0 && (m = map) != null) { // force initialization + if ((t = tab) == null && (t = tab = m.table) != null) + baseLimit = baseSize = t.length; + if (t != null) { + long n = m.counter.sum(); + int sp = getPool().getParallelism() << 3; // slack of 8 + b = batch = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp; + } } return b; } @@ -4950,15 +4969,9 @@ public class ConcurrentHashMapV8 extends BulkTask { final Action action; ForEachKeyTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, Action action) { - super(m); - this.action = action; - } - ForEachKeyTask - (BulkTask p, int b, - Action action) { - super(p, b); + super(m, p, b); this.action = action; } @SuppressWarnings("unchecked") public final boolean exec() { @@ -4969,7 +4982,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); - new ForEachKeyTask(this, b >>>= 1, action).fork(); + new ForEachKeyTask(map, this, b >>>= 1, action).fork(); } while (advance() != null) action.apply((K)nextKey); @@ -4985,15 +4998,9 @@ public class ConcurrentHashMapV8 extends BulkTask { final Action action; ForEachValueTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, Action action) { - super(m); - this.action = action; - } - ForEachValueTask - (BulkTask p, int b, - Action action) { - super(p, b); + super(m, p, b); this.action = action; } @SuppressWarnings("unchecked") public final boolean exec() { @@ -5004,7 +5011,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); - new ForEachValueTask(this, b >>>= 1, action).fork(); + new ForEachValueTask(map, this, b >>>= 1, action).fork(); } Object v; while ((v = advance()) != null) @@ -5021,15 +5028,9 @@ public class ConcurrentHashMapV8 extends BulkTask { final Action> action; ForEachEntryTask - (ConcurrentHashMapV8 m, - Action> action) { - super(m); - this.action = action; - } - ForEachEntryTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, Action> action) { - super(p, b); + super(m, p, b); this.action = action; } @SuppressWarnings("unchecked") public final boolean exec() { @@ -5040,7 +5041,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); - new ForEachEntryTask(this, b >>>= 1, action).fork(); + new ForEachEntryTask(map, this, b >>>= 1, action).fork(); } Object v; while ((v = advance()) != null) @@ -5057,18 +5058,11 @@ public class ConcurrentHashMapV8 extends BulkTask { final BiAction action; ForEachMappingTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, BiAction action) { - super(m); + super(m, p, b); this.action = action; } - ForEachMappingTask - (BulkTask p, int b, - BiAction action) { - super(p, b); - this.action = action; - } - @SuppressWarnings("unchecked") public final boolean exec() { final BiAction action = this.action; if (action == null) @@ -5077,7 +5071,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); - new ForEachMappingTask(this, b >>>= 1, + new ForEachMappingTask(map, this, b >>>= 1, action).fork(); } Object v; @@ -5096,22 +5090,14 @@ public class ConcurrentHashMapV8 final Fun transformer; final Action action; ForEachTransformedKeyTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, Fun transformer, Action action) { - super(m); + super(m, p, b); this.transformer = transformer; this.action = action; } - ForEachTransformedKeyTask - (BulkTask p, int b, - Fun transformer, - Action action) { - super(p, b); - this.transformer = transformer; - this.action = action; - } @SuppressWarnings("unchecked") public final boolean exec() { final Fun transformer = this.transformer; @@ -5123,7 +5109,7 @@ public class ConcurrentHashMapV8 while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); new ForEachTransformedKeyTask - (this, b >>>= 1, transformer, action).fork(); + (map, this, b >>>= 1, transformer, action).fork(); } U u; while (advance() != null) { @@ -5143,22 +5129,14 @@ public class ConcurrentHashMapV8 final Fun transformer; final Action action; ForEachTransformedValueTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, Fun transformer, Action action) { - super(m); + super(m, p, b); this.transformer = transformer; this.action = action; } - ForEachTransformedValueTask - (BulkTask p, int b, - Fun transformer, - Action action) { - super(p, b); - this.transformer = transformer; - this.action = action; - } @SuppressWarnings("unchecked") public final boolean exec() { final Fun transformer = this.transformer; @@ -5170,7 +5148,7 @@ public class ConcurrentHashMapV8 while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); new ForEachTransformedValueTask - (this, b >>>= 1, transformer, action).fork(); + (map, this, b >>>= 1, transformer, action).fork(); } Object v; U u; while ((v = advance()) != null) { @@ -5190,22 +5168,14 @@ public class ConcurrentHashMapV8 final Fun, ? extends U> transformer; final Action action; ForEachTransformedEntryTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, Fun, ? extends U> transformer, Action action) { - super(m); + super(m, p, b); this.transformer = transformer; this.action = action; } - ForEachTransformedEntryTask - (BulkTask p, int b, - Fun, ? extends U> transformer, - Action action) { - super(p, b); - this.transformer = transformer; - this.action = action; - } @SuppressWarnings("unchecked") public final boolean exec() { final Fun, ? extends U> transformer = this.transformer; @@ -5217,7 +5187,7 @@ public class ConcurrentHashMapV8 while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); new ForEachTransformedEntryTask - (this, b >>>= 1, transformer, action).fork(); + (map, this, b >>>= 1, transformer, action).fork(); } Object v; U u; while ((v = advance()) != null) { @@ -5237,22 +5207,14 @@ public class ConcurrentHashMapV8 final BiFun transformer; final Action action; ForEachTransformedMappingTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, BiFun transformer, Action action) { - super(m); + super(m, p, b); this.transformer = transformer; this.action = action; } - ForEachTransformedMappingTask - (BulkTask p, int b, - BiFun transformer, - Action action) { - super(p, b); - this.transformer = transformer; - this.action = action; - } @SuppressWarnings("unchecked") public final boolean exec() { final BiFun transformer = this.transformer; @@ -5264,7 +5226,7 @@ public class ConcurrentHashMapV8 while (b > 1 && baseIndex != baseLimit) { do {} while (!casPending(c = pending, c+1)); new ForEachTransformedMappingTask - (this, b >>>= 1, transformer, action).fork(); + (map, this, b >>>= 1, transformer, action).fork(); } Object v; U u; while ((v = advance()) != null) { @@ -5284,17 +5246,10 @@ public class ConcurrentHashMapV8 final Fun searchFunction; final AtomicReference result; SearchKeysTask - (ConcurrentHashMapV8 m, + (ConcurrentHashMapV8 m, BulkTask p, int b, Fun searchFunction, AtomicReference result) { - super(m); - this.searchFunction = searchFunction; this.result = result; - } - SearchKeysTask - (BulkTask p, int b, - Fun searchFunction, - AtomicReference result) { - super(p, b); + super(m, p, b); this.searchFunction = searchFunction; this.result = result; } @SuppressWarnings("unchecked") public final boolean exec() { @@ -5307,7 +5262,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit && result.get() == null) { do {} while (!casPending(c = pending, c+1)); - new SearchKeysTask(this, b >>>= 1, + new SearchKeysTask(map, this, b >>>= 1, searchFunction, result).fork(); } U u; @@ -5332,17 +5287,10 @@ public class ConcurrentHashMapV8 final Fun searchFunction; final AtomicReference result; SearchValuesTask - (ConcurrentHashMapV8 m, - Fun searchFunction, - AtomicReference result) { - super(m); - this.searchFunction = searchFunction; this.result = result; - } - SearchValuesTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, Fun searchFunction, AtomicReference result) { - super(p, b); + super(m, p, b); this.searchFunction = searchFunction; this.result = result; } @SuppressWarnings("unchecked") public final boolean exec() { @@ -5355,7 +5303,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit && result.get() == null) { do {} while (!casPending(c = pending, c+1)); - new SearchValuesTask(this, b >>>= 1, + new SearchValuesTask(map, this, b >>>= 1, searchFunction, result).fork(); } Object v; U u; @@ -5380,17 +5328,10 @@ public class ConcurrentHashMapV8 final Fun, ? extends U> searchFunction; final AtomicReference result; SearchEntriesTask - (ConcurrentHashMapV8 m, - Fun, ? extends U> searchFunction, - AtomicReference result) { - super(m); - this.searchFunction = searchFunction; this.result = result; - } - SearchEntriesTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, Fun, ? extends U> searchFunction, AtomicReference result) { - super(p, b); + super(m, p, b); this.searchFunction = searchFunction; this.result = result; } @SuppressWarnings("unchecked") public final boolean exec() { @@ -5403,7 +5344,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit && result.get() == null) { do {} while (!casPending(c = pending, c+1)); - new SearchEntriesTask(this, b >>>= 1, + new SearchEntriesTask(map, this, b >>>= 1, searchFunction, result).fork(); } Object v; U u; @@ -5428,17 +5369,10 @@ public class ConcurrentHashMapV8 final BiFun searchFunction; final AtomicReference result; SearchMappingsTask - (ConcurrentHashMapV8 m, - BiFun searchFunction, - AtomicReference result) { - super(m); - this.searchFunction = searchFunction; this.result = result; - } - SearchMappingsTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, BiFun searchFunction, AtomicReference result) { - super(p, b); + super(m, p, b); this.searchFunction = searchFunction; this.result = result; } @SuppressWarnings("unchecked") public final boolean exec() { @@ -5451,7 +5385,7 @@ public class ConcurrentHashMapV8 int b = batch(), c; while (b > 1 && baseIndex != baseLimit && result.get() == null) { do {} while (!casPending(c = pending, c+1)); - new SearchMappingsTask(this, b >>>= 1, + new SearchMappingsTask(map, this, b >>>= 1, searchFunction, result).fork(); } Object v; U u; @@ -5477,19 +5411,12 @@ public class ConcurrentHashMapV8 K result; ReduceKeysTask rights, nextRight; ReduceKeysTask - (ConcurrentHashMapV8 m, - BiFun reducer) { - super(m); - this.reducer = reducer; - } - ReduceKeysTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, ReduceKeysTask nextRight, BiFun reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.reducer = reducer; } - @SuppressWarnings("unchecked") public final boolean exec() { final BiFun reducer = this.reducer; @@ -5499,7 +5426,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new ReduceKeysTask - (this, b >>>= 1, rights, reducer)).fork(); + (map, this, b >>>= 1, rights, reducer)).fork(); } K r = null; while (advance() != null) { @@ -5538,19 +5465,12 @@ public class ConcurrentHashMapV8 V result; ReduceValuesTask rights, nextRight; ReduceValuesTask - (ConcurrentHashMapV8 m, - BiFun reducer) { - super(m); - this.reducer = reducer; - } - ReduceValuesTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, ReduceValuesTask nextRight, BiFun reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.reducer = reducer; } - @SuppressWarnings("unchecked") public final boolean exec() { final BiFun reducer = this.reducer; @@ -5560,7 +5480,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new ReduceValuesTask - (this, b >>>= 1, rights, reducer)).fork(); + (map, this, b >>>= 1, rights, reducer)).fork(); } V r = null; Object v; @@ -5600,19 +5520,12 @@ public class ConcurrentHashMapV8 Map.Entry result; ReduceEntriesTask rights, nextRight; ReduceEntriesTask - (ConcurrentHashMapV8 m, - BiFun, Map.Entry, ? extends Map.Entry> reducer) { - super(m); - this.reducer = reducer; - } - ReduceEntriesTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, ReduceEntriesTask nextRight, - BiFun, Map.Entry, ? extends Map.Entry> reducer) { - super(p, b); this.nextRight = nextRight; + BiFun, Map.Entry, ? extends Map.Entry> reducer) { + super(m, p, b); this.nextRight = nextRight; this.reducer = reducer; } - @SuppressWarnings("unchecked") public final boolean exec() { final BiFun, Map.Entry, ? extends Map.Entry> reducer = this.reducer; @@ -5622,7 +5535,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new ReduceEntriesTask - (this, b >>>= 1, rights, reducer)).fork(); + (map, this, b >>>= 1, rights, reducer)).fork(); } Map.Entry r = null; Object v; @@ -5663,19 +5576,11 @@ public class ConcurrentHashMapV8 U result; MapReduceKeysTask rights, nextRight; MapReduceKeysTask - (ConcurrentHashMapV8 m, - Fun transformer, - BiFun reducer) { - super(m); - this.transformer = transformer; - this.reducer = reducer; - } - MapReduceKeysTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceKeysTask nextRight, Fun transformer, BiFun reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.reducer = reducer; } @@ -5690,7 +5595,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceKeysTask - (this, b >>>= 1, rights, transformer, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, reducer)).fork(); } U r = null, u; while (advance() != null) { @@ -5730,19 +5635,11 @@ public class ConcurrentHashMapV8 U result; MapReduceValuesTask rights, nextRight; MapReduceValuesTask - (ConcurrentHashMapV8 m, - Fun transformer, - BiFun reducer) { - super(m); - this.transformer = transformer; - this.reducer = reducer; - } - MapReduceValuesTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceValuesTask nextRight, Fun transformer, BiFun reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.reducer = reducer; } @@ -5757,7 +5654,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceValuesTask - (this, b >>>= 1, rights, transformer, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, reducer)).fork(); } U r = null, u; Object v; @@ -5798,19 +5695,11 @@ public class ConcurrentHashMapV8 U result; MapReduceEntriesTask rights, nextRight; MapReduceEntriesTask - (ConcurrentHashMapV8 m, - Fun, ? extends U> transformer, - BiFun reducer) { - super(m); - this.transformer = transformer; - this.reducer = reducer; - } - MapReduceEntriesTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceEntriesTask nextRight, Fun, ? extends U> transformer, BiFun reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.reducer = reducer; } @@ -5825,7 +5714,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceEntriesTask - (this, b >>>= 1, rights, transformer, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, reducer)).fork(); } U r = null, u; Object v; @@ -5866,19 +5755,11 @@ public class ConcurrentHashMapV8 U result; MapReduceMappingsTask rights, nextRight; MapReduceMappingsTask - (ConcurrentHashMapV8 m, - BiFun transformer, - BiFun reducer) { - super(m); - this.transformer = transformer; - this.reducer = reducer; - } - MapReduceMappingsTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceMappingsTask nextRight, BiFun transformer, BiFun reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.reducer = reducer; } @@ -5893,7 +5774,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceMappingsTask - (this, b >>>= 1, rights, transformer, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, reducer)).fork(); } U r = null, u; Object v; @@ -5935,21 +5816,12 @@ public class ConcurrentHashMapV8 double result; MapReduceKeysToDoubleTask rights, nextRight; MapReduceKeysToDoubleTask - (ConcurrentHashMapV8 m, - ObjectToDouble transformer, - double basis, - DoubleByDoubleToDouble reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceKeysToDoubleTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceKeysToDoubleTask nextRight, ObjectToDouble transformer, double basis, DoubleByDoubleToDouble reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -5964,7 +5836,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceKeysToDoubleTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } double r = id; while (advance() != null) @@ -6002,21 +5874,12 @@ public class ConcurrentHashMapV8 double result; MapReduceValuesToDoubleTask rights, nextRight; MapReduceValuesToDoubleTask - (ConcurrentHashMapV8 m, - ObjectToDouble transformer, - double basis, - DoubleByDoubleToDouble reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceValuesToDoubleTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceValuesToDoubleTask nextRight, ObjectToDouble transformer, double basis, DoubleByDoubleToDouble reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6031,7 +5894,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceValuesToDoubleTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } double r = id; Object v; @@ -6070,21 +5933,12 @@ public class ConcurrentHashMapV8 double result; MapReduceEntriesToDoubleTask rights, nextRight; MapReduceEntriesToDoubleTask - (ConcurrentHashMapV8 m, - ObjectToDouble> transformer, - double basis, - DoubleByDoubleToDouble reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceEntriesToDoubleTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceEntriesToDoubleTask nextRight, ObjectToDouble> transformer, double basis, DoubleByDoubleToDouble reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6099,7 +5953,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceEntriesToDoubleTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } double r = id; Object v; @@ -6138,21 +5992,12 @@ public class ConcurrentHashMapV8 double result; MapReduceMappingsToDoubleTask rights, nextRight; MapReduceMappingsToDoubleTask - (ConcurrentHashMapV8 m, - ObjectByObjectToDouble transformer, - double basis, - DoubleByDoubleToDouble reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceMappingsToDoubleTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceMappingsToDoubleTask nextRight, ObjectByObjectToDouble transformer, double basis, DoubleByDoubleToDouble reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6167,7 +6012,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceMappingsToDoubleTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } double r = id; Object v; @@ -6206,21 +6051,12 @@ public class ConcurrentHashMapV8 long result; MapReduceKeysToLongTask rights, nextRight; MapReduceKeysToLongTask - (ConcurrentHashMapV8 m, - ObjectToLong transformer, - long basis, - LongByLongToLong reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceKeysToLongTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceKeysToLongTask nextRight, ObjectToLong transformer, long basis, LongByLongToLong reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6235,7 +6071,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceKeysToLongTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } long r = id; while (advance() != null) @@ -6273,21 +6109,12 @@ public class ConcurrentHashMapV8 long result; MapReduceValuesToLongTask rights, nextRight; MapReduceValuesToLongTask - (ConcurrentHashMapV8 m, - ObjectToLong transformer, - long basis, - LongByLongToLong reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceValuesToLongTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceValuesToLongTask nextRight, ObjectToLong transformer, long basis, LongByLongToLong reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6302,7 +6129,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceValuesToLongTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } long r = id; Object v; @@ -6341,21 +6168,12 @@ public class ConcurrentHashMapV8 long result; MapReduceEntriesToLongTask rights, nextRight; MapReduceEntriesToLongTask - (ConcurrentHashMapV8 m, - ObjectToLong> transformer, - long basis, - LongByLongToLong reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceEntriesToLongTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceEntriesToLongTask nextRight, ObjectToLong> transformer, long basis, LongByLongToLong reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6370,7 +6188,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceEntriesToLongTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } long r = id; Object v; @@ -6409,21 +6227,12 @@ public class ConcurrentHashMapV8 long result; MapReduceMappingsToLongTask rights, nextRight; MapReduceMappingsToLongTask - (ConcurrentHashMapV8 m, - ObjectByObjectToLong transformer, - long basis, - LongByLongToLong reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceMappingsToLongTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceMappingsToLongTask nextRight, ObjectByObjectToLong transformer, long basis, LongByLongToLong reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6438,7 +6247,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceMappingsToLongTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } long r = id; Object v; @@ -6477,21 +6286,12 @@ public class ConcurrentHashMapV8 int result; MapReduceKeysToIntTask rights, nextRight; MapReduceKeysToIntTask - (ConcurrentHashMapV8 m, - ObjectToInt transformer, - int basis, - IntByIntToInt reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceKeysToIntTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceKeysToIntTask nextRight, ObjectToInt transformer, int basis, IntByIntToInt reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6506,7 +6306,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceKeysToIntTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } int r = id; while (advance() != null) @@ -6544,21 +6344,12 @@ public class ConcurrentHashMapV8 int result; MapReduceValuesToIntTask rights, nextRight; MapReduceValuesToIntTask - (ConcurrentHashMapV8 m, - ObjectToInt transformer, - int basis, - IntByIntToInt reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceValuesToIntTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceValuesToIntTask nextRight, ObjectToInt transformer, int basis, IntByIntToInt reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6573,7 +6364,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceValuesToIntTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } int r = id; Object v; @@ -6612,21 +6403,12 @@ public class ConcurrentHashMapV8 int result; MapReduceEntriesToIntTask rights, nextRight; MapReduceEntriesToIntTask - (ConcurrentHashMapV8 m, - ObjectToInt> transformer, - int basis, - IntByIntToInt reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceEntriesToIntTask - (BulkTask p, int b, + (ConcurrentHashMapV8 m, BulkTask p, int b, MapReduceEntriesToIntTask nextRight, ObjectToInt> transformer, int basis, IntByIntToInt reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6641,7 +6423,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceEntriesToIntTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } int r = id; Object v; @@ -6680,21 +6462,12 @@ public class ConcurrentHashMapV8 int result; MapReduceMappingsToIntTask rights, nextRight; MapReduceMappingsToIntTask - (ConcurrentHashMapV8 m, - ObjectByObjectToInt transformer, - int basis, - IntByIntToInt reducer) { - super(m); - this.transformer = transformer; - this.basis = basis; this.reducer = reducer; - } - MapReduceMappingsToIntTask - (BulkTask p, int b, - MapReduceMappingsToIntTask nextRight, + (ConcurrentHashMapV8 m, BulkTask p, int b, + MapReduceMappingsToIntTask rights, ObjectByObjectToInt transformer, int basis, IntByIntToInt reducer) { - super(p, b); this.nextRight = nextRight; + super(m, p, b); this.nextRight = nextRight; this.transformer = transformer; this.basis = basis; this.reducer = reducer; } @@ -6709,7 +6482,7 @@ public class ConcurrentHashMapV8 for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) { do {} while (!casPending(c = pending, c+1)); (rights = new MapReduceMappingsToIntTask - (this, b >>>= 1, rights, transformer, id, reducer)).fork(); + (map, this, b >>>= 1, rights, transformer, id, reducer)).fork(); } int r = id; Object v;