aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/cbytegen.ml
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2017-07-30 16:10:14 +0200
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2018-03-03 18:05:56 +0100
commite82856f3108a25f7b0cabff4190bc56d3a0cafa1 (patch)
tree712336a242276c7ceb9dcde72999ad0769faa669 /kernel/cbytegen.ml
parentdf9d3a36e71d6d224286811fdc529ad5a955deb7 (diff)
Handling evars in the VM.
We simply treat them as as an application of an atom to its instance, and in the decompilation phase we reconstruct the instance from the stack. This grants wish BZ#5659.
Diffstat (limited to 'kernel/cbytegen.ml')
-rw-r--r--kernel/cbytegen.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/cbytegen.ml b/kernel/cbytegen.ml
index 3104d5751..3619bb94e 100644
--- a/kernel/cbytegen.ml
+++ b/kernel/cbytegen.ml
@@ -257,6 +257,15 @@ let pos_universe_var i r sz =
r.in_env := push_fv db env;
Kenvacc(r.offset + pos)
+let pos_evar evk r =
+ let env = !(r.in_env) in
+ let cid = FVevar evk in
+ try Kenvacc(r.offset + find_at cid env)
+ with Not_found ->
+ let pos = env.size in
+ r.in_env := push_fv cid env;
+ Kenvacc (r.offset + pos)
+
(*i Examination of the continuation *)
(* Discard all instructions up to the next label. *)
@@ -427,6 +436,7 @@ let compile_fv_elem reloc fv sz cont =
| FVrel i -> pos_rel i reloc sz :: cont
| FVnamed id -> pos_named id reloc :: cont
| FVuniv_var i -> pos_universe_var i reloc sz :: cont
+ | FVevar evk -> pos_evar evk reloc :: cont
let rec compile_fv reloc l sz cont =
match l with
@@ -471,6 +481,12 @@ let rec compile_lam env reloc lam sz cont =
| Lvar id -> pos_named id reloc :: cont
+ | Levar (evk, args) ->
+ if Array.is_empty args then
+ compile_fv_elem reloc (FVevar evk) sz cont
+ else
+ comp_app compile_fv_elem (compile_lam env) reloc (FVevar evk) args sz cont
+
| Lconst (kn,u) -> compile_constant env reloc kn u [||] sz cont
| Lind (ind,u) ->