src/java.base/share/classes/sun/security/provider/SHA2.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8076112 Cdiff src/java.base/share/classes/sun/security/provider/SHA2.java

src/java.base/share/classes/sun/security/provider/SHA2.java

Print this page
rev 12262 : 8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
Summary: Annotate possibly intrinsified methods with @HotSpotIntrinsicCandidate. Add checks omitted by intrinsics to the library code. Add CheckIntrinsics flags to check consistency of intrinsics.
Reviewed-by: jrose, kvn, thartmann, vlivanov, abuckley, darcy, ascarpino, briangoetz, alanb, aph, dnsimon

*** 23,32 **** --- 23,35 ---- * questions. */ package sun.security.provider; + import java.util.Objects; + + import jdk.internal.HotSpotIntrinsicCandidate; import static sun.security.provider.ByteArrayAccess.*; /** * This class implements the Secure Hash Algorithm SHA-256 developed by * the National Institute of Standards and Technology along with the
*** 184,195 **** --- 187,217 ---- /** * Process the current block to update the state variable state. */ void implCompress(byte[] buf, int ofs) { + 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 to the method. + @HotSpotIntrinsicCandidate + private void implCompress0(byte[] buf, int ofs) { // The first 16 ints are from the byte stream, compute the rest of // the W[]'s for (int t = 16; t < ITERATION; t++) { W[t] = lf_delta1(W[t-2]) + W[t-7] + lf_delta0(W[t-15]) + W[t-16];
src/java.base/share/classes/sun/security/provider/SHA2.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File