Skip to content

Propagate missing Cmm value kind - #13759

Merged
gasche merged 6 commits into
ocaml:trunkfrom
chambart:missing_cmm_value_kind
Feb 12, 2025
Merged

gasche merged 6 commits into
ocaml:trunkfrom
chambart:missing_cmm_value_kind

Conversation

@chambart

Copy link
Copy Markdown
Contributor

Some type information are still available in clambda but not propagated to Cmm.
This PR propagates those information in on function parameters and on loads.

Those added information are going to be mainly used to compute the frame descriptors.
For instance in this example there is one less scanned value slot in the frame descriptor for the first recursive call. This mean that the frame descriptor are a bit smaller and some integers are not going to be scanned while walking the stack.

let rec fib (n : int) =
  if n < 2 then 1 else
    let a = fib (n - 1) in (* n is live through this call *)
    let b = fib (n - 2) in
    a + b

@chambart

Copy link
Copy Markdown
Contributor Author

I might consider also adding the information on the return value of calls.

@gasche gasche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me. (This is going to create a small conflict with #13404 and #13707, oh well...)

Comment thread asmcomp/cmm_helpers.mli
val get_field_gen :
Asttypes.mutable_flag -> expression -> int -> Debuginfo.t -> expression
?memory_chunk:memory_chunk -> Asttypes.mutable_flag -> expression -> int ->
Debuginfo.t -> expression

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ideal parameter order would be to have ptr first, as memory_chunk and mut rather depend on the offset, but this is okay. Oh, could you maybe mention the parameter in the documentation comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the order of the constructor parameters. If you think this should be put elsewhere I'm ok with it.

@chambart

Copy link
Copy Markdown
Contributor Author

Looks fine to me. (This is going to create a small conflict with #13404 and #13707, oh well...)

This one is quite simple to rebase. It's probably a better idea to delay this one until those are merged.

@lpw25

lpw25 commented Jan 27, 2025

Copy link
Copy Markdown
Contributor

Unfortunately, this will make an existing bug much more common because the type information on static catches is often incorrect. See this PR on the Jane Street branch for the existing bug and a fix.

@gasche

gasche commented Jan 28, 2025

Copy link
Copy Markdown
Member

It's probably a better idea to delay this one until those are merged.

I was not trying to suggest that, on the contrary I would rather merge this one if it is easy, rather than the atomic-stuff PRs that are blocked on the fact that I don't know which approach is best (and we lack feedback/help from other people to make a decision).

@gasche

gasche commented Feb 5, 2025

Copy link
Copy Markdown
Member

#13763 is the upstream equivalent of the JS bugfix that @lpw25 was talking about, we should probably resolve it before this one.

@gasche gasche self-assigned this Feb 5, 2025
@gasche
gasche merged commit 8db7821 into ocaml:trunk Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants