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

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

# Line 30 | Line 30 | class ScalarLongSort {
30              System.out.println("Usage: java ScalarLongSort 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  
36          long[] a = new long[n];
# Line 80 | Line 80 | class ScalarLongSort {
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 ScalarLongSort {
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 ScalarLongSort {
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 ScalarLongSort {
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 ScalarLongSort {
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