Skip to content

Commit 9e1f955

Browse files
committed
Fix small CR about immutability
1 parent 7a1cf11 commit 9e1f955

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

backend/cmm_helpers.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,9 @@ let int_array_ref arr ofs dbg =
11141114
let unboxed_float_array_ref arr ofs dbg =
11151115
Cop (mk_load_mut Double, [array_indexing log2_size_float arr ofs dbg], dbg)
11161116

1117+
let unboxed_immutable_float_array_ref arr ofs dbg =
1118+
Cop (mk_load_immut Double, [array_indexing log2_size_float arr ofs dbg], dbg)
1119+
11171120
let float_array_ref mode arr ofs dbg =
11181121
box_float dbg mode (unboxed_float_array_ref arr ofs dbg)
11191122

backend/cmm_helpers.mli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ val int_array_ref : expression -> expression -> Debuginfo.t -> expression
220220
val unboxed_float_array_ref :
221221
expression -> expression -> Debuginfo.t -> expression
222222

223+
val unboxed_immutable_float_array_ref :
224+
expression -> expression -> Debuginfo.t -> expression
225+
223226
val float_array_ref :
224227
Lambda.alloc_mode -> expression -> expression -> Debuginfo.t -> expression
225228

middle_end/flambda2/to_cmm/to_cmm_primitive.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,7 @@ let block_load ~dbg (kind : P.Block_access_kind.t) (mutability : Mutability.t)
123123
match field_kind with
124124
| Tagged_immediate ->
125125
C.get_field_computed Immediate mutability ~block ~index dbg
126-
| Naked_float ->
127-
(* CR layouts v5.1: We should use the mutability here to generate better
128-
code if the load is immutable. *)
129-
C.unboxed_float_array_ref block index dbg
126+
| Naked_float -> C.unboxed_immutable_float_array_ref block index dbg
130127
| Naked_float32 -> C.get_field_unboxed_float32 mutability ~block ~index dbg
131128
| Naked_int32 -> C.get_field_unboxed_int32 mutability ~block ~index dbg
132129
| Naked_int64 | Naked_nativeint ->

0 commit comments

Comments
 (0)