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

Comparing jsr166/src/jsr166y/Phaser.java (file contents):
Revision 1.55 by dl, Mon Nov 15 12:51:54 2010 UTC vs.
Revision 1.56 by dl, Wed Nov 17 10:48:59 2010 UTC

# Line 254 | Line 254 | public class Phaser {
254      // The following unpacking methods are usually manually inlined
255  
256      private static int unarrivedOf(long s) {
257 <        return ((int) s) & UNARRIVED_MASK;
257 >        return (int)s & UNARRIVED_MASK;
258      }
259  
260      private static int partiesOf(long s) {
261 <        return (((int) s) & PARTIES_MASK) >>> PARTIES_SHIFT;
261 >        return (int)s >>> PARTIES_SHIFT;
262      }
263  
264      private static int phaseOf(long s) {
# Line 308 | Line 308 | public class Phaser {
308              int phase, unarrived;
309              if ((phase = (int)((s = state) >>> PHASE_SHIFT)) < 0)
310                  return phase;
311 <            else if ((unarrived = ((int)s) & UNARRIVED_MASK) == 0)
311 >            else if ((unarrived = (int)s & UNARRIVED_MASK) == 0)
312                  checkBadArrive(s);
313              else if (UNSAFE.compareAndSwapLong(this, stateOffset, s, s-=adj)) {
314                  if (unarrived == 1) {
# Line 364 | Line 364 | public class Phaser {
364              long s = par == null? state : reconcileState();
365              if ((phase = (int)(s >>> PHASE_SHIFT)) < 0)
366                  return phase;
367 <            if ((parties = (((int)s) & PARTIES_MASK) >>> PARTIES_SHIFT) != 0 &&
368 <                (((int)s) & UNARRIVED_MASK) == 0)
367 >            if ((parties = (int)s >>> PARTIES_SHIFT) != 0 &&
368 >                ((int)s & UNARRIVED_MASK) == 0)
369                  internalAwaitAdvance(phase, null); // wait for onAdvance
370              else if (parties + registrations > MAX_PARTIES)
371                  throw new IllegalStateException(badRegister(s));
# Line 398 | Line 398 | public class Phaser {
398                  return s;
399              long pState = par.parent == null? par.state : par.reconcileState();
400              if (state == s) {
401 <                if ((rPhase < 0 || (((int)s) & UNARRIVED_MASK) == 0) &&
401 >                if ((rPhase < 0 || ((int)s & UNARRIVED_MASK) == 0) &&
402                      ((pPhase = (int)(pState >>> PHASE_SHIFT)) < 0 ||
403                       pPhase == ((phase + 1) & MAX_PHASE)))
404                      UNSAFE.compareAndSwapLong
# Line 872 | Line 872 | public class Phaser {
872                  releaseWaiters(phase);
873                  return p;
874              }
875 <            else if ((unarrived = ((int)s) & UNARRIVED_MASK) == 0 &&
875 >            else if ((unarrived = (int)s & UNARRIVED_MASK) == 0 &&
876                       (par = current.parent) != null) {
877                  current = par;       // if all arrived, use parent
878                  par = par.parent;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines