diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-07 19:51:10 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-07 19:51:10 +0000 |
commit | 395b124c1571b138b05cf889d37624dcc15f2d16 (patch) | |
tree | 4d4a23c0d21e6793017d163858877b7bbd8ac772 /libjava/java/lang | |
parent | 941b4534a35bd3edbf078cb38f253b4e79ee00a1 (diff) | |
download | gcc-395b124c1571b138b05cf889d37624dcc15f2d16.tar.gz |
* java/lang/VMCompiler.java (md5Digest): New field.
(compileClass): Clone md5Digest instead of looking up a new one.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96039 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang')
-rw-r--r-- | libjava/java/lang/VMCompiler.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/libjava/java/lang/VMCompiler.java b/libjava/java/lang/VMCompiler.java index b3f55603487..784a816c59c 100644 --- a/libjava/java/lang/VMCompiler.java +++ b/libjava/java/lang/VMCompiler.java @@ -79,6 +79,24 @@ final class VMCompiler private static Vector precompiledMapFiles; + // We create a single MD5 engine and then clone it whenever we want + // a new one. This is simpler than trying to find a new one each + // time, and it avoids potential deadlocks due to class loader + // oddities. + private static final MessageDigest md5Digest; + + static + { + try + { + md5Digest = MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException _) + { + md5Digest = null; + } + } + static { gcjJitCompiler = System.getProperty("gnu.gcj.jit.compiler"); @@ -175,11 +193,18 @@ final class VMCompiler try { - MessageDigest md = MessageDigest.getInstance("MD5"); + MessageDigest md = (MessageDigest) md5Digest.clone(); digest = md.digest(data); } - catch (NoSuchAlgorithmException _) + catch (CloneNotSupportedException _) + { + // Can't happen. + return null; + } + catch (NullPointerException _) { + // If md5Digest==null -- but really this should never happen + // either, since the MD5 digest is in libgcj. return null; } |