base

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Branch

func Branch(frame *rtda.Frame, offset int)

指令跳转

func InitClass added in v1.8.0

func InitClass(thread *rtda.Thread, class *heap.Class)

初始化类

func InvokeMethod added in v1.7.0

func InvokeMethod(invokerFrame *rtda.Frame, method *heap.Method)

方法调用指令 对于静态方法,方法参数就是声明的几个参数 对于事例方法,处理声明的参数,还有一个编译器添加的参数this

Types

type BranchInstruction

type BranchInstruction struct {
	Offset int
}

分支指令结构体 一般用于if else,for等条件语句中

func (*BranchInstruction) FetchOperands

func (self *BranchInstruction) FetchOperands(reader *BytecodeReader)

type BytecodeReader

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

字节码阅读器

func (*BytecodeReader) PC

func (self *BytecodeReader) PC() int

func (*BytecodeReader) ReadInt16

func (self *BytecodeReader) ReadInt16() int16

func (*BytecodeReader) ReadInt32

func (self *BytecodeReader) ReadInt32() int32

func (*BytecodeReader) ReadInt32s

func (self *BytecodeReader) ReadInt32s(n int32) []int32

func (*BytecodeReader) ReadInt8

func (self *BytecodeReader) ReadInt8() int8

int8 signed 8-bit integers,range:-128 through 127

func (*BytecodeReader) ReadUint16

func (self *BytecodeReader) ReadUint16() uint16

func (*BytecodeReader) ReadUint8

func (self *BytecodeReader) ReadUint8() uint8

uint unsigned 8-bit integers,range:0 through 255

func (*BytecodeReader) Reset

func (self *BytecodeReader) Reset(code []byte, pc int)

重新赋值

func (*BytecodeReader) SkipPadding

func (self *BytecodeReader) SkipPadding()

type Index16Instruction

type Index16Instruction struct {
	Index uint
}

16位长度的指令

func (*Index16Instruction) FetchOperands

func (self *Index16Instruction) FetchOperands(reader *BytecodeReader)

type Index8Instruction

type Index8Instruction struct {
	Index uint
}

func (*Index8Instruction) FetchOperands

func (self *Index8Instruction) FetchOperands(reader *BytecodeReader)

根据索引获取局部变量表

type Instruction

type Instruction interface {
	// 从字节码中提取操作数
	FetchOperands(reader *BytecodeReader)
	// 操作指令
	Execute(frame *rtda.Frame)
}

指令接口,指令主要两个功能: 1 从字节码中获取操作数 2 执行操作指令

type NoOperandsInstruction

type NoOperandsInstruction struct{}

无操作指令 结构体 提供给其他相同没有操作的指令结构体调用

func (*NoOperandsInstruction) FetchOperands

func (self *NoOperandsInstruction) FetchOperands(reader *BytecodeReader)

Jump to

Keyboard shortcuts

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