-
Notifications
You must be signed in to change notification settings - Fork 76
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
Check for type recursion without boxing #3407
Conversation
8b38c59
to
eb42fd2
Compare
83ae0ff
to
2247db3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite convinced here. This mostly works. But it misses some cases (so it's not fully sound) and catches some cases it shouldn't (so it's not fully complete). The old check -- reporting when e.g. value & (value & value)
doesn't subjkind with value & value
is still in place, so the lack of soundness doesn't matter all that much. And maybe the lack of completeness doesn't bite in practice? But given these drawbacks, and the fact that the old check worked (but with a somewhat confusing error message), I think I lean mildly against merging.
Actually, maybe I'm wrong about "mildly against merging". I agree that this improves the error message in the majority case, and that's pretty cool. And the implementation is simple enough. But at the least I'd leave an internal ticket about revisiting this in the future. |
c5fc9cf
to
19f511f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goldfirere Thanks for the helpful review.
Here are my goals for this check:
- Improve the programming experience for unboxed records
- Prohibit all infinite-size types (types that would have a cyclic layout if we had layout variables without an occurs check)
It's because we are sound but not complete w.r.t. "no infinite-size types" that the error message complains about a stronger property, "no recursion without boxing," (it would be confusing to see a "no infinite-size types" error on type t = #{ t : t }
).
So I'd agree that w.r.t. the stronger property of "no recursion without boxing," we are both unsound (your example with type recursion hidden behind an abstract signature, and your recursive module example) and incomplete (int good good
). But I think that this is okay: the stronger property is only mentioned as it's a better error message.
I agree we'll eventually want to be more complete (e.g. allow int good good
) - I'll create an internal ticket corresponding to the CR above check_unboxed_recursion
.
It is a little unclear from the description what the definition of recursion is. Does the new check still allow more useful things like:
What about if |
@lpw25 The new check would allow that, including if For each group of mutually recursive type declarations, we define the following "type contains" relation on type expressions:
( If a path starting from the type expression on the LHS of a declaration contains two types with the same head type constructor, and that repeated type is an unboxed record or variant, then we give an error. Examples (@goldfirere - the third is newly allowed with a bug fix): type t = #{ t : t list }
(* Allowed, [t list] is not in this recursive group, and
has layout [value] so it doesn't contain anything *)
type t = #{ x : #(int * u) }
and u = T of t [@@unboxed]
(* Banned, t -> #(int * u) -> u -> t *)
type 'a id = #{ a : 'a }
type t = int id id
(* Allowed, [int id] is not in this recursive group, and
has layout [value] so it doesn't contain anything *)
type 'a id = #{ a : 'a }
and t = int id id
(* Sadly, banned. t -> int id id -> int id; id appears twice *) |
d3459e6
to
3b9c7e7
Compare
Presumably this is not the case for something like: type ('a : any) t : any is an |
Currently, an We might be concerned about programs like the following once we both drop this restriction and add module Id : sig
type ('a : any) t : any
end = struct
type ('a : any) t = 'a
end
type t = #{ t : t Id.t } But I think it will be okay to accept this, since the type also won't be visibly cyclic to Another example worth thinking about is the following, once we have type 'a id : any = 'a
type t = #{ t : t id } Speculatively: I think the check will reject this (when updated appropriately for |
What about if your |
If the functor parameter abstracts module type S = sig
type ('a : any) t : any
end
module F(Id : S) = struct
type t = #{ t : t Id.t }
end
module Id : S = struct
type ('a : any) t = 'a
end
module M = F(Id) If the functor parameter exposes module type S = sig
type ('a : any) t = 'a (* changed line *)
end
module F(Id : S) = struct
type t = #{ t : t Id.t }
end
(* Error: the definition of t contains recursion without boxing
t contains t Id.t
t Id.t contains t
*) Does this sound right? |
My concern was with your |
Actually, your |
I see the problem now, thanks. Current best guess for the fix: we consider a type not in the recursive group whose layout contains |
I made this change to future-proof against unboxed records with unrepresentable layouts, and refactored so we can more easily support |
I thought about it briefly and didn't come up with any examples where this heuristic misses anything or is overly conservative in a way that made me very sad (though it is certainly conservative). I propose we (1) have Ryan check that this isn't so conservative that it rejects anything in our code base and then (2) merge this PR, unless @lpw25 can come up with another counter example. It will be much easier to figure out whether a better solution exists once we start working on allowing non-values in records and on |
The check doesn't seem to reject anything: I rebased this branch onto |
5d2fea9
to
277b1d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks all good from my perspective. I still think we'll eventually switch to use layout variables, but there's no reason not to merge this in the meantime.
277b1d8
to
426888b
Compare
commit a53391d Author: Max Slater <max@thenumb.at> Date: Wed Jan 22 13:53:02 2025 -0500 Rename `atomic_cas`/`Compare_and_swap` (#3491) commit 92b327c Author: Max Slater <max@thenumb.at> Date: Tue Jan 21 14:18:56 2025 -0500 Additional operations for int atomics (#3490) commit 38e792c Author: Luke Maurer <lmaurer@janestreet.com> Date: Tue Jan 21 17:09:23 2025 +0000 Support `-open Foo` where `Foo` is parameterised (#3489) The command line ``` ocamlopt -open Foo -parameter P -c bar.ml ``` should be fine, even if `Foo` is itself parameterised by `P`: as usual, we compile `bar.ml` as if it began with `open! Foo`, and by the subset rule, `Bar` can refer to `Foo` because it takes at least the same parameters. Unfortunately, currently we process `-open` before `-parameter`, so when we go to check the implicit reference to `Foo`, we think there are no parameters, and we report an error. (Confusingly, the error suggests that the user add `-parameter P` to the command line.) The fix is simple: move the code that processes `-parameter` earlier so that the initial environment is constructed with the parameters already available. commit 784dc96 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 21 14:07:41 2025 +0000 Rename [emit.mlp] to [emit.ml] on amd64 (#3488) commit f3b720a Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Tue Jan 21 10:35:35 2025 +0000 Module aliases save locks instead of walking them immediately (#3398) commit 389a7c3 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:55:51 2025 +0000 Add OCAMLRUNPARAM d= parameter for max # domains (#3487) Allow maximum number of domains to be specified as a OCAMLRUNPARAM parameter. (cherry picked from commit f92715f1044aea30ca97e497653c883578f91fe6) Co-authored-by: KC Sivaramakrishnan <kc@kcsrk.info> commit 63767d7 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:45:30 2025 +0000 Add caml_runtime_parameters back (#3468) Add caml_runtime_parameters back. commit 5e9975e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 20 17:15:15 2025 +0000 Emit atomic compare and exchange (#3486) commit a9821e8 Author: Basile Clément <129742207+bclement-ocp@users.noreply.github.com> Date: Mon Jan 20 15:36:09 2025 +0100 Make patricia trees big-endian (#3438) This patch switches up the implementation of the `Patricia_tree` module from little-endian to big-endian, with the main motivation to be able to implement in-order traversal. The `caml_int_clz_tagged_to_untagged` and `caml_int_tagged_to_tagged` C stubs are recognized and replaced with the `clz` instruction when compiling with flambda2, so they are only used in the boot compiler. commit b8a9789 Author: Leo White <leo@lpw25.net> Date: Fri Jan 17 13:35:19 2025 +0000 Generate specific instructions for atomics on immediates (#3477) * Generate specific instructions for atomics on immediates * Fix formatting commit 7b93134 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 17 09:30:30 2025 +0000 Vectorizer: add tests (#3456) * Add tests * Disable ocamlformat on unboxed tests * Increase -vectorize-max-block-size for tests * Fix asssertion failure when vectorizing unboxed int32 * Disable float32 on arm64 (not yet implemented) * improve gen_dune.ml for the vectorizer tests Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com> commit 6379678 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 16:08:29 2025 +0000 Add "-ocamlrunparam" linker flag (#3483) commit f7b2cbe Author: Xavier Clerc <xclerc@users.noreply.github.com> Date: Thu Jan 16 15:25:28 2025 +0000 Bump the version of `actions/upload-artifact` (#3474) * Bump the version of actions/upload-artifact. * Ensure artifact names are unique. * To trigger CI. * Try with commit hash. commit afb8a55 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 14:03:37 2025 +0000 Move two macOS CI controllers to runtime5 (#3482) commit aae5c40 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 13:50:34 2025 +0000 Fix error in caml_get_init_stack_wsize (#3481) commit 525868c Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:30 2025 -0500 Use null pointers for `or_null` (#3267) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls * Constructors and pattern-matching * Bytecode compilation * `or_null` is `Variant_or_null` * Accept tests * Runtime tests * Delete obsolete or_null test --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 9796b21 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:13 2025 -0500 Runtime changes for `or_null` (#3265) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit df4a6e0 Author: Chris Casinghino <ccasinghino@janestreet.com> Date: Wed Jan 15 13:08:53 2025 -0500 Bump magic numbers for 5.2.0minus-5 (#3478) commit d1c8d85 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 16:44:39 2025 +0000 Peek and poke (#3309) commit f8caad4 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 15 16:00:39 2025 +0000 Vectorizer: xmm register can hold ocaml values (#3455) * Add [Valx2] to [Cmm.machtype_component] * Vectorizer generates [Valx2] * Record live offsets of [Valx2] in the frametable For runtime4, xmm register are below [gc_regs], use negative offsets. * Move [types_are_compatible] from [Reg] to [Proc] This information has to be in sync with register classes, stack slock classes, and emit for move instructions. commit 34a7873 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Wed Jan 15 13:13:18 2025 +0000 Improve coherence of modality zapping (#3462) commit 1a6a9d3 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 12:06:24 2025 +0000 Fix caml_obj_with_tag (#3465) commit bc5110a Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Wed Jan 15 11:52:25 2025 +0000 Reset the pacing of major collection after any synchronous major GC (#3463) Reset the pacing of major collection at the end of any synchronous major collection. commit 9faf700 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 11:32:59 2025 +0000 Remove remnants of caml_obj_truncate (#3469) commit ff9430b Author: Luke Maurer <lmaurer@janestreet.com> Date: Wed Jan 15 11:31:22 2025 +0000 Mangle instance symbol names using `____` rather than `___` (#3472) Apparently there are libraries around that have names ending in single underscores, leading to ambiguous symbol names if we use triple underscores to delimit instances. Other choices are possible but this PR opts for newly-developed quadruple-underscore technology. commit 9984700 Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Wed Jan 15 11:03:43 2025 +0100 Port upstream PRs 11542 and 12505 to runtime4 (#3431) fix #11482: random crash in large closure allocation (#11542) Co-authored-by: Damien Doligez <damien.doligez@inria.fr> commit 058c4db Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 22:19:32 2025 +0000 Enable all makearray_dynamic tests on runtime4 (#3470) commit ba15ee5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 20:08:31 2025 +0000 Vectorize [Ifloatarithmem] (#3452) * Add [Isimd_mem] to [Arch.Specific] and emit [addpd] with memory arg and similar instructions * Vectorize [Ifloatarithmem] When the memory alignment is known to be 128-bit (currently, never) emits [addpd], otherwise emits a vector load followed by an arithmetic instruction. commit 9755b39 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 18:57:39 2025 +0000 Fix CI failure (#3473) commit 859949c Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:56:53 2025 +0000 Vectorize [Specific.Istore_int] (#3450) Used for array initialization (amd64) commit 50f73cb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:38:39 2025 +0000 Do not allow naked pointers (remove configure option) (#3448) commit b7c8ad3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:07:39 2025 +0000 Vectorizer refactor heuristic for select_and_join (#3449) * Refactor [Block.find_last_instruction], cache [Computation.last_pos] * Improve heuristics in [Computation.select_and_join] using [last_pos] commit 22f81d8 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 17:00:29 2025 +0000 Fix mistake in conditional for makearray_dynamic array initialization (#3466) commit aaaddfb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:57:17 2025 +0000 Vectorizer: propagate alignment of memory accesses (#3451) Currently it's always 8 but having this argument will help us consider alignment for new vector sequences. commit b15d44e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:55:29 2025 +0000 vectorizer: improve debug printout (#3445) commit 6239156 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 13:43:21 2025 +0000 Better hugepage alignment of stacks and heap (#3384) Co-authored-by: Mark Shinwell <mshinwell@pm.me> commit 677d79a Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 13:23:56 2025 +0000 Backend dune copy and directive (#3467) * Remove unused line directive from [dune] * Use [copy_files#] to copy files from ARCH and add a file directive * Remove existing file directives commit 314b131 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 11:58:41 2025 +0000 Bound stack size in expect tests (#3439) commit 02774f8 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:52:50 2025 +0000 all_deps is reflexive (#3464) commit 117a0a0 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 10:44:15 2025 +0000 Stub implementation of new custom memory API (#3437) commit 4f30aac Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:31:48 2025 +0000 Vectorizer bug fix: address argument of memory operations (#3446) Fix bug: use address arg of the first instruction in a group ... not the last! Only matters for arrays at the moment, where the address offset argument is not always the same register. commit cc91e2b Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Tue Jan 14 11:26:59 2025 +0100 caml_update_dummy: fail on closure blocks (#3429) commit 17a01a9 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 10:07:39 2025 +0000 Implement %array_element_size_in_bytes (#3367) Co-authored-by: Chris Casinghino <ccasinghino@janestreet.com> commit b487f71 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 13 14:05:25 2025 +0000 Runtime: make types explicit when reading [gc_regs] (#3453) Runtime4: make types explicit when reading [gc_regs]. commit 67e6eb3 Author: Max Slater <max@thenumb.at> Date: Fri Jan 10 16:17:32 2025 -0500 More capsule API updates (#3440) commit c7f573f Author: Mark Shinwell <mshinwell@pm.me> Date: Fri Jan 10 18:26:15 2025 +0000 Reinstate %makearray_dynamic (#3460) commit e1e4fb8 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Fri Jan 10 16:15:48 2025 +0000 `portable` lazy allows `nonportable` thunk (#3436) * portable lazy allows nonportable thunk * add documentation * improve documentation * add examples * improve comments in test * say "not stronger" commit c30ec74 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 10 10:41:08 2025 -0500 Check for type recursion without boxing (#3407) commit cb290c5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 11:00:32 2025 +0000 Vectorizer: rename New (#3454) Rename New to New_vec128 to make the type clear and distinguish it from the upcoming Valx2 commit bd39e02 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 10:24:48 2025 +0000 Add function [DLL.for_all_i] (#3442) * Add function [DLL.for_all_i] * Rename to [for_alli] to match existing [mapi] and [iteri] * Remove unused argument of [aux] in [DLL.for_all*] commit c048920 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:16:36 2025 +0000 Cleanup machtype_component size (#3441) Cleanup size_component commit 830d5e7 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:59 2025 +0000 Add "dump-vectorize" to OCAMLPARAM (#3443) Add [dump-vectorize] to OCAMLPARAM for debugging commit 157c95e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:33 2025 +0000 Vectorizer bug fix: 128-bit vectorized constant (#3447) Fix bug: 128-bit vectorized constant high/low correctly ordered commit 648155d Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:09:48 2025 +0000 Add [Printreg.reglist] for debugging (#3444) commit d40254f Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 7 21:25:45 2025 +0000 Move two misplaced files (#3435) commit 4a0bb69 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Tue Jan 7 15:34:27 2025 -0500 `Yielding` mode axis (#3283) * `Yielding` mode axis * Tests * fix printing --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 00275e0 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:58 2025 -0500 Unbox_float32 should check custom ops name (#3433) check sym name commit 2e49469 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:03 2025 -0500 Make Capsule preserve wrapped exception backtraces (#3421) * with_password * portable * don't use polymorphic parameters * review * protect encapsulated from other capsule * raise wrapped exceptions with existing backtrace * cr commit 2de23a5 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Mon Jan 6 04:04:29 2025 -0500 Fix CI by using `setup-ocaml` v3 for ocamlformat workflow (#3426) [CI] Use setup-ocaml v3 for ocamlformat workflow commit eada0f1 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 3 21:23:23 2025 -0500 Move unboxed records to stable (#3419) commit a273a33 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Fri Jan 3 11:17:18 2025 -0500 Changed make fmt to run in parallel (#3422) changed make fmt to run in parallel commit 4de5a72 Author: Max Slater <max@thenumb.at> Date: Thu Jan 2 20:10:08 2025 -0500 Add `Capsule.with_password` (#3420) commit b084ff3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 1 15:34:11 2025 +0000 vectorizer: new test (#3418) Add test for register compatiblity commit 5549015 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Dec 31 17:20:56 2024 +0000 Vectorizer: check register compatibility (#3412) Check that registers are compatible when joining computations
commit 7c5c7f0 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Wed Jan 22 15:24:10 2025 -0500 Squashed commit of the following: commit a53391d Author: Max Slater <max@thenumb.at> Date: Wed Jan 22 13:53:02 2025 -0500 Rename `atomic_cas`/`Compare_and_swap` (#3491) commit 92b327c Author: Max Slater <max@thenumb.at> Date: Tue Jan 21 14:18:56 2025 -0500 Additional operations for int atomics (#3490) commit 38e792c Author: Luke Maurer <lmaurer@janestreet.com> Date: Tue Jan 21 17:09:23 2025 +0000 Support `-open Foo` where `Foo` is parameterised (#3489) The command line ``` ocamlopt -open Foo -parameter P -c bar.ml ``` should be fine, even if `Foo` is itself parameterised by `P`: as usual, we compile `bar.ml` as if it began with `open! Foo`, and by the subset rule, `Bar` can refer to `Foo` because it takes at least the same parameters. Unfortunately, currently we process `-open` before `-parameter`, so when we go to check the implicit reference to `Foo`, we think there are no parameters, and we report an error. (Confusingly, the error suggests that the user add `-parameter P` to the command line.) The fix is simple: move the code that processes `-parameter` earlier so that the initial environment is constructed with the parameters already available. commit 784dc96 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 21 14:07:41 2025 +0000 Rename [emit.mlp] to [emit.ml] on amd64 (#3488) commit f3b720a Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Tue Jan 21 10:35:35 2025 +0000 Module aliases save locks instead of walking them immediately (#3398) commit 389a7c3 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:55:51 2025 +0000 Add OCAMLRUNPARAM d= parameter for max # domains (#3487) Allow maximum number of domains to be specified as a OCAMLRUNPARAM parameter. (cherry picked from commit f92715f1044aea30ca97e497653c883578f91fe6) Co-authored-by: KC Sivaramakrishnan <kc@kcsrk.info> commit 63767d7 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:45:30 2025 +0000 Add caml_runtime_parameters back (#3468) Add caml_runtime_parameters back. commit 5e9975e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 20 17:15:15 2025 +0000 Emit atomic compare and exchange (#3486) commit a9821e8 Author: Basile Clément <129742207+bclement-ocp@users.noreply.github.com> Date: Mon Jan 20 15:36:09 2025 +0100 Make patricia trees big-endian (#3438) This patch switches up the implementation of the `Patricia_tree` module from little-endian to big-endian, with the main motivation to be able to implement in-order traversal. The `caml_int_clz_tagged_to_untagged` and `caml_int_tagged_to_tagged` C stubs are recognized and replaced with the `clz` instruction when compiling with flambda2, so they are only used in the boot compiler. commit b8a9789 Author: Leo White <leo@lpw25.net> Date: Fri Jan 17 13:35:19 2025 +0000 Generate specific instructions for atomics on immediates (#3477) * Generate specific instructions for atomics on immediates * Fix formatting commit 7b93134 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 17 09:30:30 2025 +0000 Vectorizer: add tests (#3456) * Add tests * Disable ocamlformat on unboxed tests * Increase -vectorize-max-block-size for tests * Fix asssertion failure when vectorizing unboxed int32 * Disable float32 on arm64 (not yet implemented) * improve gen_dune.ml for the vectorizer tests Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com> commit 6379678 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 16:08:29 2025 +0000 Add "-ocamlrunparam" linker flag (#3483) commit f7b2cbe Author: Xavier Clerc <xclerc@users.noreply.github.com> Date: Thu Jan 16 15:25:28 2025 +0000 Bump the version of `actions/upload-artifact` (#3474) * Bump the version of actions/upload-artifact. * Ensure artifact names are unique. * To trigger CI. * Try with commit hash. commit afb8a55 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 14:03:37 2025 +0000 Move two macOS CI controllers to runtime5 (#3482) commit aae5c40 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 13:50:34 2025 +0000 Fix error in caml_get_init_stack_wsize (#3481) commit 525868c Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:30 2025 -0500 Use null pointers for `or_null` (#3267) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls * Constructors and pattern-matching * Bytecode compilation * `or_null` is `Variant_or_null` * Accept tests * Runtime tests * Delete obsolete or_null test --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 9796b21 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:13 2025 -0500 Runtime changes for `or_null` (#3265) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit df4a6e0 Author: Chris Casinghino <ccasinghino@janestreet.com> Date: Wed Jan 15 13:08:53 2025 -0500 Bump magic numbers for 5.2.0minus-5 (#3478) commit d1c8d85 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 16:44:39 2025 +0000 Peek and poke (#3309) commit f8caad4 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 15 16:00:39 2025 +0000 Vectorizer: xmm register can hold ocaml values (#3455) * Add [Valx2] to [Cmm.machtype_component] * Vectorizer generates [Valx2] * Record live offsets of [Valx2] in the frametable For runtime4, xmm register are below [gc_regs], use negative offsets. * Move [types_are_compatible] from [Reg] to [Proc] This information has to be in sync with register classes, stack slock classes, and emit for move instructions. commit 34a7873 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Wed Jan 15 13:13:18 2025 +0000 Improve coherence of modality zapping (#3462) commit 1a6a9d3 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 12:06:24 2025 +0000 Fix caml_obj_with_tag (#3465) commit bc5110a Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Wed Jan 15 11:52:25 2025 +0000 Reset the pacing of major collection after any synchronous major GC (#3463) Reset the pacing of major collection at the end of any synchronous major collection. commit 9faf700 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 11:32:59 2025 +0000 Remove remnants of caml_obj_truncate (#3469) commit ff9430b Author: Luke Maurer <lmaurer@janestreet.com> Date: Wed Jan 15 11:31:22 2025 +0000 Mangle instance symbol names using `____` rather than `___` (#3472) Apparently there are libraries around that have names ending in single underscores, leading to ambiguous symbol names if we use triple underscores to delimit instances. Other choices are possible but this PR opts for newly-developed quadruple-underscore technology. commit 9984700 Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Wed Jan 15 11:03:43 2025 +0100 Port upstream PRs 11542 and 12505 to runtime4 (#3431) fix #11482: random crash in large closure allocation (#11542) Co-authored-by: Damien Doligez <damien.doligez@inria.fr> commit 058c4db Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 22:19:32 2025 +0000 Enable all makearray_dynamic tests on runtime4 (#3470) commit ba15ee5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 20:08:31 2025 +0000 Vectorize [Ifloatarithmem] (#3452) * Add [Isimd_mem] to [Arch.Specific] and emit [addpd] with memory arg and similar instructions * Vectorize [Ifloatarithmem] When the memory alignment is known to be 128-bit (currently, never) emits [addpd], otherwise emits a vector load followed by an arithmetic instruction. commit 9755b39 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 18:57:39 2025 +0000 Fix CI failure (#3473) commit 859949c Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:56:53 2025 +0000 Vectorize [Specific.Istore_int] (#3450) Used for array initialization (amd64) commit 50f73cb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:38:39 2025 +0000 Do not allow naked pointers (remove configure option) (#3448) commit b7c8ad3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:07:39 2025 +0000 Vectorizer refactor heuristic for select_and_join (#3449) * Refactor [Block.find_last_instruction], cache [Computation.last_pos] * Improve heuristics in [Computation.select_and_join] using [last_pos] commit 22f81d8 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 17:00:29 2025 +0000 Fix mistake in conditional for makearray_dynamic array initialization (#3466) commit aaaddfb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:57:17 2025 +0000 Vectorizer: propagate alignment of memory accesses (#3451) Currently it's always 8 but having this argument will help us consider alignment for new vector sequences. commit b15d44e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:55:29 2025 +0000 vectorizer: improve debug printout (#3445) commit 6239156 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 13:43:21 2025 +0000 Better hugepage alignment of stacks and heap (#3384) Co-authored-by: Mark Shinwell <mshinwell@pm.me> commit 677d79a Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 13:23:56 2025 +0000 Backend dune copy and directive (#3467) * Remove unused line directive from [dune] * Use [copy_files#] to copy files from ARCH and add a file directive * Remove existing file directives commit 314b131 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 11:58:41 2025 +0000 Bound stack size in expect tests (#3439) commit 02774f8 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:52:50 2025 +0000 all_deps is reflexive (#3464) commit 117a0a0 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 10:44:15 2025 +0000 Stub implementation of new custom memory API (#3437) commit 4f30aac Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:31:48 2025 +0000 Vectorizer bug fix: address argument of memory operations (#3446) Fix bug: use address arg of the first instruction in a group ... not the last! Only matters for arrays at the moment, where the address offset argument is not always the same register. commit cc91e2b Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Tue Jan 14 11:26:59 2025 +0100 caml_update_dummy: fail on closure blocks (#3429) commit 17a01a9 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 10:07:39 2025 +0000 Implement %array_element_size_in_bytes (#3367) Co-authored-by: Chris Casinghino <ccasinghino@janestreet.com> commit b487f71 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 13 14:05:25 2025 +0000 Runtime: make types explicit when reading [gc_regs] (#3453) Runtime4: make types explicit when reading [gc_regs]. commit 67e6eb3 Author: Max Slater <max@thenumb.at> Date: Fri Jan 10 16:17:32 2025 -0500 More capsule API updates (#3440) commit c7f573f Author: Mark Shinwell <mshinwell@pm.me> Date: Fri Jan 10 18:26:15 2025 +0000 Reinstate %makearray_dynamic (#3460) commit e1e4fb8 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Fri Jan 10 16:15:48 2025 +0000 `portable` lazy allows `nonportable` thunk (#3436) * portable lazy allows nonportable thunk * add documentation * improve documentation * add examples * improve comments in test * say "not stronger" commit c30ec74 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 10 10:41:08 2025 -0500 Check for type recursion without boxing (#3407) commit cb290c5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 11:00:32 2025 +0000 Vectorizer: rename New (#3454) Rename New to New_vec128 to make the type clear and distinguish it from the upcoming Valx2 commit bd39e02 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 10:24:48 2025 +0000 Add function [DLL.for_all_i] (#3442) * Add function [DLL.for_all_i] * Rename to [for_alli] to match existing [mapi] and [iteri] * Remove unused argument of [aux] in [DLL.for_all*] commit c048920 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:16:36 2025 +0000 Cleanup machtype_component size (#3441) Cleanup size_component commit 830d5e7 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:59 2025 +0000 Add "dump-vectorize" to OCAMLPARAM (#3443) Add [dump-vectorize] to OCAMLPARAM for debugging commit 157c95e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:33 2025 +0000 Vectorizer bug fix: 128-bit vectorized constant (#3447) Fix bug: 128-bit vectorized constant high/low correctly ordered commit 648155d Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:09:48 2025 +0000 Add [Printreg.reglist] for debugging (#3444) commit d40254f Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 7 21:25:45 2025 +0000 Move two misplaced files (#3435) commit 4a0bb69 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Tue Jan 7 15:34:27 2025 -0500 `Yielding` mode axis (#3283) * `Yielding` mode axis * Tests * fix printing --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 00275e0 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:58 2025 -0500 Unbox_float32 should check custom ops name (#3433) check sym name commit 2e49469 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:03 2025 -0500 Make Capsule preserve wrapped exception backtraces (#3421) * with_password * portable * don't use polymorphic parameters * review * protect encapsulated from other capsule * raise wrapped exceptions with existing backtrace * cr commit 2de23a5 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Mon Jan 6 04:04:29 2025 -0500 Fix CI by using `setup-ocaml` v3 for ocamlformat workflow (#3426) [CI] Use setup-ocaml v3 for ocamlformat workflow commit eada0f1 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 3 21:23:23 2025 -0500 Move unboxed records to stable (#3419) commit a273a33 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Fri Jan 3 11:17:18 2025 -0500 Changed make fmt to run in parallel (#3422) changed make fmt to run in parallel commit 4de5a72 Author: Max Slater <max@thenumb.at> Date: Thu Jan 2 20:10:08 2025 -0500 Add `Capsule.with_password` (#3420) commit b084ff3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 1 15:34:11 2025 +0000 vectorizer: new test (#3418) Add test for register compatiblity commit 5549015 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Dec 31 17:20:56 2024 +0000 Vectorizer: check register compatibility (#3412) Check that registers are compatible when joining computations
commit 16f1b23 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Wed Jan 22 15:25:23 2025 -0500 Squashed commit of the following: commit 7c5c7f0 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Wed Jan 22 15:24:10 2025 -0500 Squashed commit of the following: commit a53391d Author: Max Slater <max@thenumb.at> Date: Wed Jan 22 13:53:02 2025 -0500 Rename `atomic_cas`/`Compare_and_swap` (#3491) commit 92b327c Author: Max Slater <max@thenumb.at> Date: Tue Jan 21 14:18:56 2025 -0500 Additional operations for int atomics (#3490) commit 38e792c Author: Luke Maurer <lmaurer@janestreet.com> Date: Tue Jan 21 17:09:23 2025 +0000 Support `-open Foo` where `Foo` is parameterised (#3489) The command line ``` ocamlopt -open Foo -parameter P -c bar.ml ``` should be fine, even if `Foo` is itself parameterised by `P`: as usual, we compile `bar.ml` as if it began with `open! Foo`, and by the subset rule, `Bar` can refer to `Foo` because it takes at least the same parameters. Unfortunately, currently we process `-open` before `-parameter`, so when we go to check the implicit reference to `Foo`, we think there are no parameters, and we report an error. (Confusingly, the error suggests that the user add `-parameter P` to the command line.) The fix is simple: move the code that processes `-parameter` earlier so that the initial environment is constructed with the parameters already available. commit 784dc96 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 21 14:07:41 2025 +0000 Rename [emit.mlp] to [emit.ml] on amd64 (#3488) commit f3b720a Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Tue Jan 21 10:35:35 2025 +0000 Module aliases save locks instead of walking them immediately (#3398) commit 389a7c3 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:55:51 2025 +0000 Add OCAMLRUNPARAM d= parameter for max # domains (#3487) Allow maximum number of domains to be specified as a OCAMLRUNPARAM parameter. (cherry picked from commit f92715f1044aea30ca97e497653c883578f91fe6) Co-authored-by: KC Sivaramakrishnan <kc@kcsrk.info> commit 63767d7 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:45:30 2025 +0000 Add caml_runtime_parameters back (#3468) Add caml_runtime_parameters back. commit 5e9975e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 20 17:15:15 2025 +0000 Emit atomic compare and exchange (#3486) commit a9821e8 Author: Basile Clément <129742207+bclement-ocp@users.noreply.github.com> Date: Mon Jan 20 15:36:09 2025 +0100 Make patricia trees big-endian (#3438) This patch switches up the implementation of the `Patricia_tree` module from little-endian to big-endian, with the main motivation to be able to implement in-order traversal. The `caml_int_clz_tagged_to_untagged` and `caml_int_tagged_to_tagged` C stubs are recognized and replaced with the `clz` instruction when compiling with flambda2, so they are only used in the boot compiler. commit b8a9789 Author: Leo White <leo@lpw25.net> Date: Fri Jan 17 13:35:19 2025 +0000 Generate specific instructions for atomics on immediates (#3477) * Generate specific instructions for atomics on immediates * Fix formatting commit 7b93134 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 17 09:30:30 2025 +0000 Vectorizer: add tests (#3456) * Add tests * Disable ocamlformat on unboxed tests * Increase -vectorize-max-block-size for tests * Fix asssertion failure when vectorizing unboxed int32 * Disable float32 on arm64 (not yet implemented) * improve gen_dune.ml for the vectorizer tests Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com> commit 6379678 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 16:08:29 2025 +0000 Add "-ocamlrunparam" linker flag (#3483) commit f7b2cbe Author: Xavier Clerc <xclerc@users.noreply.github.com> Date: Thu Jan 16 15:25:28 2025 +0000 Bump the version of `actions/upload-artifact` (#3474) * Bump the version of actions/upload-artifact. * Ensure artifact names are unique. * To trigger CI. * Try with commit hash. commit afb8a55 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 14:03:37 2025 +0000 Move two macOS CI controllers to runtime5 (#3482) commit aae5c40 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 13:50:34 2025 +0000 Fix error in caml_get_init_stack_wsize (#3481) commit 525868c Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:30 2025 -0500 Use null pointers for `or_null` (#3267) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls * Constructors and pattern-matching * Bytecode compilation * `or_null` is `Variant_or_null` * Accept tests * Runtime tests * Delete obsolete or_null test --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 9796b21 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:13 2025 -0500 Runtime changes for `or_null` (#3265) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit df4a6e0 Author: Chris Casinghino <ccasinghino@janestreet.com> Date: Wed Jan 15 13:08:53 2025 -0500 Bump magic numbers for 5.2.0minus-5 (#3478) commit d1c8d85 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 16:44:39 2025 +0000 Peek and poke (#3309) commit f8caad4 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 15 16:00:39 2025 +0000 Vectorizer: xmm register can hold ocaml values (#3455) * Add [Valx2] to [Cmm.machtype_component] * Vectorizer generates [Valx2] * Record live offsets of [Valx2] in the frametable For runtime4, xmm register are below [gc_regs], use negative offsets. * Move [types_are_compatible] from [Reg] to [Proc] This information has to be in sync with register classes, stack slock classes, and emit for move instructions. commit 34a7873 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Wed Jan 15 13:13:18 2025 +0000 Improve coherence of modality zapping (#3462) commit 1a6a9d3 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 12:06:24 2025 +0000 Fix caml_obj_with_tag (#3465) commit bc5110a Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Wed Jan 15 11:52:25 2025 +0000 Reset the pacing of major collection after any synchronous major GC (#3463) Reset the pacing of major collection at the end of any synchronous major collection. commit 9faf700 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 11:32:59 2025 +0000 Remove remnants of caml_obj_truncate (#3469) commit ff9430b Author: Luke Maurer <lmaurer@janestreet.com> Date: Wed Jan 15 11:31:22 2025 +0000 Mangle instance symbol names using `____` rather than `___` (#3472) Apparently there are libraries around that have names ending in single underscores, leading to ambiguous symbol names if we use triple underscores to delimit instances. Other choices are possible but this PR opts for newly-developed quadruple-underscore technology. commit 9984700 Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Wed Jan 15 11:03:43 2025 +0100 Port upstream PRs 11542 and 12505 to runtime4 (#3431) fix #11482: random crash in large closure allocation (#11542) Co-authored-by: Damien Doligez <damien.doligez@inria.fr> commit 058c4db Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 22:19:32 2025 +0000 Enable all makearray_dynamic tests on runtime4 (#3470) commit ba15ee5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 20:08:31 2025 +0000 Vectorize [Ifloatarithmem] (#3452) * Add [Isimd_mem] to [Arch.Specific] and emit [addpd] with memory arg and similar instructions * Vectorize [Ifloatarithmem] When the memory alignment is known to be 128-bit (currently, never) emits [addpd], otherwise emits a vector load followed by an arithmetic instruction. commit 9755b39 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 18:57:39 2025 +0000 Fix CI failure (#3473) commit 859949c Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:56:53 2025 +0000 Vectorize [Specific.Istore_int] (#3450) Used for array initialization (amd64) commit 50f73cb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:38:39 2025 +0000 Do not allow naked pointers (remove configure option) (#3448) commit b7c8ad3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:07:39 2025 +0000 Vectorizer refactor heuristic for select_and_join (#3449) * Refactor [Block.find_last_instruction], cache [Computation.last_pos] * Improve heuristics in [Computation.select_and_join] using [last_pos] commit 22f81d8 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 17:00:29 2025 +0000 Fix mistake in conditional for makearray_dynamic array initialization (#3466) commit aaaddfb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:57:17 2025 +0000 Vectorizer: propagate alignment of memory accesses (#3451) Currently it's always 8 but having this argument will help us consider alignment for new vector sequences. commit b15d44e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:55:29 2025 +0000 vectorizer: improve debug printout (#3445) commit 6239156 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 13:43:21 2025 +0000 Better hugepage alignment of stacks and heap (#3384) Co-authored-by: Mark Shinwell <mshinwell@pm.me> commit 677d79a Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 13:23:56 2025 +0000 Backend dune copy and directive (#3467) * Remove unused line directive from [dune] * Use [copy_files#] to copy files from ARCH and add a file directive * Remove existing file directives commit 314b131 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 11:58:41 2025 +0000 Bound stack size in expect tests (#3439) commit 02774f8 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:52:50 2025 +0000 all_deps is reflexive (#3464) commit 117a0a0 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 10:44:15 2025 +0000 Stub implementation of new custom memory API (#3437) commit 4f30aac Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:31:48 2025 +0000 Vectorizer bug fix: address argument of memory operations (#3446) Fix bug: use address arg of the first instruction in a group ... not the last! Only matters for arrays at the moment, where the address offset argument is not always the same register. commit cc91e2b Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Tue Jan 14 11:26:59 2025 +0100 caml_update_dummy: fail on closure blocks (#3429) commit 17a01a9 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 10:07:39 2025 +0000 Implement %array_element_size_in_bytes (#3367) Co-authored-by: Chris Casinghino <ccasinghino@janestreet.com> commit b487f71 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 13 14:05:25 2025 +0000 Runtime: make types explicit when reading [gc_regs] (#3453) Runtime4: make types explicit when reading [gc_regs]. commit 67e6eb3 Author: Max Slater <max@thenumb.at> Date: Fri Jan 10 16:17:32 2025 -0500 More capsule API updates (#3440) commit c7f573f Author: Mark Shinwell <mshinwell@pm.me> Date: Fri Jan 10 18:26:15 2025 +0000 Reinstate %makearray_dynamic (#3460) commit e1e4fb8 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Fri Jan 10 16:15:48 2025 +0000 `portable` lazy allows `nonportable` thunk (#3436) * portable lazy allows nonportable thunk * add documentation * improve documentation * add examples * improve comments in test * say "not stronger" commit c30ec74 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 10 10:41:08 2025 -0500 Check for type recursion without boxing (#3407) commit cb290c5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 11:00:32 2025 +0000 Vectorizer: rename New (#3454) Rename New to New_vec128 to make the type clear and distinguish it from the upcoming Valx2 commit bd39e02 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 10:24:48 2025 +0000 Add function [DLL.for_all_i] (#3442) * Add function [DLL.for_all_i] * Rename to [for_alli] to match existing [mapi] and [iteri] * Remove unused argument of [aux] in [DLL.for_all*] commit c048920 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:16:36 2025 +0000 Cleanup machtype_component size (#3441) Cleanup size_component commit 830d5e7 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:59 2025 +0000 Add "dump-vectorize" to OCAMLPARAM (#3443) Add [dump-vectorize] to OCAMLPARAM for debugging commit 157c95e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:33 2025 +0000 Vectorizer bug fix: 128-bit vectorized constant (#3447) Fix bug: 128-bit vectorized constant high/low correctly ordered commit 648155d Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:09:48 2025 +0000 Add [Printreg.reglist] for debugging (#3444) commit d40254f Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 7 21:25:45 2025 +0000 Move two misplaced files (#3435) commit 4a0bb69 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Tue Jan 7 15:34:27 2025 -0500 `Yielding` mode axis (#3283) * `Yielding` mode axis * Tests * fix printing --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 00275e0 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:58 2025 -0500 Unbox_float32 should check custom ops name (#3433) check sym name commit 2e49469 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:03 2025 -0500 Make Capsule preserve wrapped exception backtraces (#3421) * with_password * portable * don't use polymorphic parameters * review * protect encapsulated from other capsule * raise wrapped exceptions with existing backtrace * cr commit 2de23a5 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Mon Jan 6 04:04:29 2025 -0500 Fix CI by using `setup-ocaml` v3 for ocamlformat workflow (#3426) [CI] Use setup-ocaml v3 for ocamlformat workflow commit eada0f1 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 3 21:23:23 2025 -0500 Move unboxed records to stable (#3419) commit a273a33 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Fri Jan 3 11:17:18 2025 -0500 Changed make fmt to run in parallel (#3422) changed make fmt to run in parallel commit 4de5a72 Author: Max Slater <max@thenumb.at> Date: Thu Jan 2 20:10:08 2025 -0500 Add `Capsule.with_password` (#3420) commit b084ff3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 1 15:34:11 2025 +0000 vectorizer: new test (#3418) Add test for register compatiblity commit 5549015 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Dec 31 17:20:56 2024 +0000 Vectorizer: check register compatibility (#3412) Check that registers are compatible when joining computations
commit 34a5e6a Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Wed Jan 22 15:26:17 2025 -0500 Squashed commit of the following: commit 16f1b23 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Wed Jan 22 15:25:23 2025 -0500 Squashed commit of the following: commit 7c5c7f0 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Wed Jan 22 15:24:10 2025 -0500 Squashed commit of the following: commit a53391d Author: Max Slater <max@thenumb.at> Date: Wed Jan 22 13:53:02 2025 -0500 Rename `atomic_cas`/`Compare_and_swap` (#3491) commit 92b327c Author: Max Slater <max@thenumb.at> Date: Tue Jan 21 14:18:56 2025 -0500 Additional operations for int atomics (#3490) commit 38e792c Author: Luke Maurer <lmaurer@janestreet.com> Date: Tue Jan 21 17:09:23 2025 +0000 Support `-open Foo` where `Foo` is parameterised (#3489) The command line ``` ocamlopt -open Foo -parameter P -c bar.ml ``` should be fine, even if `Foo` is itself parameterised by `P`: as usual, we compile `bar.ml` as if it began with `open! Foo`, and by the subset rule, `Bar` can refer to `Foo` because it takes at least the same parameters. Unfortunately, currently we process `-open` before `-parameter`, so when we go to check the implicit reference to `Foo`, we think there are no parameters, and we report an error. (Confusingly, the error suggests that the user add `-parameter P` to the command line.) The fix is simple: move the code that processes `-parameter` earlier so that the initial environment is constructed with the parameters already available. commit 784dc96 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 21 14:07:41 2025 +0000 Rename [emit.mlp] to [emit.ml] on amd64 (#3488) commit f3b720a Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Tue Jan 21 10:35:35 2025 +0000 Module aliases save locks instead of walking them immediately (#3398) commit 389a7c3 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:55:51 2025 +0000 Add OCAMLRUNPARAM d= parameter for max # domains (#3487) Allow maximum number of domains to be specified as a OCAMLRUNPARAM parameter. (cherry picked from commit f92715f1044aea30ca97e497653c883578f91fe6) Co-authored-by: KC Sivaramakrishnan <kc@kcsrk.info> commit 63767d7 Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Mon Jan 20 17:45:30 2025 +0000 Add caml_runtime_parameters back (#3468) Add caml_runtime_parameters back. commit 5e9975e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 20 17:15:15 2025 +0000 Emit atomic compare and exchange (#3486) commit a9821e8 Author: Basile Clément <129742207+bclement-ocp@users.noreply.github.com> Date: Mon Jan 20 15:36:09 2025 +0100 Make patricia trees big-endian (#3438) This patch switches up the implementation of the `Patricia_tree` module from little-endian to big-endian, with the main motivation to be able to implement in-order traversal. The `caml_int_clz_tagged_to_untagged` and `caml_int_tagged_to_tagged` C stubs are recognized and replaced with the `clz` instruction when compiling with flambda2, so they are only used in the boot compiler. commit b8a9789 Author: Leo White <leo@lpw25.net> Date: Fri Jan 17 13:35:19 2025 +0000 Generate specific instructions for atomics on immediates (#3477) * Generate specific instructions for atomics on immediates * Fix formatting commit 7b93134 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 17 09:30:30 2025 +0000 Vectorizer: add tests (#3456) * Add tests * Disable ocamlformat on unboxed tests * Increase -vectorize-max-block-size for tests * Fix asssertion failure when vectorizing unboxed int32 * Disable float32 on arm64 (not yet implemented) * improve gen_dune.ml for the vectorizer tests Co-authored-by: Xavier Clerc <xclerc@users.noreply.github.com> commit 6379678 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 16:08:29 2025 +0000 Add "-ocamlrunparam" linker flag (#3483) commit f7b2cbe Author: Xavier Clerc <xclerc@users.noreply.github.com> Date: Thu Jan 16 15:25:28 2025 +0000 Bump the version of `actions/upload-artifact` (#3474) * Bump the version of actions/upload-artifact. * Ensure artifact names are unique. * To trigger CI. * Try with commit hash. commit afb8a55 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 14:03:37 2025 +0000 Move two macOS CI controllers to runtime5 (#3482) commit aae5c40 Author: Mark Shinwell <mshinwell@pm.me> Date: Thu Jan 16 13:50:34 2025 +0000 Fix error in caml_get_init_stack_wsize (#3481) commit 525868c Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:30 2025 -0500 Use null pointers for `or_null` (#3267) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls * Constructors and pattern-matching * Bytecode compilation * `or_null` is `Variant_or_null` * Accept tests * Runtime tests * Delete obsolete or_null test --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 9796b21 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Wed Jan 15 17:47:13 2025 -0500 Runtime changes for `or_null` (#3265) * runtime changes * runtime4 changes * Change `CODE_UNBOXED_INT64` and `CODE_NULL` * make `Is_block` an inline function * redefine `Is_long` * fix * Change `CODE_UNBOXED_INT64` back * optimize `Is_block`/`Is_long` * `null_tag` for `caml_obj_tag` * consistent naming * slightly more reassuring comment * `inline` is unnecessary and might break `#define inline` * optimization incorrect in presence of nulls --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit df4a6e0 Author: Chris Casinghino <ccasinghino@janestreet.com> Date: Wed Jan 15 13:08:53 2025 -0500 Bump magic numbers for 5.2.0minus-5 (#3478) commit d1c8d85 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 16:44:39 2025 +0000 Peek and poke (#3309) commit f8caad4 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 15 16:00:39 2025 +0000 Vectorizer: xmm register can hold ocaml values (#3455) * Add [Valx2] to [Cmm.machtype_component] * Vectorizer generates [Valx2] * Record live offsets of [Valx2] in the frametable For runtime4, xmm register are below [gc_regs], use negative offsets. * Move [types_are_compatible] from [Reg] to [Proc] This information has to be in sync with register classes, stack slock classes, and emit for move instructions. commit 34a7873 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Wed Jan 15 13:13:18 2025 +0000 Improve coherence of modality zapping (#3462) commit 1a6a9d3 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 12:06:24 2025 +0000 Fix caml_obj_with_tag (#3465) commit bc5110a Author: Nick Barnes <Nick.Barnes@pobox.com> Date: Wed Jan 15 11:52:25 2025 +0000 Reset the pacing of major collection after any synchronous major GC (#3463) Reset the pacing of major collection at the end of any synchronous major collection. commit 9faf700 Author: Mark Shinwell <mshinwell@pm.me> Date: Wed Jan 15 11:32:59 2025 +0000 Remove remnants of caml_obj_truncate (#3469) commit ff9430b Author: Luke Maurer <lmaurer@janestreet.com> Date: Wed Jan 15 11:31:22 2025 +0000 Mangle instance symbol names using `____` rather than `___` (#3472) Apparently there are libraries around that have names ending in single underscores, leading to ambiguous symbol names if we use triple underscores to delimit instances. Other choices are possible but this PR opts for newly-developed quadruple-underscore technology. commit 9984700 Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Wed Jan 15 11:03:43 2025 +0100 Port upstream PRs 11542 and 12505 to runtime4 (#3431) fix #11482: random crash in large closure allocation (#11542) Co-authored-by: Damien Doligez <damien.doligez@inria.fr> commit 058c4db Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 22:19:32 2025 +0000 Enable all makearray_dynamic tests on runtime4 (#3470) commit ba15ee5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 20:08:31 2025 +0000 Vectorize [Ifloatarithmem] (#3452) * Add [Isimd_mem] to [Arch.Specific] and emit [addpd] with memory arg and similar instructions * Vectorize [Ifloatarithmem] When the memory alignment is known to be 128-bit (currently, never) emits [addpd], otherwise emits a vector load followed by an arithmetic instruction. commit 9755b39 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 18:57:39 2025 +0000 Fix CI failure (#3473) commit 859949c Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:56:53 2025 +0000 Vectorize [Specific.Istore_int] (#3450) Used for array initialization (amd64) commit 50f73cb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:38:39 2025 +0000 Do not allow naked pointers (remove configure option) (#3448) commit b7c8ad3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 17:07:39 2025 +0000 Vectorizer refactor heuristic for select_and_join (#3449) * Refactor [Block.find_last_instruction], cache [Computation.last_pos] * Improve heuristics in [Computation.select_and_join] using [last_pos] commit 22f81d8 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 17:00:29 2025 +0000 Fix mistake in conditional for makearray_dynamic array initialization (#3466) commit aaaddfb Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:57:17 2025 +0000 Vectorizer: propagate alignment of memory accesses (#3451) Currently it's always 8 but having this argument will help us consider alignment for new vector sequences. commit b15d44e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 14:55:29 2025 +0000 vectorizer: improve debug printout (#3445) commit 6239156 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 13:43:21 2025 +0000 Better hugepage alignment of stacks and heap (#3384) Co-authored-by: Mark Shinwell <mshinwell@pm.me> commit 677d79a Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 13:23:56 2025 +0000 Backend dune copy and directive (#3467) * Remove unused line directive from [dune] * Use [copy_files#] to copy files from ARCH and add a file directive * Remove existing file directives commit 314b131 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 11:58:41 2025 +0000 Bound stack size in expect tests (#3439) commit 02774f8 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:52:50 2025 +0000 all_deps is reflexive (#3464) commit 117a0a0 Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 14 10:44:15 2025 +0000 Stub implementation of new custom memory API (#3437) commit 4f30aac Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Jan 14 10:31:48 2025 +0000 Vectorizer bug fix: address argument of memory operations (#3446) Fix bug: use address arg of the first instruction in a group ... not the last! Only matters for arrays at the moment, where the address offset argument is not always the same register. commit cc91e2b Author: Vincent Laviron <vincent.laviron@gmail.com> Date: Tue Jan 14 11:26:59 2025 +0100 caml_update_dummy: fail on closure blocks (#3429) commit 17a01a9 Author: Mark Shinwell <mshinwell@pm.me> Date: Tue Jan 14 10:07:39 2025 +0000 Implement %array_element_size_in_bytes (#3367) Co-authored-by: Chris Casinghino <ccasinghino@janestreet.com> commit b487f71 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Mon Jan 13 14:05:25 2025 +0000 Runtime: make types explicit when reading [gc_regs] (#3453) Runtime4: make types explicit when reading [gc_regs]. commit 67e6eb3 Author: Max Slater <max@thenumb.at> Date: Fri Jan 10 16:17:32 2025 -0500 More capsule API updates (#3440) commit c7f573f Author: Mark Shinwell <mshinwell@pm.me> Date: Fri Jan 10 18:26:15 2025 +0000 Reinstate %makearray_dynamic (#3460) commit e1e4fb8 Author: Zesen Qian <riaqn@users.noreply.github.com> Date: Fri Jan 10 16:15:48 2025 +0000 `portable` lazy allows `nonportable` thunk (#3436) * portable lazy allows nonportable thunk * add documentation * improve documentation * add examples * improve comments in test * say "not stronger" commit c30ec74 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 10 10:41:08 2025 -0500 Check for type recursion without boxing (#3407) commit cb290c5 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 11:00:32 2025 +0000 Vectorizer: rename New (#3454) Rename New to New_vec128 to make the type clear and distinguish it from the upcoming Valx2 commit bd39e02 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Fri Jan 10 10:24:48 2025 +0000 Add function [DLL.for_all_i] (#3442) * Add function [DLL.for_all_i] * Rename to [for_alli] to match existing [mapi] and [iteri] * Remove unused argument of [aux] in [DLL.for_all*] commit c048920 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:16:36 2025 +0000 Cleanup machtype_component size (#3441) Cleanup size_component commit 830d5e7 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:59 2025 +0000 Add "dump-vectorize" to OCAMLPARAM (#3443) Add [dump-vectorize] to OCAMLPARAM for debugging commit 157c95e Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:15:33 2025 +0000 Vectorizer bug fix: 128-bit vectorized constant (#3447) Fix bug: 128-bit vectorized constant high/low correctly ordered commit 648155d Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Thu Jan 9 13:09:48 2025 +0000 Add [Printreg.reglist] for debugging (#3444) commit d40254f Author: Stephen Dolan <sdolan@janestreet.com> Date: Tue Jan 7 21:25:45 2025 +0000 Move two misplaced files (#3435) commit 4a0bb69 Author: dkalinichenko-js <118547217+dkalinichenko-js@users.noreply.github.com> Date: Tue Jan 7 15:34:27 2025 -0500 `Yielding` mode axis (#3283) * `Yielding` mode axis * Tests * fix printing --------- Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com> commit 00275e0 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:58 2025 -0500 Unbox_float32 should check custom ops name (#3433) check sym name commit 2e49469 Author: Max Slater <max@thenumb.at> Date: Mon Jan 6 13:05:03 2025 -0500 Make Capsule preserve wrapped exception backtraces (#3421) * with_password * portable * don't use polymorphic parameters * review * protect encapsulated from other capsule * raise wrapped exceptions with existing backtrace * cr commit 2de23a5 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Mon Jan 6 04:04:29 2025 -0500 Fix CI by using `setup-ocaml` v3 for ocamlformat workflow (#3426) [CI] Use setup-ocaml v3 for ocamlformat workflow commit eada0f1 Author: Ryan Tjoa <51928404+rtjoa@users.noreply.github.com> Date: Fri Jan 3 21:23:23 2025 -0500 Move unboxed records to stable (#3419) commit a273a33 Author: Jacob Van Buren <jvanburen@janestreet.com> Date: Fri Jan 3 11:17:18 2025 -0500 Changed make fmt to run in parallel (#3422) changed make fmt to run in parallel commit 4de5a72 Author: Max Slater <max@thenumb.at> Date: Thu Jan 2 20:10:08 2025 -0500 Add `Capsule.with_password` (#3420) commit b084ff3 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Wed Jan 1 15:34:11 2025 +0000 vectorizer: new test (#3418) Add test for register compatiblity commit 5549015 Author: Greta Yorsh <45005955+gretay-js@users.noreply.github.com> Date: Tue Dec 31 17:20:56 2024 +0000 Vectorizer: check register compatibility (#3412) Check that registers are compatible when joining computations
Summary
We only allow recursion in unboxed types to occur through boxes, otherwise the type is uninhabitable and usually also infinite-size.
Because
check_well_founded
already ruled out recursion through structural types (in our case, we care about unboxed tuples and aliases), we just look for a cycle in nominal unboxed types ([@@unboxed]
types and unboxed records), tracking the set of seen paths. This gives an algorithm that is simpler thancheck_well_founded
(whose correctness relies on some subtle properties ofTconstr
'sabbrev_memo
).We newly disallow recursive singleton
[@@unboxed]
types (type t = { t : t } [@@unboxed]
), which are uninhabitable anyway.Specification
For each group of mutually recursive type declarations, we define the following "type contains" transitive relation on type expressions:
type 'a t = #{ ...; lbl : u; ... }
,type 'a t = { lbl : u } [@@unboxed]
, ortype 'a t = U of u [@@unboxed]
is in the recursive group, then'a t
containsu
type 'a t = u
is in the recursive group then'a t
containsu
'a t
contains'a
iflayout_of 'a
orany
occurs in'a t
's layoutlayout_of
, so currently only considerany
#(u_1 * u_2 * ...)
contains allu_i
(
'a
is a metavariable for zero or more type parameters;t
is a metavariable for type constructors;u
is a metavariable for type expressions)If a path starting from the type expression on the LHS of a declaration contains two types with the same head type constructor, and that repeated type is an unboxed record or variant, then we give an error.
Examples
See
typing-layouts-unboxed-records/recursive.ml
for more.Alternatives
Layout variables. We could introduce layout variables (for this check only), finding infinite-size types via the occurs check. Such an implementation might be more principled, accepting finite-size recursive types like
type t = #{ t : t }
. The current implementation gives more informative error traces, and leaves the flexiblity to switch to a less restrictive check in the future.The algorithm from the Unboxed data constructors paper. This would accept types like
type 'a id = #{ a : 'a } and t = int id id
. I think this could be an appealing final solution, but some details are a bit subtle. See discussion on ocaml/ocaml#10479.Generalize
check_well_founded
. My first implementation, which roughly generalizescheck_well_founded
over the "type contains" relation, acceptstype 'a id = #{ a : 'a } and t = int id id
. (Onrtjoa.check-well-founded-unboxed-recursion
, unpolished.) I'd hesitate to increase our reliance oncheck_well_founded
, which I believe roughly implements the same algorithm as the paper above in a tricky way.Review: @goldfirere