@@ -67,6 +67,7 @@ import Booster.Prettyprinter (renderOneLineText)
6767import Booster.SMT.Interface qualified as SMT
6868import Booster.Syntax.Json.Externalise (externaliseTerm )
6969import Booster.Util (Bound (.. ))
70+ import Kore.JsonRpc.Types.ContextLog (CLContext (CLWithId ), IdContext (CtxCached ))
7071import Kore.Util (showHashHex )
7172
7273newtype EquationT io a
@@ -165,6 +166,10 @@ instance Monoid SimplifierCache where
165166data CacheTag = LLVM | Equations
166167 deriving stock (Show )
167168
169+ instance ContextFor CacheTag where
170+ withContextFor t =
171+ withContext_ (CLWithId . CtxCached $ Text. toLower $ Text. pack $ show t)
172+
168173data EquationMetadata = EquationMetadata
169174 { location :: Maybe Location
170175 , label :: Maybe Label
@@ -351,7 +356,7 @@ llvmSimplify term = do
351356 where
352357 evalLlvm definition api cb t@ (Term attributes _)
353358 | attributes. isEvaluated = pure t
354- | isConcrete t && attributes. canBeEvaluated = withContext CtxLlvm $ do
359+ | isConcrete t && attributes. canBeEvaluated = withContext CtxLlvm . withTermContext t $ do
355360 LLVM. simplifyTerm api definition t (sortOfTerm t)
356361 >>= \ case
357362 Left (LlvmError e) -> do
@@ -531,10 +536,11 @@ cached cacheTag cb t@(Term attributes _)
531536 Just cachedTerm -> do
532537 when (t /= cachedTerm) $ do
533538 setChanged
534- withContext CtxSuccess $
535- withContext CtxCached $
536- withTermContext cachedTerm $
537- pure ()
539+ withTermContext t $
540+ withContext CtxSuccess $
541+ withContextFor cacheTag $
542+ withTermContext cachedTerm $
543+ pure ()
538544 pure cachedTerm
539545
540546elseApply :: (Monad m , Eq b ) => (b -> m b ) -> (b -> m b ) -> b -> m b
0 commit comments