aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorGuillaume Melquiond2020-08-30 10:31:02 +0200
committerGuillaume Melquiond2020-11-13 15:13:23 +0100
commit203211090f9e67750a0f953d6dbefe5045271921 (patch)
tree2d2ba9f0fbf49f1f831227aeb36f21c29ab1163d /kernel
parentaebc10aab3581a0561f96de6b5db6d530a65e658 (diff)
Restore discard_dead_code and use it to simplify match-with constructs.
Otherwise, these constructs would be followed by a spurious Kreturn opcode, when in tail position.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/vmbytegen.ml7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/vmbytegen.ml b/kernel/vmbytegen.ml
index 6899ebe1a6..489929d2be 100644
--- a/kernel/vmbytegen.ml
+++ b/kernel/vmbytegen.ml
@@ -315,12 +315,10 @@ let pos_evar evk r =
(* non-terminating instruction (branch, raise, return, appterm) *)
(* in front of it. *)
-let discard_dead_code cont = cont
-(*function
- [] -> []
+let rec discard_dead_code = function
+ | [] -> []
| (Klabel _ | Krestart ) :: _ as cont -> cont
| _ :: cont -> discard_dead_code cont
-*)
(* Return a label to the beginning of the given continuation. *)
(* If the sequence starts with a branch, use the target of that branch *)
@@ -700,6 +698,7 @@ let rec compile_lam env cenv lam sz cont =
| _ -> assert false
in
+ let cont = discard_dead_code cont in
let c = ref cont in
(* Perform the extra match if needed (too many block constructors) *)
if neblock <> 0 then begin