@@ -103,14 +103,14 @@ respond stateVar =
103
103
| isJust req. stepTimeout -> pure $ Left $ RpcError. unsupportedOption (" step-timeout" :: String )
104
104
| isJust req. movingAverageStepTimeout ->
105
105
pure $ Left $ RpcError. unsupportedOption (" moving-average-step-timeout" :: String )
106
- RpcTypes. Execute req -> withModule req. _module $ \ (def, mLlvmLibrary, mSMTOptions) -> Booster.Log. withContext " execute " $ do
106
+ RpcTypes. Execute req -> withModule req. _module $ \ (def, mLlvmLibrary, mSMTOptions) -> Booster.Log. withContext CtxExecute $ do
107
107
start <- liftIO $ getTime Monotonic
108
108
-- internalise given constrained term
109
109
let internalised = runExcept $ internalisePattern DisallowAlias CheckSubsorts Nothing def req. state. term
110
110
111
111
case internalised of
112
112
Left patternError -> do
113
- void $ Booster.Log. withContext " internalise " $ logPatternError patternError
113
+ void $ Booster.Log. withContext CtxInternalise $ logPatternError patternError
114
114
pure $
115
115
Left $
116
116
RpcError. backendError $
@@ -152,7 +152,7 @@ respond stateVar =
152
152
fromIntegral (toNanoSecs (diffTimeSpec stop start)) / 1e9
153
153
else Nothing
154
154
pure $ execResponse duration req result substitution unsupported
155
- RpcTypes. AddModule RpcTypes. AddModuleRequest {_module, nameAsId = nameAsId'} -> Booster.Log. withContext " add-module " $ runExceptT $ do
155
+ RpcTypes. AddModule RpcTypes. AddModuleRequest {_module, nameAsId = nameAsId'} -> Booster.Log. withContext CtxAddModule $ runExceptT $ do
156
156
-- block other request executions while modifying the server state
157
157
state <- liftIO $ takeMVar stateVar
158
158
let nameAsId = fromMaybe False nameAsId'
@@ -213,7 +213,7 @@ respond stateVar =
213
213
Booster.Log. logMessage $
214
214
" Added a new module. Now in scope: " <> Text. intercalate " , " (Map. keys newDefinitions)
215
215
pure $ RpcTypes. AddModule $ RpcTypes. AddModuleResult moduleHash
216
- RpcTypes. Simplify req -> withModule req. _module $ \ (def, mLlvmLibrary, mSMTOptions) -> Booster.Log. withContext " simplify " $ do
216
+ RpcTypes. Simplify req -> withModule req. _module $ \ (def, mLlvmLibrary, mSMTOptions) -> Booster.Log. withContext CtxSimplify $ do
217
217
start <- liftIO $ getTime Monotonic
218
218
let internalised =
219
219
runExcept $ internaliseTermOrPredicate DisallowAlias CheckSubsorts Nothing def req. state. term
@@ -228,7 +228,7 @@ respond stateVar =
228
228
result <- case internalised of
229
229
Left patternErrors -> do
230
230
forM_ patternErrors $ \ patternError ->
231
- void $ Booster.Log. withContext " internalise " $ logPatternError patternError
231
+ void $ Booster.Log. withContext CtxInternalise $ logPatternError patternError
232
232
pure $
233
233
Left $
234
234
RpcError. backendError $
@@ -273,7 +273,7 @@ respond stateVar =
273
273
logMessage (" ignoring unsupported predicate parts" :: Text )
274
274
-- apply the given substitution before doing anything else
275
275
let predicates = map (substituteInPredicate ps. substitution) $ Set. toList ps. boolPredicates
276
- withContext " constraint " $
276
+ withContext CtxConstraint $
277
277
ApplyEquations. simplifyConstraints
278
278
def
279
279
mLlvmLibrary
@@ -305,7 +305,7 @@ respond stateVar =
305
305
pure $ second mkSimplifyResponse result
306
306
RpcTypes. GetModel req -> withModule req. _module $ \ case
307
307
(_, _, Nothing ) -> do
308
- withContext " get-model " $
308
+ withContext CtxGetModel $
309
309
logMessage' (" get-model request, not supported without SMT solver" :: Text )
310
310
pure $ Left RpcError. notImplemented
311
311
(def, _, Just smtOptions) -> do
@@ -315,7 +315,7 @@ respond stateVar =
315
315
case internalised of
316
316
Left patternErrors -> do
317
317
forM_ patternErrors $ \ patternError ->
318
- void $ Booster.Log. withContext " internalise " $ logPatternError patternError
318
+ void $ Booster.Log. withContext CtxInternalise $ logPatternError patternError
319
319
pure $
320
320
Left $
321
321
RpcError. backendError $
@@ -327,20 +327,20 @@ respond stateVar =
327
327
(boolPs, suppliedSubst) <-
328
328
case things of
329
329
TermAndPredicates pat substitution unsupported -> do
330
- withContext " get-model " $
330
+ withContext CtxGetModel $
331
331
logMessage' (" ignoring supplied terms and only checking predicates" :: Text )
332
332
333
333
unless (null unsupported) $ do
334
- withContext " get-model " $ do
334
+ withContext CtxGetModel $ do
335
335
logMessage' (" ignoring unsupported predicates" :: Text )
336
- withContext " detail " $
336
+ withContext CtxDetail $
337
337
logMessage (Text. unwords $ map prettyPattern unsupported)
338
338
pure (Set. toList pat. constraints, substitution)
339
339
Predicates ps -> do
340
340
unless (null ps. ceilPredicates && null ps. unsupported) $ do
341
- withContext " get-model " $ do
341
+ withContext CtxGetModel $ do
342
342
logMessage' (" ignoring supplied ceils and unsupported predicates" :: Text )
343
- withContext " detail " $
343
+ withContext CtxDetail $
344
344
logMessage
345
345
( Text. unlines $
346
346
map
@@ -354,8 +354,8 @@ respond stateVar =
354
354
if null boolPs && Map. null suppliedSubst
355
355
then do
356
356
-- as per spec, no predicate, no answer
357
- withContext " get-model " $
358
- withContext " smt " $
357
+ withContext CtxGetModel $
358
+ withContext CtxSMT $
359
359
logMessage (" No predicates or substitutions given, returning Unknown" :: Text )
360
360
pure $ Left SMT. Unknown
361
361
else do
@@ -365,8 +365,8 @@ respond stateVar =
365
365
case result of
366
366
Left err -> liftIO $ Exception. throw err -- fail hard on SMT errors
367
367
Right response -> pure response
368
- withContext " get-model " $
369
- withContext " smt " $
368
+ withContext CtxGetModel $
369
+ withContext CtxSMT $
370
370
logMessage $
371
371
" SMT result: " <> pack (either show ((" Subst: " <> ) . show . Map. size) smtResult)
372
372
pure . Right . RpcTypes. GetModel $ case smtResult of
@@ -413,22 +413,22 @@ respond stateVar =
413
413
{ satisfiable = RpcTypes. Sat
414
414
, substitution
415
415
}
416
- RpcTypes. Implies req -> withModule req. _module $ \ (def, mLlvmLibrary, mSMTOptions) -> Booster.Log. withContext " implies " $ do
416
+ RpcTypes. Implies req -> withModule req. _module $ \ (def, mLlvmLibrary, mSMTOptions) -> Booster.Log. withContext CtxImplies $ do
417
417
-- internalise given constrained term
418
418
let internalised =
419
419
runExcept . internalisePattern DisallowAlias CheckSubsorts Nothing def . fst . extractExistentials
420
420
421
421
case (internalised req. antecedent. term, internalised req. consequent. term) of
422
422
(Left patternError, _) -> do
423
- void $ Booster.Log. withContext " internalise " $ logPatternError patternError
423
+ void $ Booster.Log. withContext CtxInternalise $ logPatternError patternError
424
424
pure $
425
425
Left $
426
426
RpcError. backendError $
427
427
RpcError. CouldNotVerifyPattern
428
428
[ patternErrorToRpcError patternError
429
429
]
430
430
(_, Left patternError) -> do
431
- void $ Booster.Log. withContext " internalise " $ logPatternError patternError
431
+ void $ Booster.Log. withContext CtxInternalise $ logPatternError patternError
432
432
pure $
433
433
Left $
434
434
RpcError. backendError $
@@ -440,11 +440,11 @@ respond stateVar =
440
440
logMessage'
441
441
(" aborting due to unsupported predicate parts" :: Text )
442
442
unless (null unsupportedL) $
443
- withContext " detail " $
443
+ withContext CtxDetail $
444
444
logMessage
445
445
(Text. unwords $ map prettyPattern unsupportedL)
446
446
unless (null unsupportedR) $
447
- withContext " detail " $
447
+ withContext CtxDetail $
448
448
logMessage
449
449
(Text. unwords $ map prettyPattern unsupportedR)
450
450
let
0 commit comments