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

Comparing jsr166/src/main/java/util/ArrayPrefixHelpers.java (file contents):
Revision 1.8 by jsr166, Sun Sep 20 17:29:14 2015 UTC vs.
Revision 1.9 by jsr166, Sun Sep 20 17:42:24 2015 UTC

# Line 7 | Line 7
7   package java.util;
8  
9   import java.util.concurrent.CountedCompleter;
10 + import java.util.concurrent.ForkJoinPool;
11   import java.util.function.BinaryOperator;
12   import java.util.function.DoubleBinaryOperator;
13   import java.util.function.IntBinaryOperator;
# Line 79 | Line 80 | class ArrayPrefixHelpers {
80          T in, out;
81          final int lo, hi, origin, fence, threshold;
82  
83 +        /** Root task constructor */
84 +        public CumulateTask(CumulateTask<T> parent,
85 +                            BinaryOperator<T> function,
86 +                            T[] array, int lo, int hi) {
87 +            super(parent);
88 +            this.function = function; this.array = array;
89 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
90 +            int p;
91 +            this.threshold =
92 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
93 +                <= MIN_PARTITION ? MIN_PARTITION : p;
94 +        }
95 +
96 +        /** Subtask constructor */
97          CumulateTask(CumulateTask<T> parent, BinaryOperator<T> function,
98                       T[] array, int origin, int fence, int threshold,
99                       int lo, int hi) {
# Line 217 | Line 232 | class ArrayPrefixHelpers {
232          long in, out;
233          final int lo, hi, origin, fence, threshold;
234  
235 +        /** Root task constructor */
236 +        public LongCumulateTask(LongCumulateTask parent,
237 +                                LongBinaryOperator function,
238 +                                long[] array, int lo, int hi) {
239 +            super(parent);
240 +            this.function = function; this.array = array;
241 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
242 +            int p;
243 +            this.threshold =
244 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
245 +                <= MIN_PARTITION ? MIN_PARTITION : p;
246 +        }
247 +
248 +        /** Subtask constructor */
249          LongCumulateTask(LongCumulateTask parent, LongBinaryOperator function,
250                           long[] array, int origin, int fence, int threshold,
251                           int lo, int hi) {
# Line 353 | Line 382 | class ArrayPrefixHelpers {
382          double in, out;
383          final int lo, hi, origin, fence, threshold;
384  
385 +        /** Root task constructor */
386 +        public DoubleCumulateTask(DoubleCumulateTask parent,
387 +                                  DoubleBinaryOperator function,
388 +                                  double[] array, int lo, int hi) {
389 +            super(parent);
390 +            this.function = function; this.array = array;
391 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
392 +            int p;
393 +            this.threshold =
394 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
395 +                <= MIN_PARTITION ? MIN_PARTITION : p;
396 +        }
397 +
398 +        /** Subtask constructor */
399          DoubleCumulateTask(DoubleCumulateTask parent, DoubleBinaryOperator function,
400                             double[] array, int origin, int fence, int threshold,
401                             int lo, int hi) {
# Line 489 | Line 532 | class ArrayPrefixHelpers {
532          int in, out;
533          final int lo, hi, origin, fence, threshold;
534  
535 +        /** Root task constructor */
536 +        public IntCumulateTask(IntCumulateTask parent,
537 +                               IntBinaryOperator function,
538 +                               int[] array, int lo, int hi) {
539 +            super(parent);
540 +            this.function = function; this.array = array;
541 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
542 +            int p;
543 +            this.threshold =
544 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
545 +                <= MIN_PARTITION ? MIN_PARTITION : p;
546 +        }
547 +
548 +        /** Subtask constructor */
549          IntCumulateTask(IntCumulateTask parent, IntBinaryOperator function,
550                          int[] array, int origin, int fence, int threshold,
551                          int lo, int hi) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines