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 *
2237 else if (nstate == Alt_Post_Visit) {
2238 mstack.pop(); // Remove node from stack
2239 // We cannot remove the Cmp input from the Bool here, as the Bool may be
2240 // shared and all users of the Bool need to move the Cmp in parallel.
2241 // This leaves both the Bool and the If pointing at the Cmp. To
2242 // prevent the Matcher from trying to Match the Cmp along both paths
2243 // BoolNode::match_edge always returns a zero.
2244
2245 // We reorder the Op_If in a pre-order manner, so we can visit without
2246 // accidentally sharing the Cmp (the Bool and the If make 2 users).
2247 n->add_req( n->in(1)->in(1) ); // Add the Cmp next to the Bool
2248 }
2249 else if (nstate == Post_Visit) {
2250 mstack.pop(); // Remove node from stack
2251
2252 // Now hack a few special opcodes
2253 switch( n->Opcode() ) { // Handle some opcodes special
2254 case Op_StorePConditional:
2255 case Op_StoreIConditional:
2256 case Op_StoreLConditional:
2257 case Op_CompareAndExchangeB:
2258 case Op_CompareAndExchangeS:
2259 case Op_CompareAndExchangeI:
2260 case Op_CompareAndExchangeL:
2261 case Op_CompareAndExchangeP:
2262 case Op_CompareAndExchangeN:
2263 case Op_WeakCompareAndSwapB:
2264 case Op_WeakCompareAndSwapS:
2265 case Op_WeakCompareAndSwapI:
2266 case Op_WeakCompareAndSwapL:
2267 case Op_WeakCompareAndSwapP:
2268 case Op_WeakCompareAndSwapN:
2269 case Op_CompareAndSwapB:
2270 case Op_CompareAndSwapS:
2271 case Op_CompareAndSwapI:
2272 case Op_CompareAndSwapL:
2273 case Op_CompareAndSwapP:
2274 case Op_CompareAndSwapN: { // Convert trinary to binary-tree
2275 Node *newval = n->in(MemNode::ValueIn );
2276 Node *oldval = n->in(LoadStoreConditionalNode::ExpectedIn);
2480 if ((p->as_Proj()->_con == TypeFunc::Control) &&
2481 !C->node_arena()->contains(p)) { // Unmatched old-space only
2482 ctrl = p;
2483 break;
2484 }
2485 }
2486 assert((ctrl != NULL), "missing control projection");
2487
2488 for (DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++) {
2489 Node *x = ctrl->fast_out(j);
2490 int xop = x->Opcode();
2491
2492 // We don't need current barrier if we see another or a lock
2493 // before seeing volatile load.
2494 //
2495 // Op_Fastunlock previously appeared in the Op_* list below.
2496 // With the advent of 1-0 lock operations we're no longer guaranteed
2497 // that a monitor exit operation contains a serializing instruction.
2498
2499 if (xop == Op_MemBarVolatile ||
2500 xop == Op_CompareAndExchangeB ||
2501 xop == Op_CompareAndExchangeS ||
2502 xop == Op_CompareAndExchangeI ||
2503 xop == Op_CompareAndExchangeL ||
2504 xop == Op_CompareAndExchangeP ||
2505 xop == Op_CompareAndExchangeN ||
2506 xop == Op_WeakCompareAndSwapB ||
2507 xop == Op_WeakCompareAndSwapS ||
2508 xop == Op_WeakCompareAndSwapL ||
2509 xop == Op_WeakCompareAndSwapP ||
2510 xop == Op_WeakCompareAndSwapN ||
2511 xop == Op_WeakCompareAndSwapI ||
2512 xop == Op_CompareAndSwapB ||
2513 xop == Op_CompareAndSwapS ||
2514 xop == Op_CompareAndSwapL ||
2515 xop == Op_CompareAndSwapP ||
2516 xop == Op_CompareAndSwapN ||
2517 xop == Op_CompareAndSwapI) {
2518 return true;
2519 }
|
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 *
2237 else if (nstate == Alt_Post_Visit) {
2238 mstack.pop(); // Remove node from stack
2239 // We cannot remove the Cmp input from the Bool here, as the Bool may be
2240 // shared and all users of the Bool need to move the Cmp in parallel.
2241 // This leaves both the Bool and the If pointing at the Cmp. To
2242 // prevent the Matcher from trying to Match the Cmp along both paths
2243 // BoolNode::match_edge always returns a zero.
2244
2245 // We reorder the Op_If in a pre-order manner, so we can visit without
2246 // accidentally sharing the Cmp (the Bool and the If make 2 users).
2247 n->add_req( n->in(1)->in(1) ); // Add the Cmp next to the Bool
2248 }
2249 else if (nstate == Post_Visit) {
2250 mstack.pop(); // Remove node from stack
2251
2252 // Now hack a few special opcodes
2253 switch( n->Opcode() ) { // Handle some opcodes special
2254 case Op_StorePConditional:
2255 case Op_StoreIConditional:
2256 case Op_StoreLConditional:
2257 #if INCLUDE_SHENANDOAHGC
2258 case Op_ShenandoahCompareAndExchangeP:
2259 case Op_ShenandoahCompareAndExchangeN:
2260 case Op_ShenandoahWeakCompareAndSwapP:
2261 case Op_ShenandoahWeakCompareAndSwapN:
2262 case Op_ShenandoahCompareAndSwapP:
2263 case Op_ShenandoahCompareAndSwapN:
2264 #endif
2265 case Op_CompareAndExchangeB:
2266 case Op_CompareAndExchangeS:
2267 case Op_CompareAndExchangeI:
2268 case Op_CompareAndExchangeL:
2269 case Op_CompareAndExchangeP:
2270 case Op_CompareAndExchangeN:
2271 case Op_WeakCompareAndSwapB:
2272 case Op_WeakCompareAndSwapS:
2273 case Op_WeakCompareAndSwapI:
2274 case Op_WeakCompareAndSwapL:
2275 case Op_WeakCompareAndSwapP:
2276 case Op_WeakCompareAndSwapN:
2277 case Op_CompareAndSwapB:
2278 case Op_CompareAndSwapS:
2279 case Op_CompareAndSwapI:
2280 case Op_CompareAndSwapL:
2281 case Op_CompareAndSwapP:
2282 case Op_CompareAndSwapN: { // Convert trinary to binary-tree
2283 Node *newval = n->in(MemNode::ValueIn );
2284 Node *oldval = n->in(LoadStoreConditionalNode::ExpectedIn);
2488 if ((p->as_Proj()->_con == TypeFunc::Control) &&
2489 !C->node_arena()->contains(p)) { // Unmatched old-space only
2490 ctrl = p;
2491 break;
2492 }
2493 }
2494 assert((ctrl != NULL), "missing control projection");
2495
2496 for (DUIterator_Fast jmax, j = ctrl->fast_outs(jmax); j < jmax; j++) {
2497 Node *x = ctrl->fast_out(j);
2498 int xop = x->Opcode();
2499
2500 // We don't need current barrier if we see another or a lock
2501 // before seeing volatile load.
2502 //
2503 // Op_Fastunlock previously appeared in the Op_* list below.
2504 // With the advent of 1-0 lock operations we're no longer guaranteed
2505 // that a monitor exit operation contains a serializing instruction.
2506
2507 if (xop == Op_MemBarVolatile ||
2508 #if INCLUDE_SHENANDOAHGC
2509 xop == Op_ShenandoahCompareAndExchangeP ||
2510 xop == Op_ShenandoahCompareAndExchangeN ||
2511 xop == Op_ShenandoahWeakCompareAndSwapP ||
2512 xop == Op_ShenandoahWeakCompareAndSwapN ||
2513 xop == Op_ShenandoahCompareAndSwapN ||
2514 xop == Op_ShenandoahCompareAndSwapP ||
2515 #endif
2516 xop == Op_CompareAndExchangeB ||
2517 xop == Op_CompareAndExchangeS ||
2518 xop == Op_CompareAndExchangeI ||
2519 xop == Op_CompareAndExchangeL ||
2520 xop == Op_CompareAndExchangeP ||
2521 xop == Op_CompareAndExchangeN ||
2522 xop == Op_WeakCompareAndSwapB ||
2523 xop == Op_WeakCompareAndSwapS ||
2524 xop == Op_WeakCompareAndSwapL ||
2525 xop == Op_WeakCompareAndSwapP ||
2526 xop == Op_WeakCompareAndSwapN ||
2527 xop == Op_WeakCompareAndSwapI ||
2528 xop == Op_CompareAndSwapB ||
2529 xop == Op_CompareAndSwapS ||
2530 xop == Op_CompareAndSwapL ||
2531 xop == Op_CompareAndSwapP ||
2532 xop == Op_CompareAndSwapN ||
2533 xop == Op_CompareAndSwapI) {
2534 return true;
2535 }
|