< prev index next >

src/hotspot/share/opto/matcher.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2234     else if (nstate == Alt_Post_Visit) {
2235       mstack.pop(); // Remove node from stack
2236       // We cannot remove the Cmp input from the Bool here, as the Bool may be
2237       // shared and all users of the Bool need to move the Cmp in parallel.
2238       // This leaves both the Bool and the If pointing at the Cmp.  To
2239       // prevent the Matcher from trying to Match the Cmp along both paths
2240       // BoolNode::match_edge always returns a zero.
2241 
2242       // We reorder the Op_If in a pre-order manner, so we can visit without
2243       // accidentally sharing the Cmp (the Bool and the If make 2 users).
2244       n->add_req( n->in(1)->in(1) ); // Add the Cmp next to the Bool
2245     }
2246     else if (nstate == Post_Visit) {
2247       mstack.pop(); // Remove node from stack
2248 
2249       // Now hack a few special opcodes
2250       switch( n->Opcode() ) {       // Handle some opcodes special
2251       case Op_StorePConditional:
2252       case Op_StoreIConditional:
2253       case Op_StoreLConditional:








2254       case Op_CompareAndExchangeB:
2255       case Op_CompareAndExchangeS:
2256       case Op_CompareAndExchangeI:
2257       case Op_CompareAndExchangeL:
2258       case Op_CompareAndExchangeP:
2259       case Op_CompareAndExchangeN:
2260       case Op_WeakCompareAndSwapB:
2261       case Op_WeakCompareAndSwapS:
2262       case Op_WeakCompareAndSwapI:
2263       case Op_WeakCompareAndSwapL:
2264       case Op_WeakCompareAndSwapP:
2265       case Op_WeakCompareAndSwapN:
2266       case Op_CompareAndSwapB:
2267       case Op_CompareAndSwapS:
2268       case Op_CompareAndSwapI:
2269       case Op_CompareAndSwapL:
2270       case Op_CompareAndSwapP:
2271       case Op_CompareAndSwapN: {   // Convert trinary to binary-tree
2272         Node *newval = n->in(MemNode::ValueIn );
2273         Node *oldval  = n->in(LoadStoreConditionalNode::ExpectedIn);


2477     if ((p->as_Proj()->_con == TypeFunc::Control) &&
2478         !C->node_arena()->contains(p)) { // Unmatched old-space only
2479       ctrl = p;
2480       break;
2481     }
2482   }
2483   assert((ctrl != NULL), "missing control projection");
2484 
2485   for (DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++) {
2486     Node *x = ctrl->fast_out(j);
2487     int xop = x->Opcode();
2488 
2489     // We don't need current barrier if we see another or a lock
2490     // before seeing volatile load.
2491     //
2492     // Op_Fastunlock previously appeared in the Op_* list below.
2493     // With the advent of 1-0 lock operations we're no longer guaranteed
2494     // that a monitor exit operation contains a serializing instruction.
2495 
2496     if (xop == Op_MemBarVolatile ||








2497         xop == Op_CompareAndExchangeB ||
2498         xop == Op_CompareAndExchangeS ||
2499         xop == Op_CompareAndExchangeI ||
2500         xop == Op_CompareAndExchangeL ||
2501         xop == Op_CompareAndExchangeP ||
2502         xop == Op_CompareAndExchangeN ||
2503         xop == Op_WeakCompareAndSwapB ||
2504         xop == Op_WeakCompareAndSwapS ||
2505         xop == Op_WeakCompareAndSwapL ||
2506         xop == Op_WeakCompareAndSwapP ||
2507         xop == Op_WeakCompareAndSwapN ||
2508         xop == Op_WeakCompareAndSwapI ||
2509         xop == Op_CompareAndSwapB ||
2510         xop == Op_CompareAndSwapS ||
2511         xop == Op_CompareAndSwapL ||
2512         xop == Op_CompareAndSwapP ||
2513         xop == Op_CompareAndSwapN ||
2514         xop == Op_CompareAndSwapI) {
2515       return true;
2516     }


   1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


2234     else if (nstate == Alt_Post_Visit) {
2235       mstack.pop(); // Remove node from stack
2236       // We cannot remove the Cmp input from the Bool here, as the Bool may be
2237       // shared and all users of the Bool need to move the Cmp in parallel.
2238       // This leaves both the Bool and the If pointing at the Cmp.  To
2239       // prevent the Matcher from trying to Match the Cmp along both paths
2240       // BoolNode::match_edge always returns a zero.
2241 
2242       // We reorder the Op_If in a pre-order manner, so we can visit without
2243       // accidentally sharing the Cmp (the Bool and the If make 2 users).
2244       n->add_req( n->in(1)->in(1) ); // Add the Cmp next to the Bool
2245     }
2246     else if (nstate == Post_Visit) {
2247       mstack.pop(); // Remove node from stack
2248 
2249       // Now hack a few special opcodes
2250       switch( n->Opcode() ) {       // Handle some opcodes special
2251       case Op_StorePConditional:
2252       case Op_StoreIConditional:
2253       case Op_StoreLConditional:
2254 #if INCLUDE_SHENANDOAHGC
2255       case Op_ShenandoahCompareAndExchangeP:
2256       case Op_ShenandoahCompareAndExchangeN:
2257       case Op_ShenandoahWeakCompareAndSwapP:
2258       case Op_ShenandoahWeakCompareAndSwapN:
2259       case Op_ShenandoahCompareAndSwapP:
2260       case Op_ShenandoahCompareAndSwapN:
2261 #endif
2262       case Op_CompareAndExchangeB:
2263       case Op_CompareAndExchangeS:
2264       case Op_CompareAndExchangeI:
2265       case Op_CompareAndExchangeL:
2266       case Op_CompareAndExchangeP:
2267       case Op_CompareAndExchangeN:
2268       case Op_WeakCompareAndSwapB:
2269       case Op_WeakCompareAndSwapS:
2270       case Op_WeakCompareAndSwapI:
2271       case Op_WeakCompareAndSwapL:
2272       case Op_WeakCompareAndSwapP:
2273       case Op_WeakCompareAndSwapN:
2274       case Op_CompareAndSwapB:
2275       case Op_CompareAndSwapS:
2276       case Op_CompareAndSwapI:
2277       case Op_CompareAndSwapL:
2278       case Op_CompareAndSwapP:
2279       case Op_CompareAndSwapN: {   // Convert trinary to binary-tree
2280         Node *newval = n->in(MemNode::ValueIn );
2281         Node *oldval  = n->in(LoadStoreConditionalNode::ExpectedIn);


2485     if ((p->as_Proj()->_con == TypeFunc::Control) &&
2486         !C->node_arena()->contains(p)) { // Unmatched old-space only
2487       ctrl = p;
2488       break;
2489     }
2490   }
2491   assert((ctrl != NULL), "missing control projection");
2492 
2493   for (DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++) {
2494     Node *x = ctrl->fast_out(j);
2495     int xop = x->Opcode();
2496 
2497     // We don't need current barrier if we see another or a lock
2498     // before seeing volatile load.
2499     //
2500     // Op_Fastunlock previously appeared in the Op_* list below.
2501     // With the advent of 1-0 lock operations we're no longer guaranteed
2502     // that a monitor exit operation contains a serializing instruction.
2503 
2504     if (xop == Op_MemBarVolatile ||
2505 #if INCLUDE_SHENANDOAHGC
2506         xop == Op_ShenandoahCompareAndExchangeP ||
2507         xop == Op_ShenandoahCompareAndExchangeN ||
2508         xop == Op_ShenandoahWeakCompareAndSwapP ||
2509         xop == Op_ShenandoahWeakCompareAndSwapN ||
2510         xop == Op_ShenandoahCompareAndSwapN ||
2511         xop == Op_ShenandoahCompareAndSwapP ||
2512 #endif
2513         xop == Op_CompareAndExchangeB ||
2514         xop == Op_CompareAndExchangeS ||
2515         xop == Op_CompareAndExchangeI ||
2516         xop == Op_CompareAndExchangeL ||
2517         xop == Op_CompareAndExchangeP ||
2518         xop == Op_CompareAndExchangeN ||
2519         xop == Op_WeakCompareAndSwapB ||
2520         xop == Op_WeakCompareAndSwapS ||
2521         xop == Op_WeakCompareAndSwapL ||
2522         xop == Op_WeakCompareAndSwapP ||
2523         xop == Op_WeakCompareAndSwapN ||
2524         xop == Op_WeakCompareAndSwapI ||
2525         xop == Op_CompareAndSwapB ||
2526         xop == Op_CompareAndSwapS ||
2527         xop == Op_CompareAndSwapL ||
2528         xop == Op_CompareAndSwapP ||
2529         xop == Op_CompareAndSwapN ||
2530         xop == Op_CompareAndSwapI) {
2531       return true;
2532     }


< prev index next >