VM state
The VM state is a numeric field stored in J9VMThread->omrVMThread->vmState
that uses 32-bits to encode the current state of the thread. See the J9VMSTATE_
defined constants in the code. For example, if the thread is currently JIT compiling a method, the VM state indicates which compilation phase the compiler is in. If the VM crashes for any reason, the VM state is reported via standard error and in the javacore dump (in which it is referred to as "VM flags"), and serves as a first-order indicator of the failing component during problem determination.
Decoding
The high order half of the 32-bit VM state indicates the component.
Value | Component |
---|---|
0x0000 | none |
0x0001 | interpreter |
0x0002 | garbage collector |
0x0003 | stack growth |
0x0004 | JNI code |
0x0005 | JIT compilation |
0x0006 | bytecode verifier |
0x0007 | runtime verifier |
0x0008 | shared class cache |
0x0011 | sniff-n-whack stack validator |
The VM includes a -Xjit:vmstate=
command line option to decode a VM state, see the following example. Note the "0x" and the three leading zeros are required.
JIT compiler
If the current active component is the JIT compiler, the low-order half is divided into two bytes, one of which is 0xFF.
In the low-order half, if the lower byte is 0xFF, the current active component is the optimizer, and the higher byte is the numeric identifier of the current optimization (defined in an enum), e.g. 0x000501FF means that the inliner is active.
If the higher byte is 0xFF, the current active component is the code generator, and the lower byte is the numeric identifier of the current code generation phase (defined in an enum), e.g. 0x0005FF05 means that instruction selection is being performed.
If the entire low-order half of the VM state is 0xFFFF, then the active component is likely to be in the compiler initialization or the IL generator.
Finding the VM state examples
The VM state is shown as vmState=0x0002001a
in the following GC crash message.
In a javacore dump search for the HFLAGS
to find the VM state.