asm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface {
	AddZeroConstant(target Variable, size int)
	AddConstant(target Variable, data []byte)
	EmitBytes(data []byte)

	GetLabel(label Label) (int, bool)
	SetLabel(label Label)
}

type Fragment

type Fragment interface {
	Emit(ctx Context) error
}

func MarkLabel

func MarkLabel(label Label) Fragment

type Group

type Group []Fragment

func (Group) Emit

func (g Group) Emit(ctx Context) error

type Immediate

type Immediate int64

type Label

type Label string

type LiteralValue

type LiteralValue struct {
	Data     []byte
	ZeroTerm bool
}

type NativeFunc added in v0.0.2

type NativeFunc interface {
	// Call executes the compiled assembly with the provided arguments.
	// Arguments are passed according to the calling convention of the target
	// architecture (System V AMD64 ABI for x86-64, AAPCS64 for ARM64).
	Call(args ...any) uintptr

	// Entry returns the entrypoint address of the compiled fragment.
	Entry() uintptr

	// Program returns a deep copy of the Program backing the compiled function.
	Program() Program
}

NativeFunc represents a compiled function that can execute natively. This interface is implemented by architecture-specific Func types.

type Program

type Program struct {
	// contains filtered or unexported fields
}

func NewProgram

func NewProgram(code []byte, relocations []int, bss int) Program

func (Program) BSSSize

func (p Program) BSSSize() int

func (Program) Bytes

func (p Program) Bytes() []byte

func (Program) Clone

func (p Program) Clone() Program

func (Program) RelocatedCopy

func (p Program) RelocatedCopy(base uintptr) []byte

func (Program) Relocations

func (p Program) Relocations() []int

type Register

type Register Variable

type Value

type Value interface {
}

func LiteralBytes

func LiteralBytes(data []byte) Value

func String

func String(s string) Value

type Variable

type Variable int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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