src/share/vm/opto/matcher.cpp

changeset 6457
94c202aa2646
parent 6443
f4f6ae481e1a
parent 5437
fcf521c3fbc6
child 6462
e2722a66aba7
     1.1 --- a/src/share/vm/opto/matcher.cpp	Fri Jul 26 10:12:15 2013 +0200
     1.2 +++ b/src/share/vm/opto/matcher.cpp	Thu Aug 01 17:25:10 2013 -0700
     1.3 @@ -2308,26 +2308,26 @@
     1.4  // atomic instruction acting as a store_load barrier without any
     1.5  // intervening volatile load, and thus we don't need a barrier here.
     1.6  // We retain the Node to act as a compiler ordering barrier.
     1.7 -bool Matcher::post_store_load_barrier(const Node *vmb) {
     1.8 -  Compile *C = Compile::current();
     1.9 -  assert( vmb->is_MemBar(), "" );
    1.10 -  assert( vmb->Opcode() != Op_MemBarAcquire, "" );
    1.11 -  const MemBarNode *mem = (const MemBarNode*)vmb;
    1.12 +bool Matcher::post_store_load_barrier(const Node* vmb) {
    1.13 +  Compile* C = Compile::current();
    1.14 +  assert(vmb->is_MemBar(), "");
    1.15 +  assert(vmb->Opcode() != Op_MemBarAcquire, "");
    1.16 +  const MemBarNode* membar = vmb->as_MemBar();
    1.17  
    1.18 -  // Get the Proj node, ctrl, that can be used to iterate forward
    1.19 -  Node *ctrl = NULL;
    1.20 -  DUIterator_Fast imax, i = mem->fast_outs(imax);
    1.21 -  while( true ) {
    1.22 -    ctrl = mem->fast_out(i);            // Throw out-of-bounds if proj not found
    1.23 -    assert( ctrl->is_Proj(), "only projections here" );
    1.24 -    ProjNode *proj = (ProjNode*)ctrl;
    1.25 -    if( proj->_con == TypeFunc::Control &&
    1.26 -        !C->node_arena()->contains(ctrl) ) // Unmatched old-space only
    1.27 +  // Get the Ideal Proj node, ctrl, that can be used to iterate forward
    1.28 +  Node* ctrl = NULL;
    1.29 +  for (DUIterator_Fast imax, i = membar->fast_outs(imax); i < imax; i++) {
    1.30 +    Node* p = membar->fast_out(i);
    1.31 +    assert(p->is_Proj(), "only projections here");
    1.32 +    if ((p->as_Proj()->_con == TypeFunc::Control) &&
    1.33 +        !C->node_arena()->contains(p)) { // Unmatched old-space only
    1.34 +      ctrl = p;
    1.35        break;
    1.36 -    i++;
    1.37 +    }
    1.38    }
    1.39 +  assert((ctrl != NULL), "missing control projection");
    1.40  
    1.41 -  for( DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++ ) {
    1.42 +  for (DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++) {
    1.43      Node *x = ctrl->fast_out(j);
    1.44      int xop = x->Opcode();
    1.45  
    1.46 @@ -2339,37 +2339,36 @@
    1.47      // that a monitor exit operation contains a serializing instruction.
    1.48  
    1.49      if (xop == Op_MemBarVolatile ||
    1.50 -        xop == Op_FastLock ||
    1.51          xop == Op_CompareAndSwapL ||
    1.52          xop == Op_CompareAndSwapP ||
    1.53          xop == Op_CompareAndSwapN ||
    1.54 -        xop == Op_CompareAndSwapI)
    1.55 +        xop == Op_CompareAndSwapI) {
    1.56        return true;
    1.57 +    }
    1.58 +
    1.59 +    // Op_FastLock previously appeared in the Op_* list above.
    1.60 +    // With biased locking we're no longer guaranteed that a monitor
    1.61 +    // enter operation contains a serializing instruction.
    1.62 +    if ((xop == Op_FastLock) && !UseBiasedLocking) {
    1.63 +      return true;
    1.64 +    }
    1.65  
    1.66      if (x->is_MemBar()) {
    1.67        // We must retain this membar if there is an upcoming volatile
    1.68 -      // load, which will be preceded by acquire membar.
    1.69 -      if (xop == Op_MemBarAcquire)
    1.70 +      // load, which will be followed by acquire membar.
    1.71 +      if (xop == Op_MemBarAcquire) {
    1.72          return false;
    1.73 -      // For other kinds of barriers, check by pretending we
    1.74 -      // are them, and seeing if we can be removed.
    1.75 -      else
    1.76 -        return post_store_load_barrier((const MemBarNode*)x);
    1.77 +      } else {
    1.78 +        // For other kinds of barriers, check by pretending we
    1.79 +        // are them, and seeing if we can be removed.
    1.80 +        return post_store_load_barrier(x->as_MemBar());
    1.81 +      }
    1.82      }
    1.83  
    1.84 -    // Delicate code to detect case of an upcoming fastlock block
    1.85 -    if( x->is_If() && x->req() > 1 &&
    1.86 -        !C->node_arena()->contains(x) ) { // Unmatched old-space only
    1.87 -      Node *iff = x;
    1.88 -      Node *bol = iff->in(1);
    1.89 -      // The iff might be some random subclass of If or bol might be Con-Top
    1.90 -      if (!bol->is_Bool())  return false;
    1.91 -      assert( bol->req() > 1, "" );
    1.92 -      return (bol->in(1)->Opcode() == Op_FastUnlock);
    1.93 +    // probably not necessary to check for these
    1.94 +    if (x->is_Call() || x->is_SafePoint() || x->is_block_proj()) {
    1.95 +      return false;
    1.96      }
    1.97 -    // probably not necessary to check for these
    1.98 -    if (x->is_Call() || x->is_SafePoint() || x->is_block_proj())
    1.99 -      return false;
   1.100    }
   1.101    return false;
   1.102  }

mercurial