public interface Executor
-
Method Summary
Modifier and TypeMethodDescriptionassign(CIVLSource source, State state, int pid, dev.civl.sarl.IF.expr.SymbolicExpression pointer, dev.civl.sarl.IF.expr.SymbolicExpression value) Assigns a value to the referenced cell in the state.assign(State state, int pid, String process, LHSExpression lhs, dev.civl.sarl.IF.expr.SymbolicExpression value, boolean isInitializer) Assigns a value to the memory location specified by the given left-hand-side expression.assign2(CIVLSource source, State state, int pid, dev.civl.sarl.IF.expr.SymbolicExpression pointerToVarOrHeapObject, dev.civl.sarl.IF.expr.SymbolicExpression newValueOfVarOrHeapObject, dev.civl.sarl.IF.expr.SymbolicExpression valueSetTemplate) Given a "pointer" to a variable (Variable) or a memory heap object (seeSymbolicUtility.isPointerToHeap(SymbolicExpression)), a symbolic expression "newValue" that represents the new value of the variable or the memory heap object and a symbolic expression "valueSetTemplate" ofCoreUniverse.valueSetTemplateType(), which refers to a set of regions in the variable or the heap object, this method carves the part that is referred by the "valueSetTemplate" out of the "newValue" and assigns it to the counterpart in the variable or the heap object.Returns the error logger used by this executor.execute(State state, int pid, Transition transition) Returns the state that results from executing the statement, or null if path condition becomes unsatisfiable.execute_printf(CIVLSource source, State state, int pid, String process, Expression[] arguments, dev.civl.sarl.IF.expr.SymbolicExpression[] argumentValues, boolean forcePrint) longReturns the number of "steps" executed since this Executor was created.malloc(CIVLSource source, State state, int pid, String process, Expression scopeExpression, dev.civl.sarl.IF.expr.SymbolicExpression scopeValue, CIVLType objectType, dev.civl.sarl.IF.expr.SymbolicExpression objectValue) Adds a new object to the heap of a certain scope; returns the pointer of the object in the heap.voidprintf(PrintStream printStream, CIVLSource source, String process, List<Format> formats, List<StringBuffer> arguments) If there are insufficient arguments for the format, the behavior is undefined.voidsetConfiguration(CIVLConfiguration config) splitFormat(CIVLSource source, StringBuffer formatBuffer)
-
Method Details
-
assign
State assign(CIVLSource source, State state, int pid, dev.civl.sarl.IF.expr.SymbolicExpression pointer, dev.civl.sarl.IF.expr.SymbolicExpression value) throws UnsatisfiablePathConditionException Assigns a value to the referenced cell in the state. Returns a new state which is equivalent to the old state except that the memory specified by the given pointer value is assigned the given value.- Parameters:
source- the source code information for error reportstate- a CIVL model statepid- the PID of the calling processpointer- a pointer valuevalue- a value to be assigned to the referenced memory location- Returns:
- the new state
- Throws:
UnsatisfiablePathConditionException
-
assign2
State assign2(CIVLSource source, State state, int pid, dev.civl.sarl.IF.expr.SymbolicExpression pointerToVarOrHeapObject, dev.civl.sarl.IF.expr.SymbolicExpression newValueOfVarOrHeapObject, dev.civl.sarl.IF.expr.SymbolicExpression valueSetTemplate) throws UnsatisfiablePathConditionException Given a "pointer" to a variable (
Variable) or a memory heap object (seeSymbolicUtility.isPointerToHeap(SymbolicExpression)), a symbolic expression "newValue" that represents the new value of the variable or the memory heap object and a symbolic expression "valueSetTemplate" ofCoreUniverse.valueSetTemplateType(), which refers to a set of regions in the variable or the heap object, this method carves the part that is referred by the "valueSetTemplate" out of the "newValue" and assigns it to the counterpart in the variable or the heap object.- Parameters:
source- theCIVLSourcethat is related to this assignmentstate- the state where the assignment happenspid- the PID of the running processpointerToVarOrHeapObject- a pointer to a variable or a memory heap objectnewValueOfVarOrHeapObject- a symbolic expression that represents the new value of the referred variable or the memory heap object; the type of this symbolic expression will be equal to the dynamic type of the variable of the heap objectvalueSetTemplate- a symbolic expression of typeCoreUniverse.valueSetTemplateType()that represents a specific (sub-)region that will be assigned.- Returns:
- the state after assignment
- Throws:
UnsatisfiablePathConditionException
-
assign
State assign(State state, int pid, String process, LHSExpression lhs, dev.civl.sarl.IF.expr.SymbolicExpression value, boolean isInitializer) throws UnsatisfiablePathConditionException Assigns a value to the memory location specified by the given left-hand-side expression.- Parameters:
state- a CIVL model statepid- the PID of the process executing the assignmentprocess- the process information (process name + PID) for error reportlhs- a left-hand-side expressionvalue- the value being assigned to the left-hand-sideisInitializer- boolean value indicating if the given left-hand side expression will be INITIALIZED by the given value- Returns:
- the new state
- Throws:
UnsatisfiablePathConditionException
-
stateFactory
StateFactory stateFactory()- Returns:
- The state factory associated with this executor.
-
evaluator
Evaluator evaluator()- Returns:
- The evaluator used by this executor.
-
getNumSteps
long getNumSteps()Returns the number of "steps" executed since this Executor was created.- Returns:
- the number of steps executed
-
malloc
Evaluation malloc(CIVLSource source, State state, int pid, String process, Expression scopeExpression, dev.civl.sarl.IF.expr.SymbolicExpression scopeValue, CIVLType objectType, dev.civl.sarl.IF.expr.SymbolicExpression objectValue) throws UnsatisfiablePathConditionException Adds a new object to the heap of a certain scope; returns the pointer of the object in the heap.- Parameters:
source- The source code element to be used to report errors.state- The current state.pid- The ID of the process where this computation happens.scopeExpression- The static expression of the scope value.scopeValue- The symbolic expression of the scope.objectType- The CIVL type of the object to be added, needed to decide the field index in the heap.objectValue- The object to be added to the heap.- Returns:
- The new state after allocating the specified object in the heap and the pointer of the object in the heap.
- Throws:
UnsatisfiablePathConditionException
-
execute
State execute(State state, int pid, Transition transition) throws UnsatisfiablePathConditionException Returns the state that results from executing the statement, or null if path condition becomes unsatisfiable.- Parameters:
state- the state that the transition emanates frompid- the PID of the process that the transitiontransition- a deterministic transition to be executed- Returns:
- The state after the transition is executed.
- Throws:
UnsatisfiablePathConditionException- when an error is encountered during the execution
-
errorLogger
CIVLErrorLogger errorLogger()Returns the error logger used by this executor.- Returns:
- The error logger used by this executor.
-
execute_printf
Evaluation execute_printf(CIVLSource source, State state, int pid, String process, Expression[] arguments, dev.civl.sarl.IF.expr.SymbolicExpression[] argumentValues, boolean forcePrint) throws UnsatisfiablePathConditionException -
splitFormat
-
printf
void printf(PrintStream printStream, CIVLSource source, String process, List<Format> formats, List<StringBuffer> arguments) If there are insufficient arguments for the format, the behavior is undefined. If the format is exhausted while arguments remain, the excess arguments are evaluated (as always) but are otherwise ignored.- Parameters:
printStream-source-formats-arguments-
-
setConfiguration
-