@@ -108,7 +108,7 @@ module type Int = sig
108
108
val shift_op : (constant list ) -> (t -> int -> t ) -> constant option
109
109
end
110
110
111
- let eval_prim ~ target x =
111
+ let eval_prim x =
112
112
match x with
113
113
| Not , [ Int i ] -> bool Int32. (i = 0l )
114
114
| Lt , [ Int i; Int j ] -> bool Int32. (i < j)
@@ -119,7 +119,7 @@ let eval_prim ~target x =
119
119
| Extern name , l -> (
120
120
let name = Primitive. resolve name in
121
121
let (module Int : Int ) =
122
- match target with
122
+ match Config. target () with
123
123
| `JavaScript -> (module Int32 )
124
124
| `Wasm -> (module Int31 )
125
125
in
@@ -185,7 +185,7 @@ let eval_prim ~target x =
185
185
| "caml_sys_const_int_size" , [ _ ] ->
186
186
Some
187
187
(Int
188
- (match target with
188
+ (match Config. target () with
189
189
| `JavaScript -> 32l
190
190
| `Wasm -> 31l ))
191
191
| "caml_sys_const_big_endian" , [ _ ] -> Some (Int 0l )
@@ -214,7 +214,7 @@ type is_int =
214
214
| N
215
215
| Unknown
216
216
217
- let is_int ~ target info x =
217
+ let is_int info x =
218
218
match x with
219
219
| Pv x ->
220
220
get_approx
@@ -223,7 +223,7 @@ let is_int ~target info x =
223
223
match Flow.Info. def info x with
224
224
| Some (Constant (Int _ )) -> Y
225
225
| Some (Constant (NativeInt _ | Int32 _ )) ->
226
- assert (Poly. equal target `Wasm );
226
+ assert (Poly. equal ( Config. target () ) `Wasm );
227
227
N
228
228
| Some (Block (_ , _ , _ , _ ) | Constant _ ) -> N
229
229
| None | Some _ -> Unknown )
@@ -236,7 +236,7 @@ let is_int ~target info x =
236
236
x
237
237
| Pc (Int _ ) -> Y
238
238
| Pc (NativeInt _ | Int32 _ ) ->
239
- assert (Poly. equal target `Wasm );
239
+ assert (Poly. equal ( Config. target () ) `Wasm );
240
240
N
241
241
| Pc _ -> N
242
242
@@ -308,7 +308,7 @@ let constant_js_equal a b =
308
308
| Tuple _, _
309
309
| _ , Tuple _ -> None
310
310
311
- let eval_instr info ~ target ((x , loc ) as i ) =
311
+ let eval_instr info ((x , loc ) as i ) =
312
312
match x with
313
313
| Let (x , Prim (Extern (("caml_equal" | "caml_notequal" ) as prim ), [ y; z ])) -> (
314
314
match the_const_of info y, the_const_of info z with
@@ -365,7 +365,7 @@ let eval_instr info ~target ((x, loc) as i) =
365
365
below fail. *)
366
366
[ i ]
367
367
| Let (x , Prim (IsInt, [ y ])) -> (
368
- match is_int ~target info y with
368
+ match is_int info y with
369
369
| Unknown -> [ i ]
370
370
| (Y | N ) as b ->
371
371
let c = Constant (bool ' Poly. (b = Y )) in
@@ -381,7 +381,7 @@ let eval_instr info ~target ((x, loc) as i) =
381
381
| Let (x , Prim (Extern "caml_sys_const_backend_type" , [ _ ])) ->
382
382
let jsoo = Code.Var. fresh () in
383
383
let backend_name =
384
- match target with
384
+ match Config. target () with
385
385
| `JavaScript -> " js_of_ocaml"
386
386
| `Wasm -> " wasm_of_ocaml"
387
387
in
@@ -398,7 +398,6 @@ let eval_instr info ~target ((x, loc) as i) =
398
398
| _ -> false )
399
399
then
400
400
eval_prim
401
- ~target
402
401
( prim
403
402
, List. map prim_args' ~f: (function
404
403
| Some c -> c
@@ -416,7 +415,7 @@ let eval_instr info ~target ((x, loc) as i) =
416
415
, Prim
417
416
( prim
418
417
, List. map2 prim_args prim_args' ~f: (fun arg (c : constant option ) ->
419
- match c, target with
418
+ match c, Config. target () with
420
419
| ( Some ((Int _ | Int32 _ | NativeInt _ | NativeString _) as c)
421
420
, _ ) -> Pc c
422
421
| Some (Float _ as c ), `JavaScript -> Pc c
@@ -547,15 +546,15 @@ let drop_exception_handler blocks =
547
546
blocks
548
547
blocks
549
548
550
- let eval ~ target info blocks =
549
+ let eval info blocks =
551
550
Addr.Map. map
552
551
(fun block ->
553
- let body = List. concat_map block.body ~f: (eval_instr ~target info) in
552
+ let body = List. concat_map block.body ~f: (eval_instr info) in
554
553
let branch = eval_branch info block.branch in
555
554
{ block with Code. body; Code. branch })
556
555
blocks
557
556
558
- let f ~ target info p =
559
- let blocks = eval ~target info p.blocks in
557
+ let f info p =
558
+ let blocks = eval info p.blocks in
560
559
let blocks = drop_exception_handler blocks in
561
560
{ p with blocks }
0 commit comments