ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/BoxedLongSort.java
(Generate patch)

Comparing jsr166/src/test/loops/BoxedLongSort.java (file contents):
Revision 1.1 by dl, Sun Sep 19 12:55:36 2010 UTC vs.
Revision 1.2 by jsr166, Mon Sep 20 20:42:37 2010 UTC

# Line 30 | Line 30 | class BoxedLongSort {
30              System.out.println("Usage: java BoxedLongSort threads n reps");
31              return;
32          }
33 <        ForkJoinPool pool = procs == 0? new ForkJoinPool() :
33 >        ForkJoinPool pool = procs == 0? new ForkJoinPool() :
34              new ForkJoinPool(procs);
35 <        
35 >
36          Long[] a = new Long[n];
37          seqRandomFill(a, 0, n);
38  
# Line 80 | Line 80 | class BoxedLongSort {
80      }
81  
82      static final class Sorter extends RecursiveAction {
83 <        final Long[] a;
83 >        final Long[] a;
84          final Long[] w;
85 <        final int origin;
85 >        final int origin;
86          final int n;
87          Sorter(Long[] a, Long[] w, int origin, int n) {
88              this.a = a; this.w = w; this.origin = origin; this.n = n;
# Line 111 | Line 111 | class BoxedLongSort {
111              }
112          }
113      }
114 <    
114 >
115      static final class SubSorter extends RecursiveAction {
116          final Sorter left;
117          final Sorter right;
# Line 145 | Line 145 | class BoxedLongSort {
145           * and finding index of right closest to split point.
146           * Uses left-spine decomposition to generate all
147           * merge tasks before bottomming out at base case.
148 <         *
148 >         *
149           */
150          public final void compute() {
151              Merger rights = null;
# Line 169 | Line 169 | class BoxedLongSort {
169                  nleft = lh;
170                  nright = rh;
171              }
172 <            
172 >
173              merge(nleft, nright);
174 <            if (rights != null)
174 >            if (rights != null)
175                  collectRights(rights);
176 <            
176 >
177          }
178  
179          final void merge(int nleft, int nright) {
# Line 210 | Line 210 | class BoxedLongSort {
210          int n = a.length;
211          for (int i = 0; i < n - 1; i++) {
212              if (a[i] > a[i+1]) {
213 <                throw new Error("Unsorted at " + i + ": " +
213 >                throw new Error("Unsorted at " + i + ": " +
214                                  a[i] + " / " + a[i+1]);
215              }
216          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines