summaryrefslogtreecommitdiff
path: root/asmcomp/split.ml
diff options
context:
space:
mode:
authorLuc Maranget <luc.maranget@inria.fr>2000-08-11 19:50:59 +0000
committerLuc Maranget <luc.maranget@inria.fr>2000-08-11 19:50:59 +0000
commitd043fecf185164dcb2114e3617345624caeb28c8 (patch)
tree6603bc4a816c58efa6b3b9d831a8e0e19190da3c /asmcomp/split.ml
parent3ad649f365636b4f39e26d96b23eb8ddfc4101d2 (diff)
downloadocaml-d043fecf185164dcb2114e3617345624caeb28c8.tar.gz
new or-pat compilation + exhaustiveness used in compilation
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3273 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp/split.ml')
-rw-r--r--asmcomp/split.ml24
1 files changed, 15 insertions, 9 deletions
diff --git a/asmcomp/split.ml b/asmcomp/split.ml
index 51f19238aa..06a09ed04d 100644
--- a/asmcomp/split.ml
+++ b/asmcomp/split.ml
@@ -113,7 +113,12 @@ let merge_subst_array subv instr =
(* First pass: rename registers at reload points *)
-let exit_subst = ref (None: subst option)
+let exit_subst = ref []
+
+let find_exit_subst k =
+ try
+ List.assoc k !exit_subst with
+ | Not_found -> Misc.fatal_error "Split.find_exit_subst"
let rec rename i sub =
match i.desc with
@@ -159,19 +164,20 @@ let rec rename i sub =
let (new_next, sub_next) = rename i.next (merge_substs sub sub_body i) in
(instr_cons (Iloop(new_body)) [||] [||] new_next,
sub_next)
- | Icatch(body, handler) ->
- let saved_exit_subst = !exit_subst in
- exit_subst := None;
+ | Icatch(nfail, body, handler) ->
+ let new_subst = ref None in
+ exit_subst := (nfail, new_subst) :: !exit_subst ;
let (new_body, sub_body) = rename body sub in
- let sub_entry_handler = !exit_subst in
- exit_subst := saved_exit_subst;
+ let sub_entry_handler = !new_subst in
+ exit_subst := List.tl !exit_subst;
let (new_handler, sub_handler) = rename handler sub_entry_handler in
let (new_next, sub_next) =
rename i.next (merge_substs sub_body sub_handler i.next) in
- (instr_cons (Icatch(new_body, new_handler)) [||] [||] new_next,
+ (instr_cons (Icatch(nfail, new_body, new_handler)) [||] [||] new_next,
sub_next)
- | Iexit ->
- exit_subst := merge_substs !exit_subst sub i;
+ | Iexit nfail ->
+ let r = find_exit_subst nfail in
+ r := merge_substs !r sub i;
(i, None)
| Itrywith(body, handler) ->
let (new_body, sub_body) = rename body sub in