-
Enhancement
-
Resolution: Fixed
-
P4
-
9
-
None
-
b15
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8063790 | 8u45 | Vladimir Kozlov | P4 | Resolved | Fixed | b01 |
JDK-8054924 | 8u40 | Vladimir Kozlov | P4 | Resolved | Fixed | b02 |
JDK-8070244 | emb-8u47 | Vladimir Kozlov | P4 | Resolved | Fixed | team |
JDK-8227906 | openjdk7u | Andrew Hughes | P4 | Resolved | Fixed | master |
needed to pull a loop out of DigestBase.engineUpdate(byte[] b, int ofs, int len)
and make it a new method, implCompressMultiBlock(byte[] b, int ofs, int n),
which doesn't throw any exceptions so can be intrinsified.
It is believed that the compiler should inline this new method, so no
performance regression with the pure Java SUN provider is expected.
Here is the proposed change:
diff -r 43386cc9a017 src/share/classes/sun/security/provider/DigestBase.java
--- a/src/share/classes/sun/security/provider/DigestBase.java Thu Feb 06 17:35:19 2014 -0800
+++ b/src/share/classes/sun/security/provider/DigestBase.java Wed Feb 12 19:34:25 2014 -0800
@@ -122,11 +122,13 @@
}
}
// compress complete blocks
- while (len >= blockSize) {
- implCompress(b, ofs);
- len -= blockSize;
- ofs += blockSize;
+ if (len >= blockSize) {
+ int n = len/blockSize;
+ implCompressMultiBlock(b, ofs, n);
+ len -= n*blockSize;
+ ofs += n*blockSize;
}
+
// copy remainder to buffer
if (len > 0) {
System.arraycopy(b, ofs, buffer, 0, len);
@@ -134,6 +136,14 @@
}
}
+ // compress complete blocks
+ protected final void implCompressMultiBlock(byte[] b, int ofs, int n) {
+ for (int i = 0; i < n; i++) {
+ implCompress(b, ofs);
+ ofs += blockSize;
+ }
+ }
+
// reset this object. See JCA doc.
protected final void engineReset() {
if (bytesProcessed == 0) {
- backported by
-
JDK-8054924 Refactor DigestBase.engineUpdate() method for better code generation by JIT compiler
- Resolved
-
JDK-8063790 Refactor DigestBase.engineUpdate() method for better code generation by JIT compiler
- Resolved
-
JDK-8070244 Refactor DigestBase.engineUpdate() method for better code generation by JIT compiler
- Resolved
-
JDK-8227906 Refactor DigestBase.engineUpdate() method for better code generation by JIT compiler
- Resolved
- relates to
-
JDK-8046261 JEP 207: Leverage CPU Instructions to Improve SHA Performance on SPARC
- Closed
-
JDK-8035968 C2 support for SHA on SPARC
- Closed