Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GoroutineCounter *utils.Counter
var GuardedAccessCounter *utils.Counter
var PosIDCounter *utils.Counter
Functions ¶
This section is empty.
Types ¶
type BlockState ¶
type BlockState struct { GuardedAccesses []*GuardedAccess Lockset *Lockset DeferredFunctions *stacks.CallCommonStack }
func CreateBlockState ¶
func CreateBlockState(ga []*GuardedAccess, ls *Lockset, df *stacks.CallCommonStack) *BlockState
func GetEmptyBlockState ¶
func GetEmptyBlockState() *BlockState
func (*BlockState) AddFunctionCallState ¶
func (existingBlock *BlockState) AddFunctionCallState(newBlock *BlockState, shouldMergeLockset bool)
AddFunctionCallState is used to add the state of a function call to the blocks total state when iterating through it. shouldMergeLockset is used depending if the call was using a goroutine or not.
func (*BlockState) Copy ¶
func (existingBlock *BlockState) Copy() *BlockState
func (*BlockState) MergeChildBlock ¶
func (existingBlock *BlockState) MergeChildBlock(newBlock *BlockState)
MergeChildBlock merges child block with it's parent in append-like fashion. A -> B Will Merge B unto A
func (*BlockState) MergeSiblingBlock ¶
func (existingBlock *BlockState) MergeSiblingBlock(newBlock *BlockState)
MergeSiblingBlock merges sibling blocks in merge-like fashion. A -> B
-> C
Will Merge B and C
type Context ¶
type Context struct { GoroutineID int Clock VectorClock StackTrace *stacks.IntStackWithMap }
Flow context
func NewEmptyContext ¶
func NewEmptyContext() *Context
func (*Context) CopyWithoutMap ¶
func (*Context) MayConcurrent ¶
type DeferFunction ¶
type DeferFunction struct { Function *ssa.CallCommon BlockIndex int }
type FlowData ¶
type FunctionState ¶
type FunctionState struct { GuardedAccesses []*GuardedAccess Lockset *Lockset }
func CreateFunctionState ¶
func CreateFunctionState(ga []*GuardedAccess, ls *Lockset) *FunctionState
func GetFunctionState ¶
func GetFunctionState() *FunctionState
func (*FunctionState) AddContextToFunction ¶
func (fs *FunctionState) AddContextToFunction(context *Context)
AddContextToFunction adds flow specific context data
func (*FunctionState) Copy ¶
func (fs *FunctionState) Copy() *FunctionState
func (*FunctionState) RemoveContextFromFunction ¶
func (fs *FunctionState) RemoveContextFromFunction()
RemoveContextFromFunction strips any context related data from the guarded access fields. It nullifies id, goroutine id, clock and removes from the guarded access the prefix that matches the context path. This way, other flows can take the guarded access and add relevant data.
type GuardedAccess ¶
func AddGuardedAccess ¶
func (*GuardedAccess) Copy ¶
func (ga *GuardedAccess) Copy() *GuardedAccess
func (*GuardedAccess) Intersects ¶
func (ga *GuardedAccess) Intersects(gaToCompare *GuardedAccess) bool
func (*GuardedAccess) IsConflicting ¶
func (ga *GuardedAccess) IsConflicting(gaToCompare *GuardedAccess) bool
func (*GuardedAccess) ShallowCopy ¶
func (ga *GuardedAccess) ShallowCopy() *GuardedAccess
type Lockset ¶
type Lockset struct { Locks locksLastUse Unlocks locksLastUse }
func NewLockset ¶
func NewLockset() *Lockset
func (*Lockset) MergeSiblingLockset ¶
MergeSiblingLockset is called when merging different paths of the control flow graph. The mutex status should be merged and not appended. Because Locks is a must set, for a lock to appear in the result, an intersect between the branches' lockset is performed to make sure the lock appears in all branches. Unlock is a may set, so a union is applied since it's sufficient to have an unlock at least in one of the branches.
func (*Lockset) UpdateWithNewLockSet ¶
func (ls *Lockset) UpdateWithNewLockSet(newLocks, newUnlocks locksLastUse)
The three following methods handle updating the lockset the same way. By recording each lock state (locked/unlocked) at the current point. It means that if a mutex was unlocked at some point but later was locked again, then it's latest status is locked, and the unlock status is removed. The difference between each algorithm is the context used.
UpdateWithNewLockSet updates the lockset and expects newLocks, newUnlocks to contain the most up to date status of the mutex and update accordingly.
func (*Lockset) UpdateWithPrevLockset ¶
UpdateWithPrevLockset works the same as UpdateWithNewLockSet but expects prevLS to contain an earlier version of the status of the locks.
type VectorClock ¶
func (VectorClock) Copy ¶
func (vc VectorClock) Copy() VectorClock
func (VectorClock) Get ¶
func (vc VectorClock) Get(id int) int
Get returns clock for provided goroutine ID. If no such goroutine or clock is not initialized, then returns a zero value.
func (VectorClock) MergeClocks ¶
func (vc VectorClock) MergeClocks(clockToMerge VectorClock)