-
Notifications
You must be signed in to change notification settings - Fork 54
Add Prover Based ShutdownManager #489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
b8ccbe0
7422f4c
a43d183
5af69e6
2b81ac8
92f2f60
b048f56
e73b889
ba6c2bc
28d5648
5de5971
0f8e757
1b6f52b
77ab3d6
223624c
55f8e08
6613b21
843b0ee
e6587bd
418bc8b
c85042b
2fe5c2b
028ef5b
b122b50
b1ad38f
856d3b6
3b16949
fa7dfb2
37a58ee
3538fdc
9e6d0ba
02bdda9
30a74dd
1812dfc
17ec72e
5a20e6d
0b95f11
1cd34dd
c85c030
407f52a
384c7b1
97c44b6
cfa1cdb
799385c
b4fbc2f
1f5c866
676aebb
65407fb
2e83b93
ee5eee0
c1dc784
41daa1f
d06d41c
4a4cac8
0c683e8
79ba7d7
295e01a
a9023f9
3ca9316
9e63816
ac5be00
1d9ec5a
e4bf4e8
f16f77d
1ab6955
fc323b9
1b268a3
c4a7a65
b7da958
50094eb
89837d5
dbbdc31
b0e7b44
0ca8d4f
cd51b02
898832d
c900399
2166410
64b21b3
cd3ef20
477efd0
ca14eff
4b429db
d447902
22bc811
a75ec8a
5f30d42
b8c9a06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| import java.util.Optional; | ||
| import java.util.Set; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
| import org.sosy_lab.common.ShutdownManager; | ||
| import org.sosy_lab.common.ShutdownNotifier; | ||
| import org.sosy_lab.java_smt.api.BooleanFormula; | ||
| import org.sosy_lab.java_smt.api.Model; | ||
|
|
@@ -38,7 +39,10 @@ class BitwuzlaTheoremProver extends AbstractProverWithAllSat<Void> implements Pr | |
| new Terminator() { | ||
| @Override | ||
| public boolean terminate() { | ||
| return shutdownNotifier.shouldShutdown(); // shutdownNotifer is defined in the superclass | ||
| return proverShutdownManager | ||
| .getNotifier() | ||
| .shouldShutdown(); // shutdownNotifer is defined in the | ||
| // superclass | ||
|
||
| } | ||
| }; | ||
| private final Bitwuzla env; | ||
|
|
@@ -119,7 +123,8 @@ private boolean readSATResult(Result resultValue) throws SolverException, Interr | |
| return false; | ||
| } else if (resultValue == Result.UNSAT) { | ||
| return true; | ||
| } else if (resultValue == Result.UNKNOWN && shutdownNotifier.shouldShutdown()) { | ||
| } else if (resultValue == Result.UNKNOWN | ||
| && proverShutdownManager.getNotifier().shouldShutdown()) { | ||
|
||
| throw new InterruptedException(); | ||
| } else { | ||
| throw new SolverException("Bitwuzla returned UNKNOWN."); | ||
|
|
@@ -246,6 +251,11 @@ protected BitwuzlaModel getEvaluatorWithoutChecks() { | |
| Collections2.transform(getAssertedFormulas(), creator::extractInfo))); | ||
| } | ||
|
|
||
| @Override | ||
| public ShutdownManager getShutdownManagerForProver() throws UnsupportedOperationException { | ||
| return proverShutdownManager; | ||
| } | ||
|
||
|
|
||
| public boolean isClosed() { | ||
| return closed; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,7 +49,7 @@ protected BoolectorAbstractProver( | |
| this.manager = manager; | ||
| this.creator = creator; | ||
| this.btor = btor; | ||
| terminationCallback = shutdownNotifier::shouldShutdown; | ||
| terminationCallback = proverShutdownManager.getNotifier()::shouldShutdown; | ||
|
||
| terminationCallbackHelper = addTerminationCallback(); | ||
|
|
||
| isAnyStackAlive = pIsAnyStackAlive; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import java.util.Optional; | ||
| import java.util.Set; | ||
| import org.checkerframework.checker.nullness.qual.Nullable; | ||
| import org.sosy_lab.common.ShutdownManager; | ||
| import org.sosy_lab.common.ShutdownNotifier; | ||
| import org.sosy_lab.java_smt.api.BasicProverEnvironment; | ||
| import org.sosy_lab.java_smt.api.BooleanFormula; | ||
|
|
@@ -202,11 +203,12 @@ public boolean isUnsat() throws InterruptedException, SolverException { | |
| } | ||
|
|
||
| Result result; | ||
| try (ShutdownHook hook = new ShutdownHook(shutdownNotifier, smtEngine::interrupt)) { | ||
| shutdownNotifier.shutdownIfNecessary(); | ||
| try (ShutdownHook hook = | ||
| new ShutdownHook(proverShutdownManager.getNotifier(), smtEngine::interrupt)) { | ||
| proverShutdownManager.getNotifier().shutdownIfNecessary(); | ||
| result = smtEngine.checkSat(); | ||
| } | ||
| shutdownNotifier.shutdownIfNecessary(); | ||
| proverShutdownManager.getNotifier().shutdownIfNecessary(); | ||
|
||
| return convertSatResult(result); | ||
| } | ||
|
|
||
|
|
@@ -260,4 +262,9 @@ public void close() { | |
| } | ||
| super.close(); | ||
| } | ||
|
|
||
| @Override | ||
| public ShutdownManager getShutdownManagerForProver() throws UnsupportedOperationException { | ||
| return proverShutdownManager; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.