instinfo

package
v0.0.0-...-c039653 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2021 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DynamicSize = -999 // If a channel's buffer size can't be computed statically, we give DynamicSize to the Buffer field
View Source
const Lock, Unlock = "Lock", "Unlock"
View Source
const RWMutex, Mutex = "RWMutex", "Mutex"
View Source
const Send, Recv, Close, MakeChan = "Send", "Recv", "Close", "MakeChan"

Variables

View Source
var MapInst2ChanOp map[ssa.Instruction][]ChanOp

A map from inst to its corresponding LockerOp

View Source
var MapInst2LockerOp map[ssa.Instruction]LockerOp

A map from inst to its corresponding LockerOp

Functions

func ClearChanOpMap

func ClearChanOpMap()

func ClearLockerOpMap

func ClearLockerOpMap()

func ConvertInstToStr

func ConvertInstToStr(inst ssa.Instruction) string

func GetCallName

func GetCallName(call *ssa.CallCommon) string

func GetMutexName

func GetMutexName(inputInst ssa.Instruction) string

func IsChanClose

func IsChanClose(inst ssa.Instruction) bool

func IsDefer

func IsDefer(inst ssa.Instruction) bool

func IsMutexLock

func IsMutexLock(inputInst ssa.Instruction) bool

func IsMutexMake

func IsMutexMake(inputInst ssa.Instruction) bool

func IsMutexOperation

func IsMutexOperation(inputInst ssa.Instruction) bool

func IsMutexUnlock

func IsMutexUnlock(inputInst ssa.Instruction) bool

func IsRwmutex

func IsRwmutex(inst ssa.Instruction) bool

func IsRwmutexLock

func IsRwmutexLock(inputInst ssa.Instruction) bool

func IsRwmutexMake

func IsRwmutexMake(inputInst ssa.Instruction) bool

func IsRwmutexRlock

func IsRwmutexRlock(inputInst ssa.Instruction) bool

func IsRwmutexRunlock

func IsRwmutexRunlock(inputInst ssa.Instruction) bool

func IsRwmutexUnlock

func IsRwmutexUnlock(inputInst ssa.Instruction) bool

func ScanInstFindChanValue

func ScanInstFindChanValue(inst ssa.Instruction) ([]ssa.Value, []string)

ScanInstFindChanValue return multiple values and strings, only when inst is Select

func ScanInstFindLockerValue

func ScanInstFindLockerValue(inst ssa.Instruction) (v ssa.Value, comment string)

Types

type ChClose

type ChClose struct {
	Name      string
	IsDefer   bool
	WholeLine string
	Status    string // Used for debug

	ChOp // inst can be *ssa.Call or *ssa.Defer
}

Define operation ChClose, a concrete implementation of ChanOp

func AddNotDependClose

func AddNotDependClose(inst ssa.Instruction) *ChClose

Add a special close, belongs to a channel that we don't consider in this run, because it is not a dependent primitive No sync constraint will be generated for this operation.

type ChMake

type ChMake struct {
	ChOp // inst can only be MakeChan
}

Define operation ChMake, a concrete implementation of ChanOp

type ChOp

type ChOp struct {
	Parent *Channel
	Inst   ssa.Instruction
}

func (*ChOp) Instr

func (op *ChOp) Instr() ssa.Instruction

func (*ChOp) Prim

func (op *ChOp) Prim() *Channel

type ChRecv

type ChRecv struct {
	Name           string
	CaseIndex      int // If Inst is *ssa.UnOp, CaseIndex = -1; else CaseIndex is the index of case of *ssa.Select
	IsCaseBlocking bool
	WholeLine      string // Used for debug
	Status         string

	ChOp // inst can be *ssa.UnOp or *ssa.Select
}

Define operation ChRecv, a concrete implementation of ChanOp

func AddNotDependRecv

func AddNotDependRecv(inst ssa.Instruction) *ChRecv

Add a special receive, belongs to a channel that we don't consider in this run, because it is not a dependent primitive No sync constraint will be generated for this operation. Fields like Case_index need to be updated

type ChSend

type ChSend struct {
	Name           string
	CaseIndex      int // If Inst is *ssa.Send, CaseIndex = -1; else CaseIndex is the index of case of *ssa.Select
	IsCaseBlocking bool
	WholeLine      string // Used for debug
	Status         string

	ChOp // this can be *ssa.Send or *ssa.Select
}

Define operation ChSend, a concrete implementation of ChanOp

func AddNotDependSend

func AddNotDependSend(inst ssa.Instruction) *ChSend

Add a special send, belongs to a channel that we don't consider in this run, because it is not a dependent primitive No sync constraint will be generated for this operation. Fields like Case_index need to be updated

type ChanOp

type ChanOp interface {
	Prim() *Channel
	Instr() ssa.Instruction
}

Define interface ChanOp, and its implementation ChOp, which is inherited by all concrete implementations

type Channel

type Channel struct {
	Name     string
	MakeInst *ssa.MakeChan
	Make     *ChMake
	Pkg      string
	Buffer   int

	Sends  []*ChSend
	Recvs  []*ChRecv
	Closes []*ChClose

	Status string
}

Define Channel

var ChanContext Channel
var ChanNotDepend Channel
var ChanTimer Channel

Define some special channels and its operations

func (*Channel) AllOps

func (ch *Channel) AllOps() []ChanOp

func (*Channel) DebugPrintChan

func (ch *Channel) DebugPrintChan()

type LockOp

type LockOp struct {
	Name    string
	Inst    ssa.Instruction
	IsRLock bool
	IsDefer bool

	Parent *Locker
}

Define LockOp

func (*LockOp) Instr

func (l *LockOp) Instr() ssa.Instruction

func (*LockOp) Prim

func (l *LockOp) Prim() *Locker

type Locker

type Locker struct {
	Name    string
	Type    string
	Locks   []*LockOp
	Unlocks []*UnlockOp
	Pkg     string // Don't use *ssa.Package here! It's not reliable
	Value   ssa.Value

	Status string
}

Define Locker

func (*Locker) AllOps

func (l *Locker) AllOps() []LockerOp

func (*Locker) ModifyStatus

func (l *Locker) ModifyStatus(str string)

type LockerOp

type LockerOp interface {
	Instr() ssa.Instruction
	Prim() *Locker
}

Define interface LockerOp and its two implementations

Define LockerOp

type StOpValue

type StOpValue struct {
	Inst    ssa.Instruction
	Value   ssa.Value
	Comment string
}

type UnlockOp

type UnlockOp struct {
	Name      string
	Inst      ssa.Instruction
	IsRUnlock bool
	IsDefer   bool

	Parent *Locker
}

Define UnlockOp

func (*UnlockOp) Instr

func (u *UnlockOp) Instr() ssa.Instruction

func (*UnlockOp) Prim

func (u *UnlockOp) Prim() *Locker

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL