Check the validity of a .class file

Keith McGuigan Keith.McGuigan at Sun.COM
Fri Nov 21 05:52:55 PST 2008


Christian Thalinger wrote:
> On Thu, 2008-11-20 at 17:14 -0500, Keith McGuigan wrote:
>> Well, verification in the JVM occurs as part of the loading, so the 
>> bytecode actually is statically examined.  It doesn't have to run, the 
>> verifier is kicked off at link time, not run time.  This means you 
> 
> Really?  HotSpot verifies all methods during link time not during
> compile time (well, first interpreter invocation)?

Yeah, pretty much.

Hotspot (and all other spec-compliant JVMs) verify the entire class at 
link time, which is usually the point just before when the static 
initializers execute.   Check sections like 2.17.3 in the JVM spec to 
get the exact details of when this happens and what causes it.

All methods of a class are checked, even those that might not be 
executed for a while (as per the spec).  So a verification error in any 
method will prevent any methods in that class from running.

Most class format errors not related to the bytecode will be picked up 
at classfile parse time, of course, which occurs when the class is loaded.

--
- Keith



More information about the hotspot-dev mailing list