vm

package
v0.0.0-...-40ef3ae Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 2 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

31 22 13 5 0

+-------+^------+-^-----+-^-----
|b=9bits |c=9bits |a=8bits|op=6|
+-------+^------+-^-----+-^-----
|    bx=18bits    |a=8bits|op=6|
+-------+^------+-^-----+-^-----
|   sbx=18bits    |a=8bits|op=6|
+-------+^------+-^-----+-^-----
|    ax=26bits            |op=6|
+-------+^------+-^-----+-^-----

31 23 15 7 0

func (Instruction) ABC

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

func (Instruction) ABx

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

func (Instruction) AsBx

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

func (Instruction) Ax

func (self Instruction) Ax() int

func (Instruction) BMode

func (self Instruction) BMode() byte

func (Instruction) CMode

func (self Instruction) CMode() byte

func (Instruction) Execute

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

func (Instruction) OpMode

func (self Instruction) OpMode() byte

func (Instruction) OpName

func (self Instruction) OpName() string

func (Instruction) Opcode

func (self Instruction) Opcode() int

Jump to

Keyboard shortcuts

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