Documentation ¶
Index ¶
- type Frame
- type LocalVars
- func (self LocalVars) GetDouble(index uint) float64
- func (self LocalVars) GetFloat(index uint) float32
- func (self LocalVars) GetInt(index uint) int32
- func (self LocalVars) GetLong(index uint) int64
- func (self LocalVars) GetRef(index uint) *heap.Object
- func (self LocalVars) GetThis() *heap.Object
- func (self LocalVars) SetDouble(index uint, val float64)
- func (self LocalVars) SetFloat(index uint, val float32)
- func (self LocalVars) SetInt(index uint, val int32)
- func (self LocalVars) SetLong(index uint, val int64)
- func (self LocalVars) SetRef(index uint, ref *heap.Object)
- func (self LocalVars) SetSlot(index uint, slot Slot)
- type OperandStack
- func (self *OperandStack) GetRefFromTop(n uint) *heap.Object
- func (self *OperandStack) PopBoolean() bool
- func (self *OperandStack) PopDouble() float64
- func (self *OperandStack) PopFloat() float32
- func (self *OperandStack) PopInt() int32
- func (self *OperandStack) PopLong() int64
- func (self *OperandStack) PopRef() *heap.Object
- func (self *OperandStack) PopSlot() Slot
- func (self *OperandStack) PushBoolean(val bool)
- func (self *OperandStack) PushDouble(val float64)
- func (self *OperandStack) PushFloat(val float32)
- func (self *OperandStack) PushInt(val int32)
- func (self *OperandStack) PushLong(val int64)
- func (self *OperandStack) PushRef(ref *heap.Object)
- func (self *OperandStack) PushSlot(slot Slot)
- type Slot
- type Stack
- type Thread
- func (self *Thread) CurrentFrame() *Frame
- func (self *Thread) IsStackEmpty() bool
- func (self *Thread) NewFrame(method *heap.Method) *Frame
- func (self *Thread) PC() int
- func (self *Thread) PopFrame() *Frame
- func (self *Thread) PushFrame(frame *Frame)
- func (self *Thread) SetPC(pc int)
- func (self *Thread) TopFrame() *Frame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame stack frame
func (*Frame) OperandStack ¶
func (self *Frame) OperandStack() *OperandStack
func (*Frame) RevertNextPC ¶
func (self *Frame) RevertNextPC()
type LocalVars ¶
type LocalVars []Slot
LocalVars * 局部变量表(Local Variables Table)是一组变量值的存储空间,用于存放方法参数和方法内部定义的局部变量。 在Java程序被编译为Class文件时,就在方法的Code属性的max_locals数据项中确定了该方法所需分配的局部变量表的最大容量。 由于局部变量表是建立在线程堆栈中的,属于线程私有的数据,无论读写两个连续的变量槽是否为原子操作,都不会引起数据竞争和线程安全问题。
type OperandStack ¶
type OperandStack struct {
// contains filtered or unexported fields
}
OperandStack 对操作数栈的定义 * 由于编译器在编译Java程序时已经将操作数栈的最大容量记录在class文件的Code属性中。 所以直接利用Slot数组进行操作数栈的模拟。
size 栈顶指针(指向栈顶元素的下一个位置) slots Slot数组,存放具体的操作数
func (*OperandStack) GetRefFromTop ¶
func (self *OperandStack) GetRefFromTop(n uint) *heap.Object
func (*OperandStack) PopBoolean ¶
func (self *OperandStack) PopBoolean() bool
func (*OperandStack) PopDouble ¶
func (self *OperandStack) PopDouble() float64
func (*OperandStack) PopFloat ¶
func (self *OperandStack) PopFloat() float32
func (*OperandStack) PopInt ¶
func (self *OperandStack) PopInt() int32
func (*OperandStack) PopLong ¶
func (self *OperandStack) PopLong() int64
func (*OperandStack) PopRef ¶
func (self *OperandStack) PopRef() *heap.Object
func (*OperandStack) PopSlot ¶
func (self *OperandStack) PopSlot() Slot
func (*OperandStack) PushBoolean ¶
func (self *OperandStack) PushBoolean(val bool)
func (*OperandStack) PushDouble ¶
func (self *OperandStack) PushDouble(val float64)
func (*OperandStack) PushFloat ¶
func (self *OperandStack) PushFloat(val float32)
func (*OperandStack) PushInt ¶
func (self *OperandStack) PushInt(val int32)
func (*OperandStack) PushLong ¶
func (self *OperandStack) PushLong(val int64)
func (*OperandStack) PushRef ¶
func (self *OperandStack) PushRef(ref *heap.Object)
func (*OperandStack) PushSlot ¶
func (self *OperandStack) PushSlot(slot Slot)
type Slot ¶
type Slot struct {
// contains filtered or unexported fields
}
Slot 对数据结构槽的定义 *
num 存放基本数据类型 ref 存放引用数据类型
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
Stack 对Java虚拟机栈的定义 *
Java虚拟机栈应该包括三个元素:
maxSize 栈的最大容量 size 栈当前的容量 _top 栈帧
type Thread ¶
type Thread struct {
// contains filtered or unexported fields
}
Thread 对线程级的封装 Java虚拟机运行时数据区域可以分为线程私有与多线程共享 线程私有包括:程序计数器,Java虚拟机栈 * 该结构体包括两个变量: pc : 程序计数器 stack : 虚拟机栈
func (*Thread) CurrentFrame ¶
func (*Thread) IsStackEmpty ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.