@@ -94498,18 +94498,18 @@ end = struct
9449894498 TODO:
9449994499 we should have a pass called, always inlinable
9450094500 as long as its length is smaller than [exit=exit_id], for example
94501-
94501+
9450294502 {[
94503- switch(box_name)
94503+ switch(box_name)
9450494504 {case "":exit=178;break;
9450594505 case "b":exit=178;break;
9450694506 case "h":box_type=/* Pp_hbox */0;break;
9450794507 case "hov":box_type=/* Pp_hovbox */3;break;
9450894508 case "hv":box_type=/* Pp_hvbox */2;break;
9450994509 case "v":box_type=/* Pp_vbox */1;break;
9451094510 default:box_type=invalid_box(/* () */0);}
94511-
94512- switch(exit){case 178:box_type=/* Pp_box */4;break}
94511+
94512+ switch(exit){case 178:box_type=/* Pp_box */4;break}
9451394513 ]}
9451494514*)
9451594515
@@ -94591,14 +94591,15 @@ let count_helper (lam : Lam.t) : int ref Int_hashtbl.t =
9459194591 if
9459294592 nconsts < sw.sw_numconsts && nblocks < sw.sw_numblocks
9459394593 then
94594- begin (* default action will occur twice in native code *)
94595- count al ; count al
94596- (**
94594+ (*
9459794595 Reason: for pattern match,
9459894596 we will test whether it is
9459994597 an integer or block, both have default cases
9460094598 predicate: [sw_numconsts] vs nconsts
9460194599 *)
94600+
94601+ begin
94602+ count al ; count al
9460294603 end
9460394604 else
9460494605 begin (* default action will occur once *)
@@ -94632,7 +94633,7 @@ type subst_tbl = (Ident.t list * Lam.t) Int_hashtbl.t
9463294633*)
9463394634
9463494635
94635- let subst_helper (subst : subst_tbl) query lam =
94636+ let subst_helper (subst : subst_tbl) ( query : int -> int) lam =
9463694637 let rec simplif (lam : Lam.t) =
9463794638 match lam with
9463894639 | Lstaticraise (i,[]) ->
@@ -94653,7 +94654,7 @@ let subst_helper (subst : subst_tbl) query lam =
9465394654 List.fold_right2
9465494655 (fun y l r -> Lam.let_ Alias y l r)
9465594656 ys ls
94656- (Lam_util.subst_lambda env handler)
94657+ (Lam_util.subst_lambda env handler)
9465794658 | None -> Lam.staticraise i ls
9465894659 end
9465994660 | Lstaticcatch (l1,(i,[]),(Lstaticraise (j,[]) as l2)) ->
@@ -94707,12 +94708,12 @@ let subst_helper (subst : subst_tbl) query lam =
9470794708 *)
9470894709 let lam_size = Lam_analysis.size l2 in
9470994710 let ok_to_inline =
94710- i >=0 &&
94711- ( (j <= 2 && lam_size < Lam_analysis.exit_inline_size )
94712- || lam_size < 5)
94713- (*TODO: when we do the case merging on the js side,
94714- the j is not very indicative
94715- *)
94711+ i >=0 &&
94712+ ( (j <= 2 && lam_size < Lam_analysis.exit_inline_size )
94713+ || lam_size < 5)
94714+ (*TODO: when we do the case merging on the js side,
94715+ the j is not very indicative
94716+ *)
9471694717 in
9471794718 if ok_to_inline (* && false *)
9471894719 then
@@ -94742,20 +94743,20 @@ let subst_helper (subst : subst_tbl) query lam =
9474294743 and new_consts = List.map (fun (n, e) -> (n, simplif e)) sw.sw_consts
9474394744 and new_blocks = List.map (fun (n, e) -> (n, simplif e)) sw.sw_blocks
9474494745 and new_fail =
94745- begin match sw.sw_failaction with
94746- | None -> None
94747- | Some x -> Some (simplif x) end in
94746+ begin match sw.sw_failaction with
94747+ | None -> None
94748+ | Some x -> Some (simplif x) end in
9474894749 Lam.switch
9474994750 new_l
94750- {
94751- sw with
94752- sw_consts = new_consts ;
94753- sw_blocks = new_blocks;
94754- sw_failaction = new_fail}
94751+ {
94752+ sw with
94753+ sw_consts = new_consts ;
94754+ sw_blocks = new_blocks;
94755+ sw_failaction = new_fail}
9475594756 | Lstringswitch(l,sw,d) ->
9475694757 Lam.stringswitch
9475794758 (simplif l) (List.map (fun (s,l) -> s,simplif l) sw)
94758- (begin match d with None -> None | Some d -> Some (simplif d) end)
94759+ (begin match d with None -> None | Some d -> Some (simplif d) end)
9475994760 | Ltrywith (l1, v, l2) ->
9476094761 Lam.try_ (simplif l1) v (simplif l2)
9476194762 | Lifthenelse (l1, l2, l3) ->
@@ -94772,7 +94773,7 @@ let subst_helper (subst : subst_tbl) query lam =
9477294773 Lam.ifused v (simplif l)
9477394774 in
9477494775 simplif lam
94775-
94776+
9477694777let simplify_exits (lam : Lam.t) =
9477794778 let exits = count_helper lam in
9477894779 subst_helper (Int_hashtbl.create 17 ) (count_exit exits) lam
0 commit comments