@@ -1679,7 +1679,8 @@ let get_expr_args_constr ~scopes head (arg, _mut) rem =
16791679 if pos > last_pos then
16801680 argl
16811681 else
1682- (Lprim (Pfield pos, [ arg ], loc), binding_kind) :: make_args (pos + 1 )
1682+ (Lprim (Pfield (pos, Reads_agree ), [ arg ], loc), binding_kind)
1683+ :: make_args (pos + 1 )
16831684 in
16841685 make_args first_pos
16851686 in
@@ -1705,9 +1706,13 @@ let divide_constructor ~scopes ctx pm =
17051706
17061707let get_expr_args_variant_constant = drop_expr_arg
17071708
1709+ let nonconstant_variant_field index =
1710+ Lambda. Pfield (index, Reads_agree )
1711+
17081712let get_expr_args_variant_nonconst ~scopes head (arg , _mut ) rem =
17091713 let loc = head_loc ~scopes head in
1710- (Lprim (Pfield 1 , [ arg ], loc), Alias ) :: rem
1714+ let field_prim = nonconstant_variant_field 1 in
1715+ (Lprim (field_prim, [ arg ], loc), Alias ) :: rem
17111716
17121717let divide_variant ~scopes row ctx { cases = cl ; args; default = def } =
17131718 let row = Btype. row_repr row in
@@ -1805,6 +1810,8 @@ let code_force_lazy = get_mod_field "CamlinternalLazy" "force"
18051810 Forward(val_out_of_heap).
18061811*)
18071812
1813+ let lazy_forward_field = Lambda. Pfield (0 , Reads_vary )
1814+
18081815let inline_lazy_force_cond arg loc =
18091816 let idarg = Ident. create_local " lzarg" in
18101817 let varg = Lvar idarg in
@@ -1827,7 +1834,7 @@ let inline_lazy_force_cond arg loc =
18271834 ( Pintcomp Ceq ,
18281835 [ tag_var; Lconst (Const_base (Const_int Obj. forward_tag)) ],
18291836 loc ),
1830- Lprim (Pfield 0 , [ varg ], loc),
1837+ Lprim (lazy_forward_field , [ varg ], loc),
18311838 Lifthenelse
18321839 (* if (tag == Obj.lazy_tag) then Lazy.force varg else ... *)
18331840 ( Lprim
@@ -1865,7 +1872,8 @@ let inline_lazy_force_switch arg loc =
18651872 sw_numblocks = 256 ;
18661873 (* PR#6033 - tag ranges from 0 to 255 *)
18671874 sw_blocks =
1868- [ (Obj. forward_tag, Lprim (Pfield 0 , [ varg ], loc));
1875+ [ ( Obj. forward_tag,
1876+ Lprim (lazy_forward_field, [ varg ], loc) );
18691877 ( Obj. lazy_tag,
18701878 Lapply
18711879 { ap_tailcall = Default_tailcall ;
@@ -1929,7 +1937,8 @@ let get_expr_args_tuple ~scopes head (arg, _mut) rem =
19291937 if pos > = arity then
19301938 rem
19311939 else
1932- (Lprim (Pfield pos, [ arg ], loc), Alias ) :: make_args (pos + 1 )
1940+ (Lprim (Pfield (pos, Reads_agree ), [ arg ], loc), Alias )
1941+ :: make_args (pos + 1 )
19331942 in
19341943 make_args 0
19351944
@@ -1969,14 +1978,20 @@ let get_expr_args_record ~scopes head (arg, _mut) rem =
19691978 rem
19701979 else
19711980 let lbl = all_labels.(pos) in
1981+ let sem =
1982+ match lbl.lbl_mut with
1983+ | Immutable -> Reads_agree
1984+ | Mutable -> Reads_vary
1985+ in
19721986 let access =
19731987 match lbl.lbl_repres with
19741988 | Record_regular
19751989 | Record_inlined _ ->
1976- Lprim (Pfield lbl.lbl_pos, [ arg ], loc)
1990+ Lprim (Pfield ( lbl.lbl_pos, sem) , [ arg ], loc)
19771991 | Record_unboxed _ -> arg
1978- | Record_float -> Lprim (Pfloatfield lbl.lbl_pos, [ arg ], loc)
1979- | Record_extension _ -> Lprim (Pfield (lbl.lbl_pos + 1 ), [ arg ], loc)
1992+ | Record_float -> Lprim (Pfloatfield (lbl.lbl_pos, sem), [ arg ], loc)
1993+ | Record_extension _ ->
1994+ Lprim (Pfield (lbl.lbl_pos + 1 , sem), [ arg ], loc)
19801995 in
19811996 let str =
19821997 match lbl.lbl_mut with
@@ -2711,7 +2726,9 @@ let combine_constructor loc arg pat_env cstr partial ctx def
27112726 (Lprim (Pintcomp Ceq , [ Lvar tag; ext ], loc), act, rem))
27122727 nonconsts default
27132728 in
2714- Llet (Alias , Pgenval , tag, Lprim (Pfield 0 , [ arg ], loc), tests)
2729+ Llet (Alias , Pgenval , tag,
2730+ Lprim (Pfield (0 , Reads_agree ), [ arg ], loc),
2731+ tests)
27152732 in
27162733 List. fold_right
27172734 (fun (path , act ) rem ->
@@ -2802,7 +2819,7 @@ let call_switcher_variant_constr loc fail arg int_lambda_list =
28022819 ( Alias ,
28032820 Pgenval ,
28042821 v,
2805- Lprim (Pfield 0 , [ arg ], loc),
2822+ Lprim (nonconstant_variant_field 0 , [ arg ], loc),
28062823 call_switcher loc fail (Lvar v) min_int max_int int_lambda_list )
28072824
28082825let combine_variant loc row arg partial ctx def (tag_lambda_list , total1 , _pats )
0 commit comments