@@ -108,7 +108,7 @@ module type Int = sig
108108 val shift_op : (constant list ) -> (t -> int -> t ) -> constant option
109109end
110110
111- let eval_prim ~ target x =
111+ let eval_prim x =
112112 match x with
113113 | Not , [ Int i ] -> bool Int32. (i = 0l )
114114 | Lt , [ Int i; Int j ] -> bool Int32. (i < j)
@@ -119,7 +119,7 @@ let eval_prim ~target x =
119119 | Extern name , l -> (
120120 let name = Primitive. resolve name in
121121 let (module Int : Int ) =
122- match target with
122+ match Config. target () with
123123 | `JavaScript -> (module Int32 )
124124 | `Wasm -> (module Int31 )
125125 in
@@ -185,7 +185,7 @@ let eval_prim ~target x =
185185 | "caml_sys_const_int_size" , [ _ ] ->
186186 Some
187187 (Int
188- (match target with
188+ (match Config. target () with
189189 | `JavaScript -> 32l
190190 | `Wasm -> 31l ))
191191 | "caml_sys_const_big_endian" , [ _ ] -> Some (Int 0l )
@@ -214,7 +214,7 @@ type is_int =
214214 | N
215215 | Unknown
216216
217- let is_int ~ target info x =
217+ let is_int info x =
218218 match x with
219219 | Pv x ->
220220 get_approx
@@ -223,7 +223,7 @@ let is_int ~target info x =
223223 match Flow.Info. def info x with
224224 | Some (Constant (Int _ )) -> Y
225225 | Some (Constant (NativeInt _ | Int32 _ )) ->
226- assert (Poly. equal target `Wasm );
226+ assert (Poly. equal ( Config. target () ) `Wasm );
227227 N
228228 | Some (Block (_ , _ , _ , _ ) | Constant _ ) -> N
229229 | None | Some _ -> Unknown )
@@ -236,7 +236,7 @@ let is_int ~target info x =
236236 x
237237 | Pc (Int _ ) -> Y
238238 | Pc (NativeInt _ | Int32 _ ) ->
239- assert (Poly. equal target `Wasm );
239+ assert (Poly. equal ( Config. target () ) `Wasm );
240240 N
241241 | Pc _ -> N
242242
@@ -308,7 +308,7 @@ let constant_js_equal a b =
308308 | Tuple _, _
309309 | _ , Tuple _ -> None
310310
311- let eval_instr info ~ target ((x , loc ) as i ) =
311+ let eval_instr info ((x , loc ) as i ) =
312312 match x with
313313 | Let (x , Prim (Extern (("caml_equal" | "caml_notequal" ) as prim ), [ y; z ])) -> (
314314 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) =
365365 below fail. *)
366366 [ i ]
367367 | Let (x , Prim (IsInt, [ y ])) -> (
368- match is_int ~target info y with
368+ match is_int info y with
369369 | Unknown -> [ i ]
370370 | (Y | N ) as b ->
371371 let c = Constant (bool ' Poly. (b = Y )) in
@@ -381,7 +381,7 @@ let eval_instr info ~target ((x, loc) as i) =
381381 | Let (x , Prim (Extern "caml_sys_const_backend_type" , [ _ ])) ->
382382 let jsoo = Code.Var. fresh () in
383383 let backend_name =
384- match target with
384+ match Config. target () with
385385 | `JavaScript -> " js_of_ocaml"
386386 | `Wasm -> " wasm_of_ocaml"
387387 in
@@ -398,7 +398,6 @@ let eval_instr info ~target ((x, loc) as i) =
398398 | _ -> false )
399399 then
400400 eval_prim
401- ~target
402401 ( prim
403402 , List. map prim_args' ~f: (function
404403 | Some c -> c
@@ -416,7 +415,7 @@ let eval_instr info ~target ((x, loc) as i) =
416415 , Prim
417416 ( prim
418417 , List. map2 prim_args prim_args' ~f: (fun arg (c : constant option ) ->
419- match c, target with
418+ match c, Config. target () with
420419 | ( Some ((Int _ | Int32 _ | NativeInt _ | NativeString _) as c)
421420 , _ ) -> Pc c
422421 | Some (Float _ as c ), `JavaScript -> Pc c
@@ -547,15 +546,15 @@ let drop_exception_handler blocks =
547546 blocks
548547 blocks
549548
550- let eval ~ target info blocks =
549+ let eval info blocks =
551550 Addr.Map. map
552551 (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
554553 let branch = eval_branch info block.branch in
555554 { block with Code. body; Code. branch })
556555 blocks
557556
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
560559 let blocks = drop_exception_handler blocks in
561560 { p with blocks }
0 commit comments