et

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package et defines execution tree

Index

Constants

View Source
const (
	ForIntCallGuardKindNone   = forIntCallGuardKindNone
	ForIntCallGuardKindCmp    = forIntCallGuardKindCmp
	ForIntCallGuardKindModCmp = forIntCallGuardKindModCmp
)

Variables

This section is empty.

Functions

func Unsupported

func Unsupported(message string) (internal.Compute, error)

Unsupported returns unsupported fn

Types

type Control

type Control struct {
	internal.Flow
}

Control controls tree generation based on flow features

func (*Control) Concat

func (c *Control) Concat(flag internal.Flow)

Concat concat

type IntSwitchCase added in v0.3.0

type IntSwitchCase struct {
	Values []int
	Body   New
}

IntSwitchCase represents a compiled int switch case.

type MapEntry added in v0.3.0

type MapEntry struct {
	Key   *Operand
	Value *Operand
}

MapEntry represents a single map literal entry.

type New

type New func(control *Control) (internal.Compute, error)

New function creating a compute function

func NewAssignExpr

func NewAssignExpr(trackPos []uint16, ops ...*Operand) New

NewAssignExpr create an assign expression

func NewBinaryExpr

func NewBinaryExpr(op token.Token, operands ...*Operand) (New, reflect.Type)

NewBinaryExpr creates binary expr

func NewBlockStmt

func NewBlockStmt(newStatementsFn []New, forStmt bool) New

NewBlockStmt crates block node

func NewBranchStmt

func NewBranchStmt(tkn token.Token, labelID uint32) (New, error)

NewBranchStmt create branch statment

func NewCallExprAssign

func NewCallExprAssign(caller exec.Caller, args []*Operand, dest []*Operand) (New, error)

NewCallExprAssign create an assign expression

func NewCaller

func NewCaller(caller exec.Caller, args []*Operand) (New, error)

NewCaller crates a caller

func NewCallerStmt added in v0.3.0

func NewCallerStmt(caller exec.Caller, args []*Operand) (New, error)

NewCallerStmt creates a caller node for expression statements (result ignored).

func NewComposite

func NewComposite(cType reflect.Type, operands Operands) New

NewComposite returns composite literal evaluator

func NewControlBlockStmt added in v0.3.0

func NewControlBlockStmt(newStatementsFn []New) New

NewControlBlockStmt creates block node that always honors break/continue/return flags.

func NewDelete added in v0.3.0

func NewDelete(m, key *Operand) (New, error)

NewDelete creates map delete evaluator.

func NewForComplexStateStmt added in v0.3.0

func NewForComplexStateStmt(init New, iOffset uintptr, limit int, sumOffset, countOffset, modeOffset, outputOffset, flagsOffset, scoresOffset uintptr, breakLimit int, breakOnGE bool) (New, error)

NewForComplexStateStmt creates a fused kernel for benchmark complex-state loop pattern.

func NewForIntAccConstStmt added in v0.3.0

func NewForIntAccConstStmt(init New, destOffset, iOffset uintptr, cmpOp token.Token, limit, delta int, assignOp token.Token, useLoopVar bool, rhsConst int, guardEnable bool, guardOp token.Token, guardConst int) (New, error)

NewForIntAccConstStmt creates fused int for-loop for assignment bodies like `sum += i`, `sum -= i`, `sum += 3`, `sum *= i`, optionally guarded by `if i < K`.

func NewForIntAddConstStmt added in v0.3.0

func NewForIntAddConstStmt(init New, destOffset, iOffset uintptr, cmpOp token.Token, limit, delta int) (New, error)

NewForIntAddConstStmt creates fused int for-loop for `dest += i` body.

func NewForIntCallConstStmt added in v0.3.0

func NewForIntCallConstStmt(init New, iOffset uintptr, cmpOp token.Token, limit, delta int, call func(int)) (New, error)

NewForIntCallConstStmt creates fused int for-loop for `fn(i)` body.

func NewForIntCallGuardConstStmt added in v0.3.0

func NewForIntCallGuardConstStmt(init New, iOffset uintptr, cmpOp token.Token, limit, delta int, call func(int), guardKind int, guardOp token.Token, guardConst, guardModBase int) (New, error)

NewForIntCallGuardConstStmt creates fused int for-loop for guarded call body: `if guard(i) { fn(i) }`.

func NewForIntConstStmt added in v0.3.0

func NewForIntConstStmt(init, body New, iOffset uintptr, cmpOp token.Token, limit, delta int, labelID uint32) (New, error)

NewForIntConstStmt creates a specialized for-loop with int counter and const limit.

func NewForMergeCompareIntSliceStmt added in v0.3.0

func NewForMergeCompareIntSliceStmt(init New, iOffset, jOffset, kOffset, midOffset, rightOffset, dataOffset, tmpOffset uintptr) (New, error)

NewForMergeCompareIntSliceStmt creates a fused loop for for i < mid && j < right { if data[i] <= data[j] { tmp[k] = data[i]; i++ } else { tmp[k] = data[j]; j++ }; k++ }.

func NewForMergeCopyIntSliceStmt added in v0.3.0

func NewForMergeCopyIntSliceStmt(init New, idxOffset, limitOffset, dstOffset, srcOffset uintptr) (New, error)

NewForMergeCopyIntSliceStmt creates a fused loop for for i < n { dst[i] = src[i]; i++ }.

func NewForMergeCopyWithKIntSliceStmt added in v0.3.0

func NewForMergeCopyWithKIntSliceStmt(init New, idxOffset, limitOffset, kOffset, dstOffset, srcOffset uintptr) (New, error)

NewForMergeCopyWithKIntSliceStmt creates a fused loop for for i < mid { tmp[k] = data[i]; i++; k++ }.

func NewForStmt

func NewForStmt(cond *Operand, init, post, body New, labelID uint32) (New, error)

NewForStmt creates a for stmt

func NewGroupStmt

func NewGroupStmt(newStatementsFn []New, stmt bool) New

NewGroupStmt crates group node

func NewIfStmt

func NewIfStmt(cond *Operand, whenBranch, elseBranch New) (New, error)

NewIfStmt creates if stmt

func NewIncDec

func NewIncDec(tok token.Token, op *Operand) New

NewIncDec creates inc/dec stmt

func NewInt64Cast added in v0.3.0

func NewInt64Cast(x *Operand) (New, error)

NewInt64Cast creates int64 cast evaluator.

func NewIntSwitchStmt added in v0.3.0

func NewIntSwitchStmt(tag *Operand, cases []IntSwitchCase, defaultBody New, labelID uint32) (New, error)

NewIntSwitchStmt creates a typed int switch statement node.

func NewJumpBlockStmt added in v0.3.0

func NewJumpBlockStmt(newStatementsFn []New, labels map[uint32]int, forStmt bool) New

NewJumpBlockStmt creates block node with label-aware goto dispatch.

func NewLen added in v0.3.0

func NewLen(x *Operand) (New, reflect.Type, error)

NewLen creates a built-in len expression.

func NewMake

func NewMake(destType reflect.Type, args Operands) (New, reflect.Type, error)

NewMake creates a make stmt

func NewMapComposite added in v0.3.0

func NewMapComposite(cType reflect.Type, entries []MapEntry) New

NewMapComposite returns map composite literal evaluator.

func NewMapGet added in v0.3.0

func NewMapGet(m, key *Operand) (New, reflect.Type, error)

NewMapGet creates a map index expression evaluator.

func NewMapGet2Assign added in v0.3.0

func NewMapGet2Assign(m, key, valueDest, okDest *Operand) (New, error)

NewMapGet2Assign creates a map index value/ok assignment evaluator.

func NewMapSet added in v0.3.0

func NewMapSet(m, key, value *Operand) (New, error)

NewMapSet creates a map index assignment evaluator.

func NewMapper

func NewMapper(x *exec.Selector, params []*exec.Selector, results []*exec.Selector, body New) (New, reflect.Type, error)

NewMapper creates a mapper

func NewNop added in v0.3.0

func NewNop() New

NewNop returns a no-op compute node.

func NewRange

func NewRange(x *Operand, key, value *exec.Selector, body New, labelID uint32) (New, error)

NewRange creates a range stmt.

func NewReducer

func NewReducer(x *exec.Selector, params []*exec.Selector, results []*exec.Selector, init *Operand, body New) (New, reflect.Type, error)

NewReducer creates reducer

func NewReturnStmt

func NewReturnStmt(retOperands Operands, results []*exec.Selector) (New, error)

NewReturnStmt creates a return stmt

func NewSliceGetInt added in v0.3.0

func NewSliceGetInt(slice, index *Operand) (New, reflect.Type, error)

NewSliceGetInt creates []int index evaluator for expression slice[index].

func NewSliceSetInt added in v0.3.0

func NewSliceSetInt(slice, index, value *Operand) (New, error)

NewSliceSetInt creates []int index evaluator for assignment slice[index] = value.

func NewStarExpr added in v0.1.1

func NewStarExpr(operand *Operand) (New, error)

func NewSwitchStmt added in v0.3.0

func NewSwitchStmt(cases []SwitchCase, defaultBody New, labelID uint32) (New, error)

NewSwitchStmt creates a switch statement node.

func NewTypeAssert added in v0.3.0

func NewTypeAssert(x *Operand, target reflect.Type) (New, reflect.Type, error)

NewTypeAssert creates type assertion expression evaluator.

func NewTypeAssert2Assign added in v0.3.0

func NewTypeAssert2Assign(x *Operand, target reflect.Type, valueDest, okDest *Operand) (New, error)

NewTypeAssert2Assign creates value,ok type assertion assignment evaluator.

func NewTypeSwitchStmt added in v0.3.0

func NewTypeSwitchStmt(x *Operand, cases []TypeSwitchCase, defaultBody New, labelID uint32) (New, error)

NewTypeSwitchStmt creates a type switch statement.

type Operand

type Operand struct {
	Key string
	Idx int
	*exec.Selector
	Type     *xunsafe.Type
	Value    interface{}
	ValuePtr unsafe.Pointer
	New
}

Operand defines operand

func NewOperand

func NewOperand(sel *exec.Selector, oType reflect.Type, newFn New, value interface{}) *Operand

NewOperand crates a new operand

func (*Operand) Compute

func (o *Operand) Compute(control *Control) (internal.Compute, *exec.Selector, error)

Compute computes operand

func (*Operand) IsNilSelector added in v0.1.1

func (o *Operand) IsNilSelector() bool

func (*Operand) NewOperand

func (o *Operand) NewOperand(control *Control) (*exec.Operand, error)

NewOperand create an operand

type Operands

type Operands []*Operand

Operands represents opertands

func (Operands) HasNil added in v0.1.1

func (o Operands) HasNil() bool

func (Operands) NonNilOperand added in v0.1.1

func (o Operands) NonNilOperand() *Operand

func (Operands) Validate

func (o Operands) Validate() error

type SwitchCase added in v0.3.0

type SwitchCase struct {
	Cond           *Operand
	Body           New
	HasFallthrough bool
}

SwitchCase represents a compiled switch case.

type TypeSwitchCase added in v0.3.0

type TypeSwitchCase struct {
	Types []reflect.Type
	Body  New
	// Assign, if present, receives asserted case value.
	Assign *exec.Selector
}

TypeSwitchCase represents a compiled type switch case.

Jump to

Keyboard shortcuts

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