summaryrefslogtreecommitdiff
path: root/compiler/InterpreterExpressions.mli
diff options
context:
space:
mode:
authorSon Ho2022-11-08 16:35:55 +0100
committerSon HO2022-11-10 11:35:30 +0100
commitdcb1a77150d26875ab67b5e12cb299a3d9369d4a (patch)
treec5eba364eab9f975bf6fc454320c6e38dfb330c1 /compiler/InterpreterExpressions.mli
parent357782ba4c039ac6d83b4fd8344121e89f87eb7b (diff)
Update `switch` to have a specific treatment of ADTs
Diffstat (limited to '')
-rw-r--r--compiler/InterpreterExpressions.mli40
1 files changed, 39 insertions, 1 deletions
diff --git a/compiler/InterpreterExpressions.mli b/compiler/InterpreterExpressions.mli
index c610e939..2ea3c6df 100644
--- a/compiler/InterpreterExpressions.mli
+++ b/compiler/InterpreterExpressions.mli
@@ -11,6 +11,41 @@ module S = SynthesizeSymbolic
open Cps
open InterpreterPaths
+(** Read a place (CPS-style function).
+
+ We also check that the value *doesn't contain bottoms or reserved
+ borrows*.
+
+ This function doesn't reorganize the context to make sure we can read
+ the place. If needs be, you should call {!update_ctx_along_read_place} first.
+ *)
+val read_place :
+ C.config -> access_kind -> E.place -> (V.typed_value -> m_fun) -> m_fun
+
+(** Auxiliary function.
+
+ Prepare the access to a place in a right-value (typically an operand) by
+ reorganizing the environment.
+
+ We reorganize the environment so that:
+ - we can access the place (we prepare *along* the path)
+ - the value at the place itself doesn't contain loans (the [access_kind]
+ controls whether we only end mutable loans, or also shared loans).
+
+ We also check, after the reorganization, that the value at the place
+ *doesn't contain any bottom nor reserved borrows*.
+
+ [expand_prim_copy]: if [true], expand the symbolic values which are
+ primitively copyable and contain borrows.
+ *)
+val access_rplace_reorganize_and_read :
+ C.config ->
+ bool ->
+ access_kind ->
+ E.place ->
+ (V.typed_value -> m_fun) ->
+ m_fun
+
(** Evaluate an operand.
Reorganize the context, then evaluate the operand.
@@ -26,9 +61,12 @@ val eval_operand : C.config -> E.operand -> (V.typed_value -> m_fun) -> m_fun
val eval_operands :
C.config -> E.operand list -> (V.typed_value list -> m_fun) -> m_fun
-(** Evaluate an rvalue which is not a global.
+(** Evaluate an rvalue which is not a global (globals are handled elsewhere).
Transmits the computed rvalue to the received continuation.
+
+ Note that this function fails on {!E.Discriminant}: discriminant reads should
+ have been eliminated from the AST.
*)
val eval_rvalue_not_global :
C.config -> E.rvalue -> ((V.typed_value, eval_error) result -> m_fun) -> m_fun