1495 // volatile signatures and insert ldar<x> or stlr<x> are failsafe.
1496 // If we see anything other than the signature configurations we
1497 // always just translate the loads and stores to ldr<x> and str<x>
1498 // and translate acquire, release and volatile membars to the
1499 // relevant dmb instructions.
1500 //
1501
1502 // is_CAS(int opcode, bool maybe_volatile)
1503 //
1504 // return true if opcode is one of the possible CompareAndSwapX
1505 // values otherwise false.
1506
1507 bool is_CAS(int opcode, bool maybe_volatile)
1508 {
1509 switch(opcode) {
1510 // We handle these
1511 case Op_CompareAndSwapI:
1512 case Op_CompareAndSwapL:
1513 case Op_CompareAndSwapP:
1514 case Op_CompareAndSwapN:
1515 case Op_ShenandoahCompareAndSwapP:
1516 case Op_ShenandoahCompareAndSwapN:
1517 case Op_CompareAndSwapB:
1518 case Op_CompareAndSwapS:
1519 case Op_GetAndSetI:
1520 case Op_GetAndSetL:
1521 case Op_GetAndSetP:
1522 case Op_GetAndSetN:
1523 case Op_GetAndAddI:
1524 case Op_GetAndAddL:
1525 return true;
1526 case Op_CompareAndExchangeI:
1527 case Op_CompareAndExchangeN:
1528 case Op_CompareAndExchangeB:
1529 case Op_CompareAndExchangeS:
1530 case Op_CompareAndExchangeL:
1531 case Op_CompareAndExchangeP:
1532 case Op_WeakCompareAndSwapB:
1533 case Op_WeakCompareAndSwapS:
1534 case Op_WeakCompareAndSwapI:
1535 case Op_WeakCompareAndSwapL:
1536 case Op_WeakCompareAndSwapP:
1537 case Op_WeakCompareAndSwapN:
1538 case Op_ShenandoahWeakCompareAndSwapP:
1539 case Op_ShenandoahWeakCompareAndSwapN:
1540 case Op_ShenandoahCompareAndExchangeP:
1541 case Op_ShenandoahCompareAndExchangeN:
1542 return maybe_volatile;
1543 default:
1544 return false;
1545 }
1546 }
1547
1548 // helper to determine the maximum number of Phi nodes we may need to
1549 // traverse when searching from a card mark membar for the merge mem
1550 // feeding a trailing membar or vice versa
1551
1552 // predicates controlling emit of ldr<x>/ldar<x>
1553
1554 bool unnecessary_acquire(const Node *barrier)
1555 {
1556 assert(barrier->is_MemBar(), "expecting a membar");
1557
1558 MemBarNode* mb = barrier->as_MemBar();
1559
1560 if (mb->trailing_load()) {
1561 return true;
|
1495 // volatile signatures and insert ldar<x> or stlr<x> are failsafe.
1496 // If we see anything other than the signature configurations we
1497 // always just translate the loads and stores to ldr<x> and str<x>
1498 // and translate acquire, release and volatile membars to the
1499 // relevant dmb instructions.
1500 //
1501
1502 // is_CAS(int opcode, bool maybe_volatile)
1503 //
1504 // return true if opcode is one of the possible CompareAndSwapX
1505 // values otherwise false.
1506
1507 bool is_CAS(int opcode, bool maybe_volatile)
1508 {
1509 switch(opcode) {
1510 // We handle these
1511 case Op_CompareAndSwapI:
1512 case Op_CompareAndSwapL:
1513 case Op_CompareAndSwapP:
1514 case Op_CompareAndSwapN:
1515 case Op_CompareAndSwapB:
1516 case Op_CompareAndSwapS:
1517 case Op_GetAndSetI:
1518 case Op_GetAndSetL:
1519 case Op_GetAndSetP:
1520 case Op_GetAndSetN:
1521 case Op_GetAndAddI:
1522 case Op_GetAndAddL:
1523 return true;
1524 case Op_CompareAndExchangeI:
1525 case Op_CompareAndExchangeN:
1526 case Op_CompareAndExchangeB:
1527 case Op_CompareAndExchangeS:
1528 case Op_CompareAndExchangeL:
1529 case Op_CompareAndExchangeP:
1530 case Op_WeakCompareAndSwapB:
1531 case Op_WeakCompareAndSwapS:
1532 case Op_WeakCompareAndSwapI:
1533 case Op_WeakCompareAndSwapL:
1534 case Op_WeakCompareAndSwapP:
1535 case Op_WeakCompareAndSwapN:
1536 return maybe_volatile;
1537 default:
1538 return false;
1539 }
1540 }
1541
1542 // helper to determine the maximum number of Phi nodes we may need to
1543 // traverse when searching from a card mark membar for the merge mem
1544 // feeding a trailing membar or vice versa
1545
1546 // predicates controlling emit of ldr<x>/ldar<x>
1547
1548 bool unnecessary_acquire(const Node *barrier)
1549 {
1550 assert(barrier->is_MemBar(), "expecting a membar");
1551
1552 MemBarNode* mb = barrier->as_MemBar();
1553
1554 if (mb->trailing_load()) {
1555 return true;
|