opcodes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package opcodes defines plain data shapes for identifying an operation and its operands.

It performs no encoding and no execution and defines no domain-specific operations. Domain semantics belong to packages built on top: opruntime dispatches an Op to a Go function, and a domain package (such as a future ownership bytecode adapter) declares what each Op means.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instruction

type Instruction struct {
	Op      Op
	A, B, C uint32
}

Instruction pairs an Op with three generic operand slots. The meaning of A, B, and C is defined entirely by whatever opruntime.Handler is registered for Op, not by this package.

type Op

type Op uint8

Op identifies an operation. The zero value, OpNop, is always a safe no-op. Every other value is defined by the domain package that uses it.

const OpNop Op = 0

OpNop is the only predefined Op. It is the zero value of Op.

func (Op) String

func (o Op) String() string

String returns "nop" for OpNop and "Op(N)" for any other value, since this package does not know the names domain packages give their own operations.

Example
package main

import (
	"fmt"

	"github.com/apsis-io/velocity/opcodes"
)

func main() {
	const opIncrement opcodes.Op = 1

	fmt.Println(opcodes.OpNop)
	fmt.Println(opIncrement)
}
Output:
nop
Op(1)

Jump to

Keyboard shortcuts

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