chapter4_rtdt

package
v0.0.0-...-2ded9d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

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
}

*

栈帧

func (*Frame) LocalVars

func (self *Frame) LocalVars() LocalVars

func (*Frame) Method

func (self *Frame) Method() *heap.Method

func (*Frame) NextPC

func (self *Frame) NextPC() int

func (*Frame) OperandStack

func (self *Frame) OperandStack() *OperandStack

func (*Frame) RevertNextPC

func (self *Frame) RevertNextPC()

*

让当前线程的指令重新指向一条指令

func (*Frame) SetNextPC

func (self *Frame) SetNextPC(pc int)

func (*Frame) Thread

func (self *Frame) Thread() *Thread

type LocalVars

type LocalVars []heap.Slot

*

局部变量表,按照索引访问
存放基本类型或者引用类型
注意:我们并没有针对boolean、byte、short和char类型定义存取方法,这些类型都可以转换成int值类处理

func (LocalVars) GetDouble

func (self LocalVars) GetDouble(index uint) float64

func (LocalVars) GetFloat

func (self LocalVars) GetFloat(index uint) float32

func (LocalVars) GetInt

func (self LocalVars) GetInt(index uint) int32

func (LocalVars) GetLong

func (self LocalVars) GetLong(index uint) int64

func (LocalVars) GetRef

func (self LocalVars) GetRef(index uint) *heap.Object

func (LocalVars) GetSlot

func (self LocalVars) GetSlot(index uint) heap.Slot

func (LocalVars) GetThis

func (self LocalVars) GetThis() *heap.Object

func (LocalVars) SetDouble

func (self LocalVars) SetDouble(index uint, val float64)

DOUBLE类型可以先转成LONG,然后按照LONG变量来处理

func (LocalVars) SetFloat

func (self LocalVars) SetFloat(index uint, val float32)

先转成int,然后按照int变量来处理

func (LocalVars) SetInt

func (self LocalVars) SetInt(index uint, val int32)

func (LocalVars) SetLong

func (self LocalVars) SetLong(index uint, val int64)

LONG类型需要处理成两个int

func (LocalVars) SetRef

func (self LocalVars) SetRef(index uint, ref *heap.Object)

func (LocalVars) SetSlot

func (self LocalVars) SetSlot(index uint, slot heap.Slot)

type OperandStack

type OperandStack struct {
	// contains filtered or unexported fields
}

这也是一个栈结构,操作数栈

func (*OperandStack) Clear

func (self *OperandStack) Clear()

func (*OperandStack) GetRefFromTop

func (self *OperandStack) GetRefFromTop(n uint) *heap.Object

*

返回距离操作数栈顶n个单元格的引用变量。
n = 0 返回操作数占顶引用
n = 1 返回制定开始的第二个引用

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() heap.Slot

func (*OperandStack) PushBoolean

func (self *OperandStack) PushBoolean(val bool)

func (*OperandStack) PushDouble

func (self *OperandStack) PushDouble(val float64)

double先变成long,然后按照long处理

func (*OperandStack) PushFloat

func (self *OperandStack) PushFloat(val float32)

float

func (*OperandStack) PushInt

func (self *OperandStack) PushInt(val int32)

int操作

func (*OperandStack) PushLong

func (self *OperandStack) PushLong(val int64)

long变量入栈时,要拆成两个int。弹出时也弹两个int

func (*OperandStack) PushRef

func (self *OperandStack) PushRef(ref *heap.Object)

引用类型

func (*OperandStack) PushSlot

func (self *OperandStack) PushSlot(slot heap.Slot)

Slot

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

*

用链表来实现java虚拟机栈

func (*Stack) IsEmpty

func (self *Stack) IsEmpty() bool

type Thread

type Thread struct {
	// contains filtered or unexported fields
}

func NewThread

func NewThread() *Thread

func (*Thread) ClearStack

func (self *Thread) ClearStack()

func (*Thread) CurrentFrame

func (self *Thread) CurrentFrame() *Frame

func (*Thread) GetFrames

func (self *Thread) GetFrames() []*Frame

func (*Thread) IsStackEmpty

func (self *Thread) IsStackEmpty() bool

func (*Thread) NewFrame

func (self *Thread) NewFrame(method *heap.Method) *Frame

func (*Thread) PC

func (self *Thread) PC() int

func (*Thread) PopFrame

func (self *Thread) PopFrame() *Frame

func (*Thread) PushFrame

func (self *Thread) PushFrame(frame *Frame)

*

frame指虚拟机中线程栈的栈帧

func (*Thread) SetPC

func (self *Thread) SetPC(pc int)

func (*Thread) TopFrame

func (self *Thread) TopFrame() *Frame

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL