File tree Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Expand file tree Collapse file tree 4 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ let prim = Lam.prim
3232let lam_extension_id loc (head : Lam.t ) =
3333 prim ~primitive: lam_caml_id ~args: [head] loc
3434
35+ let lazy_block_info : Lam_tag_info.t =
36+ Blk_record
37+ [|Literals. lazy_done;
38+ Literals. lazy_val|]
3539
3640let unbox_extension info (args : Lam.t list ) mutable_flag loc =
3741 prim ~primitive: (Pmakeblock (0 ,info,mutable_flag)) ~args loc
@@ -281,15 +285,15 @@ let lam_prim ~primitive:( p : Lambda.primitive) ~args loc : Lam.t =
281285 [ Lam. const Const_js_true ;
282286 result
283287 ] in
284- prim ~primitive: (Pmakeblock (tag,Blk_record [| " RE_LAZY_DONE " ; " value " |] ,Mutable )) ~args loc
288+ prim ~primitive: (Pmakeblock (tag,lazy_block_info ,Mutable )) ~args loc
285289 | [computation] ->
286290 let args =
287291 [ Lam. const Const_js_false ;
288292 (* FIXME: arity 0 does not get proper supported*)
289293 prim ~primitive: (Pjs_fn_make 0 ) ~args: [Lam. function_ ~arity: 1 ~params: [Ident. create " param" ] ~body: computation]
290294 loc
291295 ] in
292- prim ~primitive: (Pmakeblock (tag,Blk_record [| " RE_LAZY_DONE " ; " value " |] ,Mutable )) ~args loc
296+ prim ~primitive: (Pmakeblock (tag,lazy_block_info ,Mutable )) ~args loc
293297
294298 | _ -> assert false
295299 end
Original file line number Diff line number Diff line change @@ -146,4 +146,7 @@ let polyvar_value = "VAL"
146146
147147let cons = " ::"
148148let hd = " hd"
149- let tl = " tl"
149+ let tl = " tl"
150+
151+ let lazy_done = " LAZY_DONE"
152+ let lazy_val = " VAL"
Original file line number Diff line number Diff line change @@ -144,4 +144,6 @@ val polyvar_value : string
144144
145145val cons : string
146146val hd : string
147- val tl : string
147+ val tl : string
148+ val lazy_done : string
149+ val lazy_val : string
Original file line number Diff line number Diff line change 2626
2727(* Internals of forcing lazy values. *)
2828type 'a t = {
29- mutable tag : bool [@ bs.as "RE_LAZY_DONE " ] ;
29+ mutable tag : bool [@ bs.as "LAZY_DONE " ] ;
3030 (* Invariant: name *)
31- mutable value : 'a (* its type is ['a] or [unit -> 'a ] *)
31+ mutable value : 'a [@ bs.as "VAL" ]
32+ (* its type is ['a] or [unit -> 'a ] *)
3233}
3334
3435
You can’t perform that action at this time.
0 commit comments