Skip to content
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

4.10, #9205: move back caml_* to thematic headers #9253

Merged
merged 3 commits into from Jan 21, 2020

Conversation

Octachron
Copy link
Member

@Octachron Octachron commented Jan 21, 2020

As suggested by @xavierleroy in #9205, this PR moves back each of the caml_* currently defined in compatibility.h.

This PR provides a compatible API for versions 4.04 to 4.10, at least for programs that were importing internal variables by including the right headers rather than redefining the variables by hand.

After discussion with @kayceesrk , those macros would still be meaningful in the multicore future, since each domain will have its own state; so those macros should not be too ephemeral.

This PR requires a handful of patches to the follwoing opam packages for:

(It might also useful to patch base to avoid some ifdefs)

With those patches, available in @kit-ty-kate 's opam-alpha-repository, both opam-health-check and opamcheck confirms that every packages compatible with 4.09 is compatible with 4.10+this PR.

For people (cc @gadmm) concerned about compatibility beyond 4.04, unfortunately, it will require some #ifdef on OCAML_VERSION. However, Debian stable is at 4.05; and only oldstable has an OCaml version inferior to 4.04 . Taking in account that this is an internal API with no stability garantee, it seems fine to only provide a nice path for the 4.04 - 4.10 range.

to the headers originally defining the corresponding internal variable.
*/
#define caml_backtrace_last_exn (Caml_state_field(backtrace_last_exn))

/* FIXME: this shouldn't matter anymore. Since OCaml 4.02, non-parameterized
Copy link
Member Author

Choose a reason for hiding this comment

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

Answering a question of @gadmm , those variables are not packed together because the comments in the header details each of them, so it seemed natural to synchronize the documentation with the code. Nevertheless, since there are no other variables defined in-between, it should be easy to add export-control macros around if needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me.

@kit-ty-kate
Copy link
Member

Patches for lablgtk and grenier are available here:

Copy link
Contributor

@gadmm gadmm left a comment

Choose a reason for hiding this comment

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

Thanks, this is a very polished PR and I do not have any change to request (apart that one should decide once and for all whether @nojb's name is written with or without accents!). In addition, you report successful results of testing the opam repository, and the shape of the fixes to packages it requires looks good. On behalf of all this, it looks good to merge.

*/
#define caml_backtrace_last_exn (Caml_state_field(backtrace_last_exn))

/* FIXME: this shouldn't matter anymore. Since OCaml 4.02, non-parameterized
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good to me.

@kayceesrk
Copy link
Contributor

Is there a reason for?

coq (note that this is not the right patch)

Otherwise, the changes look good to me.

@gadmm
Copy link
Contributor

gadmm commented Jan 21, 2020

Yes, further changes are required due to the change in semantics of allocations, and the proper patch proposed on the Coq github will subsume this one.

Copy link
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

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

I agree that this PR looks very good. Also (even more importantly) it looks like we have consensus that this is the way forward. Let's go.

@gasche gasche merged commit 036495b into ocaml:4.10 Jan 21, 2020
gasche added a commit that referenced this pull request Jan 21, 2020
4.10, #9205: move back caml_* to thematic headers

(cherry picked from commit 036495b)
@gasche
Copy link
Member

gasche commented Jan 21, 2020

Cherry-picked in trunk as 646d304.

gadmm added a commit to gadmm/ocaml that referenced this pull request Jan 22, 2020
Before a7b5bb6 from ocaml#8713, includes of compatibility.h used to be
all guarded by `#ifndef CAML_NAME_SPACE`. The solution at a7b5bb6
required to change two of those guard into `#ifndef CAML_INTERNALS`.
The solution finally retained for 4.10 at ocaml#9253 (646d304 in
trunk) does not depend on this change anymore, and one of the two
guards was changed back into `#ifndef CAML_NAME_SPACE`. This patch
changes the second one back as before.

Since a second CAML_NAME_SPACE guard is contained in compatibility.h,
the potential impact is limited to two of the macros that are not
guarded in this way: caml_stat_top_heap_size and caml_stat_heap_size,
and limited to programs that somehow came to rely on this in 4.10.

Since this patch reverts the situation as in 4.09, the current patch
is preferable to include in 4.10, and it is very low risk.

No Changes needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants