其实正常来说,应该是每个字节码指令都有一个栈状态的,但是为了节省空间,在实际生成的字节码中,只有在进行了跳转时(比如GOTO IFLT等指令时)才保存了栈的状态,其他帧的状态都可以通过它们算出来,而且一个方法的初始帧状态是不保存的,因为初始的状态可以通过方法中的签名算出来.而且为了进一步减少空间,又对栈映射帧进行一些类型的划分,因为有可能两个栈映射帧的状态是一样,或者说有一些类似,接下来我就介绍一下,具体有哪些类型.打开org.objectweb.asm.Opcodes类的源码,我们可以看到如下定义:
代码
/**
* Represents a compressed frame with complete frame data.
*/
int F_FULL = 0;
/**
* Represents a compressed frame where locals are the same as the locals in
* the previous frame, except that additional 1-3 locals are defined, and
* with an empty stack.
*/
int F_APPEND = 1;
/**
* Represents a compressed frame where locals are the same as the locals in
* the previous frame, except that the last 1-3 locals are absent and with
* an empty stack.
*/
int F_CHOP = 2;
/**
* Represents a compressed frame with exactly the same locals as the
* previous frame and with an empty stack.
*/
int F_SAME = 3;
/**
* Represents a compressed frame with exactly the same locals as the
* previous frame and with a single value on the stack.
*/
int F_SAME1 = 4;
它已经对每个状态做出解释了,我这里就不说了,要理解这里的话不难,只要你对java字节码指令执行以及栈结构了解就行