Structure of the JVM
JVM is a stack machine.
- Each executing method has a its own stack and local variables, and references a global heap containing object instances.
- Consequently, each method can be analyzed independently, relative to a typing context
- iadd: pop the top two integer elements off the stack and push their sum.
- Local: top of stack has two int
- getfield <foo.bar>: pop the pointer reference to an object of class foo off the stack and replace it with the value of its bar field.
- Local: constant pool entry for foo field of bar
- if foo’ is on stack, does foo’ widen to foo?
- Does foo actually declare bar?