forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChanges
More file actions
16961 lines (13155 loc) · 692 KB
/
Changes
File metadata and controls
16961 lines (13155 loc) · 692 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Working version
--------------
(Changes that can break existing programs are marked with a "*")
### Language features:
### Runtime system:
- #14486, #14530: Add FreeBSD frame pointers support for AMD64 and ARM64.
Document the usage of pmcstat and dtrace for generating profiling
information.
(Tim McGilchrist, review by Gabriel Scherer)
- #14494: Consistently use macro to test header promotion.
(Nick Barnes, review by Gabriel Scherer)
- #14493: Use Scannable_* macros instead of comparisons to No_scan_tag, for
legibility and correctness (fixes one bug, in weak.c).
(Nick Barnes, review by Gabriel Scherer)
* #14559: Remove `caml_fatal_error_arg` and `caml_fatal_error_arg2`
symbols from the runtime. The declarations were removed in 5.0.
(Antonin Décimo, review by Nicolás Ojeda Bär)
- #14570: Distinguish between prefetching for read and write access in the
runtime. Significant performance benefit for some multi-domain programs. For
maximum benefit on AMD64, pass -mprfchw to the C compiler.
(Nick Barnes, review by Gabriel Scherer, Damien Doligez, and Antonin Décimo)
### Type system:
- #14512: Improve check for warning 16 (unerasable-optional-argument)
(Alistair O'Brien, review by Florian Angeletti, Gabriel Scherer)
### Code generation and optimizations:
* #13919: optimize `lazy v` when `v` is a structured constant
(below a size threshold), so that `Lazy.from_val v` should not be
necessary anymore in most cases.
This may in theory break certain recursive value declarations,
in that case switching to `lazy ((); v)` should be enough to
disable the change in a backward-compatible way.
(Gabriel Scherer, review by Vincent Laviron)
- #13438: keep some optimization hints from lambda in bytecode modules
and executables (to be used by Js_of_ocaml / Wasm_of_ocaml)
(Jérôme Vouillon)
### Standard library:
- #14487: Add String.drop_{prefix,suffix}
(Michael Neumann, review by Léo Andrès, Nicolás Ojeda Bär and Gabriel Scherer)
- #14553: Add Array.fold_{left,right}2
(Clément Pottier, review by Nicolás Ojeda Bär and Vincent Laviron)
### Other libraries:
### Tools:
- #14499: in ocamltest, remove support for the legacy
test syntax (with '***') and the '-translate' option
to convert from this syntax.
(Gabriel Scherer, review by Nicolás Ojeda Bär)
- #14502: in ocamltest, `not <action>` negates a
predicate-like action.
(Gabriel Scherer, review by Olivier Nicole)
- #14532: in ocamltest, support `<action> && <action>`,
`<action> || <action>`
and `if <action> then <action> [else <action>]`.
(Gabriel Scherer, review by Olivier Nicole)
- #14545: in ocamltest, support `system` variable that uses
the configure-time @System@ value. Rename the `macos` variable to
`macosx` to match the configure-time choice.
(Tim McGilchrist, review by Gabriel Scherer and Antonin Décimo)
### Manual and documentation:
- #14598: Add `@since` annotations to `Runtime_events`. (Raphaël Proust)
### Compiler user-interface and warnings:
- #14205: Make inclusion check error message reference the user-written file
when operating on a ppx-generated file.
(Liam Stevenson, review by Florian Angeletti)
- #14142: print GADT equations in error messages when they introduce a type
(Stefan Muenzel, review by Florian Angeletti)
- #14359, #14600: when reporting unbound type variables in a type declaration,
avoid a possible confusion between type parameters and unbound variables.
(Florian Angeletti, report by Florian Weimer, review by Gabriel Scherer)
### Internal/compiler-libs changes:
- #14620: optimize utf8 normalization and (un)capitalization functions
(Gabriel Scherer, review by Stefan Muenzel and Florian Angeletti,
report by Stefan Muenzel)
- #14618: optimize utf8 normalization outside of the ASCII range
(Stefan Muenzel, review by Gabriel Scherer, Daniel Bünzli, and
Florian Angeletti)
- #14601, remove an unreachable path for unbound type variables in extension
constructor declarations.
(Florian Angeletti, review by Gabriel Scherer)
### Build system:
### Bug fixes:
- #14492: Fix Obj.dup on closures.
(Mark Shinwell and Nick Barnes, review by Gabriel Scherer and Damien Doligez)
OCaml 5.5.0
-----------
(Changes that can break existing programs are marked with a "*")
### Language features:
* #14009: infix extension points/attributes appearing in local structure items,
eg `let module%foo[@bar] ... in ...` are attached to the AST node of the
corresponding structure item (similar to their global counterparts) and no
longer to the enclosing `let` expression. Extension points/attributes that
are to be attached to the enclosing `let` expression are to be written next to
the `let` keyword, eg `let%foo[@bar] module ... in ...`. The same holds for
`let exception` and `let open`.
(Nicolás Ojeda Bär, review by Gabriel Scherer)
- #14029: Recognize `%identity` as nonexpansive
(Stephen Dolan and Olivier Nicole, review by Hugo Heuzard, Jacques Garrigue,
Jeremy Yallop, and Gabriel Scherer)
* #13712: Introduce a new kind `Type_external` and syntax
`type t = external "name"` to discriminate external types from other types
and each other. This PR turns primitive types into external and removes the
past behavior of discriminating abstract types defined in the current module.
(Takafumi Saikawa, Jacques Garrigue, review by Richard Eisenberg)
- #13806: Enable the use of function parameters with polymorphic types.
(Ulysse Gérard, Leo White, review by Florian Angeletti, Samuel Vivien, Gabriel
Scherer and Jacques Garrigue)
- #14040: generalize the constructs `let module`, `let exception` and `let open`
to most other structure items, eg `let type t = ... in ...`, `let type t +=
... in ...`, etc.
(Nicolás Ojeda Bär, review by Valentin Gatien-Baron)
### Runtime system:
- #14469: Make continuation objects have one field instead of two.
(KC Sivaramakrishnan, review by Olivier Nicole, Tim McGilchrist, Zane Hambly
and Ali Caglayan)
- #14416: Spawned domains will record backtraces if the parent domain has
enabled it.
(Nathan Taylor, review by Gabriel Scherer)
- #13616: Change free list representation in shared heap
(Sadiq Jaffer, review by Damien Doligez)
- #13580: Introduce sweep-only phase at start of major GC cycle,
to reduce latent-garbage delay and therefore improve GC performance.
(Stephen Dolan and Nick Barnes, review by KC Sivaramakrishnan)
- #14123: Fix integer-overflow problems in heap compaction.
(Nick Barnes, review by Antonin Décimo).
- #14035: Fix the alignment of _Atomic long long unsigned int fields
before GCC 11.1 on i686. Silence GCC note on newer versions.
(Antonin Décimo, review by Sadiq Jaffer)
- #13574, #13594: Generational scanning of stack frames for ARM 64 bits, POWER,
and RISC-V. This reduces minor GC work in the presence of deep call stacks.
(Xavier Leroy, review by Miod Vallat, Gabriel Scherer and Olivier Nicole)
- #14053: Statmemprof: it is now possible to replace a profile in the
current domain without stopping it in all domains.
Added the function [Gc.Memprof.is_sampling].
(Guillaume Munch-Maccagnoni, review by Gabriel Scherer)
- #14168: restore the stack size statistic in `Gc.stat` and adds a new
`live_stacks_words` field tracking the total size in words of live stacks.
(Florian Angeletti, review by Gabriel Scherer)
- #14189: Add runtime counters EV_C_MINOR_PROMOTED_WORDS and
EV_C_MINOR_ALLOCATED_WORDS. EV_C_MINOR_PROMOTED_WORDS reports words promoted
by minor GC and EV_C_MINOR_ALLOCATED_WORDS reports words allocated by minor
GC. Both have equivalent bytes counters. Also updated the documentation for
EV_C_MINOR_PROMOTED and EV_C_MINOR_ALLOCATED to qualify scope of the values
reported as being per-domain.
(Tim McGilchrist, review by Nick Barnes, Sadiq Jaffer and
Gabriel Scherer)
* #14243: Explicit relative paths in ld.conf (".", "..", "./<path...>",
"../<path...>") are interpreted as being relative to the directory ld.conf
was loaded from, and the default ld.conf now uses relative paths, rather than
embedding the absolute path to the Standard Library. The brave may continue to
put implicit paths in ld.conf. The interpretation of CAML_LD_LIBRARY_PATH is
unaltered. Additionally, ld.conf is loaded from all of $OCAMLLIB/ld.conf,
$CAMLLIB/ld.conf and standard_library_default/ld.conf rather than just the
first one found. ld.conf files with CRLF line endings are now consistently
normalised on both Windows and Unix.
(David Allsopp, review by Jonah Beckford, Damien Doligez and Hugo Heuzard)
- #14244: Added --with-relative-libdir which allows the runtime and the
compilers to locate the Standard Library relative to where the binaries
themselves are installed, removing the absolute path previously embedded in
caml_standard_library_default. Executables linked with `ocamlc -custom` now
always attempt to load bytecode from the executable itself, rather than first
trying `argv[0]`.
(David Allsopp, review by Jonah Beckford, Antonin Décimo, Damien Doligez,
Samuel Hym and Vincent Laviron)
- #14245: Introduce Runtime IDs for use in filename mangling to allow different
configurations and different versions of the runtime system to coexist
harmoniously on a single system. The IDs are used, along with the host
triplet, to provide mangled names for the ocamlrun executable and its variants
and the DLL versions of both the bytecode and native runtimes, with symlinks
created for the original names. They are also used to mangle the names of stub
libraries so that stub libraries compiled for a given configuration of the
runtime will only be sought by that runtime. The behaviour is disabled by
configuring with --disable-suffixing.
(David Allsopp, review by Damien Doligez and Samuel Hym)
- #12269, #12410, #13063: Fix unsafety, deadlocks, and/or leaks should
rare errors happen during domain creation and thread
creation/registration.
(Guillaume Munch-Maccagnoni, review by Gabriel Scherer, B. Szilvasy,
Miod Vallat)
- #14275: Add function caml_c_thread_register_in_domain, which makes it
possible to register "C threads" in another domain than 0 (which is
what caml_c_thread_register does). The function takes a domain unique
ID in which to register the thread. The domain must be running
when the function is called.
(Jack Nørskov Jørgensen, review by Gabriel Scherer,
Guillaume Munch-Maccagnoni)
- #14337: Fix potential segfault due to the C callback mechanism dropping
continuations without calling `caml_continuation_use`.
(Max Slater, review by Nick Barnes and Stephen Dolan)
- #13416: Implement concurrency primitives using WinAPI instead of
winpthreads on Windows.
(Antonin Décimo, review by Samuel Hym, Gabriel Scherer, Miod Vallat,
B. Szilvasy, and Nicolás Ojeda Bär)
- #14367: Gc.Tweak mechanism to allow named GC parameters
(Stephen Dolan and Nick Barnes, review by Gabriel Scherer, David Allsopp and
Antonin Décimo)
- #14461: Fix racy socketpair on Windows. Address-in-use errors would sometimes
occur when concurrent threads or processes were trying to create socketpairs.
(Jessie Grosen, review by Antonin Décimo and Nicolás Ojeda Bär)
- #14365: Add an Idle phase to the GC for better performance on small
heaps and for a smooth start at program launch and after a forced major GC.
(Damien Doligez, review by Stephen Dolan and Nick Barnes)
### Code generation and optimizations:
- #14583: fix bug in linear scan spilling heuristic that in certain situations
could lead to miscompilations.
(Nicolás Ojeda Bär, review by Vincent Laviron)
### Standard library:
- #14437: Add String.split_{first,last,all} and String.rsplit_all
(Daniel Bünzli, review by Nicolás Ojeda Bär and Florian Angeletti)
- #14436: Add String.replace_{first,last,all}
(Daniel Bünzli, review by Nicolás Ojeda Bär, Ali Caglayan and
Florian Angeletti)
- #13343: Add Array.stable_sort_sub
(François Pottier, review by Gabriel Scherer, Corentin Leruth and Nicolás
Ojeda Bär)
- #14439: Add String.includes
(Daniel Bünzli, review by Nicolás Ojeda Bär and Olivier Nicole)
- #10177: Seq.(delay : (unit -> 'a t) -> 'a t)
(Gabriel Scherer, review by Jeremy Yallop and François Pottier)
- #14381: Add String.find_{first,last}_index, String.find_{first,last},
String.[r]find_all.
(Daniel Bünzli, review by Nicolás Ojeda Bär, Ali Caglayan and
Florian Angeletti)
- #14438: Add String.is_empty
(Daniel Bünzli, review by Nicolás Ojeda Bär and Gabriel Scherer)
- #14440: Add String.of_char
(Daniel Bünzli, review by Nicolás Ojeda Bär and Gabriel Scherer)
- #14362: Add String.{drop,take,cut}_{first,last}_while
(Daniel Bünzli, review by Nicolás Ojeda Bär and David Allsopp)
- #14363: Preserve the backtrace at exceptional domain termination. Domain.join
on an exceptionally terminated domain re-raises the exception with the
backtrace.
(KC Sivaramakrishnan, report by Nathan Taylor, review by Gabriel Scherer,
David Allsopp)
- #13372: New Format and Printf printf-like functions that accept a
heterogeneous list as arguments.
(Leonardo Santos, review by Florian Angeletti and Gabriel Scherer)
- #14352: Add String.{drop,take,cut}_{first,last}.
(Daniel Bünzli, review by David Allsopp, Nicolás Ojeda Bär and
Vincent Laviron)
- #14185: List.split_map
(Jeremy Yallop, review by Daniel Bünzli, Nicolás Ojeda Bär and Damien Doligez)
- #13728: Add Sys.runtime_executable containing the full path (if available) to
the currently executing runtime.
(David Allsopp, review by Nicolás Ojeda Bär and Daniel Bünzli)
- #13916: Add Option.product and Option.Syntax.
(Nicolás Ojeda Bär, review by Daniel Bünzli, Gabriel Scherer and David
Allsopp)
- #13995: Add Option.blend.
(Kate Deplaix, review by Daniel Bünzli, Gabriel Scherer,
Nicolás Ojeda Bär, Florian Angeletti and Josh Berdine)
- #14043, #14393: Lazy.Mutexed: simple mutex-protected lazy thunks,
that may block the entire domain/thread on initialization races.
(Gabriel Scherer, suggestion by Kate Deplaix and Pierre Chambart,
review by KC Sivaramakrishnan, Florian Angeletti, Kate Deplaix
and Daniel Bünzli)
- #14086: Add Domain.count.
(Nicolás Ojeda Bär, review by David Allsopp, Gabriel Scherer, Daniel Bünzli
and KC Sivaramakrishnan)
- #13920: add Option.{for_all, exists}
(Gabriel Scherer, review by Kate Deplaix, Nicolás Ojeda Bär, Richard Eisenberg
and Jeremy Yallop)
- #12877: Dynarray.rev_iter, Dynarray.rev_iteri
(Gabriel Scherer, review by Léo Andrès, Jeremy Yallop and Nicolás Ojeda Bär)
- #14118: Add {Set,Map}.S.is_singleton
(Kate Deplaix, review by Daniel Bünzli, Vincent Laviron, Nicolás Ojeda Bär
and Stephen Dolan)
- #14060: Add Hashtbl.find_and_replace and Hashtbl.find_and_remove.
(Sacha-Élie Ayoun, review by Nicolás Ojeda Bär and Gabriel Scherer)
- #14227: Add List.filter_mapi.
(Émile Trotignon, review by Nicolás Ojeda Bär, Jan Midtgaard and
Damien Doligez)
- #14084: Future-proof Dynarray implementation against a smarter compiler
(Basile Clément, review by Gabriel Scherer)
- #14432: Add floor division, ceil division, Euclidean division and remainder
to the Int, Int32, Int64 and Nativeint modules.
(Xavier Leroy, review by Ali Caglayan, Nicolás Ojeda Bär, Gabriel Scherer)
- #13101: Add `Fun.todo ()` to signal that a piece of code is not yet
implemented.
(Pavlo Khrystenko and Olivier Nicole, review by Daniel Bünzli, Yawar Amin,
Gabriel Scherer)
- #14433: Add bit-counting functions `leading_zeros`, `leading_sign_bits`,
`trailing_zeros`, `bit_count`, `unsigned_bitsize`, `signed_bitsize`
to Int, Int32, Int64, and Nativeint
(Xavier Leroy, review by Ali Caglayan and David Allsopp)
### Type system:
* #13681, #13682, #13683, #13684, #13275 :
Introduce a new type `(module M : S) -> t[M]` that corresponds to
module-dependent functions (aka modular explicits).
(Samuel Vivien review by Leo White, Gabriel Scherer, Florian Angeletti,
Jacques Garrigue and Stephen Dolan)
- #13781: Set scope of internal type nodes during abbreviation expansion
rather than recursing during unification.
(Jacques Garrigue, review by Gabriel Scherer)
* #14066: catch invalid aliases introduced by signature constraints during
merging rather than in subtyping:
```ocaml
module X = struct end module F (_:sig end) = struct end
module type T = (sig module X0 : sig end module X1 = X0 end)
with module X0 := F(X)
```
Before, it failed with a subtyping error. Now, it fails with a proper error,
explaining that `X1` would keep an invalid alias to `F(X)`
(Clement Blaudeau, review by Florian Angeletti)
* #14100: Do not ignore type-constraints and module-constraints when building
the approximated signature of recursive modules. Ignoring those constraints
resulted in incorrect (wrong set of fields, wrong shadowing between fields)
approximated signatures, failing to typecheck, as in:
```ocaml
module X0 : sig type t end
module rec X : ((sig module A : sig end end) with module A := X0)
and Y : sig type t = X.A.t end (* Unbound type constructor X.A.t *)
```
Now, type and module constraints are properly merged during approximation ,
reusing the infrastructure for normal merging of constraints, but disabling
any wellformedness check.
(Clement Blaudeau and Ryan Tjoa, review by Florian Angeletti)
- #14327: Allow retyping as-patterns that contain existentials
(completing #14229)
(Jacques Garrigue and Takafumi Saikawa, reported by Olivier Nicole,
review by Gabriel Scherer)
- #14483: Reset type ID and level counters between compilations to restore
reproducibility of debug information between `ocamlc -c foo.mli foo.ml` versus
`ocamlc -c foo.mli; ocamlc -c foo.ml`. Also hashcons the identifiers used for
persistent structures across resets of the type checker. In particular, that
means the initialisation of globals in Matching do not become observable in
the marshalled output.
(David Allsopp, review by Gabriel Scherer)
### Other libraries:
- #13700, #14454: Use POSIX thread-safe getgrnam_r, getgrgid_r, getpwnam_r,
getpwuid_r, gmtime_r, localtime_r, getlogin_r, and fix mktime error checking.
(Antonin Décimo, review by David Allsopp, Stefan Muenzel, and Miod Vallat)
- #14406: Better handling of address length for unix sockets, improving Haiku
compatibility.
(Sylvain Kerjean, review by Antonin Décimo and Nicolás Ojeda Bär)
* #14046: On Windows, `Unix.kill pid Sys.sigkill` causes the receiving process
to exit with code ERROR_PROCESS_ABORTED (1067) instead of 0.
(Nicolás Ojeda Bär, review by Miod Vallat, Antonin Décimo and David Allsopp)
- #14020: Add Unix.unsetenv.
(Nicolás Ojeda Bär, review by Antonin Décimo and David Allsopp)
- #13447: Symmetrize shared `Sys` and `Unix` functions. Apply fixes
of #12072, #12184, #12320, and #13166, from `Sys.rename` to
`Unix.rename`. Make `caml_sys_close` raise on error, allowing
`Filename.temp_file` retries if close fails. Flush buffers when
calling `caml_sys_system_command` on Windows. Error with EINVAL
instead of ENOENT if the command string is not a valid C string.
(Antonin Décimo, review by Gabriel Scherer and Nicolás Ojeda Bär)
- #14310: Deprecate union sock_addr_union for struct sockaddr_storage
and socklen_param_type for socklen_t.
(Antonin Décimo, review by Nicolás Ojeda Bär, David Allsopp and Samuel Hym)
- #14391: unload native dynlinked objects when an error occurs and it is safe to
do so. (Fixes #14323)
(Nicolás Ojeda Bär, review by Vincent Laviron)
### Tools:
- #14055: Invert BUILD_PATH_PREFIX_MAP in directories loaded at startup
by the debugger.
(Pierre Boutillier, review by Gabriel Scherer and Daniel Bünzli)
* #13638: ocamlmklib exits with code 4 if passed an unrecognised option, as it
does with an unrecognised file.
(David Allsopp, review by Antonin Décimo and Sébastien Hinderer)
- #13941, #13961: Fix `ocamltest` variable handing.
(Damien Doligez, report by Olivier Nicole, review by Gabriel Scherer)
- #13962: Little ocamltest refactors. Fix error handling in C code,
leaking file descriptors, code style.
(Antonin Décimo, review by Gabriel Scherer)
- #14059: Fix flaky TSan tests
(Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer)
- #13966, #13969: Enable "generalized polymorphic #install_printer"
in the debugger
(Pierre Boutillier and Gabriel Scherer, review by Florian Angeletti)
- #14063 : Debugger fallbacks to "looking for 'module_name'.ml in the
loadpath" when seeking source files. It improves hit rate for
sources of installed packages.
(Pierre Boutillier, review by Gabriel Scherer)
- #14032, #14034: Update to and require FlexDLL 0.44.
(Jan Midtgaard, Antonin Décimo, review by David Allsopp)
- #14239: Fix `#show_constructor` when printing non-GADT type parameters
(Takafumi Saikawa, Jacques Garrigue, review by Gabriel Scherer)
- #14245: ocamlobjinfo now displays the runtime invoked by a bytecode
executable (either from the RNTM section or by analysing the shebang lines)
(David Allsopp, review by Damien Doligez and Samuel Hym)
- #14448: ocamllex now prints a `missing-case` warning and shows an example
of nonmatching input if a rule is not exhaustive (Martin Jambon,
review by David Allsopp and Gabriel Scherer)
### Manual and documentation:
- #14397: Improve documentation of type-directed disambiguation of array
literals (Alicia Michael, review by Olivier Nicole and Florian Angeletti)
- #14293: Improve documentation of Runtime_events.Timestamp (Raphaël Proust,
review by Gabriel Scherer)
- #13747: Document support for native debugging with GDB and LLDB.
(Tim McGilchrist, review by Daniel Bünzli, Samuel Hym, Olivier Nicole
and Antonin Décimo)
* #13975: documented the `[@remove_aliases]` built-in attribute for signatures
(introduced by #1652 in 2018). Small refactor of the code that fetches the
attribute.
(Clement Blaudeau, review by Gabriel Scherer)
- #14002: Add anchors to items and headings of the web version of the API
documentation for easier linking.
(Nicolás Ojeda Bär, report by Louis Roché, review by Gabriel Scherer and
Florian Angeletti)
- #14023: Add documentation for the [row_more] function.
(Richard Eisenberg, review by Jacques Garrigue)
- #14038: Fall back immediately to user-agent-defined fonts when web fonts
fail to load.
(toastal)
- #14048: document modular explicits
(Gabriel Scherer, review by Samuel Vivien, Ali Caglayan,
Didier Remy and François Pottier)
- #14077: Add missing `item-attribute` rule for `let-binding`s in documentation
for attributes.
(Shon Feder)
- #14228: Trim leading spaces from first lines of LaTeX `ocamldoccode`
environments.
(Yukai Chou, review by Nicolás Ojeda Bär)
- #14248: Added documentation about the way `Domain.join` triggers a
`Thread.join` on the domain's systhreads.
(Raphaël Proust, review by Gabriel Scherer)
- #14392: Fix AsciiDoc files, add more markup, xrefs, documentation.
(Antonin Décimo, review by Gabriel Scherer and David Allsopp)
### Compiler user-interface and warnings:
- #12628: Improved error message for unsafe values: print out the full path for
the value that is unsafe when they are detected during the compilation of
recursive modules.
(Shivam Acharya, review by Gabriel Scherer and Florian Angeletti)
- #13994: documentation for external types
(Gabriel Scherer, review by Jan Midtgaard, Jacques Garrigue
and Florian Angeletti)
- #14076, 14111: error messages, add a short explanation for mismatched
universal variables and universal quantifications.
(Florian Angeletti, review by Gabriel Scherer)
- #14126: Document the `-i-variance` option and `+-`, `-+` variance indicators
in the reference manual.
(Takafumi Saikawa, review by Florian Angeletti)
- #14146: add an error message for external declaration with
a non-syntactic arity
```
external fail: (int -> int as 'a) -> 'a = "%identity"
```
rather than failing with an internal error.
(Florian Angeletti, review by Gabriel Scherer)
- #14147: print row types in error messages when they are a type constructor,
e.g. `< foo : int; .. as $0>` when $0 is introduced by a GADT constructor
(Stefan Muenzel, review by Jacques Garrigue and Florian Angeletti)
- #14190: `ocaml -e` now also processes `-init` (previously it was ignored).
(Emile Trotignon, review by David Allsopp and @ygrek)
- #14225: do not raise unused-constructor warning on private
constructor in type implementations, for example
`type safe = private Safe`, which are typically used to
create new fresh/generative types (here `safe`) to be used
as GADT indices.
(Gabriel Scherer, review by Nicolás Ojeda Bär and Florian Angeletti,
report by Kate Deplaix)
- #14244: Add -set-runtime-default option to the compiler, allowing the default
value of the Standard Library location used by the runtime to be overridden.
(Antonin Décimo, review by David Allsopp, Jonah Beckford, Damien Doligez and
Samuel Hym)
- #14245: New option -launch-method for ocamlc allows the method used by a
tendered bytecode executable to locate the interpreter to be given explicitly.
In particular, it makes it easier to specify the use of the executable
launcher on Unix. New option -runtime-search extends the bytecode executable
header to be able to search for the runtime interpreter in the directory
containing the executable and in PATH rather than relying on a single
hard-coded path.
(David Allsopp, review by Damien Doligez and Samuel Hym)
- #14315: enable -i-variance also for classes and extension constructors,
and add description of -i-variance in manpages
(Takafumi Saikawa, review by Florian Angeletti and Jacques Garrigue)
- #14373: remove the OCAML_BINANNOT_WITHENV environment variable, and
always strip typing environment in cmt files
(Florian Angeletti, review by David Allsopp)
- #14330: add suggestions when a signature mismatch is likely to be be caused by
spellchecking mistakes, for instance
```
module M: sig type albatross end = struct type albatros end
```
(Malo Monin, Florian Angeletti, review by Gabriel Scherer)
### Internal/compiler-libs changes:
- #13839, #14008: Reimplement `let open`, `let module` and `let exception` in
terms of a single construct.
(Nicolás Ojeda Bär, review by Gabriel Scherer, Samuel Vivien, Ulysse Gérard
and Vincent Laviron, temporary regression reported by Antonio Monteiro)
- #13911, #14117, #14127: Refactor the merging of signature constraints, by
splitting the monolithic merge function into separate, specialized functions
(for merging types, modules and module types) - sharing only the recursive
part for handling deep constraints.
(Clement Blaudeau, review by Florian Angeletti and Samuel Vivien, fix by Ryan
Tjoa)
- #13980 Refactor `type-approx` and improve some errors' locations.
(Leo White, Ulysse Gérard, review by Samuel Vivien and Florian Angeletti)
- #14024: Fix unterminated-string-initialization warnings from the C compiler.
(Antonin Décimo, review by David Allsopp and Miod Vallat)
- #14094: toplevel, simplify check on installed printer types
(Florian Angeletti, review by Gabriel Scherer)
- #13656, #14114, #14308: Use C99 stdint.h/inttypes.h fixed-width
integer types and macros to define OCaml integers.
(Antonin Décimo, review by Nick Barnes and David Allsopp)
- #14148: Remove an unused field from package_type in typedtree
(Samuel Vivien, review by Gabriel Scherer)
- #14141: Rename cstrs to constraints when it refers to constraints to avoid
confusing it with constructors.
(Stefan Muenzel, review by Nicolás Ojeda Bär)
- #14149: Distinguish `(module M : S)` from `(module M) : (module S)` in
patterns.
(Samuel Vivien, review by Gabriel Scherer)
- #14161: refactor the STW-participants machinery to add an intermediate
category of 'parked' domain structures.
(Gabriel Scherer, review by Sivaramakrishnan)
- #14198 Constraints on module unpacking are not ghost
(Thomas Refis, review by Nicolás Ojeda Bär)
- #14243: ocamlc now uses the same code as the runtime to parse ld.conf (via a
C primitive), eliminating some highly obscure corner cases.
(David Allsopp, review by Jonah Beckford, Damien Doligez and Hugo Heuzard)
- #14260: Refactor Lambda.structured_constant to avoid duplicate
representations for string constants
(Vincent Laviron, review by Nicolás Ojeda Bär and Gabriel Scherer)
- #13913: Use Blake128 as the hash function for the compiler's CRCs
(Vincent Laviron, review by Xavier Leroy and Gabriel Scherer)
- #14297, #14299: Avoid iterating on hash tables to produce types or terms
(Vincent Laviron, review by Nicolás Ojeda Bär and Gabriel Scherer)
* #14322: Remove leftover hacks for handling pattern constraints
As a side effect, `let rec (_ as x) = ...` is now always rejected instead of
being treated as equivalent to `let rec x = ...`
(Vincent Laviron, review by Alistair O'Brien and Florian Angeletti)
- #14331: Enforce current_level <= generic_level, and explain create_scope
(Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)
* #14388: Remove support for `let rec (module M : S) = e1 in e2`.
(Alistair O'Brien, review by Vincent Laviron and Gabriel Scherer)
- #14413: Introduce and use the C2y countof operator.
(Antonin Décimo, review by David Allsopp)
- #14422: Refactoring an `if match e with p1 -> true | p2 -> false then ...`
into a match in typetexp.
(Samuel Vivien, review by Gabriel Scherer)
- #13224: Clarify barriers and spin macros with delayed expansion.
(Antonin Décimo, review by David Allsopp and Gabriel Scherer)
- #14435, #14455, #14550: Add the not-root builtin ocamltest action. This
allows to skip tests that fail if the current user is root (superuser).
(Kate Deplaix, review by Gabriel Scherer, Nicolás Ojeda Bär, and
Antonin Décimo)
- #14457: Handle qualified `M.{ x }` patterns in untypeast
(Basile Clément, review by Florian Angeletti)
- #14120, #14474, #14476: Associate Uids to items that don't have a concrete
definition
(Ulysse Gérard, review by Florian Angeletti and Gabriel Scherer)
### Build system:
- #13705, #14444: Cache test results of custom Autoconf tests from aclocal.m4.
(Antonin Décimo, review by David Allsopp and Miod Vallat)
- #13810: Support build of cross compilers to native freestanding targets
(Samuel Hym, review by Antonin Décimo and Romain Calascibetta)
- #14243: New configure option --with-additional-stublibsdir allows an
additional directory to be added to the start of ld.conf. Additionally, the
stublibs subdirectory is no longer created, nor added to ld.conf, when
building OCaml with --disable-shared.
(David Allsopp, review by Jonah Beckford, Damien Doligez and Hugo Heuzard)
- #14244: When targeting native Windows on Cygwin or MSYS2, preserve
backslashes in the supplied `--prefix` (in particular, backslashes instead of
slashes will then be displayed by `ocamlopt -config-var standard_library`).
If the supplied prefix contains a slash, then it is normalised, as
previously.
(David Allsopp, review by Jonah Beckford, Antonin Décimo, Damien Doligez and
Samuel Hym)
- #14245: New --enable-runtime-search configure option controls the
-runtime-search option used to build the bytecode binaries in the compiler
distribution. --enable-runtime-search-target controls the default value of
-runtime-search used for bytecode executables produced by the compiler.
(David Allsopp, review by Damien Doligez and Samuel Hym)
- #14484: Set `_WIN32_WINNT` to require Windows 8/Server 2012 Windows header SDK
support.
(Antonin Décimo, review by David Allsopp)
### Bug fixes:
- #14010: Fix miscompilation / liveness errors for string operations
(Mark Shinwell, Xavier Clerc, review by Xavier Leroy and Gabriel Scherer)
- #14036: Fix nontermination of cycle printing in recursive modules with
`-short-paths`. Add error message for types considered abstract while
checking recursive modules.
(Brandon Stride, review by Florian Angeletti)
- #14065: Fix function signature mismatch of `__tsan_func_exit` with GCC 15.
Check in the configure step if the TSan provided internal builtins are the
same as what we expect, introduce `caml_tsan_*` wrappers for the `__tsan_*`
functions we use.
(Hari Hara Naveen S, report by Hari Hara Naveen S,
review by Gabriel Scherer, Antonin Décimo, Olivier Nicole)
- #14071: Fix exception name in Dynlink.Error printer.
(Etienne Millon, review by Nicolás Ojeda Bär)
- #13853: Format breaks some line too early when there
is a break hint at the end.
(Florian Angeletti, review by Gabriel Scherer)
- #10570: Fix handling of caml_sys_argv when exposed directly as an
external
(Keryan Didier, review by Vincent Laviron and Gabriel Scherer)
- #14155: Audit unexecuted phrases in compiler expect tests and
fix all occurrences
(Stefan Muenzel, review by Gabriel Scherer)
- #14163, #14176: add a filename location to the deprecation alert for implicit
uses of libraries bundled with the compiler (unix,re,threads,dynlink)
(Florian Angeletti, report by Ali Caglayan, review by Gabriel Scherer)
- #14210: fix TSan-reported data race in weak pointers runtime
(Gabriel Scherer and Damien Doligez, report by Olivier Nicole,
review by KC Sivaramakrishnan)
- #14213: Fix shadow-stack-related crashes with TSan
(Olivier Nicole, report by Nathan Taylor, review by Gabriel Scherer and
Stefan Muenzel)
- #13658, #14181: Fix handling of recursive function types that can result
in an unbounded number of labeled or optional arguments.
(Stefan Muenzel, report by Samuel Vivien, review by Florian Angeletti)
- #13777, #14347, #14348, #14421, #14498, #14526: Test that C++
compilers can link with the OCaml runtime and include its headers.
(Antonin Décimo, review by David Allsopp and Gabriel Scherer)
- #14255: Fix TSan bug with C calls that take many arguments
(Olivier Nicole and Miod Vallat, report by Nathan Taylor, review by Gabriel
Scherer)
- #14230 : ocamltest fails to link test program with -custom in some cases
(Damien Doligez, review by David Allsopp)
- #14279: -dsource, preserve (mod) and other escaped infix keyword operators in
the printed source wherever possible.
(Florian Angeletti, review by Gabriel Scherer)
- #14300, #14304: fix a race between memprof and the minor GC, detected by TSan
(Gabriel Scherer, review by Stephen Dolan and Nick Barnes,
report by Olivier Nicole)
- #14384: use the statmemprof status word, rather than a distinguished
value of a boxed float, to identify a "not really sampling"
profile.
(Nick Barnes, review by Gabriel Scherer)
- #14332: Fix missing TSan instrumentation in subexpressions
(Vincent Laviron, review by Gabriel Scherer and Olivier Nicole)
- #14370, #14429: Fix headers for C++ inclusion.
(Antonin Décimo, review by Gabriel Scherer)
- #14417: Fix issue with nested packs on macOS.
(Vincent Laviron, report by Kate Deplaix, review by Gabriel Scherer)
- #14423: Fix detection of SetThreadDescription on 32-bit builds, meaning that
Thread.set_current_thread_name now works on 32-bit MSVC and uses the correct
mechanism on 32-bit mingw-w64.
(David Allsopp, review by Antonin Décimo)
- #14431: Enable native backend for DragonFly BSD. This builds ocamlopt on
DragonFly.
(Michael Neumann, review by Gabriel Scherer and Kate Deplaix)
- #14495: Fix infix-tag bug in the minor collector which could cause SEGVs
in multi-domain programs.
(Nick Barnes, review by Gabriel Scherer)
- #14519: Fix segfault when using `Runtime_events` under certain
circumstances due to bad error checking when calling `mmap()`.
(Mark Elvers, review by Nicolás Ojeda Bär)
- private: robustify intern.c
(Xavier Leroy and Nicolás Ojeda Bär, review by Olivier Nicole, Mindy Preston,
Edwin Török, and Gabriel Scherer)
- #13693, #14514: s390x: fix heap corruption with libasmrun_shared.so caused
by PLT lazy binding trampoline saving FPRs into OCaml's fiber stack.
Replace @PLT calls with GOT-indirect calls in the s390x code emitter.
(Zane Hambly, review by David Allsopp and Xavier Leroy)
- #14603, #14604: avoid Ctype.apply failures when mixing
polymorphic types and unboxed constructors.
(Gabriel Scherer and Stefan Muenzel, report by Brandon Stride,
review by Florian Angeletti)
- #14626: Handle module-dependent functions in warning 16 (Reported in #14622).
(Alistair O'Brien, review by Gabriel Scherer, report by Kate Deplaix)
- #14635: Fix a bug in `caml_floatarray_gather` that would cause
the result of `Float.Array.sub`, `Float.Array.append`, `Float.Array.concat`
(when empty) not to be equal to `[||]`.
(Marc Lasson, review by Gabriel Scherer)
OCaml 5.4.0 (9 October 2025)
----------------------------
(Changes that can break existing programs are marked with a "*")
### Language features:
- #13097: added immutable arrays (`'a iarray` type, Iarray stdlib module)
(Antal Spector-Zabusky and Olivier Nicole, review by Gabriel Scherer,
Jeremy Yallop and Vincent Laviron)
- #13340: Array literal syntax [| e1; ...; en |] can now be used to
denote values of type `'a array` and `'a iarray` and `floatarray`,
both in expressions and patterns. The compiler disambiguates each
case by using contextual type information (assuming `'a array`
by default).
(Nicolás Ojeda Bär, review by Richard Eisenberg, Jeremy Yallop, Jacques
Garrigue, and Gabriel Scherer)
- #13498: Tuple fields are now optionally labeled:
`(x:42, y:0)` and `let (~x, ~y) = ... in ...`.
(Ryan Tjoa and Chris Casinghino, review by Gabriel Scherer, Chris Casinghino,
and Leo White)
- RFCs#39, #13404: atomic record fields
`{ ...; mutable readers : int [@atomic]; ... }`
`Atomic.Loc.fetch_and_add [%atomic.loc data.readers] 1`
(Clément Allain and Gabriel Scherer, review by KC Sivaramakrishnan,
Basile Clément and Olivier Nicole)
### Standard library:
* #14124: Do not raise Invalid_argument on negative List.{drop,take}.
(Daniel Bünzli, review by Gabriel Scherer, Nicolás Ojeda Bär)
- #13696: Add Result.product and Result.Syntax:
`let open Result.Syntax in let* x = ... in ...`
(Daniel Bünzli, review by Gabriel Scherer, Nicolás Ojeda Bär)
- #12871: Add the Pqueue module to the stdlib. It implements priority queues.
(Jean-Christophe Filliâtre, review by Daniel Bünzli, Léo Andrès and
Gabriel Scherer)
- #13760: Add String.{edit_distance,spellcheck}
(Daniel Bünzli, review by wikku, Nicolás Ojeda Bär, Gabriel Scherer and
Florian Angeletti)
- #13753, #13755: Add Stdlib.Repr:
Repr.phys_equal and Repr.compare are more explicit than (==) and `compare`.
(Kate Deplaix, Thomas Blanc and Léo Andrès, review by Gabriel Scherer,
Florian Angeletti, Nicolás Ojeda Bär, Daniel Bünzli and Jeremy Yallop)
- #13695: Add Stdlib.Char.Ascii
(Daniel Bünzli, review by Nicolás Ojeda Bär and Jeremy Yallop)
- #13720: Add Result.{get_ok',error_to_failure}
(Daniel Bünzli, review by wikku, Gabriel Scherer, Nicolás Ojeda Bär,
Vincent Laviron and hirrolot)
- #13885: Add Dynarray.{exists2, for_all2}.
(T. Kinsart, review by Daniel Bünzli, Gabriel Scherer, and Nicolás Ojeda Bär)
* #13862: Make List.sort_uniq keep the first occurrences of duplicates.
(Benoît Jubin, review by Nicolás Ojeda Bär, Gabriel Scherer)
- #13836: Add [Float.]Array.{equal,compare}.
(Daniel Bünzli, review by Nicolás Ojeda Bär and Gabriel Scherer)
- #13796: Add Uchar.utf_8_decode_length_of_byte and
Uchar.max_utf_8_decode_length.
(Daniel Bünzli, review by Nicolás Ojeda Bär and Florian Angeletti)
- #13768: Add Either.get_left and Either.get_right
(T. Kinsart, review by Nicolás Ojeda Bär and Florian Angeletti)
* #13570, #13794: Format, add an out_width function to Format device for
approximating unicode width.
(Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli,
and Gabriel Scherer)
- #13731: Add Either.retract
(Daniel Bünzli, review by Nicolás Ojeda Bär and David Allsopp)
- #13729: Add Seq.filteri
(T. Kinsart, review by Nicolás Ojeda Bär and Daniel Bünzli)
- #13721: Add Result.retract
(Daniel Bünzli, review by Gabriel Scherer, Nicolás Ojeda Bär and
David Allsopp)
- #13310: Add Stdlib.Pair
(Victoire Noizet, review by Nicolás Ojeda Bär, Daniel Bünzli, Xavier Van de
Woestyne, Jeremy Yallop and Florian Angeletti)
- #13662: Add eager boolean operations Bool.logand, Bool.logor, Bool.logxor
(Jeremy Yallop, review by Nicolás Ojeda Bär)
- #13463, #13572: Avoid raising Queue.empty in Format when it is used
concurrently, raise a specific exception instead.
(Chritophe Raffalli, review by Gabriel Scherer and Daniel Bünzli)
- #13620: Avoid copying the string in String.concat, String.sub and
String.split_on_char when the full string is returned.
(Christophe Raffalli, review by Nicolás Ojeda Bär and Gabriel Scherer and
Hugo Heuzard)
- #13727: Reimplement Sys.getenv_opt not to use exceptions internally, meaning
that the current backtrace is preserved when Sys.getenv_opt returns None.
(David Allsopp, review by Nicolás Ojeda Bär, Josh Berdine and Gabriel Scherer)
- #13737: Avoid closure allocations in Weak.Make.add when resizing the
table
(Vincent Laviron, review by Gabriel Scherer and Daniel Bünzli)
- #13740: Improve performance of Weak.find_aux
(Josh Berdine, review by Gabriel Scherer)
- #13782: Improve performance and type safety of Type.Id by using
[%extension_constructor] instead of Obj.Extension_constructor.of_val.
(Basile Clément, review by Vincent Laviron and Nicolás Ojeda Bär)
- #13589: Expose Sys.io_buffer_size, the size of internal buffers used by the
runtime system and the `unix` library.
(Yves Ndiaye and Nicolás Ojeda Bär, review by Daniel Bünzli and Nicolás Ojeda
Bär)
- #13569: add a `Format.format_text` which adds break hints to format literals.
(Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli,
and Gabriel Scherer)
- #13578: On Windows, use the OS CSPRNG to seed the Stdlib.Random generator.
(Antonin Décimo, review by Miod Vallat, Nicolás Ojeda Bär, and Xavier Leroy)