opcode

package
v0.0.0-...-47fdfb9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OP_RETURN        uint8 = iota
	OP_RETURN_BLOCK        // return from block, return to caller's caller
	OP_RETURN_RESCUE       // pop the frame, but don't reset the stack
	OP_DUP                 // duplicate value on the top of the stack (shallow)
	OP_NEGATE
	OP_ADD
	OP_SUB
	OP_MUL
	OP_DIV
	OP_PUSH
	OP_POP
	OP_NOT
	OP_CALL_BLOCK // block on the top, params below
	OP_CALL       // 8 bit arity. The stack looks like this
	/*
		STACK_TOP: method_name
				   arg_n
				   ...
				   arg_0
				   caller
	*/
	OP_DOT_CALL      // same as above, but without global method fallback
	OP_OPTIONAL_CALL // dot call, but if caller is nil, return nil
	OP_METHOD        // the method name is on stack top. Class is the caller
	OP_STATIC_METHOD // same as above, but define to static method
	OP_GLOBAL_METHOD // same as OP_METHOD
	OP_CLASS         /*
		STACK_TOP: class
				   caller
	*/
	OP_LOAD_CONST
	OP_LOAD_CONST_U16
	OP_INT_8
	OP_INT_16
	OP_INT_32
	OP_INT_64
	OP_DOUBLE // next 64 bits as value
	OP_LOAD_STRING_8
	OP_LOAD_STRING_16
	OP_LOAD_STRING_32
	OP_LOAD_CLASS_CONST // Runtime class constants
	OP_SET_CLASS_CONST
	OP_SET_LOCAL
	OP_GET_LOCAL
	OP_GET_UPVALUE
	OP_SET_UPVALUE
	OP_CLOSURE
	OP_SET_GLOBAL
	OP_GET_GLOBAL
	OP_GET_IVAR // STACK_TOP: name
	OP_SET_IVAR
	// STACK_TOP: name
	//			  value
	OP_JUMP_IF_FALSE
	OP_JUMP_IF_TRUE
	OP_BRANCH_IF_FALSE
	OP_JUMP
	OP_LOOP
	OP_NIL
	OP_FALSE
	OP_TRUE
	OP_EQUAL
	OP_GREATER_EQUAL
	OP_LESSER_EQUAL
	OP_BUILD_ARRAY   // followed by 8 bit element count
	OP_SUBSCRIPT     // key on top of the stack, followed by object
	OP_SUBSCRIPT_SET // val on top of the stack, followed by key and object
	OP_BUILD_HASH    // followed by 8 bit pair count
	OP_RAISE         // raise with arg
	OP_SIMPLE_RAISE  // raise without arg
	OP_INHERIT
	OP_CHECK_CLASS
	OP_REQUIRE_RELATIVE
	OP_NOP // keep this at end
)

Variables

This section is empty.

Functions

func PrintChunk

func PrintChunk(chunk *value.Chunk, internedString []string, indent int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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