Documentation
¶
Index ¶
- Variables
- func IcallCached() int
- func IcallStat() (capacity int, allocate int, aviable int)
- func IsConstNil(v ssa.Value) bool
- func IsNil(v reflect.Value) bool
- func PackageList() (list []string)
- func ParseBuiltin(fset *token.FileSet, pkg string) (*ast.File, error)
- func RegisterCustomBuiltin(key string, fn interface{}) error
- func RegisterExternal(key string, i interface{})
- func RegisterFileProcess(ext string, fn SourceProcessFunc)
- func RegisterPackage(pkg *Package)
- func RegisterPatch(pkg string, src ...interface{})
- func ResetAllIcall()
- func Run(path string, args []string, mode Mode) (exitCode int, err error)
- func RunFile(filename string, src interface{}, args []string, mode Mode) (exitCode int, err error)
- func RunTest(path string, args []string, mode Mode) error
- func SetValue(v reflect.Value, x reflect.Value)
- type Context
- func (ctx *Context) AddImport(path string, dir string) (err error)
- func (ctx *Context) AddImportFile(path string, filename string, src interface{}) (err error)
- func (ctx *Context) IsEvalMode() bool
- func (ctx *Context) LoadAstFile(path string, file *ast.File) (*ssa.Package, error)
- func (ctx *Context) LoadAstPackage(path string, apkg *ast.Package) (*ssa.Package, error)
- func (ctx *Context) LoadDir(dir string, test bool) (pkg *ssa.Package, err error)
- func (ctx *Context) LoadDirEx(dir string, test bool, ...) (pkg *ssa.Package, err error)
- func (ctx *Context) LoadFS(fsys fs.FS, test bool, ...) (pkg *ssa.Package, err error)
- func (ctx *Context) LoadFile(filename string, src interface{}) (*ssa.Package, error)
- func (ctx *Context) LoadFileSystem(fsys FileSystem, test bool, ...) (pkg *ssa.Package, err error)
- func (ctx *Context) LoadInterp(filename string, src interface{}) (*Interp, error)
- func (ctx *Context) NewInterp(mainPkg *ssa.Package) (*Interp, error)
- func (ctx *Context) ParseFile(filename string, src interface{}) (*ast.File, error)
- func (ctx *Context) PrebuildSSA(pkgs ...string) (err error)
- func (ctx *Context) RegisterExternal(key string, i interface{})
- func (ctx *Context) RegisterPatch(pkg string, src interface{}) error
- func (ctx *Context) Run(path string, args []string) (exitCode int, err error)
- func (ctx *Context) RunFile(filename string, src interface{}, args []string) (exitCode int, err error)
- func (ctx *Context) RunFunc(mainPkg *ssa.Package, fnname string, args ...Value) (ret Value, err error)
- func (ctx *Context) RunInterp(interp *Interp, input string, args []string) (exitCode int, err error)
- func (ctx *Context) RunPkg(mainPkg *ssa.Package, input string, args []string) (exitCode int, err error)
- func (ctx *Context) RunTest(dir string, args []string) error
- func (ctx *Context) SetDebug(fn func(*DebugInfo))
- func (ctx *Context) SetEvalMode(b bool)
- func (ctx *Context) SetLeastCallForEnablePool(count int)
- func (ctx *Context) SetPanic(fn func(*PanicInfo))
- func (ctx *Context) SetPrintOutput(output *bytes.Buffer)
- func (ctx *Context) SetUnsafeSizes(sizes types.Sizes)
- func (ctx *Context) SourcePackage(path string) *SourcePackage
- func (ctx *Context) TestPkg(pkg *ssa.Package, input string, args []string) error
- func (ctx *Context) UnsafeRelease()
- type DebugInfo
- type Eval
- type ExitError
- type FatalError
- type FileSystem
- type FindMethod
- type Frame
- type Importer
- type Interp
- func (i *Interp) Abort()
- func (i *Interp) Exit(code int)
- func (i *Interp) ExitCode() int
- func (i *Interp) FindMethod(mtyp reflect.Type, fn *types.Func) func([]reflect.Value) []reflect.Value
- func (i *Interp) GetConst(key string) (constant.Value, bool)
- func (i *Interp) GetFunc(key string) (interface{}, bool)
- func (i *Interp) GetSymbol(key string) (m ssa.Member, v interface{}, ok bool)
- func (i *Interp) GetType(key string) (reflect.Type, bool)
- func (i *Interp) GetVarAddr(key string) (interface{}, bool)
- func (i *Interp) IcallAlloc() int
- func (i *Interp) MainPkg() *ssa.Package
- func (i *Interp) ResetIcall()
- func (i *Interp) RunFunc(name string, args ...Value) (r Value, err error)
- func (i *Interp) RunInit() (err error)
- func (i *Interp) RunMain() (exitCode int, err error)
- func (i *Interp) UnsafeRelease()
- type Loader
- type Mode
- type Package
- type PanicError
- type PanicInfo
- type PlainError
- type Repl
- type RuntimeError
- type SSABuilder
- func (b *SSABuilder) BuildImports(pkg *types.Package, src bool)
- func (b *SSABuilder) BuildMain(sp *SourcePackage) (pkg *ssa.Package, err error)
- func (b *SSABuilder) BuildPackages(pkgs []*types.Package)
- func (b *SSABuilder) PrebuildSSA(packages ...string) error
- func (b *SSABuilder) Program() *ssa.Program
- func (b *SSABuilder) Reset()
- type SourcePackage
- type SourceProcessFunc
- type Tuple
- type TypedConst
- type TypesLoader
- func (r *TypesLoader) GetPackage(pkg string) *types.Package
- func (r *TypesLoader) Import(path string) (*types.Package, error)
- func (r *TypesLoader) Insert(v reflect.Value)
- func (r *TypesLoader) InsertAlias(p *types.Package, name string, rt reflect.Type)
- func (r *TypesLoader) InsertConst(p *types.Package, name string, typ types.Type, c constant.Value)
- func (r *TypesLoader) InsertFunc(p *types.Package, name string, v reflect.Value)
- func (r *TypesLoader) InsertInterface(p *types.Package, name string, rt reflect.Type)
- func (r *TypesLoader) InsertNamedType(p *types.Package, name string, rt reflect.Type)
- func (r *TypesLoader) InsertTypedConst(p *types.Package, name string, v TypedConst)
- func (r *TypesLoader) InsertUntypedConst(p *types.Package, name string, v UntypedConst)
- func (r *TypesLoader) InsertVar(p *types.Package, name string, v reflect.Value)
- func (r *TypesLoader) Installed(path string) (pkg *Package, ok bool)
- func (r *TypesLoader) LookupPackage(pkgpath string) (*types.Package, bool)
- func (r *TypesLoader) LookupReflect(typ types.Type) (reflect.Type, bool)
- func (r *TypesLoader) LookupType(typ string) types.Type
- func (r *TypesLoader) LookupTypes(typ reflect.Type) (types.Type, bool)
- func (r *TypesLoader) Packages() (pkgs []*types.Package)
- func (r *TypesLoader) SetImport(path string, pkg *types.Package, load func() error) error
- func (r *TypesLoader) ToType(rt reflect.Type) types.Type
- type TypesRecord
- func (r *TypesRecord) EnterInstance(fn *ssa.Function)
- func (r *TypesRecord) LeaveInstance(fn *ssa.Function)
- func (r *TypesRecord) Load(pkg *ssa.Package)
- func (r *TypesRecord) LookupLocalTypes(rt reflect.Type) (typ types.Type, ok bool)
- func (r *TypesRecord) LookupReflect(typ types.Type) (rt reflect.Type, ok bool, nested bool)
- func (r *TypesRecord) LookupTypes(rt reflect.Type) (typ types.Type, ok bool)
- func (r *TypesRecord) Release()
- func (r *TypesRecord) ToType(typ types.Type) (reflect.Type, bool)
- func (r *TypesRecord) ToTypeList(tuple *types.Tuple) ([]reflect.Type, bool)
- type UntypedConst
- type Value
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFoundMain = errors.New("not found main package") ErrTestFailed = errors.New("test failed") ErrNotFoundPackage = errors.New("not found package") ErrGoexitDeadlock = errors.New("fatal error: no goroutines (main called runtime.Goexit) - deadlock!") ErrNoFunction = errors.New("no function") ErrNoTestFiles = errors.New("[no test files]") )
Functions ¶
func IcallCached ¶ added in v0.57.0
func IcallCached() int
IcallCached return reflectx icall cached
func IsConstNil ¶
func RegisterCustomBuiltin ¶
func RegisterExternal ¶
func RegisterExternal(key string, i interface{})
RegisterExternal is register external variable address or func
func RegisterFileProcess ¶
func RegisterFileProcess(ext string, fn SourceProcessFunc)
func RegisterPatch ¶
func RegisterPatch(pkg string, src ...interface{})
RegisterPatch register pkg with "pkg@patch"
func ResetAllIcall ¶
func ResetAllIcall()
ResetAllIcall is reset all reflectx icall, all interp methods invalid.
Types ¶
type Context ¶
type Context struct {
Loader Loader // types loader
BuildContext build.Context // build context, default build.Default
RunContext context.Context // run context, default unset
Importer types.Importer // importer
FileSet *token.FileSet // file set
Lookup func(root, path string) (dir string, found bool) // lookup external import
Mode Mode // mode
BuilderMode ssa.BuilderMode // ssa builder mode
Builder *SSABuilder // ssa builder
// contains filtered or unexported fields
}
Context ssa context
func (*Context) AddImportFile ¶
func (*Context) IsEvalMode ¶
func (*Context) LoadAstFile ¶
func (*Context) LoadAstPackage ¶
func (*Context) LoadFileSystem ¶
func (*Context) LoadInterp ¶
func (*Context) PrebuildSSA ¶ added in v0.60.0
func (*Context) RegisterExternal ¶
RegisterExternal register external value must variable address or func.
func (*Context) RegisterPatch ¶ added in v0.57.0
func (*Context) SetEvalMode ¶
func (*Context) SetLeastCallForEnablePool ¶
SetLeastCallForEnablePool set least call count for enable function pool, default 64
func (*Context) SetPrintOutput ¶
SetPrintOutput is captured builtin print/println output
func (*Context) SetUnsafeSizes ¶
SetUnsafeSizes set the sizing functions for package unsafe.
func (*Context) SourcePackage ¶
func (ctx *Context) SourcePackage(path string) *SourcePackage
func (*Context) UnsafeRelease ¶
func (ctx *Context) UnsafeRelease()
type FatalError ¶
type FatalError struct {
Value value
// contains filtered or unexported fields
}
run func fatal error
func (FatalError) Error ¶
func (p FatalError) Error() string
func (FatalError) Stack ¶
func (p FatalError) Stack() []byte
type FileSystem ¶
type FileSystem interface {
ReadDir(dirname string) ([]fs.DirEntry, error)
ReadFile(filename string) ([]byte, error)
Join(elem ...string) string
// Base returns the last element of path.
// Trailing path separators are removed before extracting the last element.
// If the path is empty, Base returns ".".
// If the path consists entirely of separators, Base returns a single separator.
Base(filename string) string
// Abs returns an absolute representation of path.
Abs(path string) (string, error)
}
FileSystem represents a file system.
type FindMethod ¶
type Importer ¶
type Importer struct {
// contains filtered or unexported fields
}
func NewImporter ¶
type Interp ¶
type Interp struct {
// contains filtered or unexported fields
}
func (*Interp) FindMethod ¶
func (*Interp) GetVarAddr ¶
func (*Interp) ResetIcall ¶
func (i *Interp) ResetIcall()
ResetIcall is reset reflectx icall, all methods invalid.
func (*Interp) UnsafeRelease ¶
func (i *Interp) UnsafeRelease()
UnsafeRelease is unsafe release interp. interp all invalid.
type Loader ¶
type Loader interface {
Import(path string) (*types.Package, error)
Installed(path string) (*Package, bool)
Packages() []*types.Package
LookupReflect(typ types.Type) (reflect.Type, bool)
LookupTypes(typ reflect.Type) (types.Type, bool)
SetImport(path string, pkg *types.Package, load func() error) error
}
Loader types loader interface
func NewTypesLoader ¶
NewTypesLoader install package and readonly
type Mode ¶
type Mode uint
Mode is a bitmask of options affecting the interpreter.
const ( DisableRecover Mode = 1 << iota // Disable recover() in target programs; show interpreter crash instead. DisableCustomBuiltin // Disable load custom builtin func EnableDumpImports // print import packages EnableDumpInstr // Print packages & SSA instruction code EnableTracing // Print a trace of all instructions as they are interpreted. EnablePrintAny // Enable builtin print for any type ( struct/array ) EnableNoStrict // Enable no strict mode ExperimentalSupportGC // experimental support runtime.GC SupportMultipleInterp // Support multiple interp, must manual release interp reflectx icall. CheckGopOverloadFunc // Check and skip gop overload func DisableAutoLoadPatchs // Disable automatic loading of package patches. DisableDynamicFuncCallAnalysis // Disable dynamic func call analysis and optimization. OptionLoadRutimeImethod // Option load runtime imethod for less imethod and memory space. OptionLoadAllImethod // Option load all imethod. OptionLoadDefaultImethod = 0 // Option load default imethod. LastMode = OptionLoadAllImethod // Last Mode )
type Package ¶
type Package struct {
Interfaces map[string]reflect.Type
NamedTypes map[string]reflect.Type
AliasTypes map[string]reflect.Type
Vars map[string]reflect.Value
Funcs map[string]reflect.Value
TypedConsts map[string]TypedConst
UntypedConsts map[string]UntypedConst
Deps map[string]string // path -> name
Name string
Path string
Source string
}
func LookupPackage ¶
LookupPackage lookup register pkgs
type PanicError ¶
type PanicError struct {
Value value
// contains filtered or unexported fields
}
If the target program panics, the interpreter panics with this type.
func (PanicError) Error ¶
func (p PanicError) Error() string
func (PanicError) Stack ¶
func (p PanicError) Stack() []byte
type PanicInfo ¶
type PlainError ¶
type PlainError string
func (PlainError) Error ¶
func (e PlainError) Error() string
func (PlainError) RuntimeError ¶
func (e PlainError) RuntimeError()
type Repl ¶
type Repl struct {
// contains filtered or unexported fields
}
func (*Repl) SetFileName ¶
type RuntimeError ¶
type RuntimeError string
func (RuntimeError) Error ¶
func (e RuntimeError) Error() string
func (RuntimeError) RuntimeError ¶
func (e RuntimeError) RuntimeError()
type SSABuilder ¶ added in v0.60.0
type SSABuilder struct {
// contains filtered or unexported fields
}
SSABuilder builds SSA (Static Single Assignment) form packages incrementally. It maintains a program and tracks which packages have already been created to avoid duplicate builds.
func NewSSABuilder ¶ added in v0.60.0
func NewSSABuilder(ctx *Context) *SSABuilder
func (*SSABuilder) BuildImports ¶ added in v0.60.0
func (b *SSABuilder) BuildImports(pkg *types.Package, src bool)
func (*SSABuilder) BuildMain ¶ added in v0.60.0
func (b *SSABuilder) BuildMain(sp *SourcePackage) (pkg *ssa.Package, err error)
func (*SSABuilder) BuildPackages ¶ added in v0.60.0
func (b *SSABuilder) BuildPackages(pkgs []*types.Package)
func (*SSABuilder) PrebuildSSA ¶ added in v0.60.0
func (b *SSABuilder) PrebuildSSA(packages ...string) error
func (*SSABuilder) Program ¶ added in v0.60.0
func (b *SSABuilder) Program() *ssa.Program
func (*SSABuilder) Reset ¶ added in v0.60.0
func (b *SSABuilder) Reset()
type SourcePackage ¶
type SourcePackage struct {
Context *Context
Package *types.Package
Info *types.Info
Importer types.Importer
Files []*ast.File
Links []*load.LinkSym
Dir string
Register bool // register package
NoCache bool // skip caching in importer
}
func (*SourcePackage) Load ¶
func (sp *SourcePackage) Load() (err error)
func (*SourcePackage) Loaded ¶
func (sp *SourcePackage) Loaded() bool
type SourceProcessFunc ¶
type TypesLoader ¶
type TypesLoader struct {
// contains filtered or unexported fields
}
func (*TypesLoader) GetPackage ¶
func (r *TypesLoader) GetPackage(pkg string) *types.Package
func (*TypesLoader) Insert ¶
func (r *TypesLoader) Insert(v reflect.Value)
func (*TypesLoader) InsertAlias ¶
func (*TypesLoader) InsertConst ¶
func (*TypesLoader) InsertFunc ¶
func (*TypesLoader) InsertInterface ¶
func (*TypesLoader) InsertNamedType ¶
func (*TypesLoader) InsertTypedConst ¶
func (r *TypesLoader) InsertTypedConst(p *types.Package, name string, v TypedConst)
func (*TypesLoader) InsertUntypedConst ¶
func (r *TypesLoader) InsertUntypedConst(p *types.Package, name string, v UntypedConst)
func (*TypesLoader) Installed ¶
func (r *TypesLoader) Installed(path string) (pkg *Package, ok bool)
func (*TypesLoader) LookupPackage ¶
func (r *TypesLoader) LookupPackage(pkgpath string) (*types.Package, bool)
func (*TypesLoader) LookupReflect ¶
func (*TypesLoader) LookupType ¶
func (r *TypesLoader) LookupType(typ string) types.Type
func (*TypesLoader) LookupTypes ¶
func (*TypesLoader) Packages ¶
func (r *TypesLoader) Packages() (pkgs []*types.Package)
type TypesRecord ¶
type TypesRecord struct {
// contains filtered or unexported fields
}
func NewTypesRecord ¶
func NewTypesRecord(ctx *Context, rctx *reflectx.Context, loader Loader, finder FindMethod, nested map[*types.Named]int) *TypesRecord
func (*TypesRecord) EnterInstance ¶
func (r *TypesRecord) EnterInstance(fn *ssa.Function)
func (*TypesRecord) LeaveInstance ¶
func (r *TypesRecord) LeaveInstance(fn *ssa.Function)
func (*TypesRecord) Load ¶
func (r *TypesRecord) Load(pkg *ssa.Package)
func (*TypesRecord) LookupLocalTypes ¶
func (*TypesRecord) LookupReflect ¶
func (*TypesRecord) LookupTypes ¶
func (*TypesRecord) Release ¶
func (r *TypesRecord) Release()
func (*TypesRecord) ToTypeList ¶
type UntypedConst ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
internal/base
Package base defines shared xtype pieces of the gop command, in particular logging and the Command structure.
|
Package base defines shared xtype pieces of the gop command, in particular logging and the Command structure. |
|
internal/build
Package build implements the “ixgo build” command.
|
Package build implements the “ixgo build” command. |
|
internal/help
Package help implements the “ixgo help” command.
|
Package help implements the “ixgo help” command. |
|
internal/run
Package run implements the “gop run” command.
|
Package run implements the “gop run” command. |
|
internal/test
Package test implements the “ixgo test” command.
|
Package test implements the “ixgo test” command. |
|
internal/version
Package build implements the “ixgo version” command.
|
Package build implements the “ixgo version” command. |
|
ixgo
command
|
|
|
ixgotest
command
|
|
|
qexp
command
|
|
|
internal
|
|
|
ixgo
module
|
|
|
_go123/iter
Package iter provides basic definitions and operations related to iterators over sequences.
|
Package iter provides basic definitions and operations related to iterators over sequences. |
|
_go124/iter
Package iter provides basic definitions and operations related to iterators over sequences.
|
Package iter provides basic definitions and operations related to iterators over sequences. |
|
_go125/iter
Package iter provides basic definitions and operations related to iterators over sequences.
|
Package iter provides basic definitions and operations related to iterators over sequences. |
|
race
Package race contains helper functions for manually instrumenting code for the race detector.
|
Package race contains helper functions for manually instrumenting code for the race detector. |
|
testdeps
Package testdeps provides access to dependencies needed by test execution.
|
Package testdeps provides access to dependencies needed by test execution. |
|
testlog
Package testlog provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults.
|
Package testlog provides a back-channel communication path between tests and package os, so that cmd/go can see which environment variables and files a test consults. |