Skip to content

Commit

Permalink
Merge branch 'master' into 4012-evaluate-pattern-pruning
Browse files Browse the repository at this point in the history
  • Loading branch information
PetarMax authored Aug 8, 2024
2 parents 8312613 + 9f70027 commit ceb3c1e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 9 additions & 0 deletions booster/library/Booster/CLOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,15 @@ parseSMTOptions =
\Example: '(check-sat-using smt)' (i.e., plain 'check-sat')"
)
)
<*> many
( strOption
( metavar "SMT_ARG"
<> long "smt-arg"
<> help
( "Arguments to be passed to the SMT solver process"
)
)
)
)
where
smtDefaults = defaultSMTOptions
Expand Down
2 changes: 1 addition & 1 deletion booster/library/Booster/SMT/Interface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ hardResetSolver = do
Just solverRef -> do
closeContext ctxt
Log.logMessage ("Restarting SMT solver" :: Text)
(solver, handle) <- connectToSolver
(solver, handle) <- connectToSolver ctxt.options.args
liftIO $ do
writeIORef solverRef solver
writeIORef ctxt.solverClose $ Backend.close handle
Expand Down
10 changes: 6 additions & 4 deletions booster/library/Booster/SMT/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ data SMTOptions = SMTOptions
-- ^ optional retry. Nothing for no retry, 0 for unlimited
, tactic :: Maybe SExpr
-- ^ optional tactic (used verbatim) to replace (check-sat)
, args :: [String]
}
deriving (Eq, Show)

Expand All @@ -70,6 +71,7 @@ defaultSMTOptions =
, timeout = 125
, retryLimit = Just 3
, tactic = Nothing
, args = []
}

data SMTContext = SMTContext
Expand Down Expand Up @@ -97,7 +99,7 @@ mkContext ::
io SMTContext
mkContext opts prelude = do
logMessage ("Starting SMT solver" :: Text)
(solver', handle) <- connectToSolver
(solver', handle) <- connectToSolver opts.args
solver <- liftIO $ newIORef solver'
solverClose <- liftIO $ newIORef $ Backend.close handle
mbTranscriptHandle <- forM opts.transcript $ \path -> do
Expand Down Expand Up @@ -141,9 +143,9 @@ destroyContext ctxt = do
hClose h
liftIO $ join $ readIORef ctxt.solverClose

connectToSolver :: LoggerMIO io => io (Backend.Solver, Backend.Handle)
connectToSolver = do
let config = Backend.defaultConfig
connectToSolver :: LoggerMIO io => [String] -> io (Backend.Solver, Backend.Handle)
connectToSolver args = do
let config = Backend.defaultConfig{Backend.args = args <> Backend.defaultConfig.args}
handle <- liftIO $ Backend.new config
solver <- liftIO $ Backend.initSolver Backend.Queuing $ Backend.toBackend handle
pure (solver, handle)
Expand Down

0 comments on commit ceb3c1e

Please sign in to comment.