--- old/src/java.base/share/classes/sun/security/provider/SHA.java 2015-06-26 17:30:27.361117309 +0200 +++ new/src/java.base/share/classes/sun/security/provider/SHA.java 2015-06-26 17:30:26.605117288 +0200 @@ -25,7 +25,10 @@ package sun.security.provider; +import java.util.Objects; + import static sun.security.provider.ByteArrayAccess.*; +import jdk.internal.HotSpotIntrinsicCandidate; /** * This class implements the Secure Hash Algorithm (SHA) developed by @@ -114,8 +117,27 @@ * "old" NIST Secure Hash Algorithm. */ void implCompress(byte[] buf, int ofs) { - b2iBig64(buf, ofs, W); + implCompressCheck(buf, ofs); + implCompress0(buf, ofs); + } + + private void implCompressCheck(byte[] buf, int ofs) { + Objects.requireNonNull(buf); + + // The checks performed by the method 'b2iBig64' + // are sufficient for the case when the method + // 'implCompressImpl' is replaced with a compiler + // intrinsic. + b2iBig64(buf, ofs, W); + } + // The method 'implCompressImpl seems not to use its parameters. + // The method can, however, be replaced with a compiler intrinsic + // that operates directly on the array 'buf' (starting from + // offset 'ofs') and not on array 'W', therefore 'buf' and 'ofs' + // must be passed as parameter the method. + @HotSpotIntrinsicCandidate + private void implCompress0(byte[] buf, int ofs) { // The first 16 ints have the byte stream, compute the rest of // the buffer for (int t = 16; t <= 79; t++) {