File tree Expand file tree Collapse file tree 3 files changed +21
-25
lines changed Expand file tree Collapse file tree 3 files changed +21
-25
lines changed Original file line number Diff line number Diff line change @@ -540,7 +540,7 @@ module Value = struct
540540
541541 let ( >>| ) x f = map f x
542542
543- let eq_gen ~negate x y =
543+ let js_eqeqeq ~negate x y =
544544 let xv = Code.Var. fresh () in
545545 let yv = Code.Var. fresh () in
546546 let * js = Type. js_type in
@@ -565,21 +565,15 @@ module Value = struct
565565 return () )
566566 (if negate then Arith. eqz n else n)
567567
568- let phys_eq ~relaxed x y =
569- if relaxed
570- then eq_gen ~negate: false x y
571- else
572- let * x = x in
573- let * y = y in
574- return (W. RefEq (x, y))
568+ let phys_eq x y =
569+ let * x = x in
570+ let * y = y in
571+ return (W. RefEq (x, y))
575572
576- let phys_neq ~relaxed x y =
577- if relaxed
578- then eq_gen ~negate: true x y
579- else
580- let * x = x in
581- let * y = y in
582- Arith. eqz (return (W. RefEq (x, y)))
573+ let phys_neq x y =
574+ let * x = x in
575+ let * y = y in
576+ Arith. eqz (return (W. RefEq (x, y)))
583577
584578 let ult = Arith. ult
585579
Original file line number Diff line number Diff line change @@ -226,16 +226,18 @@ module Generate (Target : Target_sig.S) = struct
226226 Arith. (transl_prim_arg ctx ~typ: (Int Unnormalized ) x lsl const 1l )
227227 Arith. (transl_prim_arg ctx ~typ: (Int Unnormalized ) y lsl const 1l )
228228 | Top , Top ->
229+ Value. js_eqeqeq
230+ ~negate
231+ (transl_prim_arg ctx ~typ: Top x)
232+ (transl_prim_arg ctx ~typ: Top y)
233+ | Bot , _ | _ , Bot ->
234+ (* this is deadcode, deadcode is off *)
229235 (if negate then Value. phys_neq else Value. phys_eq)
230- ~relaxed: true
231236 (transl_prim_arg ctx ~typ: Top x)
232237 (transl_prim_arg ctx ~typ: Top y)
233- | Int (Normalized | Unnormalized ), (Int Ref | Top | Bot | Number _ | Tuple _)
234- | (Int Ref | Top | Bot | Number _ | Tuple _), Int (Normalized | Unnormalized )
235- | ( (Int Ref | Top | Bot | Number _ | Tuple _)
236- , (Int Ref | Top | Bot | Number _ | Tuple _ ) ) ->
238+ | (Int _ | Number _ | Tuple _ ), _ | _ , (Int _ | Number _ | Tuple _ ) ->
239+ (* Only Top may contain JavaScript values *)
237240 (if negate then Value. phys_neq else Value. phys_eq)
238- ~relaxed: false
239241 (transl_prim_arg ctx ~typ: Top x)
240242 (transl_prim_arg ctx ~typ: Top y)
241243
Original file line number Diff line number Diff line change @@ -124,11 +124,11 @@ module type S = sig
124124
125125 val le : expression -> expression -> expression
126126
127- (* Relaxed means using JavaScript strict equality to compare
128- JavaScript values *)
129- val phys_eq : relaxed :bool -> expression -> expression -> expression
127+ val js_eqeqeq : negate :bool -> expression -> expression -> expression
130128
131- val phys_neq : relaxed :bool -> expression -> expression -> expression
129+ val phys_eq : expression -> expression -> expression
130+
131+ val phys_neq : expression -> expression -> expression
132132
133133 val ult : expression -> expression -> expression
134134
You can’t perform that action at this time.
0 commit comments