Documentation ¶
Index ¶
- Variables
- func Apply(node ast.Node, meta *Meta, transform Transform) ast.Node
- func ApplyAll(node ast.Node, meta *Meta, transforms []Transform) ast.Node
- func ApplyWith(node ast.Node, meta *Meta, transform Transform, visitor *Visitor) ast.Node
- func AriTreat(lhs ast.Expr, tok token.Token, rhs ast.Expr) ([]ast.Stmt, bool)
- func ArrayOf(typ *ast.Ident) *ast.ArrayType
- func InjectDecls(f *ast.File, decls []ast.Decl)
- func Int(i int) *ast.BasicLit
- func TokenAssignLess(tok token.Token) token.Token
- func TokenTranslate(tok token.Token) token.Token
- type AfterChannel
- type Alive
- type ArithmeticCall
- type Channel
- type ConditionnalCall
- type Debug
- type DesugarArray
- type DoubleBrackets
- type ElseFull
- type Format
- type FunctionDefs
- type FunctionRecord
- type Global
- type GlobalToState
- type InnerCall
- type LocalVariableAssignments
- type Meta
- func (m *Meta) Add(obj *ast.Object, prefix string) *ast.IndexExpr
- func (m *Meta) AddFunction(fd *ast.FuncDecl, prefix string) *FunctionRecord
- func (m *Meta) ChanInitialSize(obj *ast.Object) int
- func (m *Meta) Create(name, prefix string) *ast.Object
- func (m *Meta) FileSet() *token.FileSet
- func (m *Meta) FunctionCounter() *ast.Object
- func (m *Meta) Get(obj *ast.Object) *ast.IndexExpr
- func (m *Meta) GetChans() []cspinfo.Channel
- func (m *Meta) GetFunction(fn *ast.Object) *FunctionRecord
- func (m *Meta) GetFunctions() []*FunctionRecord
- func (m *Meta) GetOrAdd(obj *ast.Object, prefix string, fn *ast.Object) *ast.IndexExpr
- func (m *Meta) GetVariables() []string
- func (m *Meta) Has(obj *ast.Object) bool
- func (m *Meta) HasFunction(fn *ast.Object) bool
- func (m *Meta) Info() *types.Info
- func (m *Meta) IsRegisterWaitGroup(name string, obj *ast.Object) bool
- func (m *Meta) LabelCounter() *ast.Object
- func (m *Meta) MainFunction() *FunctionRecord
- func (m *Meta) RegisterArray(name string, ident string, size int)
- func (m *Meta) RegisterChannel(obj *ast.Object, name string, ident string, size int, initial_size int)
- func (m *Meta) RegisterWaitGroup(obj *ast.Object, name string)
- func (m *Meta) Set(obj *ast.Object, expr ast.Expr) *ast.AssignStmt
- func (m *Meta) State() *ast.Ident
- func (m *Meta) StateSize() int
- func (m *Meta) StateType() *ast.Ident
- func (m *Meta) StructStateType() *ast.Ident
- type NormalizeDeclarations
- type PostGlobal
- type PreGlobal
- type RegularizedAffect
- type RoutineAssignments
- type RoutineCounter
- type RoutinePrinter
- type Transform
- type TypeChecker
- type UnrollLoop
- type Visitor
- type WaitGroup
Constants ¶
This section is empty.
Variables ¶
var ACcount = 1
var CCcount = 1
var RAcount = 1
Functions ¶
func InjectDecls ¶
InjectDecls injects a list of declarations at the top of a file, right after the import statements.
Types ¶
type AfterChannel ¶
type AfterChannel struct { }
type ArithmeticCall ¶
type ArithmeticCall struct { }
type ConditionnalCall ¶
type ConditionnalCall struct { }
type Debug ¶
The Debug's purpose is to display the current state of transformation.
type DesugarArray ¶
type DesugarArray struct {
// contains filtered or unexported fields
}
type DoubleBrackets ¶
type DoubleBrackets struct {
// contains filtered or unexported fields
}
type FunctionDefs ¶
type FunctionDefs struct {
// contains filtered or unexported fields
}
FunctionDefs visitor type, keeps track of the current function definition.
type FunctionRecord ¶
type FunctionRecord struct { // All functions have a unique index that's used to identify them in the // function counter. Index int // Original identifier in the code. OriginalIdent *ast.Ident // Generated identifier. Ident *ast.Ident // List of labels that have been generated inside this function. Labels []*ast.Ident // Ordered list of the function's results. Results []*ast.Object // Ordered list of the function's parameters. Params []*ast.Object // Object that stores the caller function of this function. Caller *ast.Object // Object that stores the label in the caller function to jump to once the // function has finished executing. CallerLabel *ast.Object // Slice of indexes of variables belonging to this function in the global state Vars []int }
FunctionRecord represents a transformed function in store.
func (*FunctionRecord) NewLabel ¶
func (fr *FunctionRecord) NewLabel() *ast.Ident
NewLabel creates a label inside of a function and returns its ident.
type Global ¶
type Global struct { GlobalVar []string GlobalBlackbox map[string]bool ToIgnore []string // contains filtered or unexported fields }
type GlobalToState ¶
type InnerCall ¶
type InnerCall struct {
// contains filtered or unexported fields
}
func (*InnerCall) CallExprRec ¶
Handle recursive CallExpr
func (*InnerCall) CreateTmpVar ¶
type LocalVariableAssignments ¶
type LocalVariableAssignments struct { GlobalToMain []ast.Stmt GlobalBlackbox map[string]*ast.Object Global bool // contains filtered or unexported fields }
LocalVariableAssignments visitor type, stateless.
type Meta ¶
type Meta struct {
// contains filtered or unexported fields
}
Meta represents all metadata kept around during the transform steps.
func (*Meta) Add ¶
Add an object to the store. Returns an IndexExpr of the state for the given object.
func (*Meta) AddFunction ¶
func (m *Meta) AddFunction(fd *ast.FuncDecl, prefix string) *FunctionRecord
AddFunction adds a function to the store. Returns the created function record.
func (*Meta) FunctionCounter ¶
FunctionCounter returns an expression that points to the function counter.
func (*Meta) GetFunction ¶
func (m *Meta) GetFunction(fn *ast.Object) *FunctionRecord
GetFunction returns the FunctionRecord corresponding to a given function.
func (*Meta) GetFunctions ¶
func (m *Meta) GetFunctions() []*FunctionRecord
GetFunctions returns a slice of all stored functions.
func (*Meta) GetVariables ¶
GetVariables returns a list of all variable names.
func (*Meta) HasFunction ¶
HasFunction checks whether we have the provided function in store.
func (*Meta) IsRegisterWaitGroup ¶
func (*Meta) LabelCounter ¶
LabelCounter returns an expression that points to the label counter.
func (*Meta) MainFunction ¶
func (m *Meta) MainFunction() *FunctionRecord
MainFunction returns the FunctionRecord corresponding to the main function.
func (*Meta) RegisterArray ¶
Register an array so that enough slots can be reserved when adding an object. FIXME : this should be done with object rather than simple strings
func (*Meta) RegisterChannel ¶
func (m *Meta) RegisterChannel(obj *ast.Object, name string, ident string, size int, initial_size int)
Channels and Arrays are processed identically. Except that channels also register elsewhere for latter access.
func (*Meta) RegisterWaitGroup ¶
Simple function used to register waitgroups
func (*Meta) Set ¶
Set returns an AssignStmt setting the state of the given object to the given Expr.
func (*Meta) StructStateType ¶
type NormalizeDeclarations ¶
type NormalizeDeclarations struct {
// contains filtered or unexported fields
}
NormalizeDeclarations visitor type
type PostGlobal ¶
type PreGlobal ¶
type PreGlobal struct { GlobalVar []string // contains filtered or unexported fields }
type RegularizedAffect ¶
type RegularizedAffect struct { }
type RoutineAssignments ¶
type RoutineCounter ¶
type RoutineCounter struct { Functions []*cspinfo.Goroutine // contains filtered or unexported fields }
type RoutinePrinter ¶
type RoutinePrinter struct { }
type Transform ¶
type Transform interface { // Pre will be called on every node in pre-traversal order, and returns a // boolean to indicate whether or not to continue traversing downwards. Pre(*Meta, *Visitor) bool // Post will called on every node in post-traversal order, and returns a // boolean to indicate whether or not to continue traversing upwards. Post(*Meta, *Visitor) bool }
A Transform represents a transformation.
type TypeChecker ¶
type TypeChecker struct { Blackbox bool // contains filtered or unexported fields }
type UnrollLoop ¶
type UnrollLoop struct {
// contains filtered or unexported fields
}
FunctionDefs visitor type, keeps track of the current function definition.
type Visitor ¶
type Visitor struct {
// contains filtered or unexported fields
}
A Visitor keeps track of the current node and its path, where the path is a list of all its parent identifiers (file and functions).
func (*Visitor) ParentName ¶
ParentName returns the composite name of the parent of the current node.
Source Files ¶
- afterchannels.go
- alive.go
- arithmeticcall.go
- channels.go
- checktype.go
- conditionnalccall.go
- debug.go
- desugararray.go
- double_brackets.go
- elsefull.go
- format.go
- functiondefs.go
- global.go
- globaltostate.go
- goroutine.go
- injectdecls.go
- innercall.go
- localvariableassignments.go
- meta.go
- normalizedeclarations.go
- postglobal.go
- preglobal.go
- regularizedaffect.go
- routineassignments.go
- routinecounter.go
- unroll_loop.go
- util.go
- visitor.go
- waitgroup.go