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

Comparing jsr166/src/jsr166e/ConcurrentHashMapV8.java (file contents):
Revision 1.79 by dl, Fri Nov 23 17:50:51 2012 UTC vs.
Revision 1.81 by dl, Sat Dec 8 14:10:38 2012 UTC

# Line 867 | Line 867 | public class ConcurrentHashMapV8<K, V>
867                      if (c != (pc = pk.getClass()) ||
868                          !(k instanceof Comparable) ||
869                          (dir = ((Comparable)k).compareTo((Comparable)pk)) == 0) {
870 <                        dir = (c == pc) ? 0 : c.getName().compareTo(pc.getName());
871 <                        TreeNode r = null, s = null, pl, pr;
872 <                        if (dir >= 0) {
873 <                            if ((pl = p.left) != null && h <= pl.hash)
874 <                                s = pl;
870 >                        if ((dir = (c == pc) ? 0 :
871 >                             c.getName().compareTo(pc.getName())) == 0) {
872 >                            TreeNode r = null, pl, pr; // check both sides
873 >                            if ((pr = p.right) != null && h >= pr.hash &&
874 >                                (r = getTreeNode(h, k, pr)) != null)
875 >                                return r;
876 >                            else if ((pl = p.left) != null && h <= pl.hash)
877 >                                dir = -1;
878 >                            else // nothing there
879 >                                return null;
880                          }
876                        else if ((pr = p.right) != null && h >= pr.hash)
877                            s = pr;
878                        if (s != null && (r = getTreeNode(h, k, s)) != null)
879                            return r;
881                      }
882                  }
883                  else
# Line 931 | Line 932 | public class ConcurrentHashMapV8<K, V>
932                      if (c != (pc = pk.getClass()) ||
933                          !(k instanceof Comparable) ||
934                          (dir = ((Comparable)k).compareTo((Comparable)pk)) == 0) {
935 <                        dir = (c == pc) ? 0 : c.getName().compareTo(pc.getName());
936 <                        TreeNode r = null, s = null, pl, pr;
937 <                        if (dir >= 0) {
938 <                            if ((pl = p.left) != null && h <= pl.hash)
939 <                                s = pl;
935 >                        TreeNode s = null, r = null, pr;
936 >                        if ((dir = (c == pc) ? 0 :
937 >                             c.getName().compareTo(pc.getName())) == 0) {
938 >                            if ((pr = p.right) != null && h >= pr.hash &&
939 >                                (r = getTreeNode(h, k, pr)) != null)
940 >                                return r;
941 >                            else // continue left
942 >                                dir = -1;
943                          }
944                          else if ((pr = p.right) != null && h >= pr.hash)
945                              s = pr;
# Line 2523 | Line 2527 | public class ConcurrentHashMapV8<K, V>
2527                      b = (n <= 0L) ? 0 : (n < (long)sp) ? (int)n : sp;
2528                  }
2529              }
2530 <            b = (b <= 1 || baseIndex == baseLimit)? 0 : (b >>> 1);
2530 >            b = (b <= 1 || baseIndex == baseLimit) ? 0 : (b >>> 1);
2531              if ((batch = b) > 0)
2532                  addToPendingCount(1);
2533              return b;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines