8000 Upgrade to OCaml 5.3 by anmonteiro · Pull Request #51 · melange-re/melange-compiler-libs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Upgrade to OCaml 5.3 #51

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 1,179 commits into from
Oct 20, 2024
Merged

Upgrade to OCaml 5.3 #51

merged 1,179 commits into from
Oct 20, 2024

Conversation

anmonteiro
Copy link
Member

No description provided.

gasche and others added 30 commits July 16, 2024 10:55
Use syntax for effect handlers in the manual page
Don't use configured CFLAGS & CPPFLAGS to compile third-party C sources
Use the `strip` command detected by libtool
In our public headers, we're using either:
- C23 where `alignas` is a keyword;
- C++11 or later where `alignas` is also available;
- C11/C17 where `_Alignas` is available.
Explanations from Xavier Leroy at
ocaml/ocaml#13139 (comment)

- The target systems we care about are 64-bit architecture with alignment
  constraints <= 16 and malloc returning 16-aligned blocks. In this case, the
  `data` part of `struct pool_block` is naturally 16-aligned (because the two
  pointers before use 16 bytes), and nothing needs to be done. Aligning data
  using `max_align_t` should have no effect.

- For a 32-bit architecture with 16-byte alignment constraints and malloc
  returning 16-aligned blocks (e.g. Linux x86-32), aligning `data` to 16 seems
  preferable to me and can be achieved by using `max_align_t`.

- For a 32-bit architecture with 16-byte alignment constraints and malloc
  returning 8-aligned blocks (perhaps Windows 32 bits, not sure): no amount of
  alignment constraints in `struct pool_block` will give 16-aligned `data`
  fields, so you could just as well put no alignment constraints.

Unfortunately, MSVC C11 suppport is incomplete and doesn't define `max_align_t`.
- https://developercommunity.visualstudio.com/t/max_align_t-is-not-provided-by-stddefh/10299797
- https://developercommunity.visualstudio.com/t/stdc11-should-add-max-align-t-to-stddefh/1386891
For C++, MSVC defines `using max_align_t = double`. LLVM's clang-cl
copies this.

It's unlikely that we need to carry a fallback implementation for
other compilers. If so, the following could be used:

    typedef struct {
      alignas(long long) long long ll;
      alignas(long double) long double ld;
    } max_align_t;

https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/ginclude/stddef.h
https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/__stddef_max_align_t.h

https://en.cppreference.com/w/c/types/max_align_t
This ensures that the data field is always aligned to the best
boundary.
Remove "mean space overhead" computation.
This function can be used to improve the type clash error message, which
uses the parsetree instead of the typedtree to avoid loosing some
information from the source code (eg. how constants are printed).

This function is used for the "this function ..." message, which can be
easily changed to use untyped expression.
Re-use the mechanism implemented for the "This function" message in
type clash errors to print the original expression if possible.

Type error messages now look like this:

    Error: The expression '43' has type int
           but an expression was expected of type int32

The argument 'unify_exp ~sexp' is made non-optional as this isn't too
intrusive and ensures the new error is implemented in more cases.
Clarify type clash error messages by printing the kind of the reported
expression.

Currently implemented for expression that are likely 'nominal' but not
necessarily.

Example:

    The constant "42" has type ...

    This field has type ...

This is similar to the `Apply_non_function` error:

    The function "foo" has type ...

    This function has type ...
Add denominations for expressions like `for`, `while`, `if`, `match`,
etc.. that are often spanning several lines.

It acts as a confirmation that the error is about the containing
expression rather than a nested one as the printed code is sometimes
harder to read.

There's no test for some of them (`try`, `if`) but they'll become
easily reachable if the denomination is used in other messages.
Compute accurate dependencies for all the backends on any system
The extension was unintentionally overwritten in cherry-pick commit
46c7122
I made a mistake when introducing caml_process_pending_actions_res (#13013), currently in trunk `caml_process_pending_actions_exn` is exported in signals.h but its implementation is removed.

This function is not CAML_INTERNALS, and Coq uses it.

To restore this function I reintroduced a helper function to transform `caml_result` values back into encoded exception (earlier #13013 designs had this). It is named `caml_result_get_encoded_exception`, in fail.h, CAML_INTERNALS-only.
Signed-off-by: Edwin Török <edwin@etorok.net>
This is mentioned in the 'Element kinds' documentation, but that is not
visible anywhere in LSP documentation completions.
It is worth emphasizing this, because getting this wrong may lead to
memory corruption.

Suggested-by: Florian Angeletti <<florian.angeletti@inria.fr>>
Signed-off-by: Edwin Török <edwin@etorok.net>
dra27 and others added 28 commits September 12, 2024 11:19
The Pattern-Matching Bug: a disabled-by-default warning on unexpectedly-partial matches

(cherry picked from commit 8ce3e6a)
The Pattern-Matching Bug: introduce a temporality heuristic to de-pessimize certain programs

(cherry picked from commit 9e72506)
cmm: stricter computation of boxed number kinds
(cherry picked from commit 143706d)
[tooling] Remember linked declarations

(cherry picked from commit b951207)
Add ocaml-variants.install

(cherry picked from commit 5b13892)
Update ocaml-variants.opam with native Windows support

(cherry picked from commit da0db83)
Fix link to the online manual in the README

(cherry picked from commit 81003f2)
If the Hygiene workflow is triggered for a release tag (or for a branch
sat on a release tag) then ocamltest is not built by default, which
causes the .depend file to change. Explicitly enable ocamltest, even
though it is not built in BasicCompiler, so that the dependency
generation is consistent.
…ter1

Add Format_doc.deprecated{,1} to ease transformations from Format to Format_doc by users of compiler-libs

(cherry picked from commit 6ebe463)
Use `runtime_CPPFLAGS` also to build `.*pic.o` files

(cherry picked from commit 9702e43)
Fix Gc.quick_stat documentation

(cherry picked from commit 00d89ea)
Update Gc.control documentation to OCaml 5

(cherry picked from commit b516815)
Remove unused OCAMLRUNPARAMs list from manual

(cherry picked from commit fd8abd1)
When the runtime events ring is destroyed, only the domains that are
part of the stop-the-world (stw) participant list are stopped. So it is
unsafe to write to ring when the domain is not part of the stw
participant set.

This fixes the data race in `lib-runtime-events/test_dropped_events`.

(cherry picked from commit 27c82c4)
…last

Fix misindexing related to `Gc.finalise_last`

(cherry picked from commit 3e0a459)
Need to check whether the ring is still active after a callback. It may
be possible that ring has been destroyed during the execution of the
callback.

(cherry picked from commit bf63f88)
[runtime] Do not divide by zero...

(cherry picked from commit baf88ce)
Remove some String to/form Bytes conversion to behave better with jsoo

(cherry picked from commit c256a92)
Remove two useless string-bytes conversions from the testsuite

(cherry picked from commit a07799f)
@anmonteiro anmonteiro merged commit 4cdd819 into master Oct 20, 2024
@anmonteiro anmonteiro deleted the anmonteiro/merge-5.3 branch October 20, 2024 04:03
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.

0