diff options
author | Lucas Franceschino | 2024-06-03 16:53:09 +0200 |
---|---|---|
committer | Lucas Franceschino | 2024-06-03 16:53:12 +0200 |
commit | ec039b63748c2a95f89c0538a843e18d3a51cdf3 (patch) | |
tree | c094722733426709f59f38a11819df2e2dd3f481 /compiler | |
parent | 170ce1c399d3ae6b2ff9485037eae4d89e7879f2 (diff) |
feat: basic handling for `RValue::Len`, following AeneasVerif/charon#209
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/FunsAnalysis.ml | 4 | ||||
-rw-r--r-- | compiler/InterpreterExpressions.ml | 1 | ||||
-rw-r--r-- | compiler/InterpreterStatements.ml | 1 | ||||
-rw-r--r-- | compiler/InterpreterUtils.ml | 2 |
4 files changed, 6 insertions, 2 deletions
diff --git a/compiler/FunsAnalysis.ml b/compiler/FunsAnalysis.ml index eadd8f8a..815c470f 100644 --- a/compiler/FunsAnalysis.ml +++ b/compiler/FunsAnalysis.ml @@ -103,7 +103,9 @@ let analyze_module (m : crate) (funs_map : fun_decl FunDeclId.Map.t) method! visit_rvalue _env rv = match rv with - | Use _ | RvRef _ | Global _ | Discriminant _ | Aggregate _ -> () + | Use _ | RvRef _ | Global _ | Discriminant _ | Aggregate _ | Len _ + -> + () | UnaryOp (uop, _) -> can_fail := unop_can_fail uop || !can_fail | BinaryOp (bop, _, _) -> can_fail := binop_can_fail bop || !can_fail diff --git a/compiler/InterpreterExpressions.ml b/compiler/InterpreterExpressions.ml index 2223897c..56c0ab5f 100644 --- a/compiler/InterpreterExpressions.ml +++ b/compiler/InterpreterExpressions.ml @@ -816,6 +816,7 @@ let eval_rvalue_not_global (config : config) (span : Meta.span) "Unreachable: discriminant reads should have been eliminated from the \ AST" | Global _ -> craise __FILE__ __LINE__ span "Unreachable" + | Len _ -> craise __FILE__ __LINE__ span "Unhandled Len" let eval_fake_read (config : config) (span : Meta.span) (p : place) : cm_fun = fun ctx -> diff --git a/compiler/InterpreterStatements.ml b/compiler/InterpreterStatements.ml index c6a65757..c60be905 100644 --- a/compiler/InterpreterStatements.ml +++ b/compiler/InterpreterStatements.ml @@ -950,6 +950,7 @@ let rec eval_statement (config : config) (st : statement) : stl_cm_fun = let cc = match rvalue with | Global _ -> craise __FILE__ __LINE__ st.span "Unreachable" + | Len _ -> craise __FILE__ __LINE__ st.span "Unhandled Len" | Use _ | RvRef (_, (BShared | BMut | BTwoPhaseMut | BShallow)) | UnaryOp _ | BinaryOp _ | Discriminant _ | Aggregate _ -> diff --git a/compiler/InterpreterUtils.ml b/compiler/InterpreterUtils.ml index 653a0e24..f3f12906 100644 --- a/compiler/InterpreterUtils.ml +++ b/compiler/InterpreterUtils.ml @@ -291,7 +291,7 @@ let rvalue_get_place (rv : rvalue) : place option = match rv with | Use (Copy p | Move p) -> Some p | Use (Constant _) -> None - | RvRef (p, _) -> Some p + | Len (p, _, _) | RvRef (p, _) -> Some p | UnaryOp _ | BinaryOp _ | Global _ | Discriminant _ | Aggregate _ -> None (** See {!ValuesUtils.symbolic_value_has_borrows} *) |