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
540
540
541
541
let ( >>| ) x f = map f x
542
542
543
- let eq_gen ~negate x y =
543
+ let js_eqeqeq ~negate x y =
544
544
let xv = Code.Var. fresh () in
545
545
let yv = Code.Var. fresh () in
546
546
let * js = Type. js_type in
@@ -565,21 +565,15 @@ module Value = struct
565
565
return () )
566
566
(if negate then Arith. eqz n else n)
567
567
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))
575
572
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)))
583
577
584
578
let ult = Arith. ult
585
579
Original file line number Diff line number Diff line change @@ -226,16 +226,18 @@ module Generate (Target : Target_sig.S) = struct
226
226
Arith. (transl_prim_arg ctx ~typ: (Int Unnormalized ) x lsl const 1l )
227
227
Arith. (transl_prim_arg ctx ~typ: (Int Unnormalized ) y lsl const 1l )
228
228
| 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 *)
229
235
(if negate then Value. phys_neq else Value. phys_eq)
230
- ~relaxed: true
231
236
(transl_prim_arg ctx ~typ: Top x)
232
237
(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 *)
237
240
(if negate then Value. phys_neq else Value. phys_eq)
238
- ~relaxed: false
239
241
(transl_prim_arg ctx ~typ: Top x)
240
242
(transl_prim_arg ctx ~typ: Top y)
241
243
Original file line number Diff line number Diff line change @@ -124,11 +124,11 @@ module type S = sig
124
124
125
125
val le : expression -> expression -> expression
126
126
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
130
128
131
- val phys_neq : relaxed :bool -> expression -> expression -> expression
129
+ val phys_eq : expression -> expression -> expression
130
+
131
+ val phys_neq : expression -> expression -> expression
132
132
133
133
val ult : expression -> expression -> expression
134
134
You can’t perform that action at this time.
0 commit comments