rtda

package
v0.0.0-...-0de04ed Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 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
}

Frame stack frame

func (*Frame) LocalVars

func (self *Frame) LocalVars() LocalVars

getters & setters

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(nextPC int)

func (*Frame) Thread

func (self *Frame) Thread() *Thread

type LocalVars

type LocalVars []Slot

LocalVars * 局部变量表(Local Variables Table)是一组变量值的存储空间,用于存放方法参数和方法内部定义的局部变量。 在Java程序被编译为Class文件时,就在方法的Code属性的max_locals数据项中确定了该方法所需分配的局部变量表的最大容量。 由于局部变量表是建立在线程堆栈中的,属于线程私有的数据,无论读写两个连续的变量槽是否为原子操作,都不会引起数据竞争和线程安全问题。

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) GetThis

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

func (LocalVars) SetDouble

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

func (LocalVars) SetFloat

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

func (LocalVars) SetInt

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

func (LocalVars) SetLong

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

func (LocalVars) SetRef

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

func (LocalVars) SetSlot

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

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 NewThread

func NewThread() *Thread

NewThread 创建线程中栈帧 的个数为1024 可以通过设置命令行参数来设置虚拟机栈的数量

func (*Thread) CurrentFrame

func (self *Thread) CurrentFrame() *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)

func (*Thread) SetPC

func (self *Thread) SetPC(pc int)

func (*Thread) TopFrame

func (self *Thread) TopFrame() *Frame

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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