vm

package
v0.0.0-...-5105380 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: MIT Imports: 1 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MaxArgBX  = 1<<18 - 1
	MaxArgSBX = MaxArgBX >> 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgMask

type ArgMask uint8

Masks for instruction arguments.

const (
	ArgN ArgMask = iota // argument is not used
	ArgU                // argument is used
	ArgR                // argument is a register or a jump offset
	ArgK                // argument is a constant or register/constant
)

type Code

type Code uint8
const (
	MOVE Code = iota
	LOADK
	LOADKX
	LOADBOOL
	LOADNIL
	GETUPVAL
	GETTABUP
	GETTABLE
	SETTABUP
	SETUPVAL
	SETTABLE
	NEWTABLE
	SELF
	ADD
	SUB
	MUL
	MOD
	POW
	DIV
	IDIV
	BAND
	BOR
	BXOR
	SHL
	SHR
	UNM
	BNOT
	NOT
	LEN
	CONCAT
	JMP
	EQ
	LT
	LE
	TEST
	TESTSET
	CALL
	TAILCALL
	RETURN
	FORLOOP
	FORPREP
	TFORCALL
	TFORLOOP
	SETLIST
	CLOSURE
	VARARG
	EXTRAARG
)

func (Code) Mask

func (op Code) Mask() Mask

func (Code) Mode

func (op Code) Mode() Mode

func (Code) String

func (op Code) String() string

type Instr

type Instr uint32

func (Instr) A

func (instr Instr) A() (a int)

func (Instr) ABC

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

func (Instr) AX

func (instr Instr) AX() (ax int)

func (Instr) B

func (instr Instr) B() (b int)

func (Instr) BX

func (instr Instr) BX() (bx int)

func (Instr) C

func (instr Instr) C() (c int)

func (Instr) Code

func (instr Instr) Code() Code

func (Instr) SBX

func (instr Instr) SBX() (sbx int)

func (Instr) String

func (instr Instr) String() string

type Mask

type Mask uint8

ArgMask represents masks for instruction properties.

The format is: bits 0-1: op mode bits 2-3: C arg mode bits 4-5: B arg mode bit 6: instruction set register A bit 7: operator is a test (next instruction must be a jump)

func (Mask) B

func (mask Mask) B(barg ArgMask) bool

func (Mask) C

func (mask Mask) C(carg ArgMask) bool

func (Mask) Mode

func (mask Mask) Mode() Mode

func (Mask) SetA

func (mask Mask) SetA() bool

func (Mask) Test

func (mask Mask) Test() bool

type Mode

type Mode uint8
const (
	ModeABC Mode = iota
	ModeABx
	ModeAsBx
	ModeAx
)

func (Mode) String

func (mode Mode) String() string

type OpArgMask

type OpArgMask uint8

Masks for instruction properties. The format is: bits 0-1: op mode bits 2-3: C arg mode bits 4-5: B arg mode

bit 6: instruction set register A
bit 7: operator is a test (next instruction must be a jump)
const (
	OpArgN OpArgMask = 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
)

Jump to

Keyboard shortcuts

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