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.5 by jsr166, Sat Sep 19 18:36:55 2015 UTC vs.
Revision 1.13 by jsr166, Thu Oct 10 16:58:35 2019 UTC

# Line 74 | Line 74 | class ArrayPrefixHelpers {
74      static final int MIN_PARTITION = 16;
75  
76      static final class CumulateTask<T> extends CountedCompleter<Void> {
77 +        @SuppressWarnings("serial") // Not statically typed as Serializable
78          final T[] array;
79 +        @SuppressWarnings("serial") // Not statically typed as Serializable
80          final BinaryOperator<T> function;
81          CumulateTask<T> left, right;
82 <        T in, out;
82 >        @SuppressWarnings("serial") // Not statically typed as Serializable
83 >        T in;
84 >        @SuppressWarnings("serial") // Not statically typed as Serializable
85 >        T out;
86          final int lo, hi, origin, fence, threshold;
87  
88 +        /** Root task constructor */
89 +        public CumulateTask(CumulateTask<T> parent,
90 +                            BinaryOperator<T> function,
91 +                            T[] array, int lo, int hi) {
92 +            super(parent);
93 +            this.function = function; this.array = array;
94 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
95 +            int p;
96 +            this.threshold =
97 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
98 +                <= MIN_PARTITION ? MIN_PARTITION : p;
99 +        }
100 +
101 +        /** Subtask constructor */
102          CumulateTask(CumulateTask<T> parent, BinaryOperator<T> function,
103                       T[] array, int origin, int fence, int threshold,
104                       int lo, int hi) {
# Line 104 | Line 123 | class ArrayPrefixHelpers {
123                          int mid = (l + h) >>> 1;
124                          f = rt = t.right =
125                              new CumulateTask<T>(t, fn, a, org, fnc, th, mid, h);
126 <                        t = lt = t.left  =
126 >                        t = lt = t.left =
127                              new CumulateTask<T>(t, fn, a, org, fnc, th, l, mid);
128                      }
129                      else {                           // possibly refork
# Line 208 | Line 227 | class ArrayPrefixHelpers {
227                  }
228              }
229          }
230 +        // OPENJDK @java.io.Serial
231          private static final long serialVersionUID = 5293554502939613543L;
232      }
233  
234      static final class LongCumulateTask extends CountedCompleter<Void> {
235          final long[] array;
236 +        @SuppressWarnings("serial") // Not statically typed as Serializable
237          final LongBinaryOperator function;
238          LongCumulateTask left, right;
239          long in, out;
240          final int lo, hi, origin, fence, threshold;
241  
242 +        /** Root task constructor */
243 +        public LongCumulateTask(LongCumulateTask parent,
244 +                                LongBinaryOperator function,
245 +                                long[] array, int lo, int hi) {
246 +            super(parent);
247 +            this.function = function; this.array = array;
248 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
249 +            int p;
250 +            this.threshold =
251 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
252 +                <= MIN_PARTITION ? MIN_PARTITION : p;
253 +        }
254 +
255 +        /** Subtask constructor */
256          LongCumulateTask(LongCumulateTask parent, LongBinaryOperator function,
257                           long[] array, int origin, int fence, int threshold,
258                           int lo, int hi) {
# Line 242 | Line 277 | class ArrayPrefixHelpers {
277                          int mid = (l + h) >>> 1;
278                          f = rt = t.right =
279                              new LongCumulateTask(t, fn, a, org, fnc, th, mid, h);
280 <                        t = lt = t.left  =
280 >                        t = lt = t.left =
281                              new LongCumulateTask(t, fn, a, org, fnc, th, l, mid);
282                      }
283                      else {                           // possibly refork
# Line 344 | Line 379 | class ArrayPrefixHelpers {
379                  }
380              }
381          }
382 +        // OPENJDK @java.io.Serial
383          private static final long serialVersionUID = -5074099945909284273L;
384      }
385  
386      static final class DoubleCumulateTask extends CountedCompleter<Void> {
387          final double[] array;
388 +        @SuppressWarnings("serial") // Not statically typed as Serializable
389          final DoubleBinaryOperator function;
390          DoubleCumulateTask left, right;
391          double in, out;
392          final int lo, hi, origin, fence, threshold;
393  
394 +        /** Root task constructor */
395 +        public DoubleCumulateTask(DoubleCumulateTask parent,
396 +                                  DoubleBinaryOperator function,
397 +                                  double[] array, int lo, int hi) {
398 +            super(parent);
399 +            this.function = function; this.array = array;
400 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
401 +            int p;
402 +            this.threshold =
403 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
404 +                <= MIN_PARTITION ? MIN_PARTITION : p;
405 +        }
406 +
407 +        /** Subtask constructor */
408          DoubleCumulateTask(DoubleCumulateTask parent, DoubleBinaryOperator function,
409                             double[] array, int origin, int fence, int threshold,
410                             int lo, int hi) {
# Line 378 | Line 429 | class ArrayPrefixHelpers {
429                          int mid = (l + h) >>> 1;
430                          f = rt = t.right =
431                              new DoubleCumulateTask(t, fn, a, org, fnc, th, mid, h);
432 <                        t = lt = t.left  =
432 >                        t = lt = t.left =
433                              new DoubleCumulateTask(t, fn, a, org, fnc, th, l, mid);
434                      }
435                      else {                           // possibly refork
# Line 480 | Line 531 | class ArrayPrefixHelpers {
531                  }
532              }
533          }
534 +        // OPENJDK @java.io.Serial
535          private static final long serialVersionUID = -586947823794232033L;
536      }
537  
538      static final class IntCumulateTask extends CountedCompleter<Void> {
539          final int[] array;
540 +        @SuppressWarnings("serial") // Not statically typed as Serializable
541          final IntBinaryOperator function;
542          IntCumulateTask left, right;
543          int in, out;
544          final int lo, hi, origin, fence, threshold;
545  
546 +        /** Root task constructor */
547 +        public IntCumulateTask(IntCumulateTask parent,
548 +                               IntBinaryOperator function,
549 +                               int[] array, int lo, int hi) {
550 +            super(parent);
551 +            this.function = function; this.array = array;
552 +            this.lo = this.origin = lo; this.hi = this.fence = hi;
553 +            int p;
554 +            this.threshold =
555 +                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
556 +                <= MIN_PARTITION ? MIN_PARTITION : p;
557 +        }
558 +
559 +        /** Subtask constructor */
560          IntCumulateTask(IntCumulateTask parent, IntBinaryOperator function,
561                          int[] array, int origin, int fence, int threshold,
562                          int lo, int hi) {
# Line 514 | Line 581 | class ArrayPrefixHelpers {
581                          int mid = (l + h) >>> 1;
582                          f = rt = t.right =
583                              new IntCumulateTask(t, fn, a, org, fnc, th, mid, h);
584 <                        t = lt = t.left  =
584 >                        t = lt = t.left =
585                              new IntCumulateTask(t, fn, a, org, fnc, th, l, mid);
586                      }
587                      else {                           // possibly refork
# Line 616 | Line 683 | class ArrayPrefixHelpers {
683                  }
684              }
685          }
686 +        // OPENJDK @java.io.Serial
687          private static final long serialVersionUID = 3731755594596840961L;
688      }
621
689   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines