<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
There are a number of class loading optimizations (including HotSpot's
Class Data Sharing) that are hard to make generic due to the lack of a
standard way to validate cached class state. We have a unique
opportunity to fix this in 277...<br>
<br>
I propose that we add: <br>
<br>
1. An annotation to record a digest over the module's contents, which
would then be visible from ModuleInfo.<br>
2. A convenience api to return the digest, e.g.:<br>
<blockquote>public interface ModuleContent {<br>
...<br>
public byte[] getDigest();<br>
}<br>
</blockquote>
<br>
The jam tool would compute and add the annotation, and the default
implementation(s) of ModuleContent would then just return the value
from the annotation.<br>
<br>
Other implementations would be free to compute the value at install
time (or even runtime); development environments could "generate" a
value using a simple counter. <br>
<br>
Unlike the version number, this value can be used to ensure that any
change to the module's contents can be detected. Both HotSpot and other
JVMs can then introduce optimizations like Class Data Sharing that
depend on being able to validate the cache file.<br>
<br>
<br>
It may similarly be useful to have ModuleInfo be able to (lazily)
compute a digest for itself, and/or have a digest on ModuleDefinition
that encompasses both the metadata (ModuleInfo) and the contents.<br>
<br>
// Bryan<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>