Documentation ¶
Index ¶
- Variables
- func Andersen(prog *ssa.Program, mains []*ssa.Package, include IncludeType) *pointer.Result
- func CollectNames(pkgs []*packages.Package)
- func GetPtsToSets(prog *ssa.Program, mains []*ssa.Package) *pointer.Result
- func TotalAndersen(prog *ssa.Program, mains []*ssa.Package) *pointer.Result
- func Transform(c *astutil.Cursor) bool
- func UnrollLoops(pkgs []*packages.Package) []*packages.Package
- type Access
- type ArrayAccess
- type ChanNameCollector
- type ChannelOp
- type CtrLocPriorities
- type FieldAccess
- type GoCollection
- type GoCycles
- type GoTopology
- type Goro
- type IncludeType
- type TargetType
- type WrittenFields
- func (w WrittenFields) FieldInfo(typ *T.Struct, funs map[*ssa.Function]struct{}) (isWritten func(fieldIndex int) bool)
- func (w WrittenFields) IsFieldWrittenFromFunction(fun *ssa.Function, typ *T.Struct, fieldIndex int) bool
- func (w WrittenFields) MapCombinedInfo(funs map[*ssa.Function]struct{}) (isUpdated func(v ssa.Value) bool)
- func (w WrittenFields) PointerCombinedInfo(funs map[*ssa.Function]struct{}) (isUpdated func(v ssa.Value) bool)
- func (w WrittenFields) SliceCombinedInfo(funs map[*ssa.Function]struct{}) (isUpdated func(v ssa.Value) bool)
- func (w WrittenFields) String() string
Constants ¶
This section is empty.
Variables ¶
var ChAliasingInfo = &channelAliasingInfo{}
var (
ChannelNames = make(map[token.Pos]string)
)
Functions ¶
func CollectNames ¶
func UnrollLoops ¶
Loop unroller will recursively trasnform the AST, by turning for statements of the form: for init; guard; iter { S } ==> init; { S; iter }; ...; { S; iter }
---------n times-------------
where, given "i" as an iteration index, "i" is not mutated in the body of the loop, and: init - Is an initialization of the form: ---- i := c1 ---- var i := c1, for some constant c1 guard - Is a boolean expression of the form ---- i {<, <=, >=, >} c2 ---- c2 {<, <=, >=, >} i, for some constant c2 iter - Is an interation operation of the form ---- i{++, --} (equivalent with i = i {+, -} 1) ---- i = i {+, -} c3 ---- i = c3 {+, i} i, for some constant c3 And "n" is determined by |c2 - c1| / |c3|
Types ¶
type ArrayAccess ¶
type ArrayAccess struct {
// contains filtered or unexported fields
}
type ChanNameCollector ¶
type ChanNameCollector struct {
// contains filtered or unexported fields
}
type ChannelOp ¶
type ChannelOp struct { Buffer ssa.Value Send []ssa.Instruction Receive []ssa.Instruction Close []ssa.Instruction Make ssa.Instruction }
ChannelOp aggregates all possible instructions associated with a MakeChan instruction in the source.
func (*ChannelOp) BufferLabel ¶
BufferLabel formats the buffer size to a string.
type CtrLocPriorities ¶
type CtrLocPriorities struct { FunPriorities map[*ssa.Function]int BlockPriorities map[*ssa.Function][]int }
func GetCtrLocPriorities ¶
func GetCtrLocPriorities(allFuns map[*ssa.Function]struct{}, scc graph.SCCDecomposition[*ssa.Function]) CtrLocPriorities
Uses the SCC decomposition of the callgraph to assign priorities to ssa.Functions. Functions are assigned priorities in depth-first order. We prioritize "deeper" functions before others. We cannot retrieve allFuns ourselves because importing cfg causes an import cycle.
type FieldAccess ¶
type FieldAccess struct { Field string // contains filtered or unexported fields }
type GoCollection ¶
type GoTopology ¶
type GoTopology []*Goro
func CollectGoros ¶
func CollectGoros(result *pointer.Result) (goros GoTopology)
Status: mildly tested
func (GoTopology) Cycles ¶
func (goros GoTopology) Cycles() GoCycles
Calculate cycles in the call graph.
func (GoTopology) FunHasCycle ¶
func (goros GoTopology) FunHasCycle(f *ssa.Function) bool
func (GoTopology) HasCycle ¶
func (goros GoTopology) HasCycle(g *Goro) bool
func (GoTopology) LogCycles ¶
func (goros GoTopology) LogCycles()
type Goro ¶
type Goro struct { Entry *ssa.Function ChannelOperations map[ssa.Value]*ChannelOp SpawnedGoroutines []*Goro CrossPackageCalls []*Goro }
Goro describes the structure of the transitive closure of a goroutine.
func (*Goro) ProcessFunction ¶
ProcessFunction connects channel allocation sites with channel operations in the given function by using the results of the points-to analysis, and adds them to the receiver Goroutine.
type IncludeType ¶
type IncludeType struct { All bool Chan bool Interface bool Function bool Map bool // Array bool Slice bool Pointer bool }
Configuration structure determines for values of which types to include queries in the Andersen analysis. Only pointer-like values appear in this list
type TargetType ¶
type TargetType int
func (TargetType) String ¶
func (t TargetType) String() string
type WrittenFields ¶
type WrittenFields struct {
// contains filtered or unexported fields
}
func ComputeWrittenFields ¶
func ComputeWrittenFields(pt *pointer.Result, callDAG graph.SCCDecomposition[*ssa.Function]) WrittenFields
func (WrittenFields) IsFieldWrittenFromFunction ¶
func (WrittenFields) MapCombinedInfo ¶
func (WrittenFields) PointerCombinedInfo ¶
func (WrittenFields) SliceCombinedInfo ¶
func (WrittenFields) String ¶
func (w WrittenFields) String() string