Public Methods | |
void | caseAddExpr (AddExpr expr) |
void | caseAndExpr (AndExpr expr) |
void | caseArrayExpr (ArrayExpr expr) |
void | caseAssertAction (AssertAction assertAction) |
void | caseAssignAction (AssignAction assign) |
void | caseBoolLit (BoolLit expr) |
void | caseChooseExpr (ChooseExpr expr) |
void | caseConstant (Constant expr) |
void | caseDerefExpr (DerefExpr expr) |
void | caseDivExpr (DivExpr expr) |
void | caseEqExpr (EqExpr expr) |
void | caseInstanceOfExpr (InstanceOfExpr expr) |
void | caseIntLit (IntLit expr) |
void | caseLeExpr (LeExpr expr) |
void | caseLengthExpr (LengthExpr expr) |
void | caseLockAction (LockAction lockAction) |
void | caseLockTest (LockTest lockTest) |
void | caseLtExpr (LtExpr expr) |
void | caseMulExpr (MulExpr expr) |
void | caseNeExpr (NeExpr expr) |
void | caseNewArrayExpr (NewArrayExpr expr) |
void | caseNewExpr (NewExpr expr) |
void | caseNotExpr (NotExpr expr) |
void | caseNullExpr (NullExpr expr) |
void | caseOrExpr (OrExpr expr) |
void | casePrintAction (PrintAction printAction) |
void | caseRecordExpr (RecordExpr expr) |
void | caseRefExpr (RefExpr expr) |
void | caseRemExpr (RemExpr expr) |
void | caseStateVar (StateVar expr) |
void | caseSubExpr (SubExpr expr) |
void | caseThreadAction (ThreadAction threadAction) |
void | caseThreadLocTest (ThreadLocTest threadLocTest) |
void | caseThreadTest (ThreadTest threadTest) |
String | check () |
void | defaultCase (Object obj) |
List | getCounterExample () |
SpinOptions | getSpinOptions () |
boolean | isVerbose () |
BirTrace | parseOutput () |
String | runSpin () |
void | setVerbose (boolean v) |
void | translateLocation (Location loc) |
Static Public Methods | |
SpinTrans | translate (TransSystem system) |
SpinTrans | translate (TransSystem system, SpinOptions options) |
SpinTrans | translate (TransSystem system, SpinOptions options, PrintWriter out) |
SpinTrans | translate (TransSystem system, SpinOptions options, String outputDir) |
Static Public Attributes | |
final String | normal = "NORMAL_CASE" |
Private Methods | |
SpinTrans (TransSystem system, SpinOptions options, PrintWriter out) | |
String | actionId () |
String | actionIdWithCommas () |
CaseNode | applyTo (Expr expr) |
void | cleanMess () |
void | definitions () |
String | getSimpleResult () |
boolean | guardPresent (Transformation trans) |
void | header () |
void | initBlock () |
boolean | isIfBranch (TransVector outTrans) |
boolean | nonNegative (Expr expr) |
void | predicates () |
void | print (String s) |
void | printGuard (TreeNode tree) |
void | println () |
void | println (String s) |
void | printStatement (TreeNode tree) |
void | property () |
int | refIndex (StateVar target) |
void | resetDeadVariables (Location fromLoc, Location toLoc) |
SpinTrans | run () |
TreeNode | specialize (String expr) |
void | stateVariables () |
void | transitions () |
void | translateBinaryOp (Expr e1, Expr e2, String op) |
void | translateSeq (LocVector locSet, Transformation trans, int branch, boolean supressGuard) |
void | translateSequence (Transformation trans, int branch) |
void | translateTrans (Transformation trans, boolean supressGuard) |
void | translateUnaryOp (Expr e, String op) |
Static Private Methods | |
String | currentDir () |
String | locLabel (Location loc) |
String | locLabel (Location loc1, int branch, Location loc2) |
int | parseInt (String s) |
Private Attributes | |
TransSystem | system |
PrintWriter | out |
SpinTypeName | namer |
int | indentLevel = 0 |
boolean | inDefine = false |
boolean | newLine = true |
boolean | resetTemp = false |
Transformation | currentTrans |
int | actionNum |
SpinOptions | options |
boolean | ranVerifier = false |
String | panOutput |
boolean | isVerbose = true |
String | outputDir = "."+File.separator |
Static Private Attributes | |
String | ccName = "gcc" |
The SPIN translator is invoked on a transition system as follows:
// Parameters TransSystem system = ...; // the transition system SpinOptions options = new SpinOptions(); // SPIN options options.setMemoryLimit(256); // set various options ... SpinTrans spin = SpinTrans.translate(system,options); // invoke translator spin.runSpin(); // Run SPIN on generated PROMELA BirTrace trace = spin.parseOutput(); // Parse output as BIR trace
Definition at line 62 of file SpinTrans.java.
|
Get action ID of current action = loc_num trans_index action_index Definition at line 100 of file SpinTrans.java. |
|
Get action ID of current action, but comma seperated. Definition at line 110 of file SpinTrans.java. |
|
Apply translator to BIR Expr, return case tree. Definition at line 120 of file SpinTrans.java. |
|
Translate array expression. Must insert traps for array out of bounds. Reimplemented from ExprSwitch. Definition at line 136 of file SpinTrans.java. |
|
Translate assert action. Reimplemented from ExprSwitch. Definition at line 158 of file SpinTrans.java. |
|
Translate a BIR assignment action. Reimplemented from ExprSwitch. Definition at line 172 of file SpinTrans.java. |
|
Translate choose expression. As in NexExpr, we spit out code (in this case a nondeterministic if statement) that sets the _temp_ variable of the process. We then return _temp_ as the value of the expression. Once again, this is safe because a choose() must appear alone on the RHS of an assign action. Reimplemented from ExprSwitch. Definition at line 232 of file SpinTrans.java. |
|
Translate dereference. This is the case that creates most of the CaseNodes in a case tree. We need to branch based on the collection of the target. Reimplemented from ExprSwitch. Definition at line 256 of file SpinTrans.java. |
|
Translate division. DivExpr and RemExpr require special handling because they can cause a ArithmeticException if the second arg is zero. Reimplemented from ExprSwitch. Definition at line 290 of file SpinTrans.java. |
|
Translate instanceof expression (basically a big disjunction to test the refIndex for all possible targets). Reimplemented from ExprSwitch. Definition at line 312 of file SpinTrans.java. |
|
Translate array length expression. Reimplemented from ExprSwitch. Definition at line 346 of file SpinTrans.java. |
|
Translate lock action. Reimplemented from ExprSwitch. Definition at line 359 of file SpinTrans.java. |
|
Translate lock test. Reimplemented from ExprSwitch. Definition at line 384 of file SpinTrans.java. |
|
Translate array allocator. Similar to NewExpr (above), except that we need to set (and check) the supplied length. Reimplemented from ExprSwitch. Definition at line 434 of file SpinTrans.java. |
|
Translate an allocator. When we translate the allocator expression, we spit out a call to the _allocate() macro, which selects a free instance of the collection and assigns the instance index to _temp_. We then just return "_temp_" as the value of this expression (this is OK since allocators must appear alone on the RHS of an assignment action). Reimplemented from ExprSwitch. Definition at line 478 of file SpinTrans.java. |
|
Translate BIR Print action. Perhaps remove this---easier to just get output from BIR trace instead. Reimplemented from ExprSwitch. Definition at line 506 of file SpinTrans.java. |
|
Translate field selector. Reimplemented from ExprSwitch. Definition at line 529 of file SpinTrans.java. |
|
Translate thread action. Reimplemented from ExprSwitch. Definition at line 566 of file SpinTrans.java. |
|
Translate thread location test. Reimplemented from ExprSwitch. Definition at line 576 of file SpinTrans.java. |
|
Translate thread test. Reimplemented from ExprSwitch. Definition at line 588 of file SpinTrans.java. |
|
Generate constant and type definitions (using type namer). Definition at line 734 of file SpinTrans.java. |
|
getCounterExample method comment. Definition at line 783 of file SpinTrans.java. |
|
Retrieve simple result from translator, flag error if not simple. A simple result is a case tree with only a single expression node under the NORMAL case. Definition at line 821 of file SpinTrans.java. |
|
Test if guard is present. If the guard is TRUE (BoolLit) or the HAS_LOCK test (which we don't use), claim there is no guard. Definition at line 838 of file SpinTrans.java. |
|
Generate the header for all PROMELA files Definition at line 853 of file SpinTrans.java. |
|
Generate init {} block to initializae variables and start threads. Definition at line 985 of file SpinTrans.java. |
|
Test if the out transitions of a location model an 'if' branch, i.e., there are exactly two transitions, and one guard is the negation of the other. Definition at line 1026 of file SpinTrans.java. |
|
Get PROMELA label of location encountered during coarsening. Since we may encounter the same location along several collapsed paths, we must have a unique label for each. Definition at line 1062 of file SpinTrans.java. |
|
Get PROMELA label for BIR location. If location has no out transitions (i.e., is end location of thread), make the label an end-label (does not count for deadlock). Definition at line 1049 of file SpinTrans.java. |
|
Test if an expression is statically nonnegative (either a constant or in a range type that is nonnegative). Definition at line 1070 of file SpinTrans.java. |
|
Parse the output of 'pan' and interpret it as either a violation (sequence of transformations) or as a error-free analysis.
Definition at line 1095 of file SpinTrans.java. |
|
Generate the predicate definitions. Note that these are at the bottom so they can refer to any variable or code location. Definition at line 1105 of file SpinTrans.java. |
|
Support for printing things nicely indented. Definition at line 1126 of file SpinTrans.java. |
|
Print a case tree as an expression to represent a guard. We take advantage of the short-curcuit evaluation in PROMELA to express a case tree as one large boolean expression. A case node: (cond1 => expr1, cond2 => expr2, ...)is translated as ((cond1 && expr1) || (cond2 && expr2) || ... )We consider traps as always enabled, so they evaluate to the constant TRAP (defined to be 1). Definition at line 1151 of file SpinTrans.java. |
|
Print a case tree as a statement. A case node: (cond1 => expr1, cond2 => expr2, ..., condN => exprN)is translated as if :: cond1 -> expr1 :: cond2 -> expr2 ... else -> exprN fi Definition at line 1207 of file SpinTrans.java. |
|
Generate the include for the never claim Definition at line 1239 of file SpinTrans.java. |
|
Return the refIndex of a state variable (it's index in the universal reference type refAny). Definition at line 1248 of file SpinTrans.java. |
|
Reset any variables that have become dead between locations. In particular, we reset a variable if it was live at fromLoc and is not live at toLoc. Definition at line 1258 of file SpinTrans.java. |
|
Run translator: generate header, definitions, state variables, transitions (processes), predicates, and the LTL property. Definition at line 1277 of file SpinTrans.java. |
|
Run SPIN to generate an analyzer (pan), and then run the analyzer. The translator must have been executed for the transition system (the file NAME.prom must exist and contain the translated PROMELA).
Definition at line 1294 of file SpinTrans.java. |
|
Build a trivial case tree with one ExprNode holding the string. Definition at line 1354 of file SpinTrans.java. |
|
Declare the state variables. Definition at line 1361 of file SpinTrans.java. |
|
Generate the threads. Each thread is a PROMELA proctype with a label for each (visible) location and an if-case for each transformation out of that location. Definition at line 1400 of file SpinTrans.java. |
|
Generate PROMELA source representing a transition system. As above, but the PROMELA is written to the PrintWriter provided.
Definition at line 1468 of file SpinTrans.java. |
|
Generate PROMELA source representing a transition system. The PROMELA is written to a file NAME.prom where NAME is the name of the transition system. A set of options can be provided in a SpinOptions object.
Definition at line 1456 of file SpinTrans.java. |
|
Generate PROMELA source representing a transition system. As above, but with default options.
Definition at line 1442 of file SpinTrans.java. |
|
Translate binary op Definition at line 1492 of file SpinTrans.java. |
|
Generate PROMELA for visible BIR location. Definition at line 1508 of file SpinTrans.java. |
|
Translate a sequence of transformations starting with the given one, continuing until we hit a visible transformation. The locSet param keeps track of the locations we've encountered in this branch (i.e., this atomic block). If we transition to an invisible location in this set, we just generate a goto to the local label for that location, otherwise we recursively call translateSeq to continue following the sequence. If we transition to a visible location, we always generate a goto to the top-level location label for that location. The guard of the transformation may be supressed by setting param supressGuard. This is used when an 'if' branch pattern is detected (two transitions, one on expression E, the other on expression !E). Definition at line 1550 of file SpinTrans.java. |
|
Translate a sequence of transformations, continuing until we hit a visible transformation. Make the sequence atomic. The 'branch' parameter is used to generate location labels that are local to this atomic block. Definition at line 1619 of file SpinTrans.java. |
|
Generate code for a single transformation (possibly suppressing the code for the guard expression). Definition at line 1632 of file SpinTrans.java. |
|
Translate unary op Definition at line 1658 of file SpinTrans.java. |