diff --git a/CHANGES.md b/CHANGES.md index 87ab15d50e..0a26a1b1cf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,7 @@ that follows the semantic of the backend (js or wasm) * Compiler: warn on joo_global_object * Compiler: revisit static env handling (#1708) +* Compiler: Make phys_equal more like native (wrt NaN and +0/-0) #1410 * Runtime: change Sys.os_type on windows (Cygwin -> Win32) * Runtime: backtraces are really expensive, they need to be be explicitly requested at compile time (--enable with-js-error) or at startup (OCAMLRUNPARAM=b=1) diff --git a/compiler/lib/code.ml b/compiler/lib/code.ml index ee704a6a5c..09b8e9719f 100644 --- a/compiler/lib/code.ml +++ b/compiler/lib/code.ml @@ -289,14 +289,19 @@ end type cont = Addr.t * Var.t list +type float_or_not = + | Float + | Not_float + | Unknown + type prim = | Vectlength | Array_get | Extern of string | Not | IsInt - | Eq - | Neq + | Eq of float_or_not + | Neq of float_or_not | Lt | Le | Ult @@ -557,8 +562,8 @@ module Print = struct | Extern s, _ -> Format.fprintf f "\"%s\"(%a)" s (list arg) l | Not, [ x ] -> Format.fprintf f "!%a" arg x | IsInt, [ x ] -> Format.fprintf f "is_int(%a)" arg x - | Eq, [ x; y ] -> Format.fprintf f "%a === %a" arg x arg y - | Neq, [ x; y ] -> Format.fprintf f "!(%a === %a)" arg x arg y + | Eq _, [ x; y ] -> Format.fprintf f "%a === %a" arg x arg y + | Neq _, [ x; y ] -> Format.fprintf f "!(%a === %a)" arg x arg y | Lt, [ x; y ] -> Format.fprintf f "%a < %a" arg x arg y | Le, [ x; y ] -> Format.fprintf f "%a <= %a" arg x arg y | Ult, [ x; y ] -> Format.fprintf f "%a <= %a" arg x arg y diff --git a/compiler/lib/code.mli b/compiler/lib/code.mli index 699aa220fb..6946dd2363 100644 --- a/compiler/lib/code.mli +++ b/compiler/lib/code.mli @@ -139,14 +139,19 @@ end type cont = Addr.t * Var.t list +type float_or_not = + | Float + | Not_float + | Unknown + type prim = | Vectlength | Array_get | Extern of string | Not | IsInt - | Eq - | Neq + | Eq of float_or_not + | Neq of float_or_not | Lt | Le | Ult diff --git a/compiler/lib/eval.ml b/compiler/lib/eval.ml index 113fe6432b..d3a46f3896 100644 --- a/compiler/lib/eval.ml +++ b/compiler/lib/eval.ml @@ -83,8 +83,8 @@ let eval_prim x = | Not, [ Int i ] -> bool (Targetint.is_zero i) | Lt, [ Int i; Int j ] -> bool Targetint.(i < j) | Le, [ Int i; Int j ] -> bool Targetint.(i <= j) - | Eq, [ Int i; Int j ] -> bool Targetint.(i = j) - | Neq, [ Int i; Int j ] -> bool Targetint.(i <> j) + | Eq _, [ Int i; Int j ] -> bool Targetint.(i = j) + | Neq _, [ Int i; Int j ] -> bool Targetint.(i <> j) | Ult, [ Int i; Int j ] -> bool (Targetint.(j < zero) || Targetint.(i < j)) | Extern name, l -> ( let name = Primitive.resolve name in diff --git a/compiler/lib/flow.ml b/compiler/lib/flow.ml index d93b97389d..a59d1ec949 100644 --- a/compiler/lib/flow.ml +++ b/compiler/lib/flow.ml @@ -206,7 +206,7 @@ let expr_escape st _x e = | Special _ | Constant _ | Closure _ | Block _ | Field _ -> () | Apply { args; _ } -> List.iter args ~f:(fun x -> block_escape st x) | Prim (Array_get, [ Pv x; _ ]) -> block_escape st x - | Prim ((Vectlength | Array_get | Not | IsInt | Eq | Neq | Lt | Le | Ult), _) -> () + | Prim ((Vectlength | Array_get | Not | IsInt | Eq _ | Neq _ | Lt | Le | Ult), _) -> () | Prim (Extern name, l) -> let ka = match Primitive.kind_args name with @@ -340,6 +340,68 @@ let the_def_of info x = x | Pc c -> Some (Constant c) +let float_or_not x : Code.float_or_not = + match x with + | Block _ -> Not_float + | Closure _ -> Not_float + | Special (Alias_prim _) -> Not_float + | Field _ -> Unknown + | Apply _ -> Unknown + | Prim (prim, _) -> ( + match prim with + | Extern + ( "caml_ml_string_length" + | "caml_ml_bytes_length" + | "caml_bytes_unsafe_get" + | "caml_bytes_get" + | "caml_string_unsafe_get" + | "caml_string_get" + | "%int_add" + | "%int_sub" + | "%int_mul" + | "%direct_int_mul" + | "%int_div" + | "%direct_int_div" + | "%int_mod" + | "%direct_int_mod" + | "caml_obj_tag" ) -> Not_float + | Array_get -> Unknown + | Extern _ -> Unknown + | Vectlength -> Not_float + | Not -> Not_float + | IsInt -> Not_float + | Eq _ | Neq _ -> Not_float + | Lt | Le | Ult -> Not_float) + | Constant + ( String _ + | NativeString _ + | Float_array _ + | Int _ + | Int32 _ + | Int64 _ + | Tuple _ + | NativeInt _ ) -> Not_float + | Constant (Float _) -> Float + +let the_float_or_not_of info x = + match x with + | Pv x -> + get_approx + info + (fun x -> + match info.info_defs.(Var.idx x) with + | Expr e -> float_or_not e + | Param | Phi _ -> Unknown) + Unknown + (fun a b -> + match a, b with + | Unknown, _ | _, Unknown -> Unknown + | Float, Float -> Float + | Not_float, Not_float -> Not_float + | Float, Not_float | Not_float, Float -> Unknown) + x + | Pc c -> float_or_not (Constant c) + (* If [constant_identical a b = true], then the two values cannot be distinguished, i.e., they are not different objects (and [caml_js_equals a b = true]) and if both are floats, they are bitwise equal. *) diff --git a/compiler/lib/flow.mli b/compiler/lib/flow.mli index 20271a4e3f..b78ee0b5e9 100644 --- a/compiler/lib/flow.mli +++ b/compiler/lib/flow.mli @@ -52,6 +52,8 @@ val get_approx : val the_def_of : Info.t -> Code.prim_arg -> Code.expr option +val the_float_or_not_of : Info.t -> Code.prim_arg -> Code.float_or_not + val the_const_of : target:[ `JavaScript | `Wasm ] -> Info.t -> Code.prim_arg -> Code.constant option diff --git a/compiler/lib/generate.ml b/compiler/lib/generate.ml index 7d1c9f7a78..efed05e326 100644 --- a/compiler/lib/generate.ml +++ b/compiler/lib/generate.ml @@ -343,6 +343,8 @@ let plus_int x y = let bool e = J.ECond (e, one, zero) +let bool_not e = J.ECond (e, zero, one) + (****) let source_location debug ?force (pc : Code.loc) = @@ -976,6 +978,7 @@ let _ = register_un_prim "caml_obj_dup" `Mutable (fun cx loc -> J.call (J.dot cx (Utf8_string.of_string_exn "slice")) [] loc); register_un_prim "caml_int_of_float" `Pure (fun cx _loc -> to_int cx); + register_un_prim "caml_float_of_int" `Pure (fun cx _loc -> cx); register_un_math_prim "caml_abs_float" "abs"; register_un_math_prim "caml_acos_float" "acos"; register_un_math_prim "caml_asin_float" "asin"; @@ -1348,14 +1351,34 @@ let rec translate_expr ctx queue loc x e level : _ * J.statement_list = let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in bool (J.EBin (J.LeInt, cx, cy)), or_p px py, queue - | Eq, [ x; y ] -> + | Eq k, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in - bool (J.EBin (J.EqEqEq, cx, cy)), or_p px py, queue - | Neq, [ x; y ] -> + let e = + match k with + | Not_float -> bool (J.EBin (J.EqEqEq, cx, cy)) + | Float | Unknown -> + bool + (J.call + (J.dot (s_var "Object") (Utf8_string.of_string_exn "is")) + [ cx; cy ] + loc) + in + e, or_p px py, queue + | Neq k, [ x; y ] -> let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in - bool (J.EBin (J.NotEqEq, cx, cy)), or_p px py, queue + let e = + match k with + | Not_float -> bool (J.EBin (J.NotEqEq, cx, cy)) + | Float | Unknown -> + bool_not + (J.call + (J.dot (s_var "Object") (Utf8_string.of_string_exn "is")) + [ cx; cy ] + loc) + in + e, or_p px py, queue | IsInt, [ x ] -> let (px, cx), queue = access_queue' ~ctx queue x in bool (Mlvalue.is_immediate cx), px, queue @@ -1363,7 +1386,7 @@ let rec translate_expr ctx queue loc x e level : _ * J.statement_list = let (px, cx), queue = access_queue' ~ctx queue x in let (py, cy), queue = access_queue' ~ctx queue y in bool (J.EBin (J.LtInt, unsigned cx, unsigned cy)), or_p px py, queue - | (Vectlength | Array_get | Not | IsInt | Eq | Neq | Lt | Le | Ult), _ -> + | (Vectlength | Array_get | Not | IsInt | Eq _ | Neq _ | Lt | Le | Ult), _ -> assert false in res, [] @@ -2031,7 +2054,7 @@ let init () = ; "caml_int32_of_int", "%identity" ; "caml_int32_to_int", "%identity" ; "caml_int32_of_float", "caml_int_of_float" - ; "caml_int32_to_float", "%identity" + ; "caml_int32_to_float", "caml_float_of_int" ; "caml_int32_format", "caml_format_int" ; "caml_int32_of_string", "caml_int_of_string" ; "caml_int32_compare", "caml_int_compare" @@ -2050,7 +2073,7 @@ let init () = ; "caml_nativeint_of_int", "%identity" ; "caml_nativeint_to_int", "%identity" ; "caml_nativeint_of_float", "caml_int_of_float" - ; "caml_nativeint_to_float", "%identity" + ; "caml_nativeint_to_float", "caml_float_of_int" ; "caml_nativeint_of_int32", "%identity" ; "caml_nativeint_to_int32", "%identity" ; "caml_nativeint_format", "caml_format_int" @@ -2061,7 +2084,6 @@ let init () = ; "caml_int64_to_int", "caml_int64_to_int32" ; "caml_int64_of_nativeint", "caml_int64_of_int32" ; "caml_int64_to_nativeint", "caml_int64_to_int32" - ; "caml_float_of_int", "%identity" ; "caml_array_get_float", "caml_array_get" ; "caml_floatarray_get", "caml_array_get" ; "caml_array_get_addr", "caml_array_get" diff --git a/compiler/lib/global_flow.ml b/compiler/lib/global_flow.ml index 66ce9fe395..d5d5665b31 100644 --- a/compiler/lib/global_flow.ml +++ b/compiler/lib/global_flow.ml @@ -150,8 +150,9 @@ let possibly_mutable st x = Var.ISet.add st.variable_possibly_mutable x let expr_deps blocks st x e = match e with - | Constant _ | Prim ((Vectlength | Not | IsInt | Eq | Neq | Lt | Le | Ult), _) | Block _ - -> () + | Constant _ + | Prim ((Vectlength | Not | IsInt | Eq _ | Neq _ | Lt | Le | Ult), _) + | Block _ -> () | Special _ -> () | Prim ( ( Extern @@ -480,7 +481,7 @@ let propagate st ~update approx x = known | Top -> Top) | Prim (Array_get, _) -> Domain.others - | Prim ((Vectlength | Not | IsInt | Eq | Neq | Lt | Le | Ult), _) -> + | Prim ((Vectlength | Not | IsInt | Eq _ | Neq _ | Lt | Le | Ult), _) -> (* The result of these primitive is neither a function nor a block *) Domain.bot diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml index 2068d2d233..98d8a2bdc1 100644 --- a/compiler/lib/parse_bytecode.ml +++ b/compiler/lib/parse_bytecode.ml @@ -2207,7 +2207,7 @@ and compile infos pc state instrs = infos (pc + 1) (State.pop 1 state) - ((Let (x, Prim (Eq, [ Pv y; Pv z ])), loc) :: instrs) + ((Let (x, Prim (Eq Unknown, [ Pv y; Pv z ])), loc) :: instrs) | NEQ -> let y, _ = State.accu state in let z, _ = State.peek 0 state in @@ -2219,7 +2219,7 @@ and compile infos pc state instrs = infos (pc + 1) (State.pop 1 state) - ((Let (x, Prim (Neq, [ Pv y; Pv z ])), loc) :: instrs) + ((Let (x, Prim (Neq Unknown, [ Pv y; Pv z ])), loc) :: instrs) | LTINT -> let y, _ = State.accu state in let z, _ = State.peek 0 state in @@ -2303,7 +2303,8 @@ and compile infos pc state instrs = let x, _ = State.accu state in let y = Var.fresh () in - ( (Let (y, Prim (Eq, [ Pc (Int (Targetint.of_int32_exn n)); Pv x ])), loc) + ( ( Let (y, Prim (Eq Not_float, [ Pc (Int (Targetint.of_int32_exn n)); Pv x ])) + , loc ) :: instrs , (Cond (y, (pc + offset + 2, []), (pc + 3, [])), loc) , state ) @@ -2313,7 +2314,8 @@ and compile infos pc state instrs = let x, _ = State.accu state in let y = Var.fresh () in - ( (Let (y, Prim (Eq, [ Pc (Int (Targetint.of_int32_exn n)); Pv x ])), loc) + ( ( Let (y, Prim (Eq Not_float, [ Pc (Int (Targetint.of_int32_exn n)); Pv x ])) + , loc ) :: instrs , (Cond (y, (pc + 3, []), (pc + offset + 2, [])), loc) , state ) diff --git a/compiler/lib/specialize_js.ml b/compiler/lib/specialize_js.ml index 3e75f1a1f8..ba56dd8c0b 100644 --- a/compiler/lib/specialize_js.ml +++ b/compiler/lib/specialize_js.ml @@ -294,6 +294,26 @@ let specialize_instrs ~target info l = instr (Pv y') :: (Let (y', Prim (Extern check, [ y; z ])), noloc) :: acc in aux info ((y, idx) :: checks) r acc + | Let (x, Prim (Eq Unknown, [ a; b ])) -> + let i = + match Flow.the_float_or_not_of info a, Flow.the_float_or_not_of info b with + | Not_float, (Not_float | Unknown | Float) | (Float | Unknown), Not_float -> + Let (x, Prim (Eq Not_float, [ a; b ])) + | Float, Float -> Let (x, Prim (Eq Float, [ a; b ])) + | Unknown, _ | _, Unknown -> i + in + + aux info checks r ((i, loc) :: acc) + | Let (x, Prim (Neq Unknown, [ a; b ])) -> + let i = + match Flow.the_float_or_not_of info a, Flow.the_float_or_not_of info b with + | Not_float, (Not_float | Unknown | Float) | (Float | Unknown), Not_float -> + Let (x, Prim (Neq Not_float, [ a; b ])) + | Float, Float -> Let (x, Prim (Neq Float, [ a; b ])) + | Unknown, _ | _, Unknown -> i + in + + aux info checks r ((i, loc) :: acc) | _ -> let i = specialize_instr ~target info i in aux info checks r ((i, loc) :: acc)) diff --git a/compiler/tests-compiler/compact.ml b/compiler/tests-compiler/compact.ml index e91423da88..8d23fa73b3 100644 --- a/compiler/tests-compiler/compact.ml +++ b/compiler/tests-compiler/compact.ml @@ -53,4 +53,5 @@ let rec f x y z = return; } (globalThis)); - //end |}] + //end + |}] diff --git a/compiler/tests-compiler/effects.ml b/compiler/tests-compiler/effects.ml index 95892eb396..47d185d0a9 100644 --- a/compiler/tests-compiler/effects.ml +++ b/compiler/tests-compiler/effects.ml @@ -60,4 +60,5 @@ let fff () = function(_c_){return caml_cps_call2(_c_, _b_, cont);}); }); } - //end |}] + //end + |}] diff --git a/compiler/tests-compiler/effects_continuations.ml b/compiler/tests-compiler/effects_continuations.ml index 0da72bd5ee..b7e7a7fdad 100644 --- a/compiler/tests-compiler/effects_continuations.ml +++ b/compiler/tests-compiler/effects_continuations.ml @@ -101,12 +101,11 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = print_fun_decl code (Some "loop3"); [%expect {| - function exceptions(s, cont){ try{var _t_ = runtime.caml_int_of_string(s), n = _t_;} catch(_x_){ var _p_ = caml_wrap_exception(_x_); - if(_p_[1] !== Stdlib[7]){ + if(! Object.is(_p_[1], Stdlib[7])){ var raise$1 = caml_pop_trap(); return raise$1(caml_maybe_attach_backtrace(_p_, 0)); } @@ -119,7 +118,7 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = } catch(_w_){ var _q_ = caml_wrap_exception(_w_); - if(_q_ !== Stdlib[8]){ + if(! Object.is(_q_, Stdlib[8])){ var raise$0 = caml_pop_trap(); return raise$0(caml_maybe_attach_backtrace(_q_, 0)); } @@ -127,7 +126,7 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = } runtime.caml_push_trap (function(_v_){ - if(_v_ === Stdlib[8]) return cont(0); + if(Object.is(_v_, Stdlib[8])) return cont(0); var raise = caml_pop_trap(); return raise(caml_maybe_attach_backtrace(_v_, 0)); }); @@ -209,4 +208,5 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = return _f_(l); }); } - //end |}] + //end + |}] diff --git a/compiler/tests-compiler/effects_exceptions.ml b/compiler/tests-compiler/effects_exceptions.ml index f227b7b881..1b580f801a 100644 --- a/compiler/tests-compiler/effects_exceptions.ml +++ b/compiler/tests-compiler/effects_exceptions.ml @@ -55,12 +55,11 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = print_fun_decl code (Some "exceptions"); [%expect {| - function exceptions(s, cont){ try{var _k_ = runtime.caml_int_of_string(s), n = _k_;} catch(_o_){ var _g_ = caml_wrap_exception(_o_); - if(_g_[1] !== Stdlib[7]){ + if(! Object.is(_g_[1], Stdlib[7])){ var raise$1 = caml_pop_trap(); return raise$1(caml_maybe_attach_backtrace(_g_, 0)); } @@ -73,7 +72,7 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = } catch(_n_){ var _h_ = caml_wrap_exception(_n_); - if(_h_ !== Stdlib[8]){ + if(! Object.is(_h_, Stdlib[8])){ var raise$0 = caml_pop_trap(); return raise$0(caml_maybe_attach_backtrace(_h_, 0)); } @@ -81,7 +80,7 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = } caml_push_trap (function(_m_){ - if(_m_ === Stdlib[8]) return cont(0); + if(Object.is(_m_, Stdlib[8])) return cont(0); var raise = caml_pop_trap(); return raise(caml_maybe_attach_backtrace(_m_, 0)); }); @@ -93,7 +92,8 @@ let%expect_test "test-compiler/lib-effects/test1.ml" = var _i_ = Stdlib[8], raise = caml_pop_trap(); return raise(caml_maybe_attach_backtrace(_i_, 1)); } - //end |}]; + //end + |}]; print_fun_decl code (Some "handler_is_loop"); [%expect {| diff --git a/compiler/tests-compiler/es6.ml b/compiler/tests-compiler/es6.ml index 464a1d7d37..f2192a0f12 100644 --- a/compiler/tests-compiler/es6.ml +++ b/compiler/tests-compiler/es6.ml @@ -66,7 +66,8 @@ let rec odd n' = function "Test"); return;}) (globalThis); - //end |}]; + //end + |}]; let program = Util.compile_and_parse ~effects:false ~pretty:false ~flags:[] prog in Util.print_program program; [%expect @@ -91,4 +92,5 @@ let rec odd n' = function return; } (globalThis)); - //end |}] + //end + |}] diff --git a/compiler/tests-compiler/gh1320.ml b/compiler/tests-compiler/gh1320.ml index b29ce75b07..ed86db9b6b 100644 --- a/compiler/tests-compiler/gh1320.ml +++ b/compiler/tests-compiler/gh1320.ml @@ -61,4 +61,5 @@ let () = myfun () i = _b_; } } - //end |}] + //end + |}] diff --git a/compiler/tests-compiler/gh1354.ml b/compiler/tests-compiler/gh1354.ml index 472a13d750..d82c6f3377 100644 --- a/compiler/tests-compiler/gh1354.ml +++ b/compiler/tests-compiler/gh1354.ml @@ -66,7 +66,7 @@ with Exit -> try{0; _b_ = _a_ + 1 | 0; throw caml_maybe_attach_backtrace(Stdlib[3], 1);} catch(_e_){ var _c_ = caml_wrap_exception(_e_); - if(_c_ !== Stdlib[3]) throw caml_maybe_attach_backtrace(_c_, 0); + if(! Object.is(_c_, Stdlib[3])) throw caml_maybe_attach_backtrace(_c_, 0); caml_call2(Stdlib_Printf[3], _d_, _b_ | 0); var Test = [0]; runtime.caml_register_global(3, Test, "Test"); @@ -154,7 +154,7 @@ with Exit -> } catch(_j_){ var _d_ = caml_wrap_exception(_j_); - if(_d_ !== Stdlib[3]) throw caml_maybe_attach_backtrace(_d_, 0); + if(! Object.is(_d_, Stdlib[3])) throw caml_maybe_attach_backtrace(_d_, 0); caml_call3(Stdlib_Printf[3], _e_, _c_ | 0, _b_); var Test = [0]; runtime.caml_register_global(4, Test, "Test"); @@ -231,7 +231,7 @@ with Exit -> } catch(_h_){ var _c_ = caml_wrap_exception(_h_); - if(_c_ !== Stdlib[3]) throw caml_maybe_attach_backtrace(_c_, 0); + if(! Object.is(_c_, Stdlib[3])) throw caml_maybe_attach_backtrace(_c_, 0); caml_call2(Stdlib_Printf[3], _d_, _b_); var Test = [0]; runtime.caml_register_global(4, Test, "Test"); diff --git a/compiler/tests-compiler/global_deadcode.ml b/compiler/tests-compiler/global_deadcode.ml index 4103bea426..cbe2c6bb41 100644 --- a/compiler/tests-compiler/global_deadcode.ml +++ b/compiler/tests-compiler/global_deadcode.ml @@ -69,9 +69,9 @@ let%expect_test "Eliminates unused functions from functor" = if(! t) return [0, 0, x, 0, 1]; var r = t[3], v = t[2], l = t[1], c = caml_call2(Ord[1], x, v); if(0 === c) return t; - if(0 <= c){var rr = add(x, r); return r === rr ? t : bal(l, v, rr);} + if(0 <= c){var rr = add(x, r); return Object.is(r, rr) ? t : bal(l, v, rr);} var ll = add(x, l); - return l === ll ? t : bal(ll, v, r); + return Object.is(l, ll) ? t : bal(ll, v, r); } function singleton(x){return [0, 0, x, 0, 1];} function find(x, param){ @@ -89,7 +89,8 @@ let%expect_test "Eliminates unused functions from functor" = } } return [0, 0, add, singleton, find]; - //end |}] + //end + |}] let%expect_test "Omit unused fields" = let program = diff --git a/compiler/tests-compiler/lazy.ml b/compiler/tests-compiler/lazy.ml index 1ec728acd6..8b6cecfd59 100644 --- a/compiler/tests-compiler/lazy.ml +++ b/compiler/tests-compiler/lazy.ml @@ -45,4 +45,5 @@ let%expect_test "static eval of string get" = } return [0, _d_, _b_]; } - //end |}] + //end + |}] diff --git a/compiler/tests-compiler/loops.ml b/compiler/tests-compiler/loops.ml index eefa2ef721..426c02abe3 100644 --- a/compiler/tests-compiler/loops.ml +++ b/compiler/tests-compiler/loops.ml @@ -254,7 +254,7 @@ let f t x = try{var val$0 = caml_call2(Stdlib_Hashtbl[6], t, x);} catch(_f_){ var _c_ = caml_wrap_exception(_f_); - if(_c_ === Stdlib[8]) return - 1; + if(Object.is(_c_, Stdlib[8])) return - 1; throw caml_maybe_attach_backtrace(_c_, 0); } if(val$0 && ! val$0[2]){ @@ -265,7 +265,8 @@ let f t x = try{var val = caml_call2(Stdlib_Hashtbl[6], t, x$0);} catch(_e_){ var _a_ = caml_wrap_exception(_e_); - if(_a_ !== Stdlib[3]) throw caml_maybe_attach_backtrace(_a_, 0); + if(! Object.is(_a_, Stdlib[3])) + throw caml_maybe_attach_backtrace(_a_, 0); var _d_ = 0; break a; } @@ -282,7 +283,8 @@ let f t x = } return - 2; } - //end |}] + //end + |}] let%expect_test "loop-and-switch" = let program = @@ -333,7 +335,8 @@ in loop x return _a_ + 2 | 0; } } - //end |}] + //end + |}] let%expect_test "buffer.add_substitute" = let program = @@ -544,7 +547,8 @@ let add_substitute = } } } - //end |}] + //end + |}] let%expect_test "Bytes.trim" = let program = diff --git a/compiler/tests-compiler/match_with_exn.ml b/compiler/tests-compiler/match_with_exn.ml index 73d2be5761..be2699c7d9 100644 --- a/compiler/tests-compiler/match_with_exn.ml +++ b/compiler/tests-compiler/match_with_exn.ml @@ -104,4 +104,5 @@ let fun2 () = } return i; } - //end |}] + //end + |}] diff --git a/compiler/tests-compiler/mutable_closure.ml b/compiler/tests-compiler/mutable_closure.ml index f35c6dcd64..6a724b1cea 100644 --- a/compiler/tests-compiler/mutable_closure.ml +++ b/compiler/tests-compiler/mutable_closure.ml @@ -167,7 +167,8 @@ let%expect_test _ = if(runtime.caml_equal(indirect$0, direct$0)) return 0; throw caml_maybe_attach_backtrace([0, Assert_failure, _a_], 1); } - //end|}] + //end + |}] let%expect_test _ = let prog = {| diff --git a/compiler/tests-compiler/tailcall.ml b/compiler/tests-compiler/tailcall.ml index 9daa98c7f7..3d84d2a37d 100644 --- a/compiler/tests-compiler/tailcall.ml +++ b/compiler/tests-compiler/tailcall.ml @@ -62,12 +62,13 @@ let%expect_test _ = } function even(x){return caml_trampoline(even$0(0, x));} var _b_ = even(1); - if(odd(1) === _b_) + if(Object.is(odd(1), _b_)) throw caml_maybe_attach_backtrace([0, Assert_failure, _a_], 1); try{odd(5000); var _c_ = log_success(0); return _c_;} catch(_d_){return caml_call1(log_failure, cst_too_much_recursion);} } - //end |}] + //end + |}] let%expect_test _ = let prog = @@ -103,9 +104,10 @@ let%expect_test _ = } function even(x){return caml_trampoline(even$0(x));} var _b_ = even(1); - if(odd(1) === _b_) + if(Object.is(odd(1), _b_)) throw caml_maybe_attach_backtrace([0, Assert_failure, _a_], 1); try{odd(5000); var _c_ = log_success(0); return _c_;} catch(_d_){return caml_call1(log_failure, cst_too_much_recursion);} } - //end |}] + //end + |}] diff --git a/compiler/tests-full/stdlib.cma.expected.js b/compiler/tests-full/stdlib.cma.expected.js index ddd25fb271..dc6860754b 100644 --- a/compiler/tests-full/stdlib.cma.expected.js +++ b/compiler/tests-full/stdlib.cma.expected.js @@ -445,7 +445,7 @@ } catch(_x_){ var _v_ = caml_wrap_exception(_x_); - if(_v_[1] === Failure) /*<>*/ return 0; + if(Object.is(_v_[1], Failure)) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_v_, 0); } /*<>*/ } @@ -476,7 +476,7 @@ } catch(_u_){ var _s_ = caml_wrap_exception(_u_); - if(_s_[1] === Failure) /*<>*/ return 0; + if(Object.is(_s_[1], Failure)) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_s_, 0); } /*<>*/ } @@ -560,7 +560,8 @@ } catch(_p_){ var _o_ = caml_wrap_exception(_p_); - if(_o_[1] !== Sys_error) throw caml_maybe_attach_backtrace(_o_, 0); + if(! Object.is(_o_[1], Sys_error)) + throw caml_maybe_attach_backtrace(_o_, 0); } param$0 = l; } @@ -1135,7 +1136,7 @@ } catch(_e_){ var _c_ = caml_wrap_exception(_e_); - if(_c_ === Stdlib[8]) /*<>*/ return 0; + if(Object.is(_c_, Stdlib[8])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_c_, 0); } /*<>*/ } @@ -1419,7 +1420,7 @@ (Stdlib_Obj[22][3], _b_); /*<>*/ } function provably_equal(A, B){ - /*<>*/ return A[1] === B[1] ? _a_ : 0; + /*<>*/ return Object.is(A[1], B[1]) ? _a_ : 0; /*<>*/ } /*<>*/ var /*<>*/ Id = [0, make, uid, provably_equal], @@ -2900,7 +2901,7 @@ (function(globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_hash = runtime.caml_hash; - function equal(_d_, _c_){ /*<>*/ return _d_ === _c_ ? 1 : 0;} + function equal(_d_, _c_){ /*<>*/ return Object.is(_d_, _c_) ? 1 : 0;} var compare = runtime.caml_int_compare, cst_true = "true", @@ -3119,7 +3120,7 @@ (Stdlib[1], _l_); /*<>*/ } function unsafe_to_char(_j_){ /*<>*/ return _j_;} - function equal(_i_, _h_){ /*<>*/ return _i_ === _h_ ? 1 : 0;} + function equal(_i_, _h_){ /*<>*/ return Object.is(_i_, _h_) ? 1 : 0;} var compare = runtime.caml_int_compare, _a_ = [0, cst_uchar_ml, 85, 7], @@ -3750,7 +3751,7 @@ var param$0 = param; for(;;){ if(! param$0) /*<>*/ return 0; - var l = param$0[2], a = param$0[1], _A_ = a === x ? 1 : 0; + var l = param$0[2], a = param$0[1], _A_ = Object.is(a, x) ? 1 : 0; if(_A_) return _A_; param$0 = l; } @@ -3786,7 +3787,7 @@ /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (Stdlib[8], 1); var l = param$0[2], match = param$0[1], b = match[2], a = match[1]; - if(a === x) /*<>*/ return b; + if(Object.is(a, x)) /*<>*/ return b; param$0 = l; } } @@ -3795,7 +3796,7 @@ for(;;){ if(! param$0) /*<>*/ return 0; var l = param$0[2], match = param$0[1], b = match[2], a = match[1]; - if(a === x) /*<>*/ return [0, b]; + if(Object.is(a, x)) /*<>*/ return [0, b]; param$0 = l; } } @@ -3815,7 +3816,7 @@ var param$0 = param; for(;;){ if(! param$0) /*<>*/ return 0; - var l = param$0[2], a = param$0[1][1], _y_ = a === x ? 1 : 0; + var l = param$0[2], a = param$0[1][1], _y_ = Object.is(a, x) ? 1 : 0; if(_y_) return _y_; param$0 = l; } @@ -3831,7 +3832,7 @@ function remove_assq(x, param){ /*<>*/ if(! param) /*<>*/ return 0; var l = param[2], pair = param[1], a = pair[1]; - return a === x ? l : [0, pair, remove_assq(x, l)]; + return Object.is(a, x) ? l : [0, pair, remove_assq(x, l)]; } function find(p, param){ var param$0 = param; @@ -4798,7 +4799,7 @@ function lognot(x){ /*<>*/ return x ^ -1; /*<>*/ } - function equal(_b_, _a_){ /*<>*/ return _b_ === _a_ ? 1 : 0;} + function equal(_b_, _a_){ /*<>*/ return Object.is(_b_, _a_) ? 1 : 0;} var compare = runtime.caml_int_compare; function min(x, y){ /*<>*/ return x <= y ? x : y; @@ -5522,7 +5523,7 @@ } catch(_L_){ var _J_ = caml_wrap_exception(_L_); - if(_J_ === Stdlib[8]) /*<>*/ return 0; + if(Object.is(_J_, Stdlib[8])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_J_, 0); } /*<>*/ return /*<>*/ caml_call1 @@ -5540,7 +5541,7 @@ } catch(_I_){ var _G_ = caml_wrap_exception(_I_); - if(_G_ === Stdlib[8]) /*<>*/ return 0; + if(Object.is(_G_, Stdlib[8])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_G_, 0); } /*<>*/ return /*<>*/ caml_call1 @@ -6734,7 +6735,7 @@ } catch(_H_){ var _F_ = caml_wrap_exception(_H_); - if(_F_ === Stdlib[8]) /*<>*/ return 0; + if(Object.is(_F_, Stdlib[8])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_F_, 0); } /*<>*/ return /*<>*/ caml_call1 @@ -6752,7 +6753,7 @@ } catch(_E_){ var _C_ = caml_wrap_exception(_E_); - if(_C_ === Stdlib[8]) /*<>*/ return 0; + if(Object.is(_C_, Stdlib[8])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_C_, 0); } /*<>*/ return /*<>*/ caml_call1 @@ -7618,7 +7619,7 @@ /*<>*/ var n = a.length - 1, i = 0; /*<>*/ for(;;){ if(i === n) /*<>*/ return 0; - if(x === a[1 + i]) /*<>*/ return 1; + if(Object.is(x, a[1 + i])) /*<>*/ return 1; /*<>*/ /*<>*/ var i$0 = i + 1 | 0; i = i$0; } @@ -9313,7 +9314,7 @@ } catch(_e_){ var _c_ = caml_wrap_exception(_e_); - if(_c_[1] === Stdlib[7]) /*<>*/ return 0; + if(Object.is(_c_[1], Stdlib[7])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_c_, 0); } /*<>*/ } @@ -9462,7 +9463,7 @@ } catch(_h_){ var _f_ = caml_wrap_exception(_h_); - if(_f_[1] === Stdlib[7]) /*<>*/ return 0; + if(Object.is(_f_[1], Stdlib[7])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_f_, 0); } /*<>*/ } @@ -9615,7 +9616,7 @@ } catch(_c_){ var _a_ = caml_wrap_exception(_c_); - if(_a_[1] === Stdlib[7]) /*<>*/ return 0; + if(Object.is(_a_[1], Stdlib[7])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_a_, 0); } /*<>*/ } @@ -10165,16 +10166,14 @@ function(tok){ /*<>*/ if (! /*<>*/ caml_call1(Stdlib_Obj[1], tok)) - /*<>*/ return caml_check_bound(tables[2], tok) - [1 + tok] - === curr_char + /*<>*/ return /*<>*/ Object.is + (caml_check_bound(tables[2], tok)[1 + tok], curr_char) ? 1 : 0; /*<>*/ /*<>*/ var _l_ = /*<>*/ runtime.caml_obj_tag(tok); - /*<>*/ return caml_check_bound(tables[3], _l_) - [1 + _l_] - === curr_char + /*<>*/ return /*<>*/ Object.is + (caml_check_bound(tables[3], _l_)[1 + _l_], curr_char) ? 1 : 0; /*<>*/ }; @@ -10375,10 +10374,10 @@ /*<>*/ if(0 === c) /*<>*/ return t; if(0 <= c){ /*<>*/ /*<>*/ var rr = add(x, r); - return r === rr ? t : bal(l, v, rr); + return Object.is(r, rr) ? t : bal(l, v, rr); } /*<>*/ /*<>*/ var ll = add(x, l); - return l === ll ? t : bal(ll, v, r); + return Object.is(l, ll) ? t : bal(ll, v, r); } function singleton(x){ /*<>*/ return [0, 0, x, 0, 1]; @@ -10543,10 +10542,10 @@ if(0 <= c){ /*<>*/ /*<>*/ var rr = remove(x, t2); - return t2 === rr ? t : bal(t1, v, rr); + return Object.is(t2, rr) ? t : bal(t1, v, rr); } /*<>*/ /*<>*/ var ll = remove(x, t1); - return t1 === ll ? t : bal(ll, v, t2); + return Object.is(t1, ll) ? t : bal(ll, v, t2); } function union(s1, s2){ /*<>*/ if(! s1) /*<>*/ return s2; @@ -10633,7 +10632,7 @@ /*<>*/ for(;;){ if(s1$0 && s2$0){ var r1 = s1$0[3], v1 = s1$0[2], l1 = s1$0[1]; - if(s1$0 === s2$0) /*<>*/ return 0; + if(Object.is(s1$0, s2$0)) /*<>*/ return 0; /*<>*/ /*<>*/ var match = split_bis(v1, s2$0); if(! match) /*<>*/ return 0; @@ -10824,7 +10823,8 @@ /*<>*/ r$0 = filter(p, r); /*<>*/ if(! pv) /*<>*/ return concat(l$0, r$0); - if(l === l$0 && r === r$0) /*<>*/ return t; + if(Object.is(l, l$0) && Object.is(r, r$0)) + /*<>*/ return t; /*<>*/ return join(l$0, v, r$0); } function partition(p, param){ @@ -11022,7 +11022,7 @@ /*<>*/ l$0 = map(f, l), /*<>*/ v$0 = /*<>*/ caml_call1(f, v), /*<>*/ r$0 = map(f, r); - if(l === l$0 && v === v$0 && r === r$0) + if(Object.is(l, l$0) && Object.is(v, v$0) && Object.is(r, r$0)) /*<>*/ return t; /*<>*/ return try_join(l$0, v$0, r$0); } @@ -11037,7 +11037,7 @@ /*<>*/ t2 = filter_map(f, r); /*<>*/ if(v$0){ var v$1 = v$0[1]; - if(l === t1 && v === v$1 && r === t2) + if(Object.is(l, t1) && Object.is(v, v$1) && Object.is(r, t2)) /*<>*/ return t; /*<>*/ return try_join(t1, v$1, t2); } @@ -11399,15 +11399,15 @@ /*<>*/ c = /*<>*/ caml_call2(Ord[1], x, v); /*<>*/ if(0 === c) - return d === data ? m : [0, l, x, data, r, h]; + return Object.is(d, data) ? m : [0, l, x, data, r, h]; if(0 <= c){ /*<>*/ /*<>*/ var rr = add(x, data, r); - return r === rr ? m : bal(l, v, d, rr); + return Object.is(r, rr) ? m : bal(l, v, d, rr); } /*<>*/ /*<>*/ var ll = add(x, data, l); - return l === ll ? m : bal(ll, v, d, r); + return Object.is(l, ll) ? m : bal(ll, v, d, r); } function find(x, param){ var param$0 = param; @@ -11650,10 +11650,10 @@ /*<>*/ return _d_(l, r); if(0 <= c){ /*<>*/ /*<>*/ var rr = remove(x, r); - return r === rr ? m : bal(l, v, d, rr); + return Object.is(r, rr) ? m : bal(l, v, d, rr); } /*<>*/ /*<>*/ var ll = remove(x, l); - return l === ll ? m : bal(ll, v, d, r); + return Object.is(l, ll) ? m : bal(ll, v, d, r); } function update(x, f, m){ /*<>*/ if(! m){ @@ -11676,16 +11676,16 @@ match = /*<>*/ caml_call1(f, [0, d]); if(! match) /*<>*/ return _d_(l, r); var data = match[1]; - return d === data ? m : [0, l, x, data, r, h]; + return Object.is(d, data) ? m : [0, l, x, data, r, h]; } if(0 <= c){ /*<>*/ /*<>*/ var rr = update(x, f, r); - return r === rr ? m : bal(l, v, d, rr); + return Object.is(r, rr) ? m : bal(l, v, d, rr); } /*<>*/ /*<>*/ var ll = update(x, f, l); - return l === ll ? m : bal(ll, v, d, r); + return Object.is(l, ll) ? m : bal(ll, v, d, r); } function add_to_list(x, data, m){ function add(param){ @@ -11968,7 +11968,8 @@ /*<>*/ r$0 = filter(p, r); /*<>*/ if(! pvd) /*<>*/ return concat(l$0, r$0); - if(l === l$0 && r === r$0) /*<>*/ return m; + if(Object.is(l, l$0) && Object.is(r, r$0)) + /*<>*/ return m; /*<>*/ return join(l$0, v, d, r$0); } function filter_map(f, param){ @@ -13034,7 +13035,8 @@ } catch(_p_){ var _n_ = caml_wrap_exception(_p_); - if(_n_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_n_, 0); + if(! Object.is(_n_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_n_, 0); /*<>*/ add_char(b, 36); previous = 32; i$4 = start; @@ -13556,7 +13558,7 @@ /*<>*/ st$0 = /*<>*/ caml_domain_dls_get(0), /*<>*/ curval = caml_check_bound(st$0, idx)[1 + idx], - _e_ = curval === oldval ? (st$0[1 + idx] = new_obj, 1) : 0; + _e_ = Object.is(curval, oldval) ? (st$0[1 + idx] = new_obj, 1) : 0; /*<>*/ if(_e_) /*<>*/ return new_obj; /*<>*/ /*<>*/ var updated_obj = caml_check_bound(st$0, idx)[1 + idx]; @@ -18489,7 +18491,7 @@ } break a; } - if(nstart === nend) + if(Object.is(nstart, nend)) var indent = 0; else /*<>*/ try{ @@ -18502,7 +18504,8 @@ } catch(_bt_){ var _br_ = caml_wrap_exception(_bt_); - if(_br_[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(_br_, 0); + if(! Object.is(_br_[1], Stdlib[7])) + throw caml_maybe_attach_backtrace(_br_, 0); var indent = invalid_box(0); } /*<>*/ /*<>*/ var @@ -18569,7 +18572,7 @@ { var str_ind = lit_start; /*<>*/ for(;;){ - if(str_ind === end_ind) + if(Object.is(str_ind, end_ind)) /*<>*/ return add_literal (lit_start, str_ind, 0); /*<>*/ /*<>*/ var @@ -18769,7 +18772,8 @@ } catch(_bq_){ var _bf_ = caml_wrap_exception(_bq_); - if(_bf_ !== Stdlib[8] && _bf_[1] !== Stdlib[7]) + if + (! Object.is(_bf_, Stdlib[8]) && ! Object.is(_bf_[1], Stdlib[7])) throw caml_maybe_attach_backtrace(_bf_, 0); var formatting_lit$0 = formatting_lit, next_ind = str_ind$3; } @@ -18824,7 +18828,8 @@ } catch(_bp_){ var _bm_ = caml_wrap_exception(_bp_); - if(_bm_ !== Stdlib[8] && _bm_[1] !== Stdlib[7]) + if + (! Object.is(_bm_, Stdlib[8]) && ! Object.is(_bm_[1], Stdlib[7])) throw caml_maybe_attach_backtrace(_bm_, 0); var _bn_ = 0; } @@ -18887,7 +18892,7 @@ var str_ind$0 = str_ind; c: /*<>*/ for(;;){ - if(str_ind$0 === end_ind) + if(Object.is(str_ind$0, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ /*<>*/ var @@ -18939,7 +18944,7 @@ plus$0 = plus[1], minus$0 = minus[1], zero$0 = zero[1]; - if(str_ind$0 === end_ind) + if(Object.is(str_ind$0, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ var @@ -19024,7 +19029,7 @@ /*<>*/ } function parse_after_padding (pct_ind, str_ind, end_ind, minus, plus, hash, space, ign, pad){ - /*<>*/ if(str_ind === end_ind) + /*<>*/ if(Object.is(str_ind, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ /*<>*/ var @@ -19114,7 +19119,7 @@ /*<>*/ } function parse_after_precision (pct_ind, str_ind, end_ind, minus, plus, hash, space, ign, pad, prec){ - /*<>*/ if(str_ind === end_ind) + /*<>*/ if(Object.is(str_ind, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); function parse_conv(padprec){ @@ -19324,7 +19329,7 @@ var fmt_result = _aS_; break a; case 91: - if(str_ind === end_ind) + if(Object.is(str_ind, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ var @@ -19341,7 +19346,7 @@ (Stdlib[29], i)); /*<>*/ /*<>*/ var _a$_ = i + 1 | 0; - if(c === i) break; + if(Object.is(c, i)) break; i = _a$_; } } @@ -19355,7 +19360,7 @@ function(counter, str_ind, end_ind){ /*<>*/ var str_ind$0 = str_ind; /*<>*/ for(;;){ - if(str_ind$0 === end_ind) + if(Object.is(str_ind$0, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ /*<>*/ var @@ -19386,7 +19391,7 @@ str_ind$0 = str_ind, c$0 = c; /*<>*/ for(;;){ - if(str_ind$0 === end_ind) + if(Object.is(str_ind$0, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ /*<>*/ var @@ -19478,7 +19483,7 @@ /*<>*/ return caml_trampoline (parse_char_set_after_char$0(0, str_ind, end_ind, c)); }; - if(str_ind === end_ind) + if(Object.is(str_ind, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); if @@ -19492,7 +19497,7 @@ str_ind$1 = str_ind$0; else var reverse = 0, str_ind$1 = str_ind; - if(str_ind$1 === end_ind) + if(Object.is(str_ind$1, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ var @@ -19626,7 +19631,7 @@ case 76: case 108: case 110: - if(str_ind !== end_ind){ + if(! Object.is(str_ind, end_ind)){ /*<>*/ var /*<>*/ symb$0 = /*<>*/ caml_string_get @@ -19952,7 +19957,7 @@ } function parse_tag(is_open_tag, str_ind, end_ind){ /*<>*/ try{ - if(str_ind === end_ind) + if(Object.is(str_ind, end_ind)) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (Stdlib[8], 1); if @@ -19984,7 +19989,8 @@ } catch(_aj_){ var _ah_ = caml_wrap_exception(_aj_); - if(_ah_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_ah_, 0); + if(! Object.is(_ah_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_ah_, 0); /*<>*/ var fmt_rest = parse(str_ind, end_ind)[1], /*<>*/ formatting = @@ -19996,7 +20002,7 @@ function parse_spaces(str_ind, end_ind){ /*<>*/ var str_ind$0 = str_ind; /*<>*/ for(;;){ - if(str_ind$0 === end_ind) + if(Object.is(str_ind$0, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ if @@ -20013,7 +20019,7 @@ str_ind$0 = str_ind, acc$0 = acc; /*<>*/ for(;;){ - if(str_ind$0 === end_ind) + if(Object.is(str_ind$0, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ /*<>*/ var @@ -20035,7 +20041,7 @@ } /*<>*/ } function parse_integer(str_ind, end_ind){ - /*<>*/ if(str_ind === end_ind) + /*<>*/ if(Object.is(str_ind, end_ind)) /*<>*/ invalid_format_message (end_ind, cst_unexpected_end_of_format); /*<>*/ /*<>*/ var @@ -20088,7 +20094,7 @@ function search_subformat_end(str_ind, end_ind, c){ /*<>*/ var str_ind$0 = str_ind; /*<>*/ for(;;){ - if(str_ind$0 === end_ind) + if(Object.is(str_ind$0, end_ind)) /*<>*/ /*<>*/ caml_call3 (failwith_message(_U_), str, c, end_ind); if @@ -20671,7 +20677,7 @@ function check_same_length(f, a, expected){ /*<>*/ var length_a = a[1], - _W_ = expected !== length_a ? 1 : 0; + _W_ = Object.is(expected, length_a) ? 0 : 1; return _W_ ? /*<>*/ caml_call5 (Stdlib_Printf[10], Stdlib[1], _h_, f, expected, length_a) @@ -20790,7 +20796,7 @@ } catch(_U_){ var _T_ = caml_wrap_exception(_U_); - if(_T_ === Stdlib[8]) /*<>*/ return 0; + if(Object.is(_T_, Stdlib[8])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_T_, 0); } /*<>*/ return [0, x]; @@ -20870,7 +20876,7 @@ /*<>*/ } function fit_capacity(a){ /*<>*/ var _N_ = a[1]; - return capacity(a) === _N_ + return /*<>*/ Object.is(capacity(a), _N_) ? 0 : (a [2] @@ -21513,7 +21519,8 @@ } catch(_ay_){ var _as_ = caml_wrap_exception(_ay_); - if(_as_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_as_, 0); + if(! Object.is(_as_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_as_, 0); var add1 = [0, @@ -21526,7 +21533,8 @@ } catch(_ax_){ var _at_ = caml_wrap_exception(_ax_); - if(_at_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_at_, 0); + if(! Object.is(_at_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_at_, 0); var add2 = [0, @@ -21626,7 +21634,7 @@ } catch(_an_){ var _al_ = caml_wrap_exception(_an_); - if(_al_[1] === Stdlib[7]) /*<>*/ return 0; + if(Object.is(_al_[1], Stdlib[7])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_al_, 0); } /*<>*/ } @@ -21638,7 +21646,7 @@ } catch(_ak_){ var _ai_ = caml_wrap_exception(_ak_); - if(_ai_[1] === Stdlib[7]) /*<>*/ return 0; + if(Object.is(_ai_[1], Stdlib[7])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_ai_, 0); } /*<>*/ } @@ -21705,7 +21713,8 @@ } catch(_ag_){ var _W_ = caml_wrap_exception(_ag_); - if(_W_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_W_, 0); + if(! Object.is(_W_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_W_, 0); /*<>*/ try{ /*<>*/ var /*<>*/ i = @@ -21724,7 +21733,7 @@ } catch(_ah_){ var _X_ = caml_wrap_exception(_ah_); - if(_X_ === Stdlib[8]) + if(Object.is(_X_, Stdlib[8])) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace ([0, Stop, [0, s]], 1); throw caml_maybe_attach_backtrace(_X_, 0); @@ -21777,7 +21786,7 @@ } catch(_ae_){ var ___ = caml_wrap_exception(_ae_); - if(___[1] !== Stdlib[6]) + if(! Object.is(___[1], Stdlib[6])) throw caml_maybe_attach_backtrace(___, 0); var match = 0; } @@ -22064,14 +22073,15 @@ } catch(_Q_){ var _O_ = caml_wrap_exception(_Q_); - if(_O_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_O_, 0); + if(! Object.is(_O_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_O_, 0); /*<>*/ try{ /*<>*/ /*<>*/ var n = /*<>*/ caml_call2(Stdlib_String[36], s, 32); } catch(_R_){ var _P_ = caml_wrap_exception(_R_); - if(_P_ === Stdlib[8]) /*<>*/ return len; + if(Object.is(_P_, Stdlib[8])) /*<>*/ return len; throw caml_maybe_attach_backtrace(_P_, 0); } /*<>*/ return loop(n + 1 | 0); @@ -22202,7 +22212,7 @@ for(;;){ /*<>*/ /*<>*/ var c = /*<>*/ caml_call1(Stdlib[82], ic); - if(c === sep) + if(Object.is(c, sep)) /*<>*/ stash(0); else /*<>*/ /*<>*/ caml_call2 @@ -22211,7 +22221,8 @@ } catch(_G_){ var _E_ = caml_wrap_exception(_G_); - if(_E_ !== Stdlib[12]) throw caml_maybe_attach_backtrace(_E_, 0); + if(! Object.is(_E_, Stdlib[12])) + throw caml_maybe_attach_backtrace(_E_, 0); if(0 < /*<>*/ caml_call1(Stdlib_Buffer[7], buf)) /*<>*/ stash(0); /*<>*/ /*<>*/ caml_call1(Stdlib[93], ic); @@ -22484,10 +22495,11 @@ (Stdlib[28], constructor$0, f); /*<>*/ } function to_string_default(x){ - /*<>*/ if(x === Stdlib[9]) + /*<>*/ if(Object.is(x, Stdlib[9])) /*<>*/ return cst_Out_of_memory; - if(x === Stdlib[10]) /*<>*/ return cst_Stack_overflow; - if(x[1] === Stdlib[4]){ + if(Object.is(x, Stdlib[10])) + /*<>*/ return cst_Stack_overflow; + if(Object.is(x[1], Stdlib[4])){ var match = x[2], char$0 = match[3], line = match[2], file = match[1]; /*<>*/ return /*<>*/ caml_call6 (Stdlib_Printf[4], @@ -22498,7 +22510,7 @@ char$0 + 5 | 0, cst_Pattern_matching_failed); } - if(x[1] === Stdlib[5]){ + if(Object.is(x[1], Stdlib[5])){ var match$0 = x[2], char$1 = match$0[3], @@ -22513,7 +22525,7 @@ char$1 + 6 | 0, cst_Assertion_failed); } - if(x[1] !== Stdlib[15]) + if(! Object.is(x[1], Stdlib[15])) /*<>*/ return string_of_extension_constructo(x); var match$1 = x[2], @@ -22588,7 +22600,7 @@ /*<>*/ if(0 === slot[0]){ /*<>*/ var lines = - slot[3] === slot[6] + Object.is(slot[3], slot[6]) ? /*<>*/ caml_call2 (Stdlib_Printf[4], _h_, slot[3]) : /*<>*/ caml_call3 @@ -22839,7 +22851,8 @@ } catch(_D_){ var _w_ = caml_wrap_exception(_D_); - if(_w_ !== Stdlib[9]) throw caml_maybe_attach_backtrace(_w_, 0); + if(! Object.is(_w_, Stdlib[9])) + throw caml_maybe_attach_backtrace(_w_, 0); var _B_ = /*<>*/ caml_call1 @@ -23300,7 +23313,7 @@ } catch(_x_){ var _w_ = caml_wrap_exception(_x_); - if(_w_ === Stdlib[12]) /*<>*/ return 0; + if(Object.is(_w_, Stdlib[12])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_w_, 0); } /*<>*/ return [0, c]; @@ -23312,7 +23325,7 @@ } catch(_v_){ var _u_ = caml_wrap_exception(_v_); - if(_u_ === Stdlib[12]) /*<>*/ return 0; + if(Object.is(_u_, Stdlib[12])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_u_, 0); } /*<>*/ return [0, n]; @@ -23324,7 +23337,7 @@ } catch(_t_){ var _s_ = caml_wrap_exception(_t_); - if(_s_ === Stdlib[12]) /*<>*/ return 0; + if(Object.is(_s_, Stdlib[12])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_s_, 0); } /*<>*/ return [0, s]; @@ -23356,7 +23369,7 @@ } catch(_r_){ var _q_ = caml_wrap_exception(_r_); - if(_q_ === Stdlib[12]) /*<>*/ return 0; + if(Object.is(_q_, Stdlib[12])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_q_, 0); } /*<>*/ } @@ -23391,7 +23404,7 @@ } catch(_p_){ var _o_ = caml_wrap_exception(_p_); - if(_o_ === Stdlib[12]) /*<>*/ return 0; + if(Object.is(_o_, Stdlib[12])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_o_, 0); } /*<>*/ return [0, s]; @@ -23452,7 +23465,8 @@ } catch(_n_){ var _i_ = caml_wrap_exception(_n_); - if(_i_[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(_i_, 0); + if(! Object.is(_i_[1], Stdlib[11])) + throw caml_maybe_attach_backtrace(_i_, 0); var initial_size = -1; } /*<>*/ var @@ -23473,7 +23487,7 @@ } catch(_m_){ var _j_ = caml_wrap_exception(_m_); - if(_j_ === Stdlib[12]) + if(Object.is(_j_, Stdlib[12])) /*<>*/ return /*<>*/ caml_call1 (Stdlib_Bytes[44], buf); throw caml_maybe_attach_backtrace(_j_, 0); @@ -23506,7 +23520,7 @@ } catch(_h_){ var _e_ = caml_wrap_exception(_h_); - if(_e_ === Stdlib[12]) /*<>*/ return 0; + if(Object.is(_e_, Stdlib[12])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_e_, 0); } /*<>*/ var @@ -23520,7 +23534,8 @@ } catch(_g_){ var _f_ = caml_wrap_exception(_g_); - if(_f_ !== Stdlib[12]) throw caml_maybe_attach_backtrace(_f_, 0); + if(! Object.is(_f_, Stdlib[12])) + throw caml_maybe_attach_backtrace(_f_, 0); dst[1 + offset] = 0; /*<>*/ return block; } @@ -23540,7 +23555,8 @@ } catch(_d_){ var _c_ = caml_wrap_exception(_d_); - if(_c_ === Stdlib[12]) /*<>*/ return accu$0; + if(Object.is(_c_, Stdlib[12])) + /*<>*/ return accu$0; throw caml_maybe_attach_backtrace(_c_, 0); } /*<>*/ /*<>*/ var @@ -25398,7 +25414,7 @@ } catch(_al_){ var _a_ = caml_wrap_exception(_al_); - if(_a_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_a_, 0); + if(! Object.is(_a_, Stdlib[8])) throw caml_maybe_attach_backtrace(_a_, 0); /*<>*/ try{ /*<>*/ var /*<>*/ _e_ = @@ -25407,7 +25423,8 @@ } catch(_am_){ var _b_ = caml_wrap_exception(_am_); - if(_b_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_b_, 0); + if(! Object.is(_b_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_b_, 0); var _c_ = cst; } var params = _c_; @@ -26792,7 +26809,7 @@ if(sz <= i) /*<>*/ return /*<>*/ caml_call2 (notfound, h, index); - if(h === caml_check_bound(hashes, i)[1 + i]){ + if(Object.is(h, caml_check_bound(hashes, i)[1 + i])){ /*<>*/ /*<>*/ var opt = get(bucket, i); if(opt){ @@ -26881,7 +26898,7 @@ accu = 0; /*<>*/ for(;;){ if(sz <= i) /*<>*/ return accu; - if(h === caml_check_bound(hashes, i)[1 + i]){ + if(Object.is(h, caml_check_bound(hashes, i)[1 + i])){ /*<>*/ /*<>*/ var match = get(bucket, i); if(match){ @@ -27334,7 +27351,7 @@ /*<>*/ elem = [0, size, [3, indent, br_ty], 0]; /*<>*/ return scan_push(state, 0, elem); } - var _a4_ = state[14] === state[15] ? 1 : 0; + var _a4_ = Object.is(state[14], state[15]) ? 1 : 0; if(! _a4_) return _a4_; var s = state[16], x = caml_ml_string_length(s); /*<>*/ return enqueue_string_as(state, x, s); @@ -27604,7 +27621,7 @@ /*<>*/ return state[15]; /*<>*/ } function pp_over_max_boxes(state, param){ - /*<>*/ return state[14] === state[15] ? 1 : 0; + /*<>*/ return Object.is(state[14], state[15]) ? 1 : 0; /*<>*/ } function pp_set_ellipsis_text(state, s){ /*<>*/ state[16] = s; @@ -29191,7 +29208,8 @@ } catch(_aY_){ var _aX_ = caml_wrap_exception(_aY_); - if(_aX_ !== Stdlib[12]) throw caml_maybe_attach_backtrace(_aX_, 0); + if(! Object.is(_aX_, Stdlib[12])) + throw caml_maybe_attach_backtrace(_aX_, 0); ib[2] = null_char; ib[3] = 0; ib[1] = 1; @@ -29491,7 +29509,9 @@ function check_this_char(ib, c){ /*<>*/ /*<>*/ var ci = checked_peek_char(ib); - return ci === c ? invalidate_current_char(ib) : character_mismatch(c, ci); + return Object.is(ci, c) + ? invalidate_current_char(ib) + : character_mismatch(c, ci); /*<>*/ } function token_char(ib){ /*<>*/ return /*<>*/ caml_string_get @@ -29784,7 +29804,7 @@ /*<>*/ c = peek_char(ib), /*<>*/ _aL_ = lowercase( /*<>*/ caml_string_get(str, i)); - if(lowercase(c) !== _aL_) + if(! /*<>*/ Object.is(lowercase(c), _aL_)) /*<>*/ /*<>*/ caml_call1(error, 0); if(0 === width$0[1]) /*<>*/ /*<>*/ caml_call1(error, 0); @@ -30102,7 +30122,7 @@ /*<>*/ return width$0; } var c$0 = stp[1]; - if(c === c$0){ + if(Object.is(c, c$0)){ /*<>*/ invalidate_current_char(ib); /*<>*/ return width$0; } @@ -30314,7 +30334,7 @@ /*<>*/ _W_ = /*<>*/ caml_call2 (CamlinternalFormat[1], char_set, c), - /*<>*/ _X_ = _W_ ? c !== stp ? 1 : 0 : _W_; + /*<>*/ _X_ = _W_ ? Object.is(c, stp) ? 0 : 1 : _W_; else var _X_ = _V_; } @@ -30333,13 +30353,15 @@ if(! _T_) /*<>*/ return _T_; /*<>*/ /*<>*/ var ci = peek_char(ib); - return c === ci ? invalidate_current_char(ib) : character_mismatch(c, ci); + return Object.is(c, ci) + ? invalidate_current_char(ib) + : character_mismatch(c, ci); /*<>*/ } function scanf_bad_input(ib, x){ /*<>*/ if(x[1] === Scan_failure) var s = x[2]; else{ - if(x[1] !== Stdlib[7]) + if(! Object.is(x[1], Stdlib[7])) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (x, 1); var s = x[2]; @@ -30908,7 +30930,8 @@ } catch(exn$0){ var exn = caml_wrap_exception(exn$0); - if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); + if(! Object.is(exn[1], Stdlib[7])) + throw caml_maybe_attach_backtrace(exn, 0); var msg = exn[2], fmt$3 = bad_input(msg); } /*<>*/ return [0, @@ -30950,7 +30973,7 @@ } catch(exn){ var exn$0 = caml_wrap_exception(exn); - if(exn$0[1] !== Stdlib[7]) + if(! Object.is(exn$0[1], Stdlib[7])) throw caml_maybe_attach_backtrace(exn$0, 0); var msg$0 = exn$0[2], @@ -31145,8 +31168,10 @@ catch(exc$0){ var exc = caml_wrap_exception(exc$0); if - (exc[1] !== Scan_failure && exc[1] !== Stdlib[7] && exc !== Stdlib[12]){ - if(exc[1] !== Stdlib[6]) throw caml_maybe_attach_backtrace(exc, 0); + (exc[1] !== Scan_failure + && ! Object.is(exc[1], Stdlib[7]) && ! Object.is(exc, Stdlib[12])){ + if(! Object.is(exc[1], Stdlib[6])) + throw caml_maybe_attach_backtrace(exc, 0); /*<>*/ var msg = exc[2], /*<>*/ _z_ = @@ -31234,7 +31259,8 @@ } catch(exn$0){ var exn = caml_wrap_exception(exn$0); - if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); + if(! Object.is(exn[1], Stdlib[7])) + throw caml_maybe_attach_backtrace(exn, 0); var msg = exn[2], fmt = bad_input(msg); } /*<>*/ return /*<>*/ caml_call1 @@ -31509,7 +31535,8 @@ } catch(_aa_){ var ___ = caml_wrap_exception(_aa_); - if(___ !== Stdlib[8]) throw caml_maybe_attach_backtrace(___, 0); + if(! Object.is(___, Stdlib[8])) + throw caml_maybe_attach_backtrace(___, 0); /*<>*/ /*<>*/ var label = new_method(table); table[3] = @@ -31547,7 +31574,7 @@ } catch(_Y_){ var _W_ = caml_wrap_exception(_Y_); - if(_W_ === Stdlib[8]) + if(Object.is(_W_, Stdlib[8])) /*<>*/ return caml_check_bound (table[2], label) [1 + label]; @@ -31610,7 +31637,8 @@ } catch(_T_){ var _Q_ = caml_wrap_exception(_T_); - if(_Q_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_Q_, 0); + if(! Object.is(_Q_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_Q_, 0); var _R_ = 1; } by_label[1] = @@ -31697,7 +31725,8 @@ } catch(_N_){ var _L_ = caml_wrap_exception(_N_); - if(_L_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_L_, 0); + if(! Object.is(_L_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_L_, 0); var index = table[1]; table[1] = index + 1 | 0; /*<>*/ if(name !== "") @@ -31762,7 +31791,7 @@ } catch(_B_){ var _z_ = caml_wrap_exception(_B_); - if(_z_ === Stdlib[8]) + if(Object.is(_z_, Stdlib[8])) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace ([0, Assert_failure, _a_], 1); throw caml_maybe_attach_backtrace(_z_, 0); @@ -31972,7 +32001,7 @@ if(! tables$1) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace ([0, Assert_failure, _d_], 1); - if(tables$1[1] === key) break; + if( /*<>*/ Object.is(tables$1[1], key)) break; if(! tables$1) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace ([0, Assert_failure, _f_], 1); @@ -32489,7 +32518,7 @@ function(param){ /*<>*/ /*<>*/ var l = modu[1 + i$0]; - if(l$0 === l) + if(Object.is(l$0, l)) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace ([0, Stdlib[15], loc], 1); var _j_ = caml_obj_tag(l); @@ -32817,7 +32846,7 @@ /*<>*/ for(;;){ if(! param$0) /*<>*/ return 0; var hk = param$0[1], next = param$0[3], c = param$0[2]; - if(hkey !== hk){ + if(! Object.is(hkey, hk)){ var next$0 = param$0[3], c$0 = param$0[2]; /*<>*/ return [0, hk, @@ -32851,7 +32880,7 @@ /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (Stdlib[8], 1); var hk = param[1], rest = param[3], c = param[2]; - if(hkey === hk) + if(Object.is(hkey, hk)) switch( /*<>*/ caml_call2(H[3], c, key)){ case 0: /*<>*/ /*<>*/ var @@ -32875,7 +32904,7 @@ for(;;){ if(! param) /*<>*/ return 0; var hk = param[1], rest = param[3], c = param[2]; - if(hkey === hk) + if(Object.is(hkey, hk)) switch( /*<>*/ caml_call2(H[3], c, key)){ case 0: /*<>*/ /*<>*/ var @@ -32898,7 +32927,7 @@ /*<>*/ for(;;){ if(! param$0) /*<>*/ return 0; var hk = param$0[1], rest = param$0[3], c = param$0[2]; - if(hkey === hk) + if(Object.is(hkey, hk)) switch( /*<>*/ caml_call2(H[3], c, key)){ case 0: /*<>*/ /*<>*/ var @@ -32934,7 +32963,7 @@ /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (Stdlib[8], 1); var hk = param[1], next = param[3], c = param[2]; - if(hkey === hk){ + if(Object.is(hkey, hk)){ if(! /*<>*/ caml_call2(H[3], c, key)){ /*<>*/ /*<>*/ var _V_ = /*<>*/ caml_call3(H[5], c, key, info); @@ -32947,7 +32976,8 @@ } catch(_Y_){ var _W_ = caml_wrap_exception(_Y_); - if(_W_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_W_, 0); + if(! Object.is(_W_, Stdlib[8])) + throw caml_maybe_attach_backtrace(_W_, 0); /*<>*/ /*<>*/ var container = /*<>*/ caml_call2(H[1], key, info); /*<>*/ caml_check_bound(h[2], i)[1 + i] = [0, hkey, container, l]; @@ -32965,7 +32995,7 @@ /*<>*/ for(;;){ if(! param) /*<>*/ return 0; var hk = param[1], rest = param[3], c = param[2]; - if(hk === hkey){ + if(Object.is(hk, hkey)){ if(! /*<>*/ caml_call2(H[3], c, key)) /*<>*/ return 1; param = rest; @@ -33143,7 +33173,7 @@ match = get_key(eph); if(! match) /*<>*/ return 0; var k = match[1]; - return k === key ? get_data(eph) : 0; + return Object.is(k, key) ? get_data(eph) : 0; /*<>*/ } function MakeSeeded$0(H){ function create$0(k, d){ @@ -33248,7 +33278,7 @@ match = get_key(e); if(match){ var x = match[1]; - if(x === k) /*<>*/ return 1; + if(Object.is(x, k)) /*<>*/ return 1; } /*<>*/ return 0; /*<>*/ } @@ -33330,12 +33360,12 @@ match = get_key1(eph); if(! match) /*<>*/ return 0; var k = match[1]; - if(k !== key1) /*<>*/ return 0; + if(! Object.is(k, key1)) /*<>*/ return 0; /*<>*/ /*<>*/ var match$0 = get_key2(eph); if(! match$0) /*<>*/ return 0; var k$0 = match$0[1]; - return k$0 === key2 ? get_data$0(eph) : 0; + return Object.is(k$0, key2) ? get_data$0(eph) : 0; /*<>*/ } function MakeSeeded$1(H1, H2){ function create(param, d){ @@ -33476,7 +33506,8 @@ /*<>*/ match$0 = get_key2(e); if(match && match$0){ var x2 = match$0[1], x1 = match[1]; - if(x1 === k1 && x2 === k2) /*<>*/ return 1; + if(Object.is(x1, k1) && Object.is(x2, k2)) + /*<>*/ return 1; } /*<>*/ return 0; /*<>*/ } @@ -33580,7 +33611,7 @@ /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (Stdlib[3], 1); var k = match[1]; - if(k !== caml_check_bound(keys, i)[1 + i]) + if(! Object.is(k, caml_check_bound(keys, i)[1 + i])) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (Stdlib[3], 1); /*<>*/ /*<>*/ var @@ -33595,7 +33626,7 @@ } catch(_G_){ var _B_ = caml_wrap_exception(_G_); - if(_B_ === Stdlib[3]) /*<>*/ return 0; + if(Object.is(_B_, Stdlib[3])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_B_, 0); } /*<>*/ } @@ -33795,7 +33826,7 @@ match = get_key$0(e, i); if(match){ var x = match[1]; - if(x === caml_check_bound(k, i)[1 + i]){ + if(Object.is(x, caml_check_bound(k, i)[1 + i])){ /*<>*/ /*<>*/ var _i_ = i + 1 | 0; if(_g_ === i) break; @@ -33812,7 +33843,7 @@ } catch(_j_){ var _e_ = caml_wrap_exception(_j_); - if(_e_ === Stdlib[3]) /*<>*/ return 0; + if(Object.is(_e_, Stdlib[3])) /*<>*/ return 0; throw caml_maybe_attach_backtrace(_e_, 0); } /*<>*/ } @@ -34122,7 +34153,7 @@ } catch(_aB_){ var _a_ = caml_wrap_exception(_aB_); - if(_a_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_a_, 0); + if(! Object.is(_a_, Stdlib[8])) throw caml_maybe_attach_backtrace(_a_, 0); var temp_dir_name = cst_tmp; } /*<>*/ function quote(s){ @@ -34364,7 +34395,7 @@ } catch(_P_){ var _b_ = caml_wrap_exception(_P_); - if(_b_ !== Stdlib[8]) throw caml_maybe_attach_backtrace(_b_, 0); + if(! Object.is(_b_, Stdlib[8])) throw caml_maybe_attach_backtrace(_b_, 0); var temp_dir_name$0 = cst$5; } function quote$0(s){ @@ -34813,7 +34844,8 @@ } catch(e$0){ var e = caml_wrap_exception(e$0); - if(e[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(e, 0); + if(! Object.is(e[1], Stdlib[11])) + throw caml_maybe_attach_backtrace(e, 0); if(20 <= counter) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (e, 0); @@ -34847,7 +34879,8 @@ } catch(e$0){ var e = caml_wrap_exception(e$0); - if(e[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(e, 0); + if(! Object.is(e[1], Stdlib[11])) + throw caml_maybe_attach_backtrace(e, 0); if(20 <= counter) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (e, 0); @@ -34876,7 +34909,8 @@ } catch(e$0){ var e = caml_wrap_exception(e$0); - if(e[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(e, 0); + if(! Object.is(e[1], Stdlib[11])) + throw caml_maybe_attach_backtrace(e, 0); if(20 <= counter) /*<>*/ throw /*<>*/ caml_maybe_attach_backtrace (e, 0); diff --git a/compiler/tests-jsoo/test_obj.ml b/compiler/tests-jsoo/test_obj.ml index 84ea39f0da..a5a3029863 100644 --- a/compiler/tests-jsoo/test_obj.ml +++ b/compiler/tests-jsoo/test_obj.ml @@ -72,14 +72,12 @@ let%expect_test "dup" = |}] let%expect_test "sameness" = - (* FIXME: Jsoo returns the wrong opposite result for cases below. - Would be fixed by GH#1410 *) - let f x = - match Sys.backend_type with - | Other "js_of_ocaml" -> not x - | Other _ | Native | Bytecode -> x - in - print_bool (f (nan == nan)); + let mzero = 1. /. neg_infinity in + print_bool (nan == nan); [%expect {| true |}]; - print_bool (f (-0. == 0.)); + print_bool (-0. == 0.); + [%expect {| false |}]; + print_bool (mzero == float_of_int 0); + [%expect {| false |}]; + print_bool (float_of_int 0 == ~-.(float_of_int 0)); [%expect {| false |}]