Skip to content

Commit

Permalink
Update cryptol and saw-core, adapt to GaloisInc/cryptol#995.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Huffman committed Jan 28, 2021
1 parent 040a23f commit 06c08d2
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion deps/cryptol
Submodule cryptol updated 74 files
+11 −0 CHANGES.md
+8 −2 cryptol-remote-api/src/CryptolServer.hs
+3 −1 cryptol-remote-api/src/CryptolServer/Data/Expression.hs
+1 −0 cryptol.cabal
+10 −0 cryptol/Main.hs
+20 −20 cryptol/REPL/Haskeline.hs
+25 −15 src/Cryptol/Backend.hs
+6 −5 src/Cryptol/Backend/Concrete.hs
+158 −57 src/Cryptol/Backend/Monad.hs
+29 −21 src/Cryptol/Backend/SBV.hs
+13 −6 src/Cryptol/Backend/What4.hs
+116 −74 src/Cryptol/Eval.hs
+145 −290 src/Cryptol/Eval/Concrete.hs
+12 −8 src/Cryptol/Eval/Env.hs
+504 −277 src/Cryptol/Eval/Generic.hs
+39 −0 src/Cryptol/Eval/Prims.hs
+4 −1 src/Cryptol/Eval/Reference.lhs
+24 −146 src/Cryptol/Eval/SBV.hs
+2 −2 src/Cryptol/Eval/Type.hs
+72 −67 src/Cryptol/Eval/Value.hs
+104 −210 src/Cryptol/Eval/What4.hs
+1 −0 src/Cryptol/IR/FreeVars.hs
+6 −8 src/Cryptol/ModuleSystem.hs
+15 −4 src/Cryptol/ModuleSystem/Base.hs
+1 −0 src/Cryptol/ModuleSystem/InstantiateModule.hs
+33 −14 src/Cryptol/ModuleSystem/Monad.hs
+2 −2 src/Cryptol/Parser.y
+2 −1 src/Cryptol/Parser/AST.hs
+1 −1 src/Cryptol/Parser/Lexer.x
+2 −0 src/Cryptol/Parser/LexerUtils.hs
+0 −1 src/Cryptol/Parser/Position.hs
+170 −102 src/Cryptol/REPL/Command.hs
+24 −9 src/Cryptol/REPL/Monad.hs
+1 −1 src/Cryptol/Symbolic.hs
+17 −10 src/Cryptol/Symbolic/SBV.hs
+13 −9 src/Cryptol/Symbolic/What4.hs
+18 −14 src/Cryptol/Testing/Random.hs
+1 −0 src/Cryptol/Transform/AddModParams.hs
+1 −0 src/Cryptol/Transform/MonoValues.hs
+4 −3 src/Cryptol/Transform/Specialize.hs
+3 −1 src/Cryptol/TypeCheck.hs
+8 −2 src/Cryptol/TypeCheck/AST.hs
+7 −2 src/Cryptol/TypeCheck/Infer.hs
+10 −2 src/Cryptol/TypeCheck/Monad.hs
+1 −0 src/Cryptol/TypeCheck/Parseable.hs
+18 −7 src/Cryptol/TypeCheck/Sanity.hs
+1 −0 src/Cryptol/TypeCheck/Subst.hs
+3 −0 src/Cryptol/TypeCheck/TypeOf.hs
+4 −4 tests/issues/T820.icry.stdout
+4 −0 tests/issues/issue066.icry.stdout
+1 −1 tests/issues/issue084.icry.stdout
+2 −2 tests/issues/issue101.icry.stdout
+7 −0 tests/issues/issue103.icry.stdout
+3 −0 tests/issues/issue211.icry.stdout
+1 −1 tests/issues/issue322.icry.stdout
+1 −1 tests/issues/issue364.icry.stdout
+11 −11 tests/issues/issue382.icry.stdout
+6 −0 tests/issues/issue413.icry.stdout
+12 −12 tests/issues/issue582.icry.stdout
+1 −1 tests/issues/issue712.icry.stdout
+1 −1 tests/issues/issue713.icry.stdout
+1 −1 tests/issues/issue746.icry.stdout
+3 −3 tests/issues/issue818.icry.stdout
+2 −2 tests/issues/issue835.icry.stdout
+10 −10 tests/issues/issue845.icry.stdout
+16 −0 tests/issues/issue861.icry.stdout
+8 −8 tests/issues/issue910.icry.stdout
+2 −2 tests/issues/issue913.icry.stdout
+8 −8 tests/regression/float.icry.stdout
+142 −142 tests/regression/instance.icry.stdout
+4 −4 tests/regression/primes.icry.stdout
+3 −3 tests/regression/repeatFields.icry.stdout
+14 −0 tests/regression/safety.icry.stdout
+11 −11 tests/regression/tc-errors.icry.stdout
5 changes: 3 additions & 2 deletions saw-remote-api/src/SAWServer/CryptolExpression.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import qualified Data.Map as Map
import Data.Maybe (fromMaybe)

import Cryptol.Eval (EvalOpts(..), defaultPPOpts)
import Cryptol.ModuleSystem (ModuleRes)
import Cryptol.ModuleSystem (ModuleRes, ModuleInput(..))
import Cryptol.ModuleSystem.Base (genInferInput, getPrimMap, noPat, rename)
import Cryptol.ModuleSystem.Env (ModuleEnv)
import Cryptol.ModuleSystem.Interface (noIfaceParams)
Expand Down Expand Up @@ -47,7 +47,8 @@ getTypedTermOfCExp ::
getTypedTermOfCExp fileReader sc cenv expr =
do let ?fileReader = fileReader
let env = eModuleEnv cenv
mres <- runModuleM (defaultEvalOpts, B.readFile, env) $
let minp = ModuleInput True defaultEvalOpts B.readFile env
mres <- runModuleM minp $
do npe <- interactive (noPat expr) -- eliminate patterns

-- resolve names
Expand Down
6 changes: 3 additions & 3 deletions saw/SAWScript/REPL/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module SAWScript.REPL.Monad (
, getSAWScriptNames
) where

import Cryptol.Eval (EvalError)
import Cryptol.Eval (EvalError, EvalErrorEx(..))
import qualified Cryptol.ModuleSystem as M
import qualified Cryptol.ModuleSystem.NamingEnv as MN
import Cryptol.ModuleSystem.NamingEnv (NamingEnv)
Expand Down Expand Up @@ -235,8 +235,8 @@ rethrowEvalError m = run `X.catch` rethrow
a <- m
return $! a

rethrow :: EvalError -> IO a
rethrow exn = X.throwIO (EvalError exn)
rethrow :: EvalErrorEx -> IO a
rethrow (EvalErrorEx _ exn) = X.throwIO (EvalError exn)



Expand Down
3 changes: 2 additions & 1 deletion src/SAWScript/AutoMatch/Cryptol.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ getDeclsCryptol :: FilePath -> IO (Interaction (Maybe [Decl]))
getDeclsCryptol path = do
let evalOpts = EvalOpts quietLogger defaultPPOpts
modEnv <- M.initialModuleEnv
(result, warnings) <- M.loadModuleByPath path (evalOpts, BS.readFile, modEnv)
let minp = M.ModuleInput True evalOpts BS.readFile modEnv
(result, warnings) <- M.loadModuleByPath path minp
return $ do
forM_ warnings $ liftF . flip Warning () . pretty
case result of
Expand Down
2 changes: 1 addition & 1 deletion src/SAWScript/Builtins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ eval_int t = do
C.Forall [] [] (isInteger -> True) -> return ()
_ -> fail "eval_int: argument is not a finite bitvector"
v <- io $ rethrowEvalError $ SV.evaluateTypedTerm sc t'
io $ C.runEval (C.bvVal <$> C.fromVWord C.Concrete "eval_int" v)
io $ C.runEval mempty (C.bvVal <$> C.fromVWord C.Concrete "eval_int" v)

-- Predicate on Cryptol types true of integer types, i.e. types
-- @[n]Bit@ for *finite* @n@.
Expand Down
2 changes: 1 addition & 1 deletion src/SAWScript/Interpreter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ print_value (VTerm t) = do
, V.useBase = ppOptsBase opts
}
evaled_t <- io $ evaluateTypedTerm sc t'
doc <- io $ V.runEval (V.ppValue V.Concrete opts' evaled_t)
doc <- io $ V.runEval mempty (V.ppValue V.Concrete opts' evaled_t)
sawOpts <- getOptions
io (rethrowEvalError $ printOutLn sawOpts Info $ show $ doc)

Expand Down
2 changes: 1 addition & 1 deletion src/SAWScript/JavaBuiltins.hs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ showCexResults vpopts sc opts ms vs exts vals = do
printOutLn vpopts Info $ "When verifying " ++ specName ms ++ ":"
printOutLn vpopts Info $ "Proof of " ++ vsVCName vs ++ " failed."
printOutLn vpopts Info $ "Counterexample:"
let showVal v = show <$> (Cryptol.runEval
let showVal v = show <$> (Cryptol.runEval mempty
(Cryptol.ppValue Cryptol.Concrete (cryptolPPOpts opts) (exportFirstOrderValue v)))
mapM_ (\(n, v) -> do vdoc <- showVal v
printOutLn vpopts Info (" " ++ n ++ ": " ++ vdoc)) vals
Expand Down
4 changes: 2 additions & 2 deletions src/SAWScript/VerificationCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ vcCounterexample sc opts (EqualityCheck nm impNode specNode) evalFn =
sv = exportValueWithSchema sschema sn
opts' = SV.cryptolPPOpts opts
-- Grr. Different pretty-printers.
lv_doc <- CV.runEval (CV.ppValue CV.Concrete opts' lv)
sv_doc <- CV.runEval (CV.ppValue CV.Concrete opts' sv)
lv_doc <- CV.runEval mempty (CV.ppValue CV.Concrete opts' lv)
sv_doc <- CV.runEval mempty (CV.ppValue CV.Concrete opts' sv)

return $
vcat
Expand Down

0 comments on commit 06c08d2

Please sign in to comment.