- All Superinterfaces:
Sourceable
The parent of all locations.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumAtomic flags of a location: NONE: no $atomic boundary; ATOMIC_ENTER/ATOM_ENTER: the location is the starting point of an $atomic block; ATOMIC_EXIT/ATOM_EXIT: the location is the ending point of an $atomic block. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIncoming(Statement statement) voidaddOutgoing(Statement statement) booleanThis is different from isPurelyLocal(), because the latter is more restricted.Result might be: NONE: a normal location ENTER: the start location of an $atomic block LEAVE: the end location of an $atomic blockvoidcomputeWritableVariables(Set<Variable> addressedOfVariables) booleanCheck if the location is entering a general atomic block.function()getIncoming(int i) intintgetOutgoing(int i) Returns the sole outgoing statement from this location.booleanThis location or some location in the future contains dereferences of some pointers.booleanhasSpawn()Is a spawn statement reachable from this location?intid()Returns the impact memory unit expressions of this location.The impact scope of a location is required in the enabler when an atomic/atom block is encountered, in which case the impact scope of all statements in the atomic block should be considered.incoming()booleanif this is a location that contains two outgoing statement and the guards are expr and !expr, repectively.booleanbooleanbooleanare the disjunction of the guards of all outgoing statements of this location guarded not TRUE?booleanisInLoop()returns true iff this location has more than one incoming location and is inside a loop.booleanDetermines if this location lies on a cycle in which every location has exactly one outgoing statement and that outgoing statement is aNoopStatement.booleanbooleanReturns true if this loop satisfies the following conditions: has one iteration variable the iteration variable is only modified by the last statement (incremental) the condition has the formi invalid input: '<' N(ori > N) the loop has finite iterations (can be decided statically)booleanisSleep()returns true iff this location is the SLEEP location, which has no outgoing statementbooleanisStart()Returns true if this location is the start location of a function.booleanReturns true iff this is a switch or $choose statement location where a set of branch statements emanate from and a default case for it was specified.booleanvoidDetermines whether this location lies on a cycle in which every location has exactly one outgoing statement and that outgoing statement is aNoopStatement, then callswith appropriate boolean value.invalid reference
#setInNoopLoop(boolean)outgoing()returns the path condition of this location from the start locationvoidprint(String prefix, PrintStream out, boolean isDebug) Print this location and all outgoing transitions.voidAnalyze if the location is purely localvoidremoveIncoming(Statement statement) Remove a certain incoming statementvoidremoveOutgoing(Statement statement) Remove a certain outgoing statementscope()voidsetAsStart(boolean value) voidsetBinaryBranching(boolean value) update this location to denote if it is a binary branching locationvoidThis location is the start location of a certain atomic blockvoidsetEntryOfUnsafeAtomic(boolean unsafe) Set the mark of atomic block termination.voidsetId(int id) Set the unique ID number of this location.voidsetImpactMemoryUnit(Set<MemoryUnitExpression> impacts) voidset the impact scope of a location, only called when this.AtomicKind == ATOM_ENTER or ATOMIC_ENTER.voidsetIsEntryOfLocalBlock(boolean isEntryOfLocalBlock) voidThis location is the end location of a certain atomic blockvoidsetLoopPossible(boolean possible) During the translation of AST node into CIVL model, it is possible to know if a location with more than one incoming statement possible to be a loop locationvoidsetPathcondition(Expression expression) voidsetReachableMemUnitsWoPointer(Set<MemoryUnitExpression> reachable) voidsetReachableMemUnitsWtPointer(Set<MemoryUnitExpression> reachable) voidsetSafeLoop(boolean value) Mark if the loop is a safe loop.voidvoidMarks this location as a switch or $choose statement location who has a 'default' case.voidsetSystemCalls(Set<CallOrSpawnStatement> systemCalls) voidMethods inherited from interface dev.civl.mc.model.IF.Sourceable
getSource, setCIVLSource
-
Method Details
-
id
int id()- Returns:
- The unique ID number of this location.
-
scope
Scope scope()- Returns:
- The scope of this location.
-
function
CIVLFunction function()- Returns:
- The function containing this location.
-
incoming
- Returns:
- The iterable object of incoming statements.
-
outgoing
- Returns:
- The iterable object of outgoing statements.
-
getNumOutgoing
int getNumOutgoing()- Returns:
- The number of outgoing statements.
-
getNumIncoming
int getNumIncoming()- Returns:
- The number of incoming statements.
-
getOutgoing
- Parameters:
i- index of the statement- Returns:
- The i'th outgoing statement
-
getIncoming
- Parameters:
i- index of the statement- Returns:
- The i'th incoming statement
-
getSoleOutgoing
Statement getSoleOutgoing()Returns the sole outgoing statement from this location.- Returns:
- the outgoing statement
- Throws:
CIVLInternalException- if the number of outgoing statements from this location is not 1
-
setId
void setId(int id) Set the unique ID number of this location.- Parameters:
id- The unique ID number of this location.
-
setScope
- Parameters:
scope- The scope of this location.
-
addIncoming
- Parameters:
statement- A new incoming statement.
-
addOutgoing
- Parameters:
statement- A new outgoing statement.
-
print
Print this location and all outgoing transitions.- Parameters:
prefix- The prefix string for all lines of this printout.out- The PrintStream to use for printing this location.isDebug- True iff the debugging option is enabled
-
isPurelyLocal
boolean isPurelyLocal()- Returns:
- true iff the location is purely local
-
purelyLocalAnalysis
void purelyLocalAnalysis()Analyze if the location is purely local -
removeOutgoing
Remove a certain outgoing statement- Parameters:
statement- The outgoing statement to be removed
-
removeIncoming
Remove a certain incoming statement- Parameters:
statement- The incoming statement to be removed
-
setEnterAtomic
void setEnterAtomic()This location is the start location of a certain atomic block -
setLeaveAtomic
void setLeaveAtomic()This location is the end location of a certain atomic block -
enterAtomic
boolean enterAtomic()Check if the location is entering a general atomic block.- Returns:
- true iff the location is entering a general atomic block.
-
leaveAtomic
boolean leaveAtomic()- Returns:
- true iff the location is leaving a general atomic block
-
atomicKind
Location.AtomicKind atomicKind()Result might be:- NONE: a normal location
- ENTER: the start location of an $atomic block
- LEAVE: the end location of an $atomic block
- Returns:
- the atomic kind of the location
-
allOutgoingPurelyLocal
boolean allOutgoingPurelyLocal()This is different from isPurelyLocal(), because the latter is more restricted. Because the latter requires the location have exactly one incoming edge in order to avoid loop.- Returns:
- True iff every outgoing statement is purely local
-
setLoopPossible
void setLoopPossible(boolean possible) During the translation of AST node into CIVL model, it is possible to know if a location with more than one incoming statement possible to be a loop location- Parameters:
possible- The value to be used to mark whether this location is possible to be a loop location or not
-
loopAnalysis
void loopAnalysis()Determines whether this location lies on a cycle in which every location has exactly one outgoing statement and that outgoing statement is aNoopStatement, then callswith appropriate boolean value.invalid reference
#setInNoopLoop(boolean) -
impactScopeOfAtomicOrAtomBlock
Scope impactScopeOfAtomicOrAtomBlock()The impact scope of a location is required in the enabler when an atomic/atom block is encountered, in which case the impact scope of all statements in the atomic block should be considered.- Returns:
-
setImpactScopeOfAtomicOrAtomBlock
set the impact scope of a location, only called when this.AtomicKind == ATOM_ENTER or ATOMIC_ENTER. -
computeWritableVariables
-
writableVariables
-
hasDerefs
boolean hasDerefs()This location or some location in the future contains dereferences of some pointers.- Returns:
-
setAsStart
void setAsStart(boolean value) -
isStart
boolean isStart()Returns true if this location is the start location of a function.- Returns:
-
impactMemUnits
Set<MemoryUnitExpression> impactMemUnits()Returns the impact memory unit expressions of this location.- Returns:
-
reachableMemUnitsWtPointer
Set<MemoryUnitExpression> reachableMemUnitsWtPointer() -
reachableMemUnitsWoPointer
Set<MemoryUnitExpression> reachableMemUnitsWoPointer() -
setImpactMemoryUnit
-
setReachableMemUnitsWtPointer
-
setReachableMemUnitsWoPointer
-
setSystemCalls
-
systemCalls
Set<CallOrSpawnStatement> systemCalls() -
hasSpawn
boolean hasSpawn()Is a spawn statement reachable from this location?- Returns:
- true iff a spawn statement is reachable from this location.
-
staticAnalysis
void staticAnalysis() -
setSafeLoop
void setSafeLoop(boolean value) Mark if the loop is a safe loop. For "safe loop", seeisSafeLoop()- Parameters:
value- True to mark the loop as safe loop; false as may not be a safe loop.
-
isSafeLoop
boolean isSafeLoop()Returns true if this loop satisfies the following conditions:
- has one iteration variable
- the iteration variable is only modified by the last statement (incremental)
- the condition has the form
i invalid input: '<' N(ori > N) - the loop has finite iterations (can be decided statically)
- Returns:
-
isGuardedLocation
boolean isGuardedLocation()are the disjunction of the guards of all outgoing statements of this location guarded not TRUE?- Returns:
-
isInNoopLoop
boolean isInNoopLoop()Determines if this location lies on a cycle in which every location has exactly one outgoing statement and that outgoing statement is aNoopStatement.- Returns:
- True iff the location is in a cycle in which every location has
exactly one outgoing statement and that outgoing statement is a
NoopStatement.
-
pathCondition
Expression pathCondition()returns the path condition of this location from the start location- Returns:
-
setPathcondition
-
setBinaryBranching
void setBinaryBranching(boolean value) update this location to denote if it is a binary branching location- Parameters:
value- the value to be used
-
isBinaryBranching
boolean isBinaryBranching()if this is a location that contains two outgoing statement and the guards are expr and !expr, repectively.- Returns:
-
setSwitchOrChooseWithDefault
void setSwitchOrChooseWithDefault()Marks this location as a switch or $choose statement location who has a 'default' case. LetsisSwitchOrChooseWithDefault()return true. -
isSwitchOrChooseWithDefault
boolean isSwitchOrChooseWithDefault()Returns true iff this is a switch or $choose statement location where a set of branch statements emanate from and a default case for it was specified.- Returns:
- true iff this is a switch or $choose statement location where a set of branch statements emanate from and a default case for it was specified.
-
isInLoop
boolean isInLoop()returns true iff this location has more than one incoming location and is inside a loop.- Returns:
- true iff this location has more than one incoming location and is inside a loop.
-
isEntryOfUnsafeAtomic
boolean isEntryOfUnsafeAtomic()- Returns:
- True iff this location is an atomic block entry and the termination of the atomic block is NOT determined.
-
setEntryOfUnsafeAtomic
void setEntryOfUnsafeAtomic(boolean unsafe) Set the mark of atomic block termination.- Parameters:
unsafe- Set to true if this location is an atomic block entry and the termination of the atomic block is NOT determined.
-
isSleep
boolean isSleep()returns true iff this location is the SLEEP location, which has no outgoing statement- Returns:
-
isEntryOfLocalBlock
boolean isEntryOfLocalBlock()- Returns:
- true iff this location is the entry of a local block, i.e., this
location is associated with a system function call
$local_start
-
setIsEntryOfLocalBlock
void setIsEntryOfLocalBlock(boolean isEntryOfLocalBlock) - Parameters:
isEntryOfLocalBlock- true to mark that this locationisEntryOfLocalBlock()
-