Skip to content

Commit

Permalink
fix reviewers' comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferinko committed Mar 1, 2023
1 parent 156a312 commit e490654
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/Horus/CFGBuild.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Horus.CFGBuild
where

import Control.Arrow (Arrow (second))
import Control.Monad (unless, when)
import Control.Monad (when)
import Control.Monad.Except (MonadError (..))
import Control.Monad.Free.Church (F, liftF)
import Data.Coerce (coerce)
Expand Down Expand Up @@ -160,8 +160,9 @@ getSalientVertex :: Label -> CFGBuildL Vertex
getSalientVertex l = do
verts <- filter (not . isOptimising) <$> getVerts l
-- This can be at most one, so len <> 1 implies there are no vertices
unless (length verts == 1) . throw $ "No vertex with label: " <> tShow l
pure $ head verts
case verts of
[vert] -> pure vert
_ -> throw $ "No vertex with label: " <> tShow l

throw :: Text -> CFGBuildL a
throw t = liftF' (Throw t)
Expand Down
4 changes: 2 additions & 2 deletions src/Horus/CFGBuild/Runner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ verticesLabelledBy cfg l = [v | v <- cfg_vertices cfg, v_label v == l]
interpret :: CFGBuildL a -> Impl a
interpret = iterM exec . runCFGBuildL
where
exec (AddVertex l isOptimizing cont) = do
exec (AddVertex l optimises cont) = do
freshVal <- cfgVertexCounter <%= succ
let newVertex = Vertex (Text.pack (show freshVal)) l isOptimizing
let newVertex = Vertex (Text.pack (show freshVal)) l optimises
vs <- gets cfg_vertices
-- Currently, the design is such that it is convenient to be able to distinguish
-- 'the unique vertex the entire codebase relies on' from vertices that exist
Expand Down
10 changes: 3 additions & 7 deletions src/Horus/CairoSemantics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Data.Traversable (for)
import Lens.Micro ((^.), _1)

import Horus.CallStack as CS (CallEntry, CallStack)
import Horus.Expr (Cast (..), Expr (ExistsFelt, (:+)), Ty (..), (.&&), (./=), (.<), (.<=), (.==), (.=>), (.||))
import Horus.Expr (Cast (..), Expr ((:+)), Ty (..), (.&&), (./=), (.<), (.<=), (.==), (.=>), (.||))
import Horus.Expr qualified as Expr
import Horus.Expr qualified as TSMT
import Horus.Expr.Util (gatherLogicalVariables, suffixLogicalVariables)
Expand Down Expand Up @@ -227,12 +227,8 @@ preparePost ap fp expr isOptim = do
then do
memVars <- getMemVars
post <- storageRemoval expr
($ memVars) <$> exMemoryRemoval (substitute "fp" fp (substitute "ap" ap (sansExists post)))
else prepare' ap fp $ sansExists expr
where
sansExists e = case e of
ExistsFelt _ innerExpr -> innerExpr
_ -> e
($ memVars) <$> exMemoryRemoval (substitute "fp" fp (substitute "ap" ap post))
else prepare' ap fp expr

encodeApTracking :: Text -> ApTracking -> Expr TFelt
encodeApTracking traceDescr ApTracking{..} =
Expand Down

0 comments on commit e490654

Please sign in to comment.