Documentation ¶
Index ¶
- Variables
- func Listing(depth []int, ops []Op) string
- type AddrOf
- type Binary
- type BoolToConst
- type BuiltinCall
- type CallInjectionComplete
- type CallInjectionCopyArg
- type CallInjectionSetTarget
- type CallInjectionStart
- type CallInjectionStartSpecial
- type ConvertAllocToString
- type Index
- type Jump
- type JumpCond
- type Op
- type PointerDeref
- type Pop
- type PushConst
- type PushCurg
- type PushFrameoff
- type PushIdent
- type PushLen
- type PushLocal
- type PushNil
- type PushPackageVarOrSelect
- type PushRangeParentOffset
- type PushThreadID
- type Reslice
- type Select
- type SetValue
- type TypeAssert
- type TypeCast
- type Unary
Constants ¶
This section is empty.
Variables ¶
var (
ErrFuncCallNotAllowed = errors.New("function calls not allowed without using 'call'")
)
Functions ¶
Types ¶
type Binary ¶
type Binary struct {
Node *ast.BinaryExpr
}
Binary pops two variables from the stack, applies the specified binary operator to them and pushes the result back on the stack.
type BoolToConst ¶
type BoolToConst struct { }
BoolToConst pops the topmost variable from the stack, which must be a boolean variable, and converts it to a constant.
type BuiltinCall ¶
BuiltinCall pops len(Args) argument from the stack, calls the specified builtin on them and pushes the result back on the stack.
type CallInjectionComplete ¶
type CallInjectionComplete struct {
// contains filtered or unexported fields
}
CallInjectionComplete resumes target execution so that the injected call can run.
type CallInjectionCopyArg ¶
type CallInjectionCopyArg struct { ArgNum int ArgExpr ast.Expr // contains filtered or unexported fields }
CallInjectionCopyArg copies one argument for call injection.
type CallInjectionSetTarget ¶
type CallInjectionSetTarget struct {
// contains filtered or unexported fields
}
CallInjectionSetTarget starts the call injection, after runtime.debugCallVn set up the stack for us, by copying the entry point of the function, setting the closure register and copying the receiver.
type CallInjectionStart ¶
type CallInjectionStart struct { HasFunc bool // target function already pushed on the stack Node *ast.CallExpr // contains filtered or unexported fields }
CallInjectionStart starts call injection by calling runtime.debugCallVn.
type CallInjectionStartSpecial ¶
type CallInjectionStartSpecial struct { FnName string ArgAst []ast.Expr // contains filtered or unexported fields }
CallInjectionStartSpecial starts call injection for a function with a name and arguments known at compile time.
type ConvertAllocToString ¶
type ConvertAllocToString struct { }
ConvertAllocToString pops two variables from the stack, a constant string and the return value of runtime.mallocgc (mallocv), copies the contents of the string at the address in mallocv and pushes on the stack a new string value that uses the backing storage of mallocv.
type Jump ¶
Jump looks at the topmost stack variable and if it satisfies the condition specified by When it jumps to the stack machine instruction at Target+1. If Pop is set the topmost stack variable is also popped.
type Op ¶
type Op interface {
// contains filtered or unexported methods
}
Op is a stack machine opcode
func Compile ¶
Compile compiles the expression expr into a list of instructions. If canSet is true expressions like "x = y" are also accepted.
func CompileAST ¶
CompileAST compiles the expression t into a list of instructions.
func CompileSet ¶
CompileSet compiles the expression setting lhexpr to rhexpr into a list of instructions.
type PointerDeref ¶
PointerDeref replaces the topmost stack variable v with *v.
type PushFrameoff ¶
type PushFrameoff struct { }
PushFrameoff pushes the frame offset for the current frame on the stack.
type PushIdent ¶
type PushIdent struct {
Name string
}
PushIdent pushes a local or global variable or a predefined identifier (true, false, etc) or the value of a register on the stack.
type PushLen ¶
type PushLen struct { }
PushLen pushes the length of the variable at the top of the stack into the stack.
type PushPackageVarOrSelect ¶
PushPackageVarOrSelect pushes the value of Name.Sel on the stack, which could either be a global variable (with the package name specified), or a field of a local variable.
type PushRangeParentOffset ¶
type PushRangeParentOffset struct { }
PushRangeParentOffset pushes the frame offset of the range-over-func closure body parent.
type PushThreadID ¶
type PushThreadID struct { }
PushThreadID pushes the ID of the current thread on the stack.
type Reslice ¶
Reslice implements a reslice operation. If HasHigh is set it pops three variables, low, high and v, and pushes v[low:high]. Otherwise it pops two variables, low and v, and pushes v[low:]. If TrustLen is set when the variable resulting from the reslice is loaded it will be fully loaded.
type Select ¶
type Select struct {
Name string
}
Select replaces the topmost stack variable v with v.Name.
type TypeAssert ¶
type TypeAssert struct { DwarfType godwarf.Type Node *ast.TypeAssertExpr }
TypeAssert replaces the topmost stack variable v with v.(DwarfType).