Skip to content

Add a comment about immediate64s in the flat suffix of mixed records #2591

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion ocaml/typing/typedecl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1223,7 +1223,24 @@ module Element_repr = struct
let classify env loc ty jkind =
if is_float env ty then Float_element
else match Jkind.get_default_value jkind with
| Value | Immediate64 | Non_null_value -> Value_element
(* CR layouts v5.1: We don't allow [Immediate64] in the flat suffix of
mixed blocks. That's because we haven't committed to whether the
unboxing features of flambda2 can be used together with 32 bit
platforms. (If flambda2 stores unboxed things as flat in 32 bits, then
immediate64s must be banned in the flat suffix with backends for 32 bit
platforms that pass through flambda2. Further, we want a record
declaration to be accepted consistently in 32 bits vs. 64 bits.
So, immediate64s must always be banned in the flat suffix.)

In practice, users can put immediate64s in the value prefix.
(We may consider teaching the middle-ends to mark immediate64s that
abut the non-scannable suffix as non-scannable on 64 bit platforms.)

We may revisit this decision later when we know better whether we want
flambda2 to unbox for 32 bit platforms.
*)
| Immediate64 -> Value_element
| Value | Non_null_value -> Value_element
| Immediate -> Imm_element
| Float64 -> Unboxed_element Float64
| Float32 -> Unboxed_element Float32
Expand Down
Loading