@@ -34,15 +34,15 @@ type mutable_flag = Asttypes.mutable_flag
34
34
type field_dbg_info = Lambda .field_dbg_info
35
35
type set_field_dbg_info = Lambda .set_field_dbg_info
36
36
37
-
37
+ type ident = Ident .t
38
38
type primitive =
39
39
| Pbytes_to_string
40
40
| Pbytes_of_string
41
41
| Pchar_to_int
42
42
| Pchar_of_int
43
43
(* Globals *)
44
- | Pgetglobal of Ident .t
45
- | Psetglobal of Ident .t
44
+ | Pgetglobal of ident
45
+ | Psetglobal of ident
46
46
(* Operations on heap blocks *)
47
47
| Pmakeblock of int * tag_info * mutable_flag
48
48
| Pfield of int * field_dbg_info
@@ -74,10 +74,7 @@ type primitive =
74
74
(* String operations *)
75
75
| Pstringlength
76
76
| Pstringrefu
77
- | Pstringsetu
78
77
| Pstringrefs
79
- | Pstringsets
80
-
81
78
| Pbyteslength
82
79
| Pbytesrefu
83
80
| Pbytessetu
@@ -139,7 +136,7 @@ type primitive =
139
136
| Pbswap16
140
137
| Pbbswap of boxed_integer
141
138
(* Integer to external pointer *)
142
- | Pint_as_pointer
139
+
143
140
| Pdebugger
144
141
| Pjs_unsafe_downgrade
145
142
| Pinit_mod
@@ -163,30 +160,30 @@ and apply_info =
163
160
and function_info =
164
161
{ arity : int ;
165
162
kind : Lambda .function_kind ;
166
- params : Ident .t list ;
163
+ params : ident list ;
167
164
body : t
168
165
}
169
166
and t =
170
- | Lvar of Ident .t
167
+ | Lvar of ident
171
168
| Lconst of Lambda .structured_constant
172
169
| Lapply of apply_info
173
170
| Lfunction of function_info
174
- | Llet of Lambda .let_kind * Ident .t * t * t
175
- | Lletrec of (Ident .t * t ) list * t
171
+ | Llet of Lambda .let_kind * ident * t * t
172
+ | Lletrec of (ident * t ) list * t
176
173
| Lprim of prim_info
177
174
| Lswitch of t * switch
178
175
| Lstringswitch of t * (string * t ) list * t option
179
176
| Lstaticraise of int * t list
180
- | Lstaticcatch of t * (int * Ident .t list ) * t
181
- | Ltrywith of t * Ident .t * t
177
+ | Lstaticcatch of t * (int * ident list ) * t
178
+ | Ltrywith of t * ident * t
182
179
| Lifthenelse of t * t * t
183
180
| Lsequence of t * t
184
181
| Lwhile of t * t
185
- | Lfor of Ident .t * t * t * Asttypes .direction_flag * t
186
- | Lassign of Ident .t * t
182
+ | Lfor of ident * t * t * Asttypes .direction_flag * t
183
+ | Lassign of ident * t
187
184
| Lsend of Lambda .meth_kind * t * t * t list * Location .t
188
185
| Levent of t * Lambda .lambda_event
189
- | Lifused of Ident .t * t
186
+ | Lifused of ident * t
190
187
191
188
192
189
module Prim = struct
@@ -509,6 +506,7 @@ let not x : t =
509
506
510
507
let lam_prim ~primitive :(p : Lambda.primitive ) ~args : t =
511
508
match p with
509
+ | Pint_as_pointer
512
510
| Pidentity ->
513
511
begin match args with [x] -> x | _ -> assert false end
514
512
| Pbytes_to_string
@@ -544,16 +542,8 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args : t =
544
542
| Pmakeblock (tag,info, mutable_flag)
545
543
-> prim ~primitive: (Pmakeblock (tag,info,mutable_flag)) ~args
546
544
| Pfield (id,info)
547
- ->
548
- begin match args with
549
- | [Lprim {primitive = Pgetglobal {name = " CamlinternalMod" }; _}]
550
- ->
551
- if id = 0 then prim ~primitive: Pinit_mod ~args: []
552
- else prim ~primitive: Pupdate_mod ~args: []
553
- | _
554
- ->
555
- prim ~primitive: (Pfield (id,info)) ~args
556
- end
545
+ -> prim ~primitive: (Pfield (id,info)) ~args
546
+
557
547
| Psetfield (id,b,info)
558
548
-> prim ~primitive: (Psetfield (id,b,info)) ~args
559
549
@@ -592,9 +582,10 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args : t =
592
582
| Pasrint -> prim ~primitive: Pasrint ~args
593
583
| Pstringlength -> prim ~primitive: Pstringlength ~args
594
584
| Pstringrefu -> prim ~primitive: Pstringrefu ~args
595
- | Pstringsetu -> prim ~primitive: Pstringsetu ~args
585
+ | Pstringsetu
586
+ | Pstringsets -> assert false
596
587
| Pstringrefs -> prim ~primitive: Pstringrefs ~args
597
- | Pstringsets -> prim ~primitive: Pstringsets ~args
588
+
598
589
| Pbyteslength -> prim ~primitive: Pbyteslength ~args
599
590
| Pbytesrefu -> prim ~primitive: Pbytesrefu ~args
600
591
| Pbytessetu -> prim ~primitive: Pbytessetu ~args
@@ -611,7 +602,7 @@ let lam_prim ~primitive:(p : Lambda.primitive) ~args : t =
611
602
| Psubfloat -> prim ~primitive: Psubfloat ~args
612
603
| Pmulfloat -> prim ~primitive: Pmulfloat ~args
613
604
| Pdivfloat -> prim ~primitive: Pdivfloat ~args
614
- | Pint_as_pointer -> prim ~primitive: Pint_as_pointer ~args
605
+
615
606
| Pbswap16 -> prim ~primitive: Pbswap16 ~args
616
607
| Pintcomp x -> prim ~primitive: (Pintcomp x) ~args
617
608
| Poffsetint x -> prim ~primitive: (Poffsetint x) ~args
@@ -680,7 +671,6 @@ let rec convert (lam : Lambda.lambda) : t =
680
671
match args with
681
672
| [_loc ; shape] ->
682
673
begin match shape with
683
-
684
674
| Lconst (Const_block (0 , _, [Const_block (0 , _, [] )]))
685
675
-> unit (* see {!Translmod.init_shape}*)
686
676
| _ -> prim ~primitive: Pinit_mod ~args
0 commit comments