@@ -186,12 +186,32 @@ let record_primitive = function
186
186
| _ -> ()
187
187
188
188
(* Utilities for compiling "module rec" definitions *)
189
-
190
- let mod_prim name =
189
+ let bs_init_mod args : Lambda.lambda =
190
+ Lprim (Pccall {prim_name = " #init_mod" ; prim_arity = 2 ;
191
+ prim_alloc = true ;
192
+ prim_native_name = " " ;
193
+ prim_native_float = false }, args, Location. none)
194
+ let bs_update_mod args : Lambda.lambda =
195
+ Lprim (Pccall {prim_name = " #update_mod" ; prim_arity = 3 ;
196
+ prim_alloc = true ;
197
+ prim_native_name = " " ;
198
+ prim_native_float = false }, args, Location. none)
199
+
200
+ let mod_prim name args =
201
+ if ! Clflags. bs_only then
202
+ if name = " init_mod" then
203
+ bs_init_mod args
204
+ else if name = " update_mod" then
205
+ bs_update_mod args
206
+ else assert false
207
+ else
191
208
try
192
- transl_normal_path
193
- (fst (Env. lookup_value (Ldot (Lident " CamlinternalMod" , name))
194
- Env. empty))
209
+ Lapply
210
+ (
211
+ transl_normal_path
212
+ (fst (Env. lookup_value (Ldot (Lident " CamlinternalMod" , name))
213
+ Env. empty))
214
+ , args, Location. none)
195
215
with Not_found ->
196
216
fatal_error (" Primitive " ^ name ^ " not found." )
197
217
@@ -289,7 +309,7 @@ let eval_rec_bindings bindings cont =
289
309
| (id , None, rhs ) :: rem ->
290
310
bind_inits rem
291
311
| (id , Some(loc , shape ), rhs ) :: rem ->
292
- Llet (Strict , id, Lapply (mod_prim " init_mod" , [loc; shape], Location. none ),
312
+ Llet (Strict , id, (mod_prim " init_mod" [loc; shape]),
293
313
bind_inits rem)
294
314
and bind_strict = function
295
315
[] ->
@@ -304,8 +324,7 @@ let eval_rec_bindings bindings cont =
304
324
| (id , None, rhs ) :: rem ->
305
325
patch_forwards rem
306
326
| (id , Some(loc , shape ), rhs ) :: rem ->
307
- Lsequence (Lapply (mod_prim " update_mod" , [shape; Lvar id; rhs],
308
- Location. none),
327
+ Lsequence ((mod_prim " update_mod" [shape; Lvar id; rhs]),
309
328
patch_forwards rem)
310
329
in
311
330
bind_inits bindings
0 commit comments