Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
spins-ltsmin-deb
Commits
b543e6c6
Commit
b543e6c6
authored
Mar 31, 2016
by
Alfons Laarman
Browse files
Option ignore atomics
Better for LTSmin POR and symbolic
parent
86170828
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/spins/Compile.java
View file @
b543e6c6
...
...
@@ -35,6 +35,7 @@ import spins.promela.compiler.Preprocessor;
import
spins.promela.compiler.Preprocessor.DefineMapping
;
import
spins.promela.compiler.Proctype
;
import
spins.promela.compiler.Specification
;
import
spins.promela.compiler.automaton.State
;
import
spins.promela.compiler.expression.Expression
;
import
spins.promela.compiler.ltsmin.LTSminPrinter
;
import
spins.promela.compiler.ltsmin.LTSminTreeWalker
;
...
...
@@ -59,8 +60,8 @@ import spins.promela.compiler.parser.TokenMgrError;
public
class
Compile
{
private
static
Specification
compile
(
final
File
promFile
,
final
boolean
useStateMerging
,
final
boolean
verbose
)
{
LTSminDebug
debug
=
new
LTSminDebug
(
verbose
);
final
Options
opts
)
{
LTSminDebug
debug
=
new
LTSminDebug
(
opts
.
verbose
);
try
{
Preprocessor
.
setFilename
(
promFile
.
getName
());
String
path
=
promFile
.
getAbsoluteFile
().
getParent
();
...
...
@@ -73,6 +74,19 @@ public class Compile {
debug
.
say
(
"Parsing "
+
promFile
.
getName
()
+
" done (%s sec)"
,
report
.
stopTimer
().
sec
());
debug
.
say
(
""
);
if
(
opts
.
no_atomic
)
{
for
(
Proctype
p
:
spec
.
getProcs
())
{
for
(
State
s
:
p
.
getAutomaton
())
{
s
.
setInAtomic
(
false
);
}
}
if
(
spec
.
getNever
()
!=
null
)
{
for
(
State
s
:
spec
.
getNever
().
getAutomaton
())
{
s
.
setInAtomic
(
false
);
}
}
}
report
.
resetTimer
().
startTimer
();
debug
.
say
(
"Optimizing graphs..."
);
...
...
@@ -193,6 +207,10 @@ public class Compile {
"compilation process."
);
parser
.
addOption
(
verbose
);
final
BooleanOption
no_atomic
=
new
BooleanOption
(
'i'
,
"Ignore atomic sections (better for LTSmin POR and symbolic tools)."
);
parser
.
addOption
(
no_atomic
);
parser
.
parse
(
args
);
final
List
<
String
>
files
=
parser
.
getFiles
();
...
...
@@ -248,8 +266,12 @@ public class Compile {
System
.
exit
(
0
);
}
Options
opts
=
new
Options
(
verbose
.
isSet
(),
no_guards
.
isSet
(),
must_write
.
isSet
(),
!
no_cnf
.
isSet
(),
nonever
.
isSet
(),
java
.
isSet
(),
no_atomic
.
isSet
());
final
Specification
spec
=
Compile
.
compile
(
file
,
!
optimalizations
.
isSet
(
"3"
),
verbose
.
isSet
()
);
Compile
.
compile
(
file
,
!
optimalizations
.
isSet
(
"3"
),
opts
);
if
(
nonever
.
isSet
())
spec
.
setNever
(
null
);
if
(
spec
==
null
)
{
...
...
@@ -275,9 +297,6 @@ public class Compile {
System
.
out
.
println
(
""
);
}
Options
opts
=
new
Options
(
verbose
.
isSet
(),
no_guards
.
isSet
(),
must_write
.
isSet
(),
!
no_cnf
.
isSet
(),
nonever
.
isSet
(),
java
.
isSet
());
File
outputDir
=
new
File
(
System
.
getProperty
(
"user.dir"
));
if
(
dot
.
isSet
())
{
...
...
@@ -380,13 +399,12 @@ public class Compile {
boolean
ltsmin_ltl
,
Options
opts
,
Map
<
String
,
Expression
>
exports
,
Expression
progress
)
{
LTSminTreeWalker
walker
=
new
LTSminTreeWalker
(
spec
,
ltsmin_ltl
);
LTSminModel
model
=
walker
.
createLTSminModel
(
name
,
opts
,
exports
,
progress
);
String
code
=
LTSminPrinter
.
generateCode
(
model
,
opts
);
final
File
javaFile
=
new
File
(
outputDir
,
name
+
".spins.c"
);
try
{
final
FileOutputStream
fos
=
new
FileOutputStream
(
javaFile
);
LTSminTreeWalker
walker
=
new
LTSminTreeWalker
(
spec
,
ltsmin_ltl
);
LTSminModel
model
=
walker
.
createLTSminModel
(
name
,
opts
,
exports
,
progress
);
String
code
=
LTSminPrinter
.
generateCode
(
model
,
opts
);
fos
.
write
(
code
.
getBytes
());
fos
.
flush
();
fos
.
close
();
...
...
src/spins/promela/compiler/ltsmin/LTSminDMWalker.java
View file @
b543e6c6
...
...
@@ -98,7 +98,7 @@ public class LTSminDMWalker {
}
private
static
RWMatrix
DUMMY_MATRIX
=
new
RWMatrix
(
null
,
null
,
null
);
private
static
Options
DUMMY_OPTIONS
=
new
Options
(
false
,
false
,
false
,
false
,
false
,
false
);
private
static
Options
DUMMY_OPTIONS
=
new
Options
(
false
,
false
,
false
,
false
,
false
,
false
,
false
);
private
static
Params
sParams
=
new
Params
(
null
,
null
,
DUMMY_MATRIX
,
0
,
DUMMY_OPTIONS
);
public
static
void
walkOneGuard
(
LTSminModel
model
,
DepMatrix
dm
,
...
...
src/spins/promela/compiler/ltsmin/LTSminTreeWalker.java
View file @
b543e6c6
...
...
@@ -171,13 +171,14 @@ public class LTSminTreeWalker {
public
static
class
Options
{
public
Options
(
boolean
verbose
,
boolean
no_gm
,
boolean
must_write
,
boolean
cnf
,
boolean
nonever
,
boolean
unless_java_semantics
)
{
boolean
unless_java_semantics
,
boolean
no_atomic
)
{
this
.
verbose
=
verbose
;
this
.
no_gm
=
no_gm
;
this
.
must_write
=
must_write
;
this
.
cnf
=
cnf
;
this
.
nonever
=
nonever
;
this
.
unless_java_semantics
=
unless_java_semantics
;
this
.
no_atomic
=
no_atomic
;
}
public
boolean
nonever
=
false
;
public
boolean
verbose
=
false
;
...
...
@@ -185,6 +186,7 @@ public class LTSminTreeWalker {
public
boolean
must_write
=
false
;
public
boolean
cnf
=
false
;
public
boolean
unless_java_semantics
=
false
;
public
boolean
no_atomic
=
false
;
}
TimeoutExpression
timeout
=
null
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment