Guest User

Untitled

a guest
Feb 18th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. diff --git a/bytecomp/switch.ml b/bytecomp/switch.ml
  2. index 90dfde2..24e6d1c 100644
  3. --- a/bytecomp/switch.ml
  4. +++ b/bytecomp/switch.ml
  5. @@ -722,7 +722,7 @@ let comp_clusters ({cases=cases ; actions=actions} as s) =
  6. let make_switch {cases=cases ; actions=actions} i j =
  7. let ll,_,_ = cases.(i)
  8. and _,hh,_ = cases.(j) in
  9. - let tbl = Array.make (hh-ll+1) 0
  10. + let tbl = Array.make (hh-ll+1) (-1)
  11. and t = Hashtbl.create 17
  12. and index = ref 0 in
  13. let get_index act =
  14. @@ -742,7 +742,11 @@ let make_switch {cases=cases ; actions=actions} i j =
  15. tbl.(kk) <- index
  16. done
  17. done ;
  18. - let acts = Array.make !index actions.(0) in
  19. + let dummy = lazy (incr index; !index - 1) in
  20. + for i = 0 to Array.length tbl - 1 do
  21. + if tbl.(i) < 0 then tbl.(i) <- Lazy.force dummy
  22. + done;
  23. + let acts = Array.make !index (Arg.make_const 42) in
  24. Hashtbl.iter
  25. (fun act i -> acts.(i) <- actions.(act))
  26. t ;
Add Comment
Please, Sign In to add comment