From 86ce05ee637130300b174551fd708206f489784b Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Tue, 1 Aug 2023 15:21:40 +0200 Subject: [PATCH] better limit for try-catch --- compiler/lib/structure.ml | 51 +- compiler/tests-compiler/exceptions.ml | 12 +- compiler/tests-full/stdlib.cma.expected.js | 920 ++++++++++----------- 3 files changed, 453 insertions(+), 530 deletions(-) diff --git a/compiler/lib/structure.ml b/compiler/lib/structure.ml index 8d6b59940b..88d799023b 100644 --- a/compiler/lib/structure.ml +++ b/compiler/lib/structure.ml @@ -17,12 +17,6 @@ let reverse_graph g = g; g' -let rec leave_try_body blocks pc = - match Addr.Map.find pc blocks with - | { body = []; branch = (Return _ | Stop), _; _ } -> false - | { body = []; branch = Branch (pc', _), _; _ } -> leave_try_body blocks pc' - | _ -> true - type graph = (Addr.t, Addr.Set.t) Hashtbl.t type t = @@ -44,10 +38,30 @@ let is_backward g pc pc' = Hashtbl.find g.block_order pc >= Hashtbl.find g.block let is_forward g pc pc' = Hashtbl.find g.block_order pc < Hashtbl.find g.block_order pc' +(* pc has at least two forward edges moving into it *) +let is_merge_node' block_order preds pc = + let s = try Hashtbl.find preds pc with Not_found -> Addr.Set.empty in + let o = Hashtbl.find block_order pc in + let n = + Addr.Set.fold (fun pc' n -> if Hashtbl.find block_order pc' < o then n + 1 else n) s 0 + in + n > 1 + +let rec leave_try_body block_order preds blocks pc = + if is_merge_node' block_order preds pc + then false + else + match Addr.Map.find pc blocks with + | { body = []; branch = (Return _ | Stop), _; _ } -> false + | { body = []; branch = Branch (pc', _), _; _ } -> + leave_try_body block_order preds blocks pc' + | _ -> true + let build_graph blocks pc = let succs = Hashtbl.create 16 in let l = ref [] in let visited = Hashtbl.create 16 in + let poptraps = ref [] in let rec traverse ~englobing_exn_handlers pc = if not (Hashtbl.mem visited pc) then ( @@ -65,13 +79,7 @@ let build_graph blocks pc = match englobing_exn_handlers with | [] -> assert false | enter_pc :: rem -> - if leave_try_body blocks leave_pc - then - (* Add an edge to limit the [try] body *) - Hashtbl.add - succs - enter_pc - (Addr.Set.add leave_pc (Hashtbl.find succs enter_pc)); + poptraps := (enter_pc, leave_pc) :: !poptraps; rem) | _ -> englobing_exn_handlers in @@ -83,6 +91,12 @@ let build_graph blocks pc = let block_order = Hashtbl.create 16 in List.iteri !l ~f:(fun i pc -> Hashtbl.add block_order pc i); let preds = reverse_graph succs in + List.iter !poptraps ~f:(fun (enter_pc, leave_pc) -> + if leave_try_body block_order preds blocks leave_pc + then + (* Add an edge to limit the [try] body *) + Hashtbl.add succs enter_pc (Addr.Set.add leave_pc (Hashtbl.find succs enter_pc))); + let preds = reverse_graph succs in { succs; preds; reverse_post_order = !l; block_order } let dominator_tree g = @@ -119,16 +133,7 @@ let dominator_tree g = reverse_tree dom (* pc has at least two forward edges moving into it *) -let is_merge_node g pc = - let s = try Hashtbl.find g.preds pc with Not_found -> Addr.Set.empty in - let o = Hashtbl.find g.block_order pc in - let n = - Addr.Set.fold - (fun pc' n -> if Hashtbl.find g.block_order pc' < o then n + 1 else n) - s - 0 - in - n > 1 +let is_merge_node g pc = is_merge_node' g.block_order g.preds pc let is_loop_header g pc = let s = try Hashtbl.find g.preds pc with Not_found -> Addr.Set.empty in diff --git a/compiler/tests-compiler/exceptions.ml b/compiler/tests-compiler/exceptions.ml index c90bd5f4de..5383e0a1e6 100644 --- a/compiler/tests-compiler/exceptions.ml +++ b/compiler/tests-compiler/exceptions.ml @@ -33,15 +33,11 @@ let prevent_inline = some_name [%expect {| function some_name(param){ - a: - { - try{ - try{throw caml_maybe_attach_backtrace(Stdlib[8], 1);} - catch(x$0){var x = caml_wrap_exception(x$0);} - } - catch(i$1){var i = caml_wrap_exception(i$1), i$0 = i; break a;} - var i$0 = x; + try{ + try{throw caml_maybe_attach_backtrace(Stdlib[8], 1);} + catch(x$0){var x = caml_wrap_exception(x$0), i$0 = x;} } + catch(i$1){var i = caml_wrap_exception(i$1), i$0 = i;} throw caml_maybe_attach_backtrace(i$0, 1); } //end |}]; diff --git a/compiler/tests-full/stdlib.cma.expected.js b/compiler/tests-full/stdlib.cma.expected.js index 1d720ab560..4c5a981f51 100644 --- a/compiler/tests-full/stdlib.cma.expected.js +++ b/compiler/tests-full/stdlib.cma.expected.js @@ -542,13 +542,12 @@ /*<>*/ for(;;){ if(! param$0) /*<>*/ return 0; var l = param$0[2], a = param$0[1]; - a: - try{ /*<>*/ /*<>*/ caml_ml_flush(a); + /*<>*/ try{ + /*<>*/ /*<>*/ caml_ml_flush(a); } catch(_w_){ var _v_ = caml_wrap_exception(_w_); - if(_v_[1] === Sys_error) break a; - throw caml_maybe_attach_backtrace(_v_, 0); + if(_v_[1] !== Sys_error) throw caml_maybe_attach_backtrace(_v_, 0); } var param$0 = l; } @@ -585,9 +584,10 @@ (oc); /*<>*/ } function close_out_noerr(oc){ - /*<>*/ b: - try{ /*<>*/ /*<>*/ caml_ml_flush(oc);} - catch(_u_){break b;} + /*<>*/ try{ + /*<>*/ /*<>*/ caml_ml_flush(oc); + } + catch(_u_){} /*<>*/ try{ /*<>*/ /*<>*/ var _s_ = /*<>*/ caml_ml_close_channel(oc); @@ -7380,8 +7380,7 @@ for(;;){ /*<>*/ /*<>*/ var e$1 = caml_check_bound(a, i$6)[1 + i$6]; - c: - try{ + /*<>*/ try{ var i = i$6; /*<>*/ for(;;){ /*<>*/ /*<>*/ var @@ -7405,7 +7404,6 @@ if(exn[1] !== Bottom) throw caml_maybe_attach_backtrace(exn, 0); var i$0 = exn[2]; /*<>*/ caml_check_bound(a, i$0)[1 + i$0] = e$1; - break c; } /*<>*/ /*<>*/ var _C_ = i$6 - 1 | 0; if(0 === i$6) break; @@ -8235,8 +8233,7 @@ for(;;){ /*<>*/ /*<>*/ var e$1 = /*<>*/ caml_array_get(a, i$6); - c: - try{ + /*<>*/ try{ var i = i$6; /*<>*/ for(;;){ /*<>*/ /*<>*/ var @@ -8261,7 +8258,6 @@ var i$0 = exn[2]; /*<>*/ /*<>*/ caml_array_set (a, i$0, e$1); - break c; } /*<>*/ /*<>*/ var _J_ = i$6 - 1 | 0; if(0 === i$6) break; @@ -9505,23 +9501,20 @@ var cmd = 3, arg = 0; break; case 4: - c: - { - try{ - /*<>*/ var - _i_ = env[13], - /*<>*/ _j_ = - /*<>*/ caml_call1 - (caml_check_bound(tables[1], _i_)[1 + _i_], env), - /*<>*/ _k_ = 4; - } - catch(_m_){ - var _h_ = caml_wrap_exception(_m_); - if(_h_ !== Parse_error) throw caml_maybe_attach_backtrace(_h_, 0); - var value = 0, action = 5; - break c; - } - var value = _j_, action = _k_; + try{ + /*<>*/ var + _i_ = env[13], + /*<>*/ _j_ = + /*<>*/ caml_call1 + (caml_check_bound(tables[1], _i_)[1 + _i_], env), + /*<>*/ _k_ = 4, + value = _j_, + action = _k_; + } + catch(_m_){ + var _h_ = caml_wrap_exception(_m_); + if(_h_ !== Parse_error) throw caml_maybe_attach_backtrace(_h_, 0); + var value = 0, action = 5; } var cmd = action, arg = value; break; @@ -12979,17 +12972,15 @@ } var result = [0, res]; } - a: - { - /*<>*/ try{ /*<>*/ do_at_exit(0);} - catch(ex){ - /*<>*/ var - ex$0 = caml_wrap_exception(ex), - /*<>*/ _d_ = 0 === result[0] ? [1, ex$0] : result, - result$0 = _d_; - break a; - } + /*<>*/ try{ + /*<>*/ do_at_exit(0); var result$0 = result; + } + catch(ex){ + /*<>*/ var + ex$0 = caml_wrap_exception(ex), + /*<>*/ _d_ = 0 === result[0] ? [1, ex$0] : result, + result$0 = _d_; } /*<>*/ /*<>*/ caml_call1 (Stdlib_Mutex[2], term_mutex); @@ -17978,25 +17969,22 @@ nend = j$0; continue; } - e: if(nstart === nend) var indent = 0; - else{ + else /*<>*/ try{ - /*<>*/ /*<>*/ var - _bs_ = + /*<>*/ var + /*<>*/ _bs_ = /*<>*/ runtime.caml_int_of_string ( /*<>*/ caml_call3 - (Stdlib_String[15], str, nstart, nend - nstart | 0)); + (Stdlib_String[15], str, nstart, nend - nstart | 0)), + indent = _bs_; } catch(_bt_){ var _br_ = caml_wrap_exception(_bt_); if(_br_[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(_br_, 0); var indent = invalid_box(0); - break e; } - var indent = _bs_; - } /*<>*/ /*<>*/ var exp_end = parse_spaces(nend); if(exp_end !== len) @@ -18195,110 +18183,104 @@ case 27: var str_ind$3 = str_ind$0 + 1 | 0; e: - { - f: + try{ + var + _bg_ = str_ind$3 === end_ind ? 1 : 0, + _bh_ = + _bg_ + || + (60 + !== + /*<>*/ caml_string_get + (str, str_ind$3) + ? 1 + : 0); + if(_bh_) + /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace + (Stdlib[8], 1); + /*<>*/ var + /*<>*/ str_ind_1 = + parse_spaces(str_ind$3 + 1 | 0, end_ind), + /*<>*/ match$2 = + /*<>*/ caml_string_get + (str, str_ind_1); + g: { - g: - try{ - var - _bg_ = str_ind$3 === end_ind ? 1 : 0, - _bh_ = - _bg_ - || - (60 - !== - /*<>*/ caml_string_get - (str, str_ind$3) - ? 1 - : 0); - if(_bh_) - /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace - (Stdlib[8], 1); - /*<>*/ var - /*<>*/ str_ind_1 = - parse_spaces(str_ind$3 + 1 | 0, end_ind), - /*<>*/ match$2 = - /*<>*/ caml_string_get - (str, str_ind_1); - h: - { - if(48 <= match$2){ - if(58 > match$2) break h; - } - else if(45 === match$2) break h; - /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace - (Stdlib[8], 1); - } - /*<>*/ var - /*<>*/ match$3 = - parse_integer(str_ind_1, end_ind), - width = match$3[2], - str_ind_2 = match$3[1], - /*<>*/ str_ind_3 = - parse_spaces(str_ind_2, end_ind), - /*<>*/ switcher$0 = - /*<>*/ caml_string_get - (str, str_ind_3) - - 45 - | 0; - if(12 < switcher$0 >>> 0){ - if(17 === switcher$0){ - /*<>*/ var - /*<>*/ s = - /*<>*/ caml_call3 - (Stdlib_String[15], - str, - str_ind$3 - 2 | 0, - (str_ind_3 - str_ind$3 | 0) + 3 | 0), - /*<>*/ _bi_ = - [0, s, width, 0], - /*<>*/ _bj_ = - str_ind_3 + 1 | 0; - break g; - } - } - else if(1 < switcher$0 - 1 >>> 0){ - /*<>*/ var - /*<>*/ match$4 = - parse_integer(str_ind_3, end_ind), - offset = match$4[2], - str_ind_4 = match$4[1], - /*<>*/ str_ind_5 = - parse_spaces(str_ind_4, end_ind); - if - (62 - !== - /*<>*/ caml_string_get - (str, str_ind_5)) - /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace - (Stdlib[8], 1); - /*<>*/ var - /*<>*/ s$0 = - /*<>*/ caml_call3 - (Stdlib_String[15], - str, - str_ind$3 - 2 | 0, - (str_ind_5 - str_ind$3 | 0) + 3 | 0), - /*<>*/ _bk_ = - [0, s$0, width, offset], - /*<>*/ _bl_ = - str_ind_5 + 1 | 0; - break f; - } - /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace - (Stdlib[8], 1); + if(48 <= match$2){ + if(58 > match$2) break g; } - catch(_bq_){ - var _bf_ = caml_wrap_exception(_bq_); - if(_bf_ !== Stdlib[8] && _bf_[1] !== Stdlib[7]) - throw caml_maybe_attach_backtrace(_bf_, 0); - var formatting_lit$0 = formatting_lit, next_ind = str_ind$3; + else if(45 === match$2) break g; + /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace + (Stdlib[8], 1); + } + /*<>*/ var + /*<>*/ match$3 = + parse_integer(str_ind_1, end_ind), + width = match$3[2], + str_ind_2 = match$3[1], + /*<>*/ str_ind_3 = + parse_spaces(str_ind_2, end_ind), + /*<>*/ switcher$0 = + /*<>*/ caml_string_get + (str, str_ind_3) + - 45 + | 0; + if(12 < switcher$0 >>> 0){ + if(17 === switcher$0){ + /*<>*/ var + /*<>*/ s = + /*<>*/ caml_call3 + (Stdlib_String[15], + str, + str_ind$3 - 2 | 0, + (str_ind_3 - str_ind$3 | 0) + 3 | 0), + /*<>*/ _bi_ = + [0, s, width, 0], + /*<>*/ _bj_ = + str_ind_3 + 1 | 0, + formatting_lit$0 = _bi_, + next_ind = _bj_; break e; } - var formatting_lit$0 = _bi_, next_ind = _bj_; + } + else if(1 < switcher$0 - 1 >>> 0){ + /*<>*/ var + /*<>*/ match$4 = + parse_integer(str_ind_3, end_ind), + offset = match$4[2], + str_ind_4 = match$4[1], + /*<>*/ str_ind_5 = + parse_spaces(str_ind_4, end_ind); + if + (62 + !== + /*<>*/ caml_string_get + (str, str_ind_5)) + /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace + (Stdlib[8], 1); + /*<>*/ var + /*<>*/ s$0 = + /*<>*/ caml_call3 + (Stdlib_String[15], + str, + str_ind$3 - 2 | 0, + (str_ind_5 - str_ind$3 | 0) + 3 | 0), + /*<>*/ _bk_ = + [0, s$0, width, offset], + /*<>*/ _bl_ = + str_ind_5 + 1 | 0, + formatting_lit$0 = _bk_, + next_ind = _bl_; break e; } - var formatting_lit$0 = _bk_, next_ind = _bl_; + /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace + (Stdlib[8], 1); + } + catch(_bq_){ + var _bf_ = caml_wrap_exception(_bq_); + if(_bf_ !== Stdlib[8] && _bf_[1] !== Stdlib[7]) + throw caml_maybe_attach_backtrace(_bf_, 0); + var formatting_lit$0 = formatting_lit, next_ind = str_ind$3; } var fmt_rest$12 = parse(next_ind, end_ind)[1], @@ -18306,59 +18288,55 @@ break a; case 28: var str_ind$4 = str_ind$0 + 1 | 0; - e: - { - /*<>*/ try{ - /*<>*/ var - /*<>*/ str_ind_1$0 = - parse_spaces(str_ind$4, end_ind), - /*<>*/ match$6 = - /*<>*/ caml_string_get - (str, str_ind_1$0); + /*<>*/ try{ + /*<>*/ var + /*<>*/ str_ind_1$0 = + parse_spaces(str_ind$4, end_ind), + /*<>*/ match$6 = + /*<>*/ caml_string_get + (str, str_ind_1$0); + f: + { g: { - i: - { - if(48 <= match$6){ - if(58 > match$6) break i; - } - else if(45 === match$6) break i; - var _bo_ = 0; - break g; + if(48 <= match$6){ + if(58 > match$6) break g; } - /*<>*/ var - /*<>*/ match$7 = - parse_integer(str_ind_1$0, end_ind), - size = match$7[2], - str_ind_2$0 = match$7[1], - /*<>*/ str_ind_3$0 = - parse_spaces(str_ind_2$0, end_ind); - if - (62 - !== - /*<>*/ caml_string_get - (str, str_ind_3$0)) - /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace - (Stdlib[8], 1); - /*<>*/ var - /*<>*/ s$1 = - /*<>*/ caml_call3 - (Stdlib_String[15], - str, - str_ind$4 - 2 | 0, - (str_ind_3$0 - str_ind$4 | 0) + 3 | 0), - _bo_ = [0, [0, str_ind_3$0 + 1 | 0, [1, s$1, size]]]; + else if(45 === match$6) break g; + var _bo_ = 0; + break f; } - } - catch(_bp_){ - var _bm_ = caml_wrap_exception(_bp_); - if(_bm_ !== Stdlib[8] && _bm_[1] !== Stdlib[7]) - throw caml_maybe_attach_backtrace(_bm_, 0); - var _bn_ = 0; - break e; + /*<>*/ var + /*<>*/ match$7 = + parse_integer(str_ind_1$0, end_ind), + size = match$7[2], + str_ind_2$0 = match$7[1], + /*<>*/ str_ind_3$0 = + parse_spaces(str_ind_2$0, end_ind); + if + (62 + !== + /*<>*/ caml_string_get + (str, str_ind_3$0)) + /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace + (Stdlib[8], 1); + /*<>*/ var + /*<>*/ s$1 = + /*<>*/ caml_call3 + (Stdlib_String[15], + str, + str_ind$4 - 2 | 0, + (str_ind_3$0 - str_ind$4 | 0) + 3 | 0), + _bo_ = [0, [0, str_ind_3$0 + 1 | 0, [1, s$1, size]]]; } var _bn_ = _bo_; } + catch(_bp_){ + var _bm_ = caml_wrap_exception(_bp_); + if(_bm_ !== Stdlib[8] && _bm_[1] !== Stdlib[7]) + throw caml_maybe_attach_backtrace(_bm_, 0); + var _bn_ = 0; + } if(_bn_) var match$5 = _bn_[1], @@ -20154,41 +20132,31 @@ ([0, Stop, _c_], 1); /*<>*/ } function add_help(speclist){ - /*<>*/ b: - { - /*<>*/ try{ - /*<>*/ assoc3(cst_help$2, speclist); - /*<>*/ /*<>*/ var _aA_ = 0; - } - catch(_aC_){ - var _aw_ = caml_wrap_exception(_aC_); - if(_aw_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_aw_, 0); - var - add1 = - [0, - [0, cst_help, [0, help_action], cst_Display_this_list_of_optio], - 0]; - break b; - } - var add1 = _aA_; + /*<>*/ try{ + /*<>*/ assoc3(cst_help$2, speclist); + /*<>*/ var /*<>*/ _aA_ = 0, add1 = _aA_; } - a: - { - try{ - /*<>*/ assoc3(cst_help$1, speclist); - /*<>*/ /*<>*/ var _az_ = 0; - } - catch(_aB_){ - var _ax_ = caml_wrap_exception(_aB_); - if(_ax_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_ax_, 0); - var - add2 = - [0, - [0, cst_help$0, [0, help_action], cst_Display_this_list_of_optio$0], - 0]; - break a; - } - var add2 = _az_; + catch(_aC_){ + var _aw_ = caml_wrap_exception(_aC_); + if(_aw_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_aw_, 0); + var + add1 = + [0, + [0, cst_help, [0, help_action], cst_Display_this_list_of_optio], + 0]; + } + try{ + /*<>*/ assoc3(cst_help$1, speclist); + /*<>*/ var /*<>*/ _az_ = 0, add2 = _az_; + } + catch(_aB_){ + var _ax_ = caml_wrap_exception(_aB_); + if(_ax_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_ax_, 0); + var + add2 = + [0, + [0, cst_help$0, [0, help_action], cst_Display_this_list_of_optio$0], + 0]; } /*<>*/ /*<>*/ var _ay_ = /*<>*/ caml_call2(Stdlib[37], add1, add2); @@ -20316,41 +20284,39 @@ /*<>*/ if (1 <= /*<>*/ caml_ml_string_length(s) && 45 === /*<>*/ caml_string_get(s, 0)){ - e: - { - try{ - /*<>*/ var - follow$1 = 0, - /*<>*/ _aa_ = assoc3(s, speclist[1]); + try{ + /*<>*/ var + follow$1 = 0, + /*<>*/ _aa_ = assoc3(s, speclist[1]), + follow$0 = follow$1, + action = _aa_; + } + catch(_aj_){ + var _Z_ = caml_wrap_exception(_aj_); + if(_Z_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_Z_, 0); + /*<>*/ try{ + /*<>*/ var + /*<>*/ i = + /*<>*/ caml_call2(Stdlib_String[35], s, 61), + /*<>*/ len = + /*<>*/ caml_ml_string_length(s), + /*<>*/ arg = + /*<>*/ caml_call3 + (Stdlib_String[15], s, i + 1 | 0, len - (i + 1 | 0) | 0), + /*<>*/ keyword = + /*<>*/ caml_call3(Stdlib_String[15], s, 0, i), + /*<>*/ follow = [0, arg], + /*<>*/ _$_ = assoc3(keyword, speclist[1]), + follow$0 = follow, + action = _$_; } - catch(_aj_){ - var _Z_ = caml_wrap_exception(_aj_); - if(_Z_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_Z_, 0); - /*<>*/ try{ - /*<>*/ var - /*<>*/ i = - /*<>*/ caml_call2(Stdlib_String[35], s, 61), - /*<>*/ len = - /*<>*/ caml_ml_string_length(s), - /*<>*/ arg = - /*<>*/ caml_call3 - (Stdlib_String[15], s, i + 1 | 0, len - (i + 1 | 0) | 0), - /*<>*/ keyword = - /*<>*/ caml_call3(Stdlib_String[15], s, 0, i), - /*<>*/ follow = [0, arg], - /*<>*/ _$_ = assoc3(keyword, speclist[1]); - } - catch(_ak_){ - var ___ = caml_wrap_exception(_ak_); - if(___ === Stdlib[8]) - /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace - ([0, Stop, [0, s]], 1); - throw caml_maybe_attach_backtrace(___, 0); - } - var follow$0 = follow, action = _$_; - break e; + catch(_ak_){ + var ___ = caml_wrap_exception(_ak_); + if(___ === Stdlib[8]) + /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace + ([0, Stop, [0, s]], 1); + throw caml_maybe_attach_backtrace(___, 0); } - var follow$0 = follow$1, action = _aa_; } var no_arg$0 = @@ -20403,21 +20369,17 @@ /*<>*/ var f$0 = param[1], /*<>*/ arg = get_arg(0); - b: - { - /*<>*/ try{ - /*<>*/ /*<>*/ var - _ac_ = - [0, /*<>*/ caml_call1(Stdlib[32], arg)]; - } - catch(_ah_){ - var _ab_ = caml_wrap_exception(_ah_); - if(_ab_[1] !== Stdlib[6]) - throw caml_maybe_attach_backtrace(_ab_, 0); - var match = 0; - break b; - } - var match = _ac_; + /*<>*/ try{ + /*<>*/ var + /*<>*/ _ac_ = + [0, /*<>*/ caml_call1(Stdlib[32], arg)], + match = _ac_; + } + catch(_ah_){ + var _ab_ = caml_wrap_exception(_ah_); + if(_ab_[1] !== Stdlib[6]) + throw caml_maybe_attach_backtrace(_ab_, 0); + var match = 0; } if(! match) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace @@ -21431,61 +21393,52 @@ var empty_backtrace = [0]; function handle_uncaught_exception(exn$0, debugger_in_use){ /*<>*/ try{ - b: - { - /*<>*/ try{ - var - raw_backtrace = - debugger_in_use - ? empty_backtrace - : /*<>*/ caml_get_exception_raw_backtra(0); - d: - try{ - /*<>*/ /*<>*/ caml_call1 - (Stdlib[103], 0); - } - catch(_H_){break d;} - e: - { - /*<>*/ try{ - /*<>*/ /*<>*/ var - _D_ = - /*<>*/ caml_call2 - (uncaught_exception_handler[1], exn$0, raw_backtrace); - } - catch(exn$1){ - /*<>*/ var - exn = caml_wrap_exception(exn$1), - /*<>*/ raw_backtrace$0 = - /*<>*/ caml_get_exception_raw_backtra(0), - /*<>*/ _A_ = to_string(exn$0); - /*<>*/ /*<>*/ caml_call2 - (Stdlib_Printf[3], _o_, _A_); - /*<>*/ print_raw_backtrace - (Stdlib[40], raw_backtrace); - /*<>*/ /*<>*/ var - _B_ = to_string(exn); - /*<>*/ /*<>*/ caml_call2 - (Stdlib_Printf[3], _p_, _B_); - /*<>*/ print_raw_backtrace - (Stdlib[40], raw_backtrace$0); - var - _C_ = /*<>*/ caml_call1(Stdlib[63], Stdlib[40]); - break e; - } - var _C_ = _D_; - } + /*<>*/ try{ + var + raw_backtrace = + debugger_in_use + ? empty_backtrace + : /*<>*/ caml_get_exception_raw_backtra(0); + /*<>*/ try{ + /*<>*/ /*<>*/ caml_call1 + (Stdlib[103], 0); } - catch(_G_){ - var _z_ = caml_wrap_exception(_G_); - if(_z_ !== Stdlib[9]) throw caml_maybe_attach_backtrace(_z_, 0); + catch(_H_){} + /*<>*/ try{ + /*<>*/ var + /*<>*/ _D_ = + /*<>*/ caml_call2 + (uncaught_exception_handler[1], exn$0, raw_backtrace), + _C_ = _D_; + } + catch(exn$1){ + /*<>*/ var + exn = caml_wrap_exception(exn$1), + /*<>*/ raw_backtrace$0 = + /*<>*/ caml_get_exception_raw_backtra(0), + /*<>*/ _A_ = to_string(exn$0); + /*<>*/ /*<>*/ caml_call2 + (Stdlib_Printf[3], _o_, _A_); + /*<>*/ print_raw_backtrace + (Stdlib[40], raw_backtrace); + /*<>*/ /*<>*/ var + _B_ = to_string(exn); + /*<>*/ /*<>*/ caml_call2 + (Stdlib_Printf[3], _p_, _B_); + /*<>*/ print_raw_backtrace + (Stdlib[40], raw_backtrace$0); var - _E_ = - /*<>*/ caml_call1 - (Stdlib[53], cst_Fatal_error_out_of_memory_); - break b; + _C_ = /*<>*/ caml_call1(Stdlib[63], Stdlib[40]); } var _E_ = _C_; + } + catch(_G_){ + var _z_ = caml_wrap_exception(_G_); + if(_z_ !== Stdlib[9]) throw caml_maybe_attach_backtrace(_z_, 0); + var + _E_ = + /*<>*/ caml_call1 + (Stdlib[53], cst_Fatal_error_out_of_memory_); } /*<>*/ return _E_; } @@ -23185,33 +23138,27 @@ /*<>*/ h[4] = - h[4] | 0; return 0; /*<>*/ } - b: - { - try{ - /*<>*/ /*<>*/ var - _f_ = /*<>*/ caml_sys_getenv("OCAMLRUNPARAM"); - } - catch(_az_){ - var _a_ = caml_wrap_exception(_az_); - if(_a_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_a_, 0); - c: - { - /*<>*/ try{ - /*<>*/ /*<>*/ var - _e_ = /*<>*/ caml_sys_getenv("CAMLRUNPARAM"); - } - catch(_aA_){ - var _b_ = caml_wrap_exception(_aA_); - if(_b_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_b_, 0); - var _c_ = cst; - break c; - } - var _c_ = _e_; - } - var params = _c_; - break b; + try{ + /*<>*/ var + /*<>*/ _f_ = + /*<>*/ caml_sys_getenv("OCAMLRUNPARAM"), + params = _f_; + } + catch(_az_){ + var _a_ = caml_wrap_exception(_az_); + if(_a_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_a_, 0); + /*<>*/ try{ + /*<>*/ var + /*<>*/ _e_ = + /*<>*/ caml_sys_getenv("CAMLRUNPARAM"), + _c_ = _e_; + } + catch(_aA_){ + var _b_ = caml_wrap_exception(_aA_); + if(_b_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_b_, 0); + var _c_ = cst; } - var params = _f_; + var params = _c_; } /*<>*/ var /*<>*/ randomized_default = @@ -27701,16 +27648,16 @@ /*<>*/ if(0 !== width$4 && ! end_of_input(ib)){ /*<>*/ /*<>*/ var _aP_ = peek_char(ib) - 46 | 0; - j: + h: { - k: + i: { if(34 < _aP_ >>> 0){ - if(66 === _aP_) break k; + if(66 === _aP_) break i; } - else if(32 < _aP_ - 1 >>> 0) break k; + else if(32 < _aP_ - 1 >>> 0) break i; var width$5 = scan_hexadecimal_int(width$4, ib); - break j; + break h; } var width$5 = width$4; } @@ -27720,12 +27667,12 @@ if(46 === c$0){ /*<>*/ /*<>*/ var width$6 = store_char(width$5, ib, c$0); - l: + j: { /*<>*/ if(0 !== width$6 && ! end_of_input(ib)){ /*<>*/ /*<>*/ var match = peek_char(ib); - m: + k: { if(80 !== match && 112 !== match){ /*<>*/ var @@ -27736,12 +27683,12 @@ width$6 - (precision$0 - scan_hexadecimal_int(precision$0, ib) | 0) | 0; - break m; + break k; } var width$10 = width$6; } var width$7 = width$10; - break l; + break j; } var width$7 = width$6; } @@ -27859,20 +27806,20 @@ /*<>*/ var /*<>*/ c$1 = peek_char(ib), /*<>*/ switcher = c$1 - 80 | 0; - l: + j: { - n: + l: { if(32 < switcher >>> 0){ if(-34 === switcher){ /*<>*/ /*<>*/ var width$5 = store_char(width$4, ib, c$1); - o: + m: { /*<>*/ if(0 !== width$5 && ! end_of_input(ib)){ /*<>*/ /*<>*/ var match = peek_char(ib); - p: + n: { if(80 !== match && 112 !== match){ /*<>*/ var @@ -27883,22 +27830,22 @@ width$5 - (precision$0 - scan_hexadecimal_int(precision$0, ib) | 0) | 0; - break p; + break n; } var width$10 = width$5; } var width$6 = width$10; - break o; + break m; } var width$6 = width$5; } var width$7 = width$6; - break n; + break l; } } - else if(30 < switcher - 1 >>> 0){var width$7 = width$4; break n;} + else if(30 < switcher - 1 >>> 0){var width$7 = width$4; break l;} var width$8 = bad_float(0); - break l; + break j; } var width$8 = width$7; } @@ -28785,21 +28732,17 @@ (width_of_pad_opt(pad_opt), ib); /*<>*/ /*<>*/ var s = token_string(ib); - c: - { - /*<>*/ try{ - /*<>*/ /*<>*/ var - _I_ = - /*<>*/ caml_call2 - (CamlinternalFormat[14], s, fmtty); - } - catch(exn$0){ - var exn = caml_wrap_exception(exn$0); - if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); - var msg = exn[2], fmt$3 = bad_input(msg); - break c; - } - var fmt$3 = _I_; + /*<>*/ try{ + /*<>*/ var + /*<>*/ _I_ = + /*<>*/ caml_call2 + (CamlinternalFormat[14], s, fmtty), + fmt$3 = _I_; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); + var msg = exn[2], fmt$3 = bad_input(msg); } /*<>*/ return [0, fmt$3, @@ -28810,46 +28753,43 @@ (width_of_pad_opt(pad_opt$0), ib); /*<>*/ /*<>*/ var s$0 = token_string(ib); - c: - { - try{ - /*<>*/ var - fmt$6 = - /*<>*/ caml_call2 - (CamlinternalFormat[13], 0, s$0) - [1], - fmt$7 = - /*<>*/ caml_call2 - (CamlinternalFormat[13], 0, s$0) - [1], - /*<>*/ _K_ = - /*<>*/ caml_call1 - (CamlinternalFormat[21], fmtty$0), - /*<>*/ _L_ = - /*<>*/ caml_call1 - (CamlinternalFormatBasics[2], _K_), - /*<>*/ fmt$8 = - /*<>*/ caml_call2 - (CamlinternalFormat[12], fmt$7, _L_), - /*<>*/ _M_ = - /*<>*/ caml_call1 - (CamlinternalFormatBasics[2], fmtty$0), - /*<>*/ _N_ = - /*<>*/ caml_call2 - (CamlinternalFormat[12], fmt$6, _M_); - } - catch(exn){ - var exn$0 = caml_wrap_exception(exn); - if(exn$0[1] !== Stdlib[7]) - throw caml_maybe_attach_backtrace(exn$0, 0); - var - msg$0 = exn$0[2], - _J_ = bad_input(msg$0), - fmt$5 = _J_[2], - fmt$4 = _J_[1]; - break c; - } - var fmt$5 = fmt$8, fmt$4 = _N_; + try{ + /*<>*/ var + fmt$6 = + /*<>*/ caml_call2 + (CamlinternalFormat[13], 0, s$0) + [1], + fmt$7 = + /*<>*/ caml_call2 + (CamlinternalFormat[13], 0, s$0) + [1], + /*<>*/ _K_ = + /*<>*/ caml_call1 + (CamlinternalFormat[21], fmtty$0), + /*<>*/ _L_ = + /*<>*/ caml_call1 + (CamlinternalFormatBasics[2], _K_), + /*<>*/ fmt$8 = + /*<>*/ caml_call2 + (CamlinternalFormat[12], fmt$7, _L_), + /*<>*/ _M_ = + /*<>*/ caml_call1 + (CamlinternalFormatBasics[2], fmtty$0), + /*<>*/ _N_ = + /*<>*/ caml_call2 + (CamlinternalFormat[12], fmt$6, _M_), + fmt$5 = fmt$8, + fmt$4 = _N_; + } + catch(exn){ + var exn$0 = caml_wrap_exception(exn); + if(exn$0[1] !== Stdlib[7]) + throw caml_maybe_attach_backtrace(exn$0, 0); + var + msg$0 = exn$0[2], + _J_ = bad_input(msg$0), + fmt$5 = _J_[2], + fmt$4 = _J_[1]; } /*<>*/ return [0, [0, fmt$4, s$0], @@ -29076,21 +29016,17 @@ /*<>*/ scan_caml_string(Stdlib[19], ib); /*<>*/ /*<>*/ var str = token_string(ib); - b: - { - /*<>*/ try{ - /*<>*/ /*<>*/ var - _z_ = - /*<>*/ caml_call2 - (CamlinternalFormat[15], str, format); - } - catch(exn$0){ - var exn = caml_wrap_exception(exn$0); - if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); - var msg = exn[2], fmt = bad_input(msg); - break b; - } - var fmt = _z_; + /*<>*/ try{ + /*<>*/ var + /*<>*/ _z_ = + /*<>*/ caml_call2 + (CamlinternalFormat[15], str, format), + fmt = _z_; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); + var msg = exn[2], fmt = bad_input(msg); } /*<>*/ return /*<>*/ caml_call1 (f, fmt); @@ -29459,22 +29395,18 @@ /*<>*/ by_name[1] = /*<>*/ caml_call3 (Meths[4], met, label, by_name[1]); - b: - { - var _af_ = by_label[1]; - try{ - /*<>*/ /*<>*/ var - _ai_ = - /*<>*/ caml_call2 - (Labs[28], label, table[4]); - } - catch(_aj_){ - var _ag_ = caml_wrap_exception(_aj_); - if(_ag_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_ag_, 0); - var _ah_ = 1; - break b; - } - var _ah_ = _ai_; + var _af_ = by_label[1]; + try{ + /*<>*/ var + /*<>*/ _ai_ = + /*<>*/ caml_call2 + (Labs[28], label, table[4]), + _ah_ = _ai_; + } + catch(_aj_){ + var _ag_ = caml_wrap_exception(_aj_); + if(_ag_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_ag_, 0); + var _ah_ = 1; } by_label[1] = /*<>*/ caml_call3(Labs[4], label, _ah_, _af_); @@ -31972,19 +31904,16 @@ (Stdlib_String[15], filename, 0, len_f - len_s | 0)] : 0; /*<>*/ } - b: - { - try{ - /*<>*/ /*<>*/ var - _k_ = /*<>*/ caml_sys_getenv("TMPDIR"); - } - catch(_aE_){ - var _a_ = caml_wrap_exception(_aE_); - if(_a_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_a_, 0); - var temp_dir_name = cst_tmp; - break b; - } - var temp_dir_name = _k_; + try{ + /*<>*/ var + /*<>*/ _k_ = + /*<>*/ caml_sys_getenv("TMPDIR"), + temp_dir_name = _k_; + } + catch(_aE_){ + var _a_ = caml_wrap_exception(_aE_); + if(_a_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_a_, 0); + var temp_dir_name = cst_tmp; } /*<>*/ function quote(s){ /*<>*/ var @@ -32213,19 +32142,16 @@ (Stdlib_String[15], filename, 0, len_f - len_s | 0)] : 0; /*<>*/ } - a: - { - try{ - /*<>*/ /*<>*/ var - _j_ = /*<>*/ caml_sys_getenv("TEMP"); - } - catch(_S_){ - var _b_ = caml_wrap_exception(_S_); - if(_b_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_b_, 0); - var temp_dir_name$0 = cst$5; - break a; - } - var temp_dir_name$0 = _j_; + try{ + /*<>*/ var + /*<>*/ _j_ = + /*<>*/ caml_sys_getenv("TEMP"), + temp_dir_name$0 = _j_; + } + catch(_S_){ + var _b_ = caml_wrap_exception(_S_); + if(_b_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_b_, 0); + var temp_dir_name$0 = cst$5; } function quote$0(s){ /*<>*/ var @@ -33662,24 +33588,20 @@ } /*<>*/ } function input_all(ic){ - /*<>*/ b: - { - /*<>*/ /*<>*/ var - chunk_size = 65536; - /*<>*/ try{ - /*<>*/ var - /*<>*/ _d_ = - /*<>*/ caml_call1(Stdlib[91], ic), - /*<>*/ _e_ = - /*<>*/ caml_call1(Stdlib[92], ic) - _d_ | 0; - } - catch(_g_){ - var _b_ = caml_wrap_exception(_g_); - if(_b_[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(_b_, 0); - var initial_size = -1; - break b; - } - var initial_size = _e_; + /*<>*/ /*<>*/ var + chunk_size = 65536; + /*<>*/ try{ + /*<>*/ var + /*<>*/ _d_ = + /*<>*/ caml_call1(Stdlib[91], ic), + /*<>*/ _e_ = + /*<>*/ caml_call1(Stdlib[92], ic) - _d_ | 0, + initial_size = _e_; + } + catch(_g_){ + var _b_ = caml_wrap_exception(_g_); + if(_b_[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(_b_, 0); + var initial_size = -1; } /*<>*/ var /*<>*/ initial_size$0 =