--- old/src/hotspot/share/opto/library_call.cpp 2018-10-31 14:22:38.848955728 +0100 +++ new/src/hotspot/share/opto/library_call.cpp 2018-10-31 14:22:38.724955826 +0100 @@ -308,6 +308,8 @@ Node* get_state_from_sha5_object(Node *sha_object); Node* inline_digestBase_implCompressMB_predicate(int predicate); bool inline_encodeISOArray(); + bool inline_setBit(); + bool inline_clrBit(); bool inline_updateCRC32(); bool inline_updateBytesCRC32(); bool inline_updateByteBufferCRC32(); @@ -841,6 +843,11 @@ case vmIntrinsics::_encodeByteISOArray: return inline_encodeISOArray(); + case vmIntrinsics::_setBit: + return inline_setBit(); + case vmIntrinsics::_clrBit: + return inline_clrBit(); + case vmIntrinsics::_updateCRC32: return inline_updateCRC32(); case vmIntrinsics::_updateBytesCRC32: @@ -5382,6 +5389,39 @@ return true; } +bool LibraryCallKit::inline_setBit() { + Node* bits = argument(0); // type: oop + Node* index = argument(1); // type: int + + Node* hi = _gvn.transform(new RShiftINode(index, intcon(3))); + Node* bit = array_element_address(bits, hi, T_BYTE); + + Node* lo = _gvn.transform(new AndINode(index, intcon(7))); + Node* value = _gvn.transform(new LShiftINode(intcon(1), lo)); + + store_to_memory(control(), bit, value, T_BYTE, TypeAryPtr::BYTES, MemNode::unordered, + false, false, false, 1); + + return true; +} + +bool LibraryCallKit::inline_clrBit() { + Node* bits = argument(0); // type: oop + Node* index = argument(1); // type: int + + Node* hi = _gvn.transform(new RShiftINode(index, intcon(3))); + Node* bit = array_element_address(bits, hi, T_BYTE); + + Node* lo = _gvn.transform(new AndINode(index, intcon(7))); + Node* value = _gvn.transform(new LShiftINode(intcon(1), lo)); + value = _gvn.transform(new XorINode(value, intcon(-1))); + + store_to_memory(control(), bit, value, T_BYTE, TypeAryPtr::BYTES, MemNode::unordered, + false, false, false, 0); + + return true; +} + /** * Calculate CRC32 for byte[] array. * int java.util.zip.CRC32.updateBytes(int crc, byte[] buf, int off, int len)