ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.129 by dl, Fri Sep 21 18:41:35 2012 UTC vs.
Revision 1.130 by dl, Sat Sep 29 16:01:28 2012 UTC

# Line 96 | Line 96 | import java.io.Serializable;
96   * <a href="{@docRoot}/../technotes/guides/collections/index.html">
97   * Java Collections Framework</a>.
98   *
99 < * <p><em>jsr166e note: This class is a candidate replacement for
100 < * java.util.concurrent.ConcurrentHashMap.  During transition, this
99 > * <p><em> During transition to JDK8, this
100   * class declares and uses nested functional interfaces with different
101   * names but the same forms as those expected for JDK8.<em>
102   *
# Line 2287 | Line 2286 | public class ConcurrentHashMap<K, V>
2286          int index;           // index of bin to use next
2287          int baseIndex;       // current index of initial table
2288          int baseLimit;       // index bound for initial table
2289 <        final int baseSize;  // initial table size
2289 >        int baseSize;        // initial table size
2290  
2291          /** Creates iterator for all entries in the table. */
2292          Traverser(ConcurrentHashMap<K, V> map) {
2293 <            this.tab = (this.map = map).table;
2295 <            baseLimit = baseSize = (tab == null) ? 0 : tab.length;
2293 >            this.map = map;
2294          }
2295  
2296          /** Creates iterator for split() methods */
2297          Traverser(Traverser<K,V,?> it) {
2298 <            this.map = it.map;
2299 <            this.tab = it.tab;
2298 >            ConcurrentHashMap<K, V> m; Node[] t;
2299 >            if ((m = this.map = it.map) == null)
2300 >                t = null;
2301 >            else if ((t = it.tab) == null && // force parent tab initialization
2302 >                     (t = it.tab = m.table) != null)
2303 >                it.baseLimit = it.baseSize = t.length;
2304 >            this.tab = t;
2305              this.baseSize = it.baseSize;
2306              it.baseLimit = this.index = this.baseIndex =
2307                  ((this.baseLimit = it.baseLimit) + it.baseIndex + 1) >>> 1;
# Line 2315 | Line 2318 | public class ConcurrentHashMap<K, V>
2318                  if (e != null)                  // advance past used/skipped node
2319                      e = e.next;
2320                  while (e == null) {             // get to next non-null bin
2321 +                    ConcurrentHashMap<K, V> m;
2322                      Node[] t; int b, i, n; Object ek; // checks must use locals
2323 <                    if ((b = baseIndex) >= baseLimit || (i = index) < 0 ||
2324 <                        (t = tab) == null || i >= (n = t.length))
2323 >                    if ((t = tab) != null)
2324 >                        n = t.length;
2325 >                    else if ((m = map) != null && (t = tab = m.table) != null)
2326 >                        n = baseLimit = baseSize = t.length;
2327 >                    else
2328                          break outer;
2329 <                    else if ((e = tabAt(t, i)) != null && e.hash == MOVED) {
2329 >                    if ((b = baseIndex) >= baseLimit ||
2330 >                        (i = index) < 0 || i >= n)
2331 >                        break outer;
2332 >                    if ((e = tabAt(t, i)) != null && e.hash == MOVED) {
2333                          if ((ek = e.key) instanceof TreeBin)
2334                              e = ((TreeBin)ek).first;
2335                          else {
# Line 4176 | Line 4186 | public class ConcurrentHashMap<K, V>
4186              (ConcurrentHashMap<K,V> map,
4187               BiAction<K,V> action) {
4188              if (action == null) throw new NullPointerException();
4189 <            return new ForEachMappingTask<K,V>(map, action);
4189 >            return new ForEachMappingTask<K,V>(map, null, -1, action);
4190          }
4191  
4192          /**
# Line 4197 | Line 4207 | public class ConcurrentHashMap<K, V>
4207              if (transformer == null || action == null)
4208                  throw new NullPointerException();
4209              return new ForEachTransformedMappingTask<K,V,U>
4210 <                (map, transformer, action);
4210 >                (map, null, -1, transformer, action);
4211          }
4212  
4213          /**
# Line 4217 | Line 4227 | public class ConcurrentHashMap<K, V>
4227               BiFun<? super K, ? super V, ? extends U> searchFunction) {
4228              if (searchFunction == null) throw new NullPointerException();
4229              return new SearchMappingsTask<K,V,U>
4230 <                (map, searchFunction,
4230 >                (map, null, -1, searchFunction,
4231                   new AtomicReference<U>());
4232          }
4233  
# Line 4240 | Line 4250 | public class ConcurrentHashMap<K, V>
4250              if (transformer == null || reducer == null)
4251                  throw new NullPointerException();
4252              return new MapReduceMappingsTask<K,V,U>
4253 <                (map, transformer, reducer);
4253 >                (map, null, -1, null, transformer, reducer);
4254          }
4255  
4256          /**
# Line 4264 | Line 4274 | public class ConcurrentHashMap<K, V>
4274              if (transformer == null || reducer == null)
4275                  throw new NullPointerException();
4276              return new MapReduceMappingsToDoubleTask<K,V>
4277 <                (map, transformer, basis, reducer);
4277 >                (map, null, -1, null, transformer, basis, reducer);
4278          }
4279  
4280          /**
# Line 4288 | Line 4298 | public class ConcurrentHashMap<K, V>
4298              if (transformer == null || reducer == null)
4299                  throw new NullPointerException();
4300              return new MapReduceMappingsToLongTask<K,V>
4301 <                (map, transformer, basis, reducer);
4301 >                (map, null, -1, null, transformer, basis, reducer);
4302          }
4303  
4304          /**
# Line 4311 | Line 4321 | public class ConcurrentHashMap<K, V>
4321              if (transformer == null || reducer == null)
4322                  throw new NullPointerException();
4323              return new MapReduceMappingsToIntTask<K,V>
4324 <                (map, transformer, basis, reducer);
4324 >                (map, null, -1, null, transformer, basis, reducer);
4325          }
4326  
4327          /**
# Line 4326 | Line 4336 | public class ConcurrentHashMap<K, V>
4336              (ConcurrentHashMap<K,V> map,
4337               Action<K> action) {
4338              if (action == null) throw new NullPointerException();
4339 <            return new ForEachKeyTask<K,V>(map, action);
4339 >            return new ForEachKeyTask<K,V>(map, null, -1, action);
4340          }
4341  
4342          /**
# Line 4347 | Line 4357 | public class ConcurrentHashMap<K, V>
4357              if (transformer == null || action == null)
4358                  throw new NullPointerException();
4359              return new ForEachTransformedKeyTask<K,V,U>
4360 <                (map, transformer, action);
4360 >                (map, null, -1, transformer, action);
4361          }
4362  
4363          /**
# Line 4367 | Line 4377 | public class ConcurrentHashMap<K, V>
4377               Fun<? super K, ? extends U> searchFunction) {
4378              if (searchFunction == null) throw new NullPointerException();
4379              return new SearchKeysTask<K,V,U>
4380 <                (map, searchFunction,
4380 >                (map, null, -1, searchFunction,
4381                   new AtomicReference<U>());
4382          }
4383  
# Line 4385 | Line 4395 | public class ConcurrentHashMap<K, V>
4395               BiFun<? super K, ? super K, ? extends K> reducer) {
4396              if (reducer == null) throw new NullPointerException();
4397              return new ReduceKeysTask<K,V>
4398 <                (map, reducer);
4398 >                (map, null, -1, null, reducer);
4399          }
4400  
4401          /**
# Line 4407 | Line 4417 | public class ConcurrentHashMap<K, V>
4417              if (transformer == null || reducer == null)
4418                  throw new NullPointerException();
4419              return new MapReduceKeysTask<K,V,U>
4420 <                (map, transformer, reducer);
4420 >                (map, null, -1, null, transformer, reducer);
4421          }
4422  
4423          /**
# Line 4431 | Line 4441 | public class ConcurrentHashMap<K, V>
4441              if (transformer == null || reducer == null)
4442                  throw new NullPointerException();
4443              return new MapReduceKeysToDoubleTask<K,V>
4444 <                (map, transformer, basis, reducer);
4444 >                (map, null, -1, null, transformer, basis, reducer);
4445          }
4446  
4447          /**
# Line 4455 | Line 4465 | public class ConcurrentHashMap<K, V>
4465              if (transformer == null || reducer == null)
4466                  throw new NullPointerException();
4467              return new MapReduceKeysToLongTask<K,V>
4468 <                (map, transformer, basis, reducer);
4468 >                (map, null, -1, null, transformer, basis, reducer);
4469          }
4470  
4471          /**
# Line 4479 | Line 4489 | public class ConcurrentHashMap<K, V>
4489              if (transformer == null || reducer == null)
4490                  throw new NullPointerException();
4491              return new MapReduceKeysToIntTask<K,V>
4492 <                (map, transformer, basis, reducer);
4492 >                (map, null, -1, null, transformer, basis, reducer);
4493          }
4494  
4495          /**
# Line 4493 | Line 4503 | public class ConcurrentHashMap<K, V>
4503              (ConcurrentHashMap<K,V> map,
4504               Action<V> action) {
4505              if (action == null) throw new NullPointerException();
4506 <            return new ForEachValueTask<K,V>(map, action);
4506 >            return new ForEachValueTask<K,V>(map, null, -1, action);
4507          }
4508  
4509          /**
# Line 4513 | Line 4523 | public class ConcurrentHashMap<K, V>
4523              if (transformer == null || action == null)
4524                  throw new NullPointerException();
4525              return new ForEachTransformedValueTask<K,V,U>
4526 <                (map, transformer, action);
4526 >                (map, null, -1, transformer, action);
4527          }
4528  
4529          /**
# Line 4534 | Line 4544 | public class ConcurrentHashMap<K, V>
4544               Fun<? super V, ? extends U> searchFunction) {
4545              if (searchFunction == null) throw new NullPointerException();
4546              return new SearchValuesTask<K,V,U>
4547 <                (map, searchFunction,
4547 >                (map, null, -1, searchFunction,
4548                   new AtomicReference<U>());
4549          }
4550  
# Line 4552 | Line 4562 | public class ConcurrentHashMap<K, V>
4562               BiFun<? super V, ? super V, ? extends V> reducer) {
4563              if (reducer == null) throw new NullPointerException();
4564              return new ReduceValuesTask<K,V>
4565 <                (map, reducer);
4565 >                (map, null, -1, null, reducer);
4566          }
4567  
4568          /**
# Line 4574 | Line 4584 | public class ConcurrentHashMap<K, V>
4584              if (transformer == null || reducer == null)
4585                  throw new NullPointerException();
4586              return new MapReduceValuesTask<K,V,U>
4587 <                (map, transformer, reducer);
4587 >                (map, null, -1, null, transformer, reducer);
4588          }
4589  
4590          /**
# Line 4598 | Line 4608 | public class ConcurrentHashMap<K, V>
4608              if (transformer == null || reducer == null)
4609                  throw new NullPointerException();
4610              return new MapReduceValuesToDoubleTask<K,V>
4611 <                (map, transformer, basis, reducer);
4611 >                (map, null, -1, null, transformer, basis, reducer);
4612          }
4613  
4614          /**
# Line 4622 | Line 4632 | public class ConcurrentHashMap<K, V>
4632              if (transformer == null || reducer == null)
4633                  throw new NullPointerException();
4634              return new MapReduceValuesToLongTask<K,V>
4635 <                (map, transformer, basis, reducer);
4635 >                (map, null, -1, null, transformer, basis, reducer);
4636          }
4637  
4638          /**
# Line 4646 | Line 4656 | public class ConcurrentHashMap<K, V>
4656              if (transformer == null || reducer == null)
4657                  throw new NullPointerException();
4658              return new MapReduceValuesToIntTask<K,V>
4659 <                (map, transformer, basis, reducer);
4659 >                (map, null, -1, null, transformer, basis, reducer);
4660          }
4661  
4662          /**
# Line 4660 | Line 4670 | public class ConcurrentHashMap<K, V>
4670              (ConcurrentHashMap<K,V> map,
4671               Action<Map.Entry<K,V>> action) {
4672              if (action == null) throw new NullPointerException();
4673 <            return new ForEachEntryTask<K,V>(map, action);
4673 >            return new ForEachEntryTask<K,V>(map, null, -1, action);
4674          }
4675  
4676          /**
# Line 4680 | Line 4690 | public class ConcurrentHashMap<K, V>
4690              if (transformer == null || action == null)
4691                  throw new NullPointerException();
4692              return new ForEachTransformedEntryTask<K,V,U>
4693 <                (map, transformer, action);
4693 >                (map, null, -1, transformer, action);
4694          }
4695  
4696          /**
# Line 4701 | Line 4711 | public class ConcurrentHashMap<K, V>
4711               Fun<Map.Entry<K,V>, ? extends U> searchFunction) {
4712              if (searchFunction == null) throw new NullPointerException();
4713              return new SearchEntriesTask<K,V,U>
4714 <                (map, searchFunction,
4714 >                (map, null, -1, searchFunction,
4715                   new AtomicReference<U>());
4716          }
4717  
# Line 4719 | Line 4729 | public class ConcurrentHashMap<K, V>
4729               BiFun<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) {
4730              if (reducer == null) throw new NullPointerException();
4731              return new ReduceEntriesTask<K,V>
4732 <                (map, reducer);
4732 >                (map, null, -1, null, reducer);
4733          }
4734  
4735          /**
# Line 4741 | Line 4751 | public class ConcurrentHashMap<K, V>
4751              if (transformer == null || reducer == null)
4752                  throw new NullPointerException();
4753              return new MapReduceEntriesTask<K,V,U>
4754 <                (map, transformer, reducer);
4754 >                (map, null, -1, null, transformer, reducer);
4755          }
4756  
4757          /**
# Line 4765 | Line 4775 | public class ConcurrentHashMap<K, V>
4775              if (transformer == null || reducer == null)
4776                  throw new NullPointerException();
4777              return new MapReduceEntriesToDoubleTask<K,V>
4778 <                (map, transformer, basis, reducer);
4778 >                (map, null, -1, null, transformer, basis, reducer);
4779          }
4780  
4781          /**
# Line 4789 | Line 4799 | public class ConcurrentHashMap<K, V>
4799              if (transformer == null || reducer == null)
4800                  throw new NullPointerException();
4801              return new MapReduceEntriesToLongTask<K,V>
4802 <                (map, transformer, basis, reducer);
4802 >                (map, null, -1, null, transformer, basis, reducer);
4803          }
4804  
4805          /**
# Line 4813 | Line 4823 | public class ConcurrentHashMap<K, V>
4823              if (transformer == null || reducer == null)
4824                  throw new NullPointerException();
4825              return new MapReduceEntriesToIntTask<K,V>
4826 <                (map, transformer, basis, reducer);
4826 >                (map, null, -1, null, transformer, basis, reducer);
4827          }
4828      }
4829  
# Line 4832 | Line 4842 | public class ConcurrentHashMap<K, V>
4842       */
4843      @SuppressWarnings("serial") static abstract class BulkTask<K,V,R> extends Traverser<K,V,R> {
4844          final BulkTask<K,V,?> parent;  // completion target
4845 <        int batch;                     // split control
4845 >        int batch;                     // split control; -1 for unknown
4846          int pending;                   // completion control
4847  
4848 <        /** Constructor for root tasks */
4849 <        BulkTask(ConcurrentHashMap<K,V> map) {
4848 >        BulkTask(ConcurrentHashMap<K,V> map, BulkTask<K,V,?> parent,
4849 >                 int batch) {
4850              super(map);
4841            this.parent = null;
4842            this.batch = -1; // force call to batch() on execution
4843        }
4844
4845        /** Constructor for subtasks */
4846        BulkTask(BulkTask<K,V,?> parent, int batch) {
4847            super(parent);
4851              this.parent = parent;
4852              this.batch = batch;
4853 +            if (parent != null && map != null) { // split parent
4854 +                Node[] t;
4855 +                if ((t = parent.tab) == null &&
4856 +                    (t = parent.tab = map.table) != null)
4857 +                    parent.baseLimit = parent.baseSize = t.length;
4858 +                this.tab = t;
4859 +                this.baseSize = parent.baseSize;
4860 +                int hi = this.baseLimit = parent.baseLimit;
4861 +                parent.baseLimit = this.index = this.baseIndex =
4862 +                    (hi + parent.baseIndex + 1) >>> 1;
4863 +            }
4864          }
4865  
4866          // FJ methods
# Line 4910 | Line 4924 | public class ConcurrentHashMap<K, V>
4924           * dividing by two anyway.
4925           */
4926          final int batch() {
4927 <            int b = batch;
4928 <            if (b < 0) {
4929 <                long n = map.counter.sum();
4930 <                int sp = getPool().getParallelism() << 3; // slack of 8
4931 <                b = batch = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp;
4927 >            ConcurrentHashMap<K, V> m; int b; Node[] t;
4928 >            if ((b = batch) < 0 && (m = map) != null) { // force initialization
4929 >                if ((t = tab) == null && (t = tab = m.table) != null)
4930 >                    baseLimit = baseSize = t.length;
4931 >                if (t != null) {
4932 >                    long n = m.counter.sum();
4933 >                    int sp = getPool().getParallelism() << 3; // slack of 8
4934 >                    b = batch = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp;
4935 >                }
4936              }
4937              return b;
4938          }
# Line 4950 | Line 4968 | public class ConcurrentHashMap<K, V>
4968          extends BulkTask<K,V,Void> {
4969          final Action<K> action;
4970          ForEachKeyTask
4971 <            (ConcurrentHashMap<K,V> m,
4971 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
4972               Action<K> action) {
4973 <            super(m);
4956 <            this.action = action;
4957 <        }
4958 <        ForEachKeyTask
4959 <            (BulkTask<K,V,?> p, int b,
4960 <             Action<K> action) {
4961 <            super(p, b);
4973 >            super(m, p, b);
4974              this.action = action;
4975          }
4976          @SuppressWarnings("unchecked") public final boolean exec() {
# Line 4969 | Line 4981 | public class ConcurrentHashMap<K, V>
4981                  int b = batch(), c;
4982                  while (b > 1 && baseIndex != baseLimit) {
4983                      do {} while (!casPending(c = pending, c+1));
4984 <                    new ForEachKeyTask<K,V>(this, b >>>= 1, action).fork();
4984 >                    new ForEachKeyTask<K,V>(map, this, b >>>= 1, action).fork();
4985                  }
4986                  while (advance() != null)
4987                      action.apply((K)nextKey);
# Line 4985 | Line 4997 | public class ConcurrentHashMap<K, V>
4997          extends BulkTask<K,V,Void> {
4998          final Action<V> action;
4999          ForEachValueTask
5000 <            (ConcurrentHashMap<K,V> m,
5000 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5001               Action<V> action) {
5002 <            super(m);
4991 <            this.action = action;
4992 <        }
4993 <        ForEachValueTask
4994 <            (BulkTask<K,V,?> p, int b,
4995 <             Action<V> action) {
4996 <            super(p, b);
5002 >            super(m, p, b);
5003              this.action = action;
5004          }
5005          @SuppressWarnings("unchecked") public final boolean exec() {
# Line 5004 | Line 5010 | public class ConcurrentHashMap<K, V>
5010                  int b = batch(), c;
5011                  while (b > 1 && baseIndex != baseLimit) {
5012                      do {} while (!casPending(c = pending, c+1));
5013 <                    new ForEachValueTask<K,V>(this, b >>>= 1, action).fork();
5013 >                    new ForEachValueTask<K,V>(map, this, b >>>= 1, action).fork();
5014                  }
5015                  Object v;
5016                  while ((v = advance()) != null)
# Line 5021 | Line 5027 | public class ConcurrentHashMap<K, V>
5027          extends BulkTask<K,V,Void> {
5028          final Action<Entry<K,V>> action;
5029          ForEachEntryTask
5030 <            (ConcurrentHashMap<K,V> m,
5025 <             Action<Entry<K,V>> action) {
5026 <            super(m);
5027 <            this.action = action;
5028 <        }
5029 <        ForEachEntryTask
5030 <            (BulkTask<K,V,?> p, int b,
5030 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5031               Action<Entry<K,V>> action) {
5032 <            super(p, b);
5032 >            super(m, p, b);
5033              this.action = action;
5034          }
5035          @SuppressWarnings("unchecked") public final boolean exec() {
# Line 5040 | Line 5040 | public class ConcurrentHashMap<K, V>
5040                  int b = batch(), c;
5041                  while (b > 1 && baseIndex != baseLimit) {
5042                      do {} while (!casPending(c = pending, c+1));
5043 <                    new ForEachEntryTask<K,V>(this, b >>>= 1, action).fork();
5043 >                    new ForEachEntryTask<K,V>(map, this, b >>>= 1, action).fork();
5044                  }
5045                  Object v;
5046                  while ((v = advance()) != null)
# Line 5057 | Line 5057 | public class ConcurrentHashMap<K, V>
5057          extends BulkTask<K,V,Void> {
5058          final BiAction<K,V> action;
5059          ForEachMappingTask
5060 <            (ConcurrentHashMap<K,V> m,
5060 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5061               BiAction<K,V> action) {
5062 <            super(m);
5062 >            super(m, p, b);
5063              this.action = action;
5064          }
5065        ForEachMappingTask
5066            (BulkTask<K,V,?> p, int b,
5067             BiAction<K,V> action) {
5068            super(p, b);
5069            this.action = action;
5070        }
5071
5065          @SuppressWarnings("unchecked") public final boolean exec() {
5066              final BiAction<K,V> action = this.action;
5067              if (action == null)
# Line 5077 | Line 5070 | public class ConcurrentHashMap<K, V>
5070                  int b = batch(), c;
5071                  while (b > 1 && baseIndex != baseLimit) {
5072                      do {} while (!casPending(c = pending, c+1));
5073 <                    new ForEachMappingTask<K,V>(this, b >>>= 1,
5073 >                    new ForEachMappingTask<K,V>(map, this, b >>>= 1,
5074                                                  action).fork();
5075                  }
5076                  Object v;
# Line 5096 | Line 5089 | public class ConcurrentHashMap<K, V>
5089          final Fun<? super K, ? extends U> transformer;
5090          final Action<U> action;
5091          ForEachTransformedKeyTask
5092 <            (ConcurrentHashMap<K,V> m,
5092 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5093               Fun<? super K, ? extends U> transformer,
5094               Action<U> action) {
5095 <            super(m);
5095 >            super(m, p, b);
5096              this.transformer = transformer;
5097              this.action = action;
5098  
5099          }
5107        ForEachTransformedKeyTask
5108            (BulkTask<K,V,?> p, int b,
5109             Fun<? super K, ? extends U> transformer,
5110             Action<U> action) {
5111            super(p, b);
5112            this.transformer = transformer;
5113            this.action = action;
5114        }
5100          @SuppressWarnings("unchecked") public final boolean exec() {
5101              final Fun<? super K, ? extends U> transformer =
5102                  this.transformer;
# Line 5123 | Line 5108 | public class ConcurrentHashMap<K, V>
5108                  while (b > 1 && baseIndex != baseLimit) {
5109                      do {} while (!casPending(c = pending, c+1));
5110                      new ForEachTransformedKeyTask<K,V,U>
5111 <                        (this, b >>>= 1, transformer, action).fork();
5111 >                        (map, this, b >>>= 1, transformer, action).fork();
5112                  }
5113                  U u;
5114                  while (advance() != null) {
# Line 5143 | Line 5128 | public class ConcurrentHashMap<K, V>
5128          final Fun<? super V, ? extends U> transformer;
5129          final Action<U> action;
5130          ForEachTransformedValueTask
5131 <            (ConcurrentHashMap<K,V> m,
5131 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5132               Fun<? super V, ? extends U> transformer,
5133               Action<U> action) {
5134 <            super(m);
5134 >            super(m, p, b);
5135              this.transformer = transformer;
5136              this.action = action;
5137  
5138          }
5154        ForEachTransformedValueTask
5155            (BulkTask<K,V,?> p, int b,
5156             Fun<? super V, ? extends U> transformer,
5157             Action<U> action) {
5158            super(p, b);
5159            this.transformer = transformer;
5160            this.action = action;
5161        }
5139          @SuppressWarnings("unchecked") public final boolean exec() {
5140              final Fun<? super V, ? extends U> transformer =
5141                  this.transformer;
# Line 5170 | Line 5147 | public class ConcurrentHashMap<K, V>
5147                  while (b > 1 && baseIndex != baseLimit) {
5148                      do {} while (!casPending(c = pending, c+1));
5149                      new ForEachTransformedValueTask<K,V,U>
5150 <                        (this, b >>>= 1, transformer, action).fork();
5150 >                        (map, this, b >>>= 1, transformer, action).fork();
5151                  }
5152                  Object v; U u;
5153                  while ((v = advance()) != null) {
# Line 5190 | Line 5167 | public class ConcurrentHashMap<K, V>
5167          final Fun<Map.Entry<K,V>, ? extends U> transformer;
5168          final Action<U> action;
5169          ForEachTransformedEntryTask
5170 <            (ConcurrentHashMap<K,V> m,
5170 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5171               Fun<Map.Entry<K,V>, ? extends U> transformer,
5172               Action<U> action) {
5173 <            super(m);
5173 >            super(m, p, b);
5174              this.transformer = transformer;
5175              this.action = action;
5176  
5177          }
5201        ForEachTransformedEntryTask
5202            (BulkTask<K,V,?> p, int b,
5203             Fun<Map.Entry<K,V>, ? extends U> transformer,
5204             Action<U> action) {
5205            super(p, b);
5206            this.transformer = transformer;
5207            this.action = action;
5208        }
5178          @SuppressWarnings("unchecked") public final boolean exec() {
5179              final Fun<Map.Entry<K,V>, ? extends U> transformer =
5180                  this.transformer;
# Line 5217 | Line 5186 | public class ConcurrentHashMap<K, V>
5186                  while (b > 1 && baseIndex != baseLimit) {
5187                      do {} while (!casPending(c = pending, c+1));
5188                      new ForEachTransformedEntryTask<K,V,U>
5189 <                        (this, b >>>= 1, transformer, action).fork();
5189 >                        (map, this, b >>>= 1, transformer, action).fork();
5190                  }
5191                  Object v; U u;
5192                  while ((v = advance()) != null) {
# Line 5237 | Line 5206 | public class ConcurrentHashMap<K, V>
5206          final BiFun<? super K, ? super V, ? extends U> transformer;
5207          final Action<U> action;
5208          ForEachTransformedMappingTask
5209 <            (ConcurrentHashMap<K,V> m,
5209 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5210               BiFun<? super K, ? super V, ? extends U> transformer,
5211               Action<U> action) {
5212 <            super(m);
5212 >            super(m, p, b);
5213              this.transformer = transformer;
5214              this.action = action;
5215  
5216          }
5248        ForEachTransformedMappingTask
5249            (BulkTask<K,V,?> p, int b,
5250             BiFun<? super K, ? super V, ? extends U> transformer,
5251             Action<U> action) {
5252            super(p, b);
5253            this.transformer = transformer;
5254            this.action = action;
5255        }
5217          @SuppressWarnings("unchecked") public final boolean exec() {
5218              final BiFun<? super K, ? super V, ? extends U> transformer =
5219                  this.transformer;
# Line 5264 | Line 5225 | public class ConcurrentHashMap<K, V>
5225                  while (b > 1 && baseIndex != baseLimit) {
5226                      do {} while (!casPending(c = pending, c+1));
5227                      new ForEachTransformedMappingTask<K,V,U>
5228 <                        (this, b >>>= 1, transformer, action).fork();
5228 >                        (map, this, b >>>= 1, transformer, action).fork();
5229                  }
5230                  Object v; U u;
5231                  while ((v = advance()) != null) {
# Line 5284 | Line 5245 | public class ConcurrentHashMap<K, V>
5245          final Fun<? super K, ? extends U> searchFunction;
5246          final AtomicReference<U> result;
5247          SearchKeysTask
5248 <            (ConcurrentHashMap<K,V> m,
5248 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5249               Fun<? super K, ? extends U> searchFunction,
5250               AtomicReference<U> result) {
5251 <            super(m);
5291 <            this.searchFunction = searchFunction; this.result = result;
5292 <        }
5293 <        SearchKeysTask
5294 <            (BulkTask<K,V,?> p, int b,
5295 <             Fun<? super K, ? extends U> searchFunction,
5296 <             AtomicReference<U> result) {
5297 <            super(p, b);
5251 >            super(m, p, b);
5252              this.searchFunction = searchFunction; this.result = result;
5253          }
5254          @SuppressWarnings("unchecked") public final boolean exec() {
# Line 5307 | Line 5261 | public class ConcurrentHashMap<K, V>
5261                  int b = batch(), c;
5262                  while (b > 1 && baseIndex != baseLimit && result.get() == null) {
5263                      do {} while (!casPending(c = pending, c+1));
5264 <                    new SearchKeysTask<K,V,U>(this, b >>>= 1,
5264 >                    new SearchKeysTask<K,V,U>(map, this, b >>>= 1,
5265                                                searchFunction, result).fork();
5266                  }
5267                  U u;
# Line 5332 | Line 5286 | public class ConcurrentHashMap<K, V>
5286          final Fun<? super V, ? extends U> searchFunction;
5287          final AtomicReference<U> result;
5288          SearchValuesTask
5289 <            (ConcurrentHashMap<K,V> m,
5336 <             Fun<? super V, ? extends U> searchFunction,
5337 <             AtomicReference<U> result) {
5338 <            super(m);
5339 <            this.searchFunction = searchFunction; this.result = result;
5340 <        }
5341 <        SearchValuesTask
5342 <            (BulkTask<K,V,?> p, int b,
5289 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5290               Fun<? super V, ? extends U> searchFunction,
5291               AtomicReference<U> result) {
5292 <            super(p, b);
5292 >            super(m, p, b);
5293              this.searchFunction = searchFunction; this.result = result;
5294          }
5295          @SuppressWarnings("unchecked") public final boolean exec() {
# Line 5355 | Line 5302 | public class ConcurrentHashMap<K, V>
5302                  int b = batch(), c;
5303                  while (b > 1 && baseIndex != baseLimit && result.get() == null) {
5304                      do {} while (!casPending(c = pending, c+1));
5305 <                    new SearchValuesTask<K,V,U>(this, b >>>= 1,
5305 >                    new SearchValuesTask<K,V,U>(map, this, b >>>= 1,
5306                                                  searchFunction, result).fork();
5307                  }
5308                  Object v; U u;
# Line 5380 | Line 5327 | public class ConcurrentHashMap<K, V>
5327          final Fun<Entry<K,V>, ? extends U> searchFunction;
5328          final AtomicReference<U> result;
5329          SearchEntriesTask
5330 <            (ConcurrentHashMap<K,V> m,
5384 <             Fun<Entry<K,V>, ? extends U> searchFunction,
5385 <             AtomicReference<U> result) {
5386 <            super(m);
5387 <            this.searchFunction = searchFunction; this.result = result;
5388 <        }
5389 <        SearchEntriesTask
5390 <            (BulkTask<K,V,?> p, int b,
5330 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5331               Fun<Entry<K,V>, ? extends U> searchFunction,
5332               AtomicReference<U> result) {
5333 <            super(p, b);
5333 >            super(m, p, b);
5334              this.searchFunction = searchFunction; this.result = result;
5335          }
5336          @SuppressWarnings("unchecked") public final boolean exec() {
# Line 5403 | Line 5343 | public class ConcurrentHashMap<K, V>
5343                  int b = batch(), c;
5344                  while (b > 1 && baseIndex != baseLimit && result.get() == null) {
5345                      do {} while (!casPending(c = pending, c+1));
5346 <                    new SearchEntriesTask<K,V,U>(this, b >>>= 1,
5346 >                    new SearchEntriesTask<K,V,U>(map, this, b >>>= 1,
5347                                                   searchFunction, result).fork();
5348                  }
5349                  Object v; U u;
# Line 5428 | Line 5368 | public class ConcurrentHashMap<K, V>
5368          final BiFun<? super K, ? super V, ? extends U> searchFunction;
5369          final AtomicReference<U> result;
5370          SearchMappingsTask
5371 <            (ConcurrentHashMap<K,V> m,
5432 <             BiFun<? super K, ? super V, ? extends U> searchFunction,
5433 <             AtomicReference<U> result) {
5434 <            super(m);
5435 <            this.searchFunction = searchFunction; this.result = result;
5436 <        }
5437 <        SearchMappingsTask
5438 <            (BulkTask<K,V,?> p, int b,
5371 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5372               BiFun<? super K, ? super V, ? extends U> searchFunction,
5373               AtomicReference<U> result) {
5374 <            super(p, b);
5374 >            super(m, p, b);
5375              this.searchFunction = searchFunction; this.result = result;
5376          }
5377          @SuppressWarnings("unchecked") public final boolean exec() {
# Line 5451 | Line 5384 | public class ConcurrentHashMap<K, V>
5384                  int b = batch(), c;
5385                  while (b > 1 && baseIndex != baseLimit && result.get() == null) {
5386                      do {} while (!casPending(c = pending, c+1));
5387 <                    new SearchMappingsTask<K,V,U>(this, b >>>= 1,
5387 >                    new SearchMappingsTask<K,V,U>(map, this, b >>>= 1,
5388                                                    searchFunction, result).fork();
5389                  }
5390                  Object v; U u;
# Line 5477 | Line 5410 | public class ConcurrentHashMap<K, V>
5410          K result;
5411          ReduceKeysTask<K,V> rights, nextRight;
5412          ReduceKeysTask
5413 <            (ConcurrentHashMap<K,V> m,
5481 <             BiFun<? super K, ? super K, ? extends K> reducer) {
5482 <            super(m);
5483 <            this.reducer = reducer;
5484 <        }
5485 <        ReduceKeysTask
5486 <            (BulkTask<K,V,?> p, int b,
5413 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5414               ReduceKeysTask<K,V> nextRight,
5415               BiFun<? super K, ? super K, ? extends K> reducer) {
5416 <            super(p, b); this.nextRight = nextRight;
5416 >            super(m, p, b); this.nextRight = nextRight;
5417              this.reducer = reducer;
5418          }
5492
5419          @SuppressWarnings("unchecked") public final boolean exec() {
5420              final BiFun<? super K, ? super K, ? extends K> reducer =
5421                  this.reducer;
# Line 5499 | Line 5425 | public class ConcurrentHashMap<K, V>
5425                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5426                      do {} while (!casPending(c = pending, c+1));
5427                      (rights = new ReduceKeysTask<K,V>
5428 <                     (this, b >>>= 1, rights, reducer)).fork();
5428 >                     (map, this, b >>>= 1, rights, reducer)).fork();
5429                  }
5430                  K r = null;
5431                  while (advance() != null) {
# Line 5538 | Line 5464 | public class ConcurrentHashMap<K, V>
5464          V result;
5465          ReduceValuesTask<K,V> rights, nextRight;
5466          ReduceValuesTask
5467 <            (ConcurrentHashMap<K,V> m,
5542 <             BiFun<? super V, ? super V, ? extends V> reducer) {
5543 <            super(m);
5544 <            this.reducer = reducer;
5545 <        }
5546 <        ReduceValuesTask
5547 <            (BulkTask<K,V,?> p, int b,
5467 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5468               ReduceValuesTask<K,V> nextRight,
5469               BiFun<? super V, ? super V, ? extends V> reducer) {
5470 <            super(p, b); this.nextRight = nextRight;
5470 >            super(m, p, b); this.nextRight = nextRight;
5471              this.reducer = reducer;
5472          }
5553
5473          @SuppressWarnings("unchecked") public final boolean exec() {
5474              final BiFun<? super V, ? super V, ? extends V> reducer =
5475                  this.reducer;
# Line 5560 | Line 5479 | public class ConcurrentHashMap<K, V>
5479                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5480                      do {} while (!casPending(c = pending, c+1));
5481                      (rights = new ReduceValuesTask<K,V>
5482 <                     (this, b >>>= 1, rights, reducer)).fork();
5482 >                     (map, this, b >>>= 1, rights, reducer)).fork();
5483                  }
5484                  V r = null;
5485                  Object v;
# Line 5600 | Line 5519 | public class ConcurrentHashMap<K, V>
5519          Map.Entry<K,V> result;
5520          ReduceEntriesTask<K,V> rights, nextRight;
5521          ReduceEntriesTask
5522 <            (ConcurrentHashMap<K,V> m,
5604 <             BiFun<Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) {
5605 <            super(m);
5606 <            this.reducer = reducer;
5607 <        }
5608 <        ReduceEntriesTask
5609 <            (BulkTask<K,V,?> p, int b,
5522 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5523               ReduceEntriesTask<K,V> nextRight,
5524 <             BiFun<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) {
5525 <            super(p, b); this.nextRight = nextRight;
5524 >             BiFun<Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer) {
5525 >            super(m, p, b); this.nextRight = nextRight;
5526              this.reducer = reducer;
5527          }
5615
5528          @SuppressWarnings("unchecked") public final boolean exec() {
5529              final BiFun<Map.Entry<K,V>, Map.Entry<K,V>, ? extends Map.Entry<K,V>> reducer =
5530                  this.reducer;
# Line 5622 | Line 5534 | public class ConcurrentHashMap<K, V>
5534                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5535                      do {} while (!casPending(c = pending, c+1));
5536                      (rights = new ReduceEntriesTask<K,V>
5537 <                     (this, b >>>= 1, rights, reducer)).fork();
5537 >                     (map, this, b >>>= 1, rights, reducer)).fork();
5538                  }
5539                  Map.Entry<K,V> r = null;
5540                  Object v;
# Line 5663 | Line 5575 | public class ConcurrentHashMap<K, V>
5575          U result;
5576          MapReduceKeysTask<K,V,U> rights, nextRight;
5577          MapReduceKeysTask
5578 <            (ConcurrentHashMap<K,V> m,
5667 <             Fun<? super K, ? extends U> transformer,
5668 <             BiFun<? super U, ? super U, ? extends U> reducer) {
5669 <            super(m);
5670 <            this.transformer = transformer;
5671 <            this.reducer = reducer;
5672 <        }
5673 <        MapReduceKeysTask
5674 <            (BulkTask<K,V,?> p, int b,
5578 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5579               MapReduceKeysTask<K,V,U> nextRight,
5580               Fun<? super K, ? extends U> transformer,
5581               BiFun<? super U, ? super U, ? extends U> reducer) {
5582 <            super(p, b); this.nextRight = nextRight;
5582 >            super(m, p, b); this.nextRight = nextRight;
5583              this.transformer = transformer;
5584              this.reducer = reducer;
5585          }
# Line 5690 | Line 5594 | public class ConcurrentHashMap<K, V>
5594                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5595                      do {} while (!casPending(c = pending, c+1));
5596                      (rights = new MapReduceKeysTask<K,V,U>
5597 <                     (this, b >>>= 1, rights, transformer, reducer)).fork();
5597 >                     (map, this, b >>>= 1, rights, transformer, reducer)).fork();
5598                  }
5599                  U r = null, u;
5600                  while (advance() != null) {
# Line 5730 | Line 5634 | public class ConcurrentHashMap<K, V>
5634          U result;
5635          MapReduceValuesTask<K,V,U> rights, nextRight;
5636          MapReduceValuesTask
5637 <            (ConcurrentHashMap<K,V> m,
5734 <             Fun<? super V, ? extends U> transformer,
5735 <             BiFun<? super U, ? super U, ? extends U> reducer) {
5736 <            super(m);
5737 <            this.transformer = transformer;
5738 <            this.reducer = reducer;
5739 <        }
5740 <        MapReduceValuesTask
5741 <            (BulkTask<K,V,?> p, int b,
5637 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5638               MapReduceValuesTask<K,V,U> nextRight,
5639               Fun<? super V, ? extends U> transformer,
5640               BiFun<? super U, ? super U, ? extends U> reducer) {
5641 <            super(p, b); this.nextRight = nextRight;
5641 >            super(m, p, b); this.nextRight = nextRight;
5642              this.transformer = transformer;
5643              this.reducer = reducer;
5644          }
# Line 5757 | Line 5653 | public class ConcurrentHashMap<K, V>
5653                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5654                      do {} while (!casPending(c = pending, c+1));
5655                      (rights = new MapReduceValuesTask<K,V,U>
5656 <                     (this, b >>>= 1, rights, transformer, reducer)).fork();
5656 >                     (map, this, b >>>= 1, rights, transformer, reducer)).fork();
5657                  }
5658                  U r = null, u;
5659                  Object v;
# Line 5798 | Line 5694 | public class ConcurrentHashMap<K, V>
5694          U result;
5695          MapReduceEntriesTask<K,V,U> rights, nextRight;
5696          MapReduceEntriesTask
5697 <            (ConcurrentHashMap<K,V> m,
5802 <             Fun<Map.Entry<K,V>, ? extends U> transformer,
5803 <             BiFun<? super U, ? super U, ? extends U> reducer) {
5804 <            super(m);
5805 <            this.transformer = transformer;
5806 <            this.reducer = reducer;
5807 <        }
5808 <        MapReduceEntriesTask
5809 <            (BulkTask<K,V,?> p, int b,
5697 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5698               MapReduceEntriesTask<K,V,U> nextRight,
5699               Fun<Map.Entry<K,V>, ? extends U> transformer,
5700               BiFun<? super U, ? super U, ? extends U> reducer) {
5701 <            super(p, b); this.nextRight = nextRight;
5701 >            super(m, p, b); this.nextRight = nextRight;
5702              this.transformer = transformer;
5703              this.reducer = reducer;
5704          }
# Line 5825 | Line 5713 | public class ConcurrentHashMap<K, V>
5713                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5714                      do {} while (!casPending(c = pending, c+1));
5715                      (rights = new MapReduceEntriesTask<K,V,U>
5716 <                     (this, b >>>= 1, rights, transformer, reducer)).fork();
5716 >                     (map, this, b >>>= 1, rights, transformer, reducer)).fork();
5717                  }
5718                  U r = null, u;
5719                  Object v;
# Line 5866 | Line 5754 | public class ConcurrentHashMap<K, V>
5754          U result;
5755          MapReduceMappingsTask<K,V,U> rights, nextRight;
5756          MapReduceMappingsTask
5757 <            (ConcurrentHashMap<K,V> m,
5870 <             BiFun<? super K, ? super V, ? extends U> transformer,
5871 <             BiFun<? super U, ? super U, ? extends U> reducer) {
5872 <            super(m);
5873 <            this.transformer = transformer;
5874 <            this.reducer = reducer;
5875 <        }
5876 <        MapReduceMappingsTask
5877 <            (BulkTask<K,V,?> p, int b,
5757 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5758               MapReduceMappingsTask<K,V,U> nextRight,
5759               BiFun<? super K, ? super V, ? extends U> transformer,
5760               BiFun<? super U, ? super U, ? extends U> reducer) {
5761 <            super(p, b); this.nextRight = nextRight;
5761 >            super(m, p, b); this.nextRight = nextRight;
5762              this.transformer = transformer;
5763              this.reducer = reducer;
5764          }
# Line 5893 | Line 5773 | public class ConcurrentHashMap<K, V>
5773                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5774                      do {} while (!casPending(c = pending, c+1));
5775                      (rights = new MapReduceMappingsTask<K,V,U>
5776 <                     (this, b >>>= 1, rights, transformer, reducer)).fork();
5776 >                     (map, this, b >>>= 1, rights, transformer, reducer)).fork();
5777                  }
5778                  U r = null, u;
5779                  Object v;
# Line 5935 | Line 5815 | public class ConcurrentHashMap<K, V>
5815          double result;
5816          MapReduceKeysToDoubleTask<K,V> rights, nextRight;
5817          MapReduceKeysToDoubleTask
5818 <            (ConcurrentHashMap<K,V> m,
5939 <             ObjectToDouble<? super K> transformer,
5940 <             double basis,
5941 <             DoubleByDoubleToDouble reducer) {
5942 <            super(m);
5943 <            this.transformer = transformer;
5944 <            this.basis = basis; this.reducer = reducer;
5945 <        }
5946 <        MapReduceKeysToDoubleTask
5947 <            (BulkTask<K,V,?> p, int b,
5818 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5819               MapReduceKeysToDoubleTask<K,V> nextRight,
5820               ObjectToDouble<? super K> transformer,
5821               double basis,
5822               DoubleByDoubleToDouble reducer) {
5823 <            super(p, b); this.nextRight = nextRight;
5823 >            super(m, p, b); this.nextRight = nextRight;
5824              this.transformer = transformer;
5825              this.basis = basis; this.reducer = reducer;
5826          }
# Line 5964 | Line 5835 | public class ConcurrentHashMap<K, V>
5835                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5836                      do {} while (!casPending(c = pending, c+1));
5837                      (rights = new MapReduceKeysToDoubleTask<K,V>
5838 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
5838 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
5839                  }
5840                  double r = id;
5841                  while (advance() != null)
# Line 6002 | Line 5873 | public class ConcurrentHashMap<K, V>
5873          double result;
5874          MapReduceValuesToDoubleTask<K,V> rights, nextRight;
5875          MapReduceValuesToDoubleTask
5876 <            (ConcurrentHashMap<K,V> m,
6006 <             ObjectToDouble<? super V> transformer,
6007 <             double basis,
6008 <             DoubleByDoubleToDouble reducer) {
6009 <            super(m);
6010 <            this.transformer = transformer;
6011 <            this.basis = basis; this.reducer = reducer;
6012 <        }
6013 <        MapReduceValuesToDoubleTask
6014 <            (BulkTask<K,V,?> p, int b,
5876 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5877               MapReduceValuesToDoubleTask<K,V> nextRight,
5878               ObjectToDouble<? super V> transformer,
5879               double basis,
5880               DoubleByDoubleToDouble reducer) {
5881 <            super(p, b); this.nextRight = nextRight;
5881 >            super(m, p, b); this.nextRight = nextRight;
5882              this.transformer = transformer;
5883              this.basis = basis; this.reducer = reducer;
5884          }
# Line 6031 | Line 5893 | public class ConcurrentHashMap<K, V>
5893                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5894                      do {} while (!casPending(c = pending, c+1));
5895                      (rights = new MapReduceValuesToDoubleTask<K,V>
5896 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
5896 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
5897                  }
5898                  double r = id;
5899                  Object v;
# Line 6070 | Line 5932 | public class ConcurrentHashMap<K, V>
5932          double result;
5933          MapReduceEntriesToDoubleTask<K,V> rights, nextRight;
5934          MapReduceEntriesToDoubleTask
5935 <            (ConcurrentHashMap<K,V> m,
6074 <             ObjectToDouble<Map.Entry<K,V>> transformer,
6075 <             double basis,
6076 <             DoubleByDoubleToDouble reducer) {
6077 <            super(m);
6078 <            this.transformer = transformer;
6079 <            this.basis = basis; this.reducer = reducer;
6080 <        }
6081 <        MapReduceEntriesToDoubleTask
6082 <            (BulkTask<K,V,?> p, int b,
5935 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5936               MapReduceEntriesToDoubleTask<K,V> nextRight,
5937               ObjectToDouble<Map.Entry<K,V>> transformer,
5938               double basis,
5939               DoubleByDoubleToDouble reducer) {
5940 <            super(p, b); this.nextRight = nextRight;
5940 >            super(m, p, b); this.nextRight = nextRight;
5941              this.transformer = transformer;
5942              this.basis = basis; this.reducer = reducer;
5943          }
# Line 6099 | Line 5952 | public class ConcurrentHashMap<K, V>
5952                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
5953                      do {} while (!casPending(c = pending, c+1));
5954                      (rights = new MapReduceEntriesToDoubleTask<K,V>
5955 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
5955 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
5956                  }
5957                  double r = id;
5958                  Object v;
# Line 6138 | Line 5991 | public class ConcurrentHashMap<K, V>
5991          double result;
5992          MapReduceMappingsToDoubleTask<K,V> rights, nextRight;
5993          MapReduceMappingsToDoubleTask
5994 <            (ConcurrentHashMap<K,V> m,
6142 <             ObjectByObjectToDouble<? super K, ? super V> transformer,
6143 <             double basis,
6144 <             DoubleByDoubleToDouble reducer) {
6145 <            super(m);
6146 <            this.transformer = transformer;
6147 <            this.basis = basis; this.reducer = reducer;
6148 <        }
6149 <        MapReduceMappingsToDoubleTask
6150 <            (BulkTask<K,V,?> p, int b,
5994 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
5995               MapReduceMappingsToDoubleTask<K,V> nextRight,
5996               ObjectByObjectToDouble<? super K, ? super V> transformer,
5997               double basis,
5998               DoubleByDoubleToDouble reducer) {
5999 <            super(p, b); this.nextRight = nextRight;
5999 >            super(m, p, b); this.nextRight = nextRight;
6000              this.transformer = transformer;
6001              this.basis = basis; this.reducer = reducer;
6002          }
# Line 6167 | Line 6011 | public class ConcurrentHashMap<K, V>
6011                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6012                      do {} while (!casPending(c = pending, c+1));
6013                      (rights = new MapReduceMappingsToDoubleTask<K,V>
6014 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6014 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6015                  }
6016                  double r = id;
6017                  Object v;
# Line 6206 | Line 6050 | public class ConcurrentHashMap<K, V>
6050          long result;
6051          MapReduceKeysToLongTask<K,V> rights, nextRight;
6052          MapReduceKeysToLongTask
6053 <            (ConcurrentHashMap<K,V> m,
6210 <             ObjectToLong<? super K> transformer,
6211 <             long basis,
6212 <             LongByLongToLong reducer) {
6213 <            super(m);
6214 <            this.transformer = transformer;
6215 <            this.basis = basis; this.reducer = reducer;
6216 <        }
6217 <        MapReduceKeysToLongTask
6218 <            (BulkTask<K,V,?> p, int b,
6053 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6054               MapReduceKeysToLongTask<K,V> nextRight,
6055               ObjectToLong<? super K> transformer,
6056               long basis,
6057               LongByLongToLong reducer) {
6058 <            super(p, b); this.nextRight = nextRight;
6058 >            super(m, p, b); this.nextRight = nextRight;
6059              this.transformer = transformer;
6060              this.basis = basis; this.reducer = reducer;
6061          }
# Line 6235 | Line 6070 | public class ConcurrentHashMap<K, V>
6070                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6071                      do {} while (!casPending(c = pending, c+1));
6072                      (rights = new MapReduceKeysToLongTask<K,V>
6073 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6073 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6074                  }
6075                  long r = id;
6076                  while (advance() != null)
# Line 6273 | Line 6108 | public class ConcurrentHashMap<K, V>
6108          long result;
6109          MapReduceValuesToLongTask<K,V> rights, nextRight;
6110          MapReduceValuesToLongTask
6111 <            (ConcurrentHashMap<K,V> m,
6277 <             ObjectToLong<? super V> transformer,
6278 <             long basis,
6279 <             LongByLongToLong reducer) {
6280 <            super(m);
6281 <            this.transformer = transformer;
6282 <            this.basis = basis; this.reducer = reducer;
6283 <        }
6284 <        MapReduceValuesToLongTask
6285 <            (BulkTask<K,V,?> p, int b,
6111 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6112               MapReduceValuesToLongTask<K,V> nextRight,
6113               ObjectToLong<? super V> transformer,
6114               long basis,
6115               LongByLongToLong reducer) {
6116 <            super(p, b); this.nextRight = nextRight;
6116 >            super(m, p, b); this.nextRight = nextRight;
6117              this.transformer = transformer;
6118              this.basis = basis; this.reducer = reducer;
6119          }
# Line 6302 | Line 6128 | public class ConcurrentHashMap<K, V>
6128                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6129                      do {} while (!casPending(c = pending, c+1));
6130                      (rights = new MapReduceValuesToLongTask<K,V>
6131 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6131 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6132                  }
6133                  long r = id;
6134                  Object v;
# Line 6341 | Line 6167 | public class ConcurrentHashMap<K, V>
6167          long result;
6168          MapReduceEntriesToLongTask<K,V> rights, nextRight;
6169          MapReduceEntriesToLongTask
6170 <            (ConcurrentHashMap<K,V> m,
6345 <             ObjectToLong<Map.Entry<K,V>> transformer,
6346 <             long basis,
6347 <             LongByLongToLong reducer) {
6348 <            super(m);
6349 <            this.transformer = transformer;
6350 <            this.basis = basis; this.reducer = reducer;
6351 <        }
6352 <        MapReduceEntriesToLongTask
6353 <            (BulkTask<K,V,?> p, int b,
6170 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6171               MapReduceEntriesToLongTask<K,V> nextRight,
6172               ObjectToLong<Map.Entry<K,V>> transformer,
6173               long basis,
6174               LongByLongToLong reducer) {
6175 <            super(p, b); this.nextRight = nextRight;
6175 >            super(m, p, b); this.nextRight = nextRight;
6176              this.transformer = transformer;
6177              this.basis = basis; this.reducer = reducer;
6178          }
# Line 6370 | Line 6187 | public class ConcurrentHashMap<K, V>
6187                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6188                      do {} while (!casPending(c = pending, c+1));
6189                      (rights = new MapReduceEntriesToLongTask<K,V>
6190 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6190 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6191                  }
6192                  long r = id;
6193                  Object v;
# Line 6409 | Line 6226 | public class ConcurrentHashMap<K, V>
6226          long result;
6227          MapReduceMappingsToLongTask<K,V> rights, nextRight;
6228          MapReduceMappingsToLongTask
6229 <            (ConcurrentHashMap<K,V> m,
6413 <             ObjectByObjectToLong<? super K, ? super V> transformer,
6414 <             long basis,
6415 <             LongByLongToLong reducer) {
6416 <            super(m);
6417 <            this.transformer = transformer;
6418 <            this.basis = basis; this.reducer = reducer;
6419 <        }
6420 <        MapReduceMappingsToLongTask
6421 <            (BulkTask<K,V,?> p, int b,
6229 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6230               MapReduceMappingsToLongTask<K,V> nextRight,
6231               ObjectByObjectToLong<? super K, ? super V> transformer,
6232               long basis,
6233               LongByLongToLong reducer) {
6234 <            super(p, b); this.nextRight = nextRight;
6234 >            super(m, p, b); this.nextRight = nextRight;
6235              this.transformer = transformer;
6236              this.basis = basis; this.reducer = reducer;
6237          }
# Line 6438 | Line 6246 | public class ConcurrentHashMap<K, V>
6246                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6247                      do {} while (!casPending(c = pending, c+1));
6248                      (rights = new MapReduceMappingsToLongTask<K,V>
6249 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6249 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6250                  }
6251                  long r = id;
6252                  Object v;
# Line 6477 | Line 6285 | public class ConcurrentHashMap<K, V>
6285          int result;
6286          MapReduceKeysToIntTask<K,V> rights, nextRight;
6287          MapReduceKeysToIntTask
6288 <            (ConcurrentHashMap<K,V> m,
6481 <             ObjectToInt<? super K> transformer,
6482 <             int basis,
6483 <             IntByIntToInt reducer) {
6484 <            super(m);
6485 <            this.transformer = transformer;
6486 <            this.basis = basis; this.reducer = reducer;
6487 <        }
6488 <        MapReduceKeysToIntTask
6489 <            (BulkTask<K,V,?> p, int b,
6288 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6289               MapReduceKeysToIntTask<K,V> nextRight,
6290               ObjectToInt<? super K> transformer,
6291               int basis,
6292               IntByIntToInt reducer) {
6293 <            super(p, b); this.nextRight = nextRight;
6293 >            super(m, p, b); this.nextRight = nextRight;
6294              this.transformer = transformer;
6295              this.basis = basis; this.reducer = reducer;
6296          }
# Line 6506 | Line 6305 | public class ConcurrentHashMap<K, V>
6305                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6306                      do {} while (!casPending(c = pending, c+1));
6307                      (rights = new MapReduceKeysToIntTask<K,V>
6308 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6308 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6309                  }
6310                  int r = id;
6311                  while (advance() != null)
# Line 6544 | Line 6343 | public class ConcurrentHashMap<K, V>
6343          int result;
6344          MapReduceValuesToIntTask<K,V> rights, nextRight;
6345          MapReduceValuesToIntTask
6346 <            (ConcurrentHashMap<K,V> m,
6548 <             ObjectToInt<? super V> transformer,
6549 <             int basis,
6550 <             IntByIntToInt reducer) {
6551 <            super(m);
6552 <            this.transformer = transformer;
6553 <            this.basis = basis; this.reducer = reducer;
6554 <        }
6555 <        MapReduceValuesToIntTask
6556 <            (BulkTask<K,V,?> p, int b,
6346 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6347               MapReduceValuesToIntTask<K,V> nextRight,
6348               ObjectToInt<? super V> transformer,
6349               int basis,
6350               IntByIntToInt reducer) {
6351 <            super(p, b); this.nextRight = nextRight;
6351 >            super(m, p, b); this.nextRight = nextRight;
6352              this.transformer = transformer;
6353              this.basis = basis; this.reducer = reducer;
6354          }
# Line 6573 | Line 6363 | public class ConcurrentHashMap<K, V>
6363                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6364                      do {} while (!casPending(c = pending, c+1));
6365                      (rights = new MapReduceValuesToIntTask<K,V>
6366 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6366 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6367                  }
6368                  int r = id;
6369                  Object v;
# Line 6612 | Line 6402 | public class ConcurrentHashMap<K, V>
6402          int result;
6403          MapReduceEntriesToIntTask<K,V> rights, nextRight;
6404          MapReduceEntriesToIntTask
6405 <            (ConcurrentHashMap<K,V> m,
6616 <             ObjectToInt<Map.Entry<K,V>> transformer,
6617 <             int basis,
6618 <             IntByIntToInt reducer) {
6619 <            super(m);
6620 <            this.transformer = transformer;
6621 <            this.basis = basis; this.reducer = reducer;
6622 <        }
6623 <        MapReduceEntriesToIntTask
6624 <            (BulkTask<K,V,?> p, int b,
6405 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6406               MapReduceEntriesToIntTask<K,V> nextRight,
6407               ObjectToInt<Map.Entry<K,V>> transformer,
6408               int basis,
6409               IntByIntToInt reducer) {
6410 <            super(p, b); this.nextRight = nextRight;
6410 >            super(m, p, b); this.nextRight = nextRight;
6411              this.transformer = transformer;
6412              this.basis = basis; this.reducer = reducer;
6413          }
# Line 6641 | Line 6422 | public class ConcurrentHashMap<K, V>
6422                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6423                      do {} while (!casPending(c = pending, c+1));
6424                      (rights = new MapReduceEntriesToIntTask<K,V>
6425 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6425 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6426                  }
6427                  int r = id;
6428                  Object v;
# Line 6680 | Line 6461 | public class ConcurrentHashMap<K, V>
6461          int result;
6462          MapReduceMappingsToIntTask<K,V> rights, nextRight;
6463          MapReduceMappingsToIntTask
6464 <            (ConcurrentHashMap<K,V> m,
6465 <             ObjectByObjectToInt<? super K, ? super V> transformer,
6685 <             int basis,
6686 <             IntByIntToInt reducer) {
6687 <            super(m);
6688 <            this.transformer = transformer;
6689 <            this.basis = basis; this.reducer = reducer;
6690 <        }
6691 <        MapReduceMappingsToIntTask
6692 <            (BulkTask<K,V,?> p, int b,
6693 <             MapReduceMappingsToIntTask<K,V> nextRight,
6464 >            (ConcurrentHashMap<K,V> m, BulkTask<K,V,?> p, int b,
6465 >             MapReduceMappingsToIntTask<K,V> rights,
6466               ObjectByObjectToInt<? super K, ? super V> transformer,
6467               int basis,
6468               IntByIntToInt reducer) {
6469 <            super(p, b); this.nextRight = nextRight;
6469 >            super(m, p, b); this.nextRight = nextRight;
6470              this.transformer = transformer;
6471              this.basis = basis; this.reducer = reducer;
6472          }
# Line 6709 | Line 6481 | public class ConcurrentHashMap<K, V>
6481                  for (int c, b = batch(); b > 1 && baseIndex != baseLimit;) {
6482                      do {} while (!casPending(c = pending, c+1));
6483                      (rights = new MapReduceMappingsToIntTask<K,V>
6484 <                     (this, b >>>= 1, rights, transformer, id, reducer)).fork();
6484 >                     (map, this, b >>>= 1, rights, transformer, id, reducer)).fork();
6485                  }
6486                  int r = id;
6487                  Object v;
# Line 6740 | Line 6512 | public class ConcurrentHashMap<K, V>
6512          public final Integer getRawResult() { return result; }
6513      }
6514  
6515 +
6516      // Unsafe mechanics
6517      private static final sun.misc.Unsafe UNSAFE;
6518      private static final long counterOffset;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines