提交 0cf9f37b 编写于 作者: K kvn

8035974: Refactor DigestBase.engineUpdate() method for better code generation by JIT compiler

Summary: Move the lopp from DigestBase.engineUpdate() to new private method implCompressMultiBlock() which can be intrinsified.
Reviewed-by: psandoz, ascarpino, forax
Contributed-by: james.cheng@oracle.com
上级 bca1f8be
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -122,10 +122,10 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable { ...@@ -122,10 +122,10 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
} }
} }
// compress complete blocks // compress complete blocks
while (len >= blockSize) { if (len >= blockSize) {
implCompress(b, ofs); int limit = ofs + len;
len -= blockSize; ofs = implCompressMultiBlock(b, ofs, limit - blockSize);
ofs += blockSize; len = limit - ofs;
} }
// copy remainder to buffer // copy remainder to buffer
if (len > 0) { if (len > 0) {
...@@ -134,6 +134,14 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable { ...@@ -134,6 +134,14 @@ abstract class DigestBase extends MessageDigestSpi implements Cloneable {
} }
} }
// compress complete blocks
private int implCompressMultiBlock(byte[] b, int ofs, int limit) {
for (; ofs <= limit; ofs += blockSize) {
implCompress(b, ofs);
}
return ofs;
}
// reset this object. See JCA doc. // reset this object. See JCA doc.
protected final void engineReset() { protected final void engineReset() {
if (bytesProcessed == 0) { if (bytesProcessed == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册