Documentation ¶
Index ¶
Constants ¶
View Source
const ( //Array Type atype AT_BOOLEAN = 4 AT_CHAR = 5 AT_FLOAT = 6 AT_DOUBLE = 7 AT_BYTE = 8 AT_SHORT = 9 AT_INT = 10 AT_LONG = 11 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ANEW_ARRAY ¶
type ANEW_ARRAY struct {
base.Index16Instruction
}
Create new array of reference 需要两个操作数,第一个操作数uint16索引来自字节码,可以从当前类的运行时常量池中找到一个类符号引用,解析这个符号引用就可以得到数组元素的类 第二个数组长度,从操作数栈弹出
func (*ANEW_ARRAY) Execute ¶
func (self *ANEW_ARRAY) Execute(frame *chapter4_rtdt.Frame)
type ARRAY_LENGTH ¶
type ARRAY_LENGTH struct {
base.NoOperandsInstruction
}
func (*ARRAY_LENGTH) Execute ¶
func (self *ARRAY_LENGTH) Execute(frame *chapter4_rtdt.Frame)
type ATHROW ¶
type ATHROW struct {
base.NoOperandsInstruction
}
type CHECK_CAST ¶
type CHECK_CAST struct {
base.Index16Instruction
}
*
跟instanceof非常像,区别: instanceof会改变操作数栈(弹出引用,推入判断结果) checkcast不改变操作数栈(如果判断失败,直接抛出ClassCastException)
func (*CHECK_CAST) Execute ¶
func (self *CHECK_CAST) Execute(frame *chapter4_rtdt.Frame)
type GET_FIELD ¶
type GET_FIELD struct {
base.Index16Instruction
}
type GET_STATIC ¶
type GET_STATIC struct {
base.Index16Instruction
}
func (*GET_STATIC) Execute ¶
func (self *GET_STATIC) Execute(frame *chapter4_rtdt.Frame)
type INSTANCE_OF ¶
type INSTANCE_OF struct {
base.Index16Instruction
}
func (*INSTANCE_OF) Execute ¶
func (self *INSTANCE_OF) Execute(frame *chapter4_rtdt.Frame)
type INVOKE_INTERFACE ¶
type INVOKE_INTERFACE struct {
// contains filtered or unexported fields
}
*
和其他三条invoke指令不同,invokeinterface后面跟着 4 字节操作符 不是2个字节 前两个字节的含义和其他invoke一样,是个运行时常量池的索引 第三个字节的给方法传递参数需要的slot数 含义和Method结构体的argSlotCount一样 第四个字节是给oracle的java虚拟机实现的,值必须是0
func (*INVOKE_INTERFACE) Execute ¶
func (self *INVOKE_INTERFACE) Execute(frame *chapter4_rtdt.Frame)
func (*INVOKE_INTERFACE) FetchOperands ¶
func (self *INVOKE_INTERFACE) FetchOperands(reader *base.BytecodeReader)
type INVOKE_SPECIAL ¶
type INVOKE_SPECIAL struct {
base.Index16Instruction
}
func (*INVOKE_SPECIAL) Execute ¶
func (self *INVOKE_SPECIAL) Execute(frame *chapter4_rtdt.Frame)
type INVOKE_STATIC ¶
type INVOKE_STATIC struct {
base.Index16Instruction
}
func (*INVOKE_STATIC) Execute ¶
func (self *INVOKE_STATIC) Execute(frame *chapter4_rtdt.Frame)
type INVOKE_VIRTUAL ¶
type INVOKE_VIRTUAL struct {
base.Index16Instruction
}
func (*INVOKE_VIRTUAL) Execute ¶
func (self *INVOKE_VIRTUAL) Execute(frame *chapter4_rtdt.Frame)
*
frame.Method()指的是当前的方法,要执行的方法应该用 toBeInvoked := heap.LookupMethodInClass(ref.Class(), methodRef.Name(), methodRef.Descriptor()) 来获取。 举个例子: void A() { B(); } 这时候frame.Method()返回的是A,要执行B,这里会调用invokeVirtual指令 这时候要根据invokeVirtual的index找到运行时常量池中的methodRef 然后再执行,即heap.LookupMethodInClass(ref.Class(), methodRef.Name(), methodRef.Descriptor())会返回B
*
type MULTI_ANEW_ARRAY ¶
type MULTI_ANEW_ARRAY struct {
// contains filtered or unexported fields
}
func (*MULTI_ANEW_ARRAY) Execute ¶
func (self *MULTI_ANEW_ARRAY) Execute(frame *chapter4_rtdt.Frame)
func (*MULTI_ANEW_ARRAY) FetchOperands ¶
func (self *MULTI_ANEW_ARRAY) FetchOperands(reader *base.BytecodeReader)
type NEW ¶
type NEW struct {
base.Index16Instruction
}
*
操作的是一个uint16的索引,来自字节码。通过这个索引,可以从当前类的运行时常量池中找到一个类符号引用。 解析这个类符号引用,拿到类数据 然后创建对象,并把对象引用推入栈顶
type NEW_ARRAY ¶
type NEW_ARRAY struct {
// contains filtered or unexported fields
}
Create new array
func (*NEW_ARRAY) FetchOperands ¶
func (self *NEW_ARRAY) FetchOperands(reader *base.BytecodeReader)
type PUT_FIELD ¶
type PUT_FIELD struct {
base.Index16Instruction
}
*
需要三个操作数。 前两个操作数是常量池索引和变量值,用法和putstatic一样。 第三个操作数是对象的应用,从操作数中弹出。
type PUT_STATIC ¶
type PUT_STATIC struct {
base.Index16Instruction
}
func (*PUT_STATIC) Execute ¶
func (self *PUT_STATIC) Execute(frame *chapter4_rtdt.Frame)
Click to show internal directories.
Click to hide internal directories.