vm

package
v0.0.0-...-701c767 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IABC  = iota // [  B:9  ][  C:9  ][ A:8  ][OP:6]
	IABx         // [      Bx:18     ][ A:8  ][OP:6]
	IAsBx        // [     sBx:18     ][ A:8  ][OP:6]
	IAx          // [           Ax:26        ][OP:6]
)

OpMode basic instruction format

View Source
const (
	OpArgN = iota // argument is not used
	OpArgU        // argument is used
	OpArgR        // argument is a register or a jump offset
	OpArgK        // argument is a constant or register/constant
)

OpArgMask

View Source
const (
	OP_MOVE = iota
	OP_LOADK
	OP_LOADKX
	OP_LOADBOOL
	OP_LOADNIL
	OP_GETUPVAL
	OP_GETTABUP
	OP_GETTABLE
	OP_SETTABUP
	OP_SETUPVAL
	OP_SETTABLE
	OP_NEWTABLE
	OP_SELF
	OP_ADD
	OP_SUB
	OP_MUL
	OP_MOD
	OP_POW
	OP_DIV
	OP_IDIV
	OP_BAND
	OP_BOR
	OP_BXOR
	OP_SHL
	OP_SHR
	OP_UNM
	OP_BNOT
	OP_NOT
	OP_LEN
	OP_CONCAT
	OP_JMP
	OP_EQ
	OP_LT
	OP_LE
	OP_TEST
	OP_TESTSET
	OP_CALL
	OP_TAILCALL
	OP_RETURN
	OP_FORLOOP
	OP_FORPREP
	OP_TFORCALL
	OP_TFORLOOP
	OP_SETLIST
	OP_CLOSURE
	OP_VARARG
	OP_EXTRAARG
)

OpCode

View Source
const LFIELDS_PER_FLUSH = 50

number of list items to accumulate before a SETLIST instruction

View Source
const MAXARG_Bx = 1<<18 - 1 // 262143
View Source
const MAXARG_sBx = MAXARG_Bx >> 1 // 131071

Variables

This section is empty.

Functions

func Fb2int

func Fb2int(x int) int

converts back

func Int2fb

func Int2fb(x int) int

** converts an integer to a "floating point byte", represented as ** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if ** eeeee != 0 and (xxx) otherwise.

Types

type Instruction

type Instruction uint32

func (Instruction) ABC

func (instr Instruction) ABC() (a, b, c int)

ABC 从iABC指令提取参数

func (Instruction) ABx

func (instr Instruction) ABx() (a, bx int)

ABx 从iABx指令提取参数

func (Instruction) AsBx

func (instr Instruction) AsBx() (a, sbx int)

AsBx 从iAsBx指令提取参数

func (Instruction) Ax

func (instr Instruction) Ax() int

Ax 从iAx指令提取参数

func (Instruction) BMode

func (instr Instruction) BMode() byte

func (Instruction) CMode

func (instr Instruction) CMode() byte

func (Instruction) Execute

func (instr Instruction) Execute(vm api.LuaVM)

func (Instruction) OpMode

func (instr Instruction) OpMode() byte

func (Instruction) OpName

func (instr Instruction) OpName() string

func (Instruction) Opcode

func (instr Instruction) Opcode() int

Opcode 从指令中提取操作码

Jump to

Keyboard shortcuts

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