forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Changes
10378 lines (8230 loc) · 418 KB
/
Changes
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
---------------
### Language features:
* #9500: Injectivity annotations
One can now mark type parameters as injective, which is useful for
abstract types:
module Vec : sig type !'a t end = struct type 'a t = 'a array end
On non-abstract types, this can be used to check the injectivity of
parameters. Since all parameters of record and sum types are by definition
injective, this only makes sense for type abbreviations:
type !'a t = 'a list
(Jacques Garrigue, review by Jeremy Yallop and Leo White)
### Runtime system:
- #1795, #9543: modernize signal handling on Linux i386, PowerPC, and s390x,
adding support for Musl ppc64le along the way.
(Xavier Leroy and Anil Madhavapeddy, review by Stephen Dolan)
- #9466: Memprof: optimize random samples generation.
(Jacques-Henri Jourdan review by Xavier Leroy and Stephen Dolan)
- #9628: Memprof: disable sampling when memprof is suspended.
(Jacques-Henri Jourdan review by Gabriel Scherer and Stephen Dolan)
- #9508: Remove support for FreeBSD prior to 4.0R, that required explicit
floating-point initialization to behave like IEEE standard
(Hannes Mehnert, review by David Allsopp)
* #9513: Selectively initialise blocks in `Obj.new_block`. Reject `Custom_tag`
objects and zero-length `String_tag` objects.
(KC Sivaramakrishnan, review by David Allsopp, Xavier Leroy, Mark Shinwell
and Leo White)
- #9564: Add a macro to construct out-of-heap block header.
(KC Sivaramakrishnan, review by Stephen Dolan, Gabriel Scherer,
and Xavier Leroy)
- #9569: Add `Val_none`, `Some_val`, `Is_none`, `Is_some`, `caml_alloc_some`,
and `Tag_some`.
(Nicolás Ojeda Bär, review by Stephen Dolan, Gabriel Scherer, Mark Shinwell,
and Xavier Leroy)
- #9619: Change representation of function closures so that code pointers
can be easily distinguished from environment variables
(Xavier Leroy, review by Mark Shinwell and Damien Doligez)
- #9634: Allow initial and repeated commas in `OCAMLRUNPARAM`.
(Nicolás Ojeda Bär, review by Gabriel Scherer)
- #9648, #9689: Update the generic hash function to take advantage
of the new representation for function closures
(Xavier Leroy, review by Stephen Dolan)
- #9649: Update the marshaler (output_value) to take advantage
of the new representation for function closures
(Xavier Leroy, review by Damien Doligez)
- #9654: More efficient management of code fragments.
(Xavier Leroy, review by Jacques-Henri Jourdan, Damien Doligez, and
Stephen Dolan)
- #9670: Report full major collections in Gc stats.
(Leo White, review by Gabriel Scherer)
- #9675: Remove the caml_static_{alloc,free,resize} primitives, now unused.
(Xavier Leroy, review by Gabriel Scherer)
- #9678: Reimplement `Obj.reachable_words` using a hash table to
detect sharing, instead of temporary in-place modifications. This
is a prerequisite for Multicore OCaml.
(Xavier Leroy, review by Jacques-Henri Jourdan and Sébastien Hinderer)
* #9697: Remove the Is_in_code_area macro and the registration of DLL code
areas in the page table, subsumed by the new code fragment management API
(Xavier Leroy, review by Jacques-Henri Jourdan)
### Code generation and optimizations:
- #9620: Limit the number of parameters for an uncurried or untupled
function. Functions with more parameters than that are left
partially curried or tupled.
(Xavier Leroy, review by Mark Shinwell)
### Standard library:
* #9554: add primitive __FUNCTION__ that returns the name of the current method
or function, including any enclosing module or class.
(Nicolás Ojeda Bär, Stephen Dolan, review by Stephen Dolan)
- #9075: define to_rev_seq in Set and Map modules.
(Sébastien Briais, review by Gabriel Scherer and Nicolás Ojeda Bär)
- #9561: Unbox Unix.gettimeofday and Unix.time
(Stephen Dolan, review by David Allsopp)
- #9570: Provide an Atomic module with a trivial purely-sequential
implementation, to help write code that is compatible with Multicore
OCaml.
(Gabriel Scherer, review by Xavier Leroy)
- #9571: Make at_exit and Printexc.register_printer thread-safe.
(Guillaume Munch-Maccagnoni, review by Gabriel Scherer and Xavier Leroy)
- #9587: Arg: new Rest_all spec to get all rest arguments in a list
(this is similar to Rest, but makes it possible to detect when there
are no arguments (an empty list) after the rest marker)
(Gabriel Scherer, review by Nicolás Ojeda Bär and David Allsopp)
- #9655: Obj: introduce type raw_data and functions raw_field, set_raw_field
to manipulate out-of-heap pointers in no-naked-pointer mode,
and more generally all other data that is not a well-formed OCaml value
(Xavier Leroy, review by Damien Doligez and Gabriel Scherer)
- #9533: Added String.starts_with and String.ends_with.
(Bernhard Schommer, review by Daniel Bünzli, Gabriel Scherer and
Alain Frisch)
### Other libraries:
* #9206, #9419: update documentation of the threads library;
deprecate Thread.kill, Thread.wait_read, Thread.wait_write,
and the whole ThreadUnix module.
(Xavier Leroy, review by Florian Angeletti, Guillaume Munch-Maccagnoni,
and Gabriel Scherer)
- #9573: reimplement Unix.create_process and related functions without
Unix.fork, for better efficiency and compatibility with threads.
(Xavier Leroy, review by Gabriel Scherer and Anil Madhavapeddy)
- #9575: Add Unix.is_inet6_addr
(Nicolás Ojeda Bär, review by Xavier Leroy)
- #9593: Use new flag for non-elevated symbolic links and test for Developer
Mode on Windows
(Manuel Hornung, review by David Allsopp and Nicolás Ojeda Bär)
* #9601: Return EPERM for EUNKNOWN -1314 in win32unix (principally affects
error handling when Unix.symlink is unavailable)
(David Allsopp, review by Xavier Leroy)
### Tools:
- #9606, #9635, #9637: fix performance regression in the debugger
(behaviors quadratic in the size of the debugged program)
(Xavier Leroy, report by Jacques Garrigue and Virgile Prevosto,
review by David Allsopp and Jacques-Henri Jourdan)
### Manual and documentation:
- #9468: HACKING.adoc: using dune to get merlin's support
(Thomas Refis, review by Gabriel Scherer)
### Compiler user-interface and warnings:
* #9011: Do not create .a/.lib files when creating a .cmxa with no modules.
macOS ar doesn't support creating empty .a files (#1094) and MSVC doesn't
permit .lib files to contain no objects. When linking with a .cmxa containing
no modules, it is now not an error for there to be no .a/.lib file.
(David Allsopp, review by Xavier Leroy)
- #9560: Report partial application warnings on type errors in applications.
(Stephen Dolan, report and testcase by whitequark, review by Gabriel Scherer
and Thomas Refis)
- #9583: when bytecode linking fails due to an unavailable module, the module
that requires it is now included in the error message.
(Nicolás Ojeda Bär, review by Vincent Laviron)
- #9615: Attach package type attributes to core_type.
When parsing constraints on a first class module, attributes found after the
module type were parsed but ignored. Now they are attached to the
corresponding core_type.
(Etienne Millon, review by Thomas Refis)
- #6633, #9673: Add hint when a module is used instead of a module type or
when a module type is used instead of a module or when a class type is used
instead of a class.
(Xavier Van de Woestyne, report by whitequark, review by Florian Angeletti
and Gabriel Scherer)
### Internal/compiler-libs changes:
- #9493, #9520, #9563, #9599, #9608: refactor the pattern-matching compiler
(Thomas Refis and Gabriel Scherer, review by Florian Angeletti)
- #9604: refactoring of the ocamltest codebase.
(Nicolás Ojeda Bär, review by Gabriel Scherer and Sébastien Hinderer)
- #9498, #9511: make the pattern-matching analyzer more robust to
or-pattern explosion, by stopping after the first counter-example to
exhaustivity
(Gabriel Scherer, review by Luc Maranget, Thomas Refis and Florian Angeletti,
report by Alex Fedoseev through Hongbo Zhang)
- #9514: optimize pattern-matching exhaustivity analysis in the single-row case
(Gabriel Scherer, review by Stephen DOlan)
- #9442: refactor the implementation of the [@tailcall] attribute
to allow for a structured attribute payload
(Gabriel Scherer, review by Vladimir Keleshev and Nicolás Ojeda Bär)
- #9684: document in address_class.h the runtime value model in
naked-pointers and no-naked-pointers mode
(Xavier Leroy and Gabriel Scherer)
- #9696: ocamltest now shows its log when a test fails. In addition, the log
contains the output of executed programs.
(Nicolás Ojeda Bär, review by David Allsopp, Sébastien Hinderer and Gabriel
Scherer)
### Build system:
- #7121, #9558: Always the autoconf-discovered ld in PACKLD. For
cross-compilation, this means the triplet-prefixed version will always be
used.
(David Allsopp, report by Adrian Nader, review by Sébastien Hinderer)
- #9332, #9518, #9529: Cease storing C dependencies in the codebase. C
dependencies are generated on-the-fly in development mode. For incremental
compilation, the MSVC ports require GCC to be present.
(David Allsopp, review by Sébastien Hinderer, YAML-fu by Stephen Dolan)
- #9527: stop including configuration when running 'clean' rules
to avoid C dependency recomputation.
(Gabriel Scherer, review by David Allsopp)
### Bug fixes:
- #7902, #9556: Type-checker infers recursive type, even though -rectypes is
off.
(Jacques Garrigue, report by Francois Pottier, review by Leo White)
- #8747, #9709: incorrect principality warning on functional updates of records
(Jacques Garrigue, report and review by Thomas Refis)
- #9469: Better backtraces for lazy values
(Leo White, review by Nicolás Ojeda Bär)
- #9521, #9522: correctly fail when comparing functions
with Closure and Infix tags.
(Gabriel Scherer and Jeremy Yallop and Xavier Leroy,
report by Twitter user @st_toHKR through Jun Furuse)
- #9611: maintain order of load path entries in various situations: when passing
them to system linker, ppx contexts, etc.
(Nicolás Ojeda Bär, review by Jérémie Dimino and Gabriel Scherer)
- #9633: ocamltest: fix a bug when certain variables set in test scripts would
be ignored (eg `ocamlrunparam`).
(Nicolás Ojeda Bär, review by Sébastien Hinderer)
- #9681, #9690, #9693: small runtime changes
for the new closure representation (#9619)
(Xavier Leroy, Sadiq Jaffer, Gabriel Scherer,
review by Xavier Leroy and Jacques-Henri Jourdan)
OCaml 4.11
----------
(Changes that can break existing programs are marked with a "*")
### Language features
- #8820, #9166: quoted extensions: {%foo|...|} is lighter syntax for
[%foo {||}], and {%foo bar|...|bar} for [%foo {bar|...|bar}].
(Gabriel Radanne, Leo White, Gabriel Scherer and Pieter Goetschalckx,
request by Bikal Lem)
- #6673, #1132, #9617: Relax the handling of explicit polymorphic types
(Leo White, review by Jacques Garrigue and Gabriel Scherer)
- #9232: allow any class type paths in #-types,
For instance, "val f: #F(X).t -> unit" is now allowed.
(Florian Angeletti, review by Gabriel Scherer, suggestion by Leo White)
- #7364, #2188, #9592, #9609: improvement of the unboxability check for types
with a single constructor. Mutually-recursive type declarations can
now contain unboxed types. This is based on the paper
https://arxiv.org/abs/1811.02300
(Gabriel Scherer and Rodolphe Lepigre,
review by Jeremy Yallop, Damien Doligez and Frédéric Bour)
- #1154, #1706: spellchecker hints and type-directed disambiguation
for extensible sum type constructors
(Florian Angeletti, review by Alain Frisch, Gabriel Radanne, Gabriel Scherer
and Leo White)
### Runtime system:
- #9096: Print function names in backtraces.
(Stephen Dolan, review by Leo White and Mark Shinwell)
- #9119: Make [caml_stat_resize_noexc] compatible with the [realloc]
API when the old block is NULL.
(Jacques-Henri Jourdan, review by Xavier Leroy)
- #8920, #9238, #9239, #9254, #9458: New API for statistical memory profiling
in Memprof.Gc. The new version does no longer use ephemerons and allows
registering callbacks for promotion and deallocation of memory
blocks.
The new API no longer gives the block tags to the allocation callback.
(Stephen Dolan and Jacques-Henri Jourdan, review by Damien Doligez
and Gabriel Scherer)
- #9233: Restore the bytecode stack after an allocation.
(Stephen Dolan, review by Gabriel Scherer and Jacques-Henri Jourdan)
- #9230, #9362: Memprof support for native allocations.
(Jacques-Henri Jourdan and Stephen Dolan, review by Gabriel Scherer)
- #9249: restore definition of ARCH_ALIGN_INT64 in m.h if the architecture
requires 64-bit integers to be double-word aligned (autoconf regression)
(David Allsopp, review by Sébastien Hinderer)
- #9259: Made `Ephemeron.blit_key` and `Weak.blit` faster. They are now
linear in the size of the range being copied instead of depending on the
total sizes of the ephemerons or weak arrays involved.
(Arseniy Alekseyev, design advice by Leo White, review by François Bobot
and Damien Doligez)
- #9279: Memprof optimisation.
(Stephen Dolan, review by Jacques-Henri Jourdan)
- #9280: Micro-optimise allocations on amd64 to save a register.
(Stephen Dolan, review by Xavier Leroy)
- #9316, #9443, #9463: Use typing information from Clambda
for mutable Cmm variables.
(Stephen Dolan, review by Vincent Laviron, Guillaume Bury, Xavier Leroy,
and Gabriel Scherer; temporary bug report by Richard Jones)
- #9426: build the Mingw ports with higher levels of GCC optimization
(Xavier Leroy, review by Sébastien Hinderer)
* #9483: Remove accidental inclusion of <stdio.h> in <caml/misc.h>
The only release with the inclusion of stdio.h has been 4.10.0
(Christopher Zimmermann, review by Xavier Leroy and David Allsopp)
- #9353: Reimplement `output_value` and the `Marshal.to_*` functions
using a hash table to detect sharing, instead of temporary in-place
modifications. This is a prerequisite for Multicore OCaml.
(Xavier Leroy and Basile Clément, review by Gabriel Scherer and
Stephen Dolan)
- #9282: Make Cconst_symbol have typ_int to fix no-naked-pointers mode.
(Stephen Dolan, review by Mark Shinwell, Xavier Leroy and Vincent Laviron)
- #9497: Harmonise behaviour between bytecode and native code for
recursive module initialisation in one particular case (fixes #9494).
(Mark Shinwell, David Allsopp, Vincent Laviron, Xavier Leroy,
Geoff Reedy, original bug report by Arlen Cox)
- #8791: use a variable-length encoding when marshalling bigarray dimensions,
avoiding overflow.
(Jeremy Yallop, Stephen Dolan, review by Xavier Leroy)
- #9082: The instrumented runtime now records logs in the CTF format.
A new API is available in the runtime to collect runtime statistics,
replacing the previous instrumented runtime macros.
Gc.eventlog_pause and Gc.eventlog_resume were added to allow user to control
instrumentation in a running program.
(Enguerrand Decorne and Stephen Dolan, with help and review from
David Allsopp, Sébastien Hinderer, review by Anil Madhavapeddy,
Nicolás Ojeda Bär, Shakthi Kannan, KC Sivaramakrishnan, Gabriel Scherer,
Guillaume Munch-Maccagnoni, Damien Doligez, Leo White, Daniel Bünzli
and Xavier Leroy)
### Code generation and optimizations:
- #8637, #8805, #9247, #9296: Record debug info for each allocation.
(Stephen Dolan and Jacques-Henri Jourdan, review by Damien Doligez,
KC Sivaramakrishnan and Xavier Leroy)
- #9193: Make tuple matching optimisation apply to Lswitch and Lstringswitch.
(Stephen Dolan, review by Thomas Refis and Gabriel Scherer)
- #9392: Visit registers at most once in Coloring.iter_preferred.
(Stephen Dolan, review by Pierre Chambart and Xavier Leroy)
- #9441: Add RISC-V RV64G native-code backend.
(Nicolás Ojeda Bär, review by Xavier Leroy and Gabriel Scherer)
### Standard library:
- #9077: Add Seq.cons and Seq.append
(Sébastien Briais, review by Yawar Amin and Florian Angeletti)
- #9248: Add Printexc.default_uncaught_exception_handler
(Raphael Sousa Santos, review by Daniel Bünzli)
- #9235: Add Array.exists2 and Array.for_all2
(Bernhard Schommer, review by Armaël Guéneau)
- #9226: Add Seq.unfold.
(Jeremy Yallop, review by Hezekiah M. Carty, Gabriel Scherer and
Gabriel Radanne)
- #8771: Lexing: add set_position and set_filename to change (fake)
the initial tracking position of the lexbuf.
(Konstantin Romanov, Miguel Lumapat, review by Gabriel Scherer,
Sébastien Hinderer, and David Allsopp)
- #9059: Added List.filteri function, same as List.filter but
with the index of the element.
(Léo Andrès, review by Alain Frisch)
- #8894: Added List.fold_left_map function combining map and fold.
(Bernhard Schommer, review by Alain Frisch and github user @cfcs)
- #9237: `Format.pp_update_geometry ppf (fun geo -> {geo with ...})`
for formatter geometry changes that are robust to new geometry fields.
(Gabriel Scherer, review by Josh Berdine and Florian Angeletti)
- #7110: Added Printf.ikbprintf and Printf.ibprintf
(Muskan Garg, review by Gabriel Scherer and Florian Angeletti)
- #9365: Set.filter_map and Map.filter_map
(Gabriel Scherer, review by Stephen Dolan and Nicolás Ojeda Bär)
- #9266: Install pretty-printer for the exception Fun.Finally_raised.
(Guillaume Munch-Maccagnoni, review by Daniel Bünzli, Gabriel Radanne,
and Gabriel Scherer)
- #9549, #9557: Make -flarge-toc the default for PowerPC and introduce
-fsmall-toc to enable the previous behaviour.
(David Allsopp, report by Nathaniel Wesley Filardo, review by Xavier Leroy)
### Other libraries:
- #9106: Register printer for Unix_error in win32unix, as in unix.
(Christopher Zimmermann, review by David Allsopp)
- #9183: Preserve exception backtrace of exceptions raised by top-level phrases
of dynlinked modules.
(Nicolás Ojeda Bär, review by Xavier Clerc and Gabriel Scherer)
- #9320, #9550: under Windows, make sure that the Unix.exec* functions
properly quote their argument lists.
(Xavier Leroy, report by André Maroneze, review by Nicolás Ojeda Bär
and David Allsopp)
- #9490, #9505: ensure proper rounding of file times returned by
Unix.stat, Unix.lstat, Unix.fstat.
(Xavier Leroy and Guillaume Melquiond, report by David Brown,
review by Gabriel Scherer and David Allsopp)
### Tools:
- #6969: Argument -nocwd added to ocamldep
(Muskan Garg, review by Florian Angeletti)
- #8676, #9594: turn debugger off in programs launched by the program
being debugged
(Xavier Leroy, report by Michael Soegtrop, review by Gabriel Scherer)
- #9057: aid debugging the debugger by preserving backtraces of unhandled
exceptions.
(David Allsopp, review by Gabriel Scherer)
- #9276: objinfo: cm[x]a print extra C options, objects and dlls in
the order given on the cli. Follow up to #4949.
(Daniel Bünzli, review by Gabriel Scherer)
- #463: objinfo: better errors on object files coming
from a different (older or newer), incompatible compiler version.
(Gabriel Scherer, review by Gabriel Radanne and Damien Doligez)
- #9181: make objinfo work on Cygwin and look for the caml_plugin_header
symbol in both the static and the dynamic symbol tables.
(Sébastien Hinderer, review by Gabriel Scherer and David Allsopp)
* #9197: remove compatibility logic from #244 that was designed to
synchronize toplevel printing margins with Format.std_formatter,
but also resulted in unpredictable/fragile changes to formatter
margins.
Setting the margins on the desired formatters should now work.
typically on `Format.std_formatter`.
Note that there currently is no robust way to do this from the
toplevel, as applications may redirect toplevel printing. In
a compiler/toplevel driver, one should instead access
`Location.formatter_for_warnings`; it is not currently exposed
to the toplevel.
(Gabriel Scherer, review by Armaël Guéneau)
- #9207, #9210: fix ocamlyacc to work correctly with up to 255 entry
points to the grammar.
(Andreas Abel, review by Xavier Leroy)
- #9283, #9455, #9457: add a new toplevel directive `#use_output "<command>"` to
run a command and evaluate its output.
(Jérémie Dimino, review by David Allsopp)
- #9402: Remove `sudo:false` from .travis.yml
(Hikaru Yoshimura)
- #9414: testsuite, ocamltest: keep test artifacts only on failure.
Use KEEP_TEST_DIR_ON_SUCCESS=1 to keep all artifacts.
(Gabriel Scherer, review by Sébastien Hinderer)
- #9482, #9492: use diversions (@file) to work around OS limitations
on length of Sys.command argument.
(Xavier Leroy, report by Jérémie Dimino, review by David Allsopp)
- #9552: restore ocamloptp build and installation
(Florian Angeletti, review by David Allsopp and Xavier Leroy)
### Manual and documentation:
- #8644: fix formatting comment about @raise in stdlib's mli files
(Élie Brami, review by David Allsopp)
- #9141: beginning of the ocamltest reference manual
(Sébastien Hinderer, review by Gabriel Scherer and Thomas Refis)
- #9228: Various Map documentation improvements: add missing key argument in
the 'merge' example; clarify the relationship between input and output keys
in 'union'; note that find and find_opt return values, not bindings.
(Jeremy Yallop, review by Gabriel Scherer and Florian Angeletti)
- #9255, #9300: reference chapter, split the expression grammar
(Florian Angeletti, report by Harrison Ainsworth, review by Gabriel Scherer)
- #9325: documented base case for `List.for_all` and `List.exists`
(Glenn Slotte, review by Florian Angeletti)
- #9403: added a description for warning 67 and added a "." at the end of
warnings for consistency.
(Muskan Garg, review by Gabriel Scherer and Florian Angeletti)
- #7708, #9580: Ensure Stdlib documentation index refers to Stdlib.
(Stephen Dolan, review by Florian Angeletti, report by Hannes Mehnert)
- #9610: manual, C FFI: naked pointers are deprecated, detail the
forward-compatible options for handling out-of-heap pointers.
(Xavier Leroy, review by Mark Shinwell, David Allsopp and Florian Angeletti)
- #9618: clarify the Format documentation on the margin and maximum indentation
limit
(Florian Angeletti, review by Josh Berdine)
### Compiler user-interface and warnings:
- GPR#1664: make -output-complete-obj link the runtime native c libraries when
building shared libraries like `-output-obj`.
(Florian Angeletti, review by Nicolás Ojeda Bär)
* #7678, #8631: ocamlc -c and ocamlopt -c pass same switches to the C
compiler when compiling .c files (in particular, this means ocamlopt
passes -fPIC on systems requiring it for shared library support).
(David Allsopp, report by Daniel Bünzli, review by Sébastien Hinderer)
- #9074: reworded error message for non-regular structural types
(Florian Angeletti, review by Jacques Garrigue and Leo White,
report by Chas Emerick)
- #8938: Extend ocamlopt option "-stop-after" to handle "scheduling" argument.
(Greta Yorsh, review by Florian Angeletti and Sébastien Hinderer)
- #8945, #9086: Fix toplevel show directive to work with constructors
(Simon Parry, review by Gabriel Scherer, Jeremy Yallop,
Alain Frisch, Florian Angeletti)
- #9107: improved error message for exceptions in module signature errors
(Gabriel Scherer, review by Florian Angeletti)
- #9208: -dno-locations option to hide source locations (and debug events)
from intermediate-representation dumps (-dfoo).
(Gabriel Scherer, review by Vincent Laviron)
- #9393: Improve recursive module usage warnings
(Leo White, review by Thomas Refis)
- #2141: generate .annot files from cmt data; deprecate -annot.
(Nicolás Ojeda Bär, review by Alain Frisch, Gabriel Scherer and Damien
Doligez)
- #9486: Fix configuration for the Haiku operating system
(Sylvain Kerjean, review by David Allsopp and Sébastien Hinderer)
### Internal/compiler-libs changes:
- #463: a new Misc.Magic_number module for user-friendly parsing
and validation of OCaml magic numbers.
(Gabriel Scherer, review by Gabriel Radanne and Damien Doligez)
- #1176: encourage better compatibility with older Microsoft C compilers by
using GCC's -Wdeclaration-after-statement when available. Introduce
Caml_inline to stop abuse of the inline keyword on MSVC and to help ensure
that only static inline is used in the codebase (erroneous instance in
runtime/win32.c removed).
(David Allsopp, review by Oliver Andrieu and Xavier Leroy)
- #8934: Stop relying on location to track usage
(Thomas Refis, review by Gabriel Radanne)
- #8970: separate value patterns (matching on values) from computation patterns
(matching on the effects of a copmutation) in the typedtree.
(Gabriel Scherer, review by Jacques Garrigue and Alain Frisch)
- #9060: ensure that Misc.protect_refs preserves backtraces
(Gabriel Scherer, review by Guillaume Munch-Maccagnoni and David Allsopp)
- #9021: expose compiler Longident.t parsers
(Florian Angeletti, review by Gabriel Scherer)
- #9078: make all compilerlibs/ available to ocamltest.
(Gabriel Scherer, review by Sébastien Hinderer)
- #9079: typecore/parmatch: refactor ppat_of_type and refine
the use of backtracking on wildcard patterns
(Florian Angeletti, Jacques Garrigue, Gabriel Scherer,
review by Thomas Refis)
- #9081: typedtree, make the pat_env field of pattern data immutable
(Gabriel Scherer, review by Jacques Garrigue, report by Alain Frisch)
- #9178, #9182, #9196: refactor label-disambiguation (Typecore.NameChoice)
(Gabriel Scherer, Thomas Refis, Florian Angeletti and Jacques Garrigue,
reviewing each other without self-loops)
- #9321, #9322, #9359, #9361, #9417, #9447, #9464: refactor the
pattern-matching compiler
(Thomas Refis and Gabriel Scherer, review by Florian Angeletti)
- #9211, #9215, #9222: fix Makefile dependencies in
compilerlibs, dynlink, ocamltest.
(Gabriel Scherer, review by Vincent Laviron and David Allsopp)
- #9305: Avoid polymorphic compare in Ident
(Leo White, review by Xavier Leroy and Gabriel Scherer)
- #7927: refactor val_env met_env par_env to class_env
(Muskan Garg, review by Gabriel Scherer and Florian Angeletti)
- #2324, #9613: Replace the caml_int_compare and caml_float_compare
(C functions) with primitives.
(Greta Yorsh, review by Stephen Dolan and Vincent Laviron)
- #9246: Avoid rechecking functor applications
(Leo White, review by Jacques Garrigue)
* #9411: forbid optional arguments reordering with -nolabels
(Thomas Refis, review by Frédéric Bour and Jacques Garrigue)
- #9452: Add locations to docstring attributes
(Leo White, review by Gabriel Scherer)
### Build system:
- #9250: Add --disable-ocamltest to configure and disable building for
non-development builds.
(David Allsopp, review by Sébastien Hinderer)
### Bug fixes:
- #7520, #9547: Odd behaviour of refutation cases with polymorphic variants
(Jacques Garrigue, report by Leo White, reviews by Gabriel Scherer and Leo)
- #7562, #9456: ocamlopt-generated code crashed on Alpine Linux on
ppc64le, arm, and i386. Fixed by turning PIE off for musl-based Linux
systems except amd64 (x86_64) and s390x.
(Xavier Leroy, review by Gabriel Scherer)
- #7683, #1499: Fixes one case where the evaluation order in native-code
may not match the one in bytecode.
(Nicolás Ojeda Bär, report by Pierre Chambart, review by Gabriel Scherer)
- #7696, #6608: Record expression deleted when all fields specified
(Jacques Garrigue, report by Jeremy Yallop)
- #7741, #9645: Failure to report escaping type variable
(Jacques Garrigue, report by Gabriel Radanne, review by Gabriel Scherer)
- #7817, #9546: Unsound inclusion check for polymorphic variant
(Jacques Garrigue, report by Mikhail Mandrykin, review by Gabriel Scherer)
- #7897, #9537: Fix warning 38 for rebound extension constructors
(Leo White, review by Florian Angeletti)
- #7917, #9426: Use GCC option -fexcess-precision=standard when available,
avoiding a problem with x87 excess precision in Float.round.
(Xavier Leroy, review by Sébastien Hinderer)
- #9011: Allow linking .cmxa files with no units on MSVC by not requiring the
.lib file to be present.
(David Allsopp, report by Dimitry Bely, review by Xavier Leroy)
- #9064: Relax the level handling when unifying row fields
(Leo White, review by Jacques Garrigue)
- #9097: Do not emit references to dead labels introduced by #2321 (spacetime).
(Greta Yorsh, review by Mark Shinwell)
- #9163: Treat loops properly in un_anf
(Leo White, review by Mark Shinwell, Pierre Chambart and Vincent Laviron)
- #9189, #9281: fix a conflict with Gentoo build system
by removing an one-letter Makefile variable.
(Florian Angeletti, report by Ralph Seichter, review by David Allsopp
and Damien Doligez)
- #9225: Do not drop bytecode debug info after C calls.
(Stephen Dolan, review by Gabriel Scherer and Jacques-Henri Jourdan)
- #9231: Make sure a debug event (and the corresponding debug
information) is inserted after every primitive that can appear in a
collected call stack, and make sure ocamlc preserves such events
even if they are at tail position.
(Jacques-Henri Jourdan, review by Gabriel Scherer)
- #9244: Fix some missing usage warnings
(Leo White, review by Florian Angeletti)
- #9274, avoid reading cmi file while printing types
(Florian Angeletti, review by Gabriel Scherer)
- #9307, #9345: reproducible env summaries for reproducible compilation
(Florian Angeletti, review by Leo White)
- #9309, #9318: Fix exhaustivity checking with empty types
(Florian Angeletti, Stefan Muenzel and Thomas Refis, review by Gabriel Scherer
and Thomas Refis)
- #9335: actually have --disable-stdlib-manpages not build the manpages
(implementation conflicted with #8837 which wasn't picked up in review)
(David Allsopp, review by Florian Angeletti and Sébastien Hinderer)
- #9343: Re-enable `-short-paths` for some error messages
(Leo White, review by Florian Angeletti)
- #9355, #9356: ocamldebug, fix a fatal error when printing values
whose type involves a functor application.
(Florian Angeletti, review by Gabriel Scherer, report by Cyril Six)
- #9367: Make bytecode and native-code backtraces agree.
(Stephen Dolan, review by Gabriel Scherer)
- #9375, #9477: add forgotten substitution when compiling anonymous modules
(Thomas Refis, review by Frédéric Bour, report by Andreas Hauptmann)
- #9384, #9385: Fix copy scope bugs in substitutions
(Leo White, review by Thomas Refis, report by Nick Roberts)
* #9388: Prohibit signature local types with constraints
(Leo White, review by Jacques Garrigue)
- #9406, #9409: fix an error with packed module types from missing
cmis.
(Florian Angeletti, report by Thomas Leonard, review by Gabriel Radanne
and Gabriel Scherer)
- #9415: Treat `open struct` as `include struct` in toplevel
(Leo White, review by Thomas Refis)
- #9416: Avoid warning 58 in flambda ocamlnat
(Leo White, review by Florian Angeletti)
- #9420: Fix memory leak when `caml_output_value_to_block` raises an exception
(Xavier Leroy, review by Guillaume Munch-Maccagnoni)
- #9428: Fix truncated exception backtrace for C->OCaml callbacks
on Power and Z System
(Xavier Leroy, review by Nicolás Ojeda Bär)
- #9623, #9642: fix typing environments in Typedecl.transl_with_constraint
(Gabriel Scherer, review by Jacques Garrigue and Leo White,
report by Hugo Heuzard)
- #9695, #9702: no error when opening an alias to a missing module
(Jacques Garrigue, report and review by Gabriel Scherer)
OCaml 4.10 maintenance branch
-----------------------------
### Runtime system:
- #9344, #9368: Disable exception backtraces in bytecode programs
built with "-output-complete-exe". At the moment, such programs do
not embed debug information and exception backtraces where causing
them to crash.
(Jérémie Dimino, review by Nicolás Ojeda Bär)
### Build system:
- #9531: fix support for the BFD library on FreeBSD
(Hannes Mehnert, review by Gabriel Scherer and David Allsopp)
### Bug fixes:
- #9068, #9437: ocamlopt -output-complete-obj failure on FreeBSD 12
(Xavier Leroy, report by Hannes Mehnert, review by Sébastien Hinderer)
- #9165: Add missing -function-sections and -O3 flags in Makefiles.
(Greta Yorsh, review by David Allsopp)
- #9495: fix a bug where bytecode binaries compiled with `-output-complete-exe`
would not execute `at_exit` hooks at program termination (in particular,
output channels would not be flushed).
(Nicolás Ojeda Bär, review by David Allsopp)
OCaml 4.10.0 (21 February 2020)
-------------------------------
(Changes that can break existing programs are marked with a "*")
### Language features
- #7757, #1726: multi-indices for extended indexing operators:
`a.%{0;1;2}` desugars to `( .%{ ;.. } ) a [|0;1;2|]`
(Florian Angeletti, review by Gabriel Radanne)
* #1859, #9117: enforce safe (immutable) strings by removing
the -unsafe-string option by default. This can be overridden by
a configure-time option (available since 4.04 in 2016):
--disable-force-safe-string since 4.08, -no-force-safe-since
between 4.07 and 4.04.
In the force-safe-string mode (now the default), the return type of the
String_val macro in C stubs is `const char*` instead of
`char*`. This change may break C FFI code.
(Kate Deplaix)
- #6662, #8908: allow writing "module _ = E" to ignore module expressions
(Thomas Refis, review by Gabriel Radanne)
### Runtime system:
- #8809, #9292: Add a best-fit allocator for the major heap; still
experimental, it should be much better than current allocation
policies (first-fit and next-fit) for programs with large heaps,
reducing both GC cost and memory usage.
This new best-fit is not (yet) the default; set it explicitly with
OCAMLRUNPARAM="a=2" (or Gc.set from the program). You may also want
to increase the `space_overhead` parameter of the GC (a percentage,
80 by default), for example OCAMLRUNPARAM="o=85", for optimal
speed.
(Damien Doligez, review by Stephen Dolan, Jacques-Henri Jourdan,
Xavier Leroy, Leo White)
* #8713, #8940, #9115, #9143, #9202, #9251:
Introduce a state table in the runtime to contain the global variables.
(The Multicore runtime will have one such state for each domain.)
This changes the status of some internal variables of the OCaml runtime;
in many cases the header file originally defining the internal variable
provides a compatibility macro with the old name, but programs
re-defining those variables by hand need to be fixed.
(KC Sivaramakrishnan and Stephen Dolan,
compatibility hacking by David Allsopp, Florian Angeletti, Kate Deplaix,
Jacques Garrigue, Guillaume Munch-Maccagnoni and Nicolás Ojeda Bär,
review by David Allsopp, Alain Frisch, Nicolás Ojeda Bär,
Gabriel Scherer, Damien Doligez, and Guillaume Munch-Maccagnoni)
- #8993: New C functions caml_process_pending_actions{,_exn} in
caml/signals.h, intended for executing all pending actions inside
long-running C functions (requested minor and major collections,
signal handlers, finalisers, and memprof callbacks). The function
caml_process_pending_actions_exn returns any exception arising
during their execution, allowing resources to be cleaned-up before
re-raising.
(Guillaume Munch-Maccagnoni, review by Jacques-Henri Jourdan,
Stephen Dolan, and Gabriel Scherer)
* #8691, #8897, #9027: Allocation functions are now guaranteed not to
trigger any OCaml callback when called from C. In long-running C
functions, this can be replaced with calls to
caml_process_pending_actions at safe points.
Side effect of this change: in bytecode mode, polling for
asynchronous callbacks is performed at every minor heap allocation,
in addition to function calls and loops as in previous OCaml
releases.
(Jacques-Henri Jourdan, review by Stephen Dolan, Gabriel Scherer and
Guillaume Munch-Maccagnoni)
* #9037: caml_check_urgent_gc is now guaranteed not to trigger any
finaliser. In long-running C functions, this can be replaced
with calls to caml_process_pending_actions at safe points.
(Guillaume Munch-Maccagnoni, review by Jacques-Henri Jourdan and
Stephen Dolan)
- #8619: Ensure Gc.minor_words remains accurate after a GC.
(Stephen Dolan, Xavier Leroy and David Allsopp,
review by Xavier Leroy and Gabriel Scherer)
- #8667: Limit GC credit to 1.0
(Leo White, review by Damien Doligez)
- #8670: Fix stack overflow detection with systhreads
(Stephen Dolan, review by Xavier Leroy, Anil Madhavapeddy, Gabriel Scherer,
Frédéric Bour and Guillaume Munch-Maccagnoni)
* #8711: The major GC hooks are no longer allowed to interact with the
OCaml heap.
(Jacques-Henri Jourdan, review by Damien Doligez)
- #8630: Use abort() instead of exit(2) in caml_fatal_error, and add
the new hook caml_fatal_error_hook.
(Jacques-Henri Jourdan, review by Xavier Leroy)
- #8641: Better call stacks when a C call is involved in byte code mode
(Jacques-Henri Jourdan, review by Xavier Leroy)
- #8634, #8668, #8684, #9103 (originally #847): Statistical memory profiling.
In OCaml 4.10, support for allocations in the minor heap in native
mode is not available, and callbacks for promotions and
deallocations are not available.
Hence, there is not any public API for this feature yet.
(Jacques-Henri Jourdan, review by Stephen Dolan, Gabriel Scherer
and Damien Doligez)
- #9268, #9271: Fix bytecode backtrace generation with large integers present.
(Stephen Dolan and Mark Shinwell, review by Gabriel Scherer and
Jacques-Henri Jourdan)
### Standard library:
- #8760: List.concat_map : ('a -> 'b list) -> 'a list -> 'b list
(Gabriel Scherer, review by Daniel Bünzli and Thomas Refis)
- #8832: List.find_map : ('a -> 'b option) -> 'a list -> 'b option
(Gabriel Scherer, review by Jeremy Yallop, Nicolás Ojeda Bär
and Daniel Bünzli)
- #7672, #1492: Add `Filename.quote_command` to produce properly-quoted
commands for execution by Sys.command.
(Xavier Leroy, review by David Allsopp and Damien Doligez)
- #8971: Add `Filename.null`, the conventional name of the "null" device.
(Nicolás Ojeda Bär, review by Xavier Leroy and Alain Frisch)
- #8651: add '%#F' modifier in printf to output OCaml float constants
in hexadecimal
(Pierre Roux, review by Gabriel Scherer and Xavier Leroy)
- #8657: Optimization in [Array.make] when initializing with unboxed
or young values.
(Jacques-Henri Jourdan, review by Gabriel Scherer and Stephen Dolan)
- #8716: Optimize [Array.fill] and [Hashtbl.clear] with a new runtime primitive
(Alain Frisch, review by David Allsopp, Stephen Dolan and Damien Doligez)
- #8530: List.sort: avoid duplicate work by chop
(Guillaume Munch-Maccagnoni, review by David Allsopp, Damien Doligez and
Gabriel Scherer)
### Other libraries:
- #1939, #2023: Implement Unix.truncate and Unix.ftruncate on Windows.
(Florent Monnier and Nicolás Ojeda Bär, review by David Allsopp)
### Code generation and optimizations:
- #8806: Add an [@@immediate64] attribute for types that are known to
be immediate only on 64 bit platforms
(Jérémie Dimino, review by Vladimir Keleshev)
- #9028, #9032: Fix miscompilation by no longer assuming that
untag_int (tag_int x) = x in Cmmgen; the compilation of `(n lsl 1) + 1`,
for example, would be incorrect if evaluated with a large value for `n`.
(Stephen Dolan, review by Vincent Laviron and Xavier Leroy)
- #8672: Optimise Switch code generation on booleans.
(Stephen Dolan, review by Pierre Chambart)
- #8990: amd64: Emit 32bit registers for Iconst_int when we can
(Xavier Clerc, Tom Kelly and Mark Shinwell, review by Xavier Leroy)
- #2322: Add pseudo-instruction `Ladjust_trap_depth` to replace
dummy Lpushtrap generated in linearize
(Greta Yorsh and Vincent Laviron, review by Xavier Leroy)
- #8707: Simplif: more regular treatment of Tupled and Curried functions
(Gabriel Scherer, review by Leo White and Alain Frisch)
- #8526: Add compile-time option -function-sections in ocamlopt to emit
each function in a separate named text section on supported targets.
(Greta Yorsh, review by Pierre Chambart)
- #2321: Eliminate dead ICatch handlers
(Greta Yorsh, review by Pierre Chambart and Vincent Laviron)
- #8919: lift mutable lets along with immutable ones
(Leo White, review by Pierre Chambart)
- #8909: Graph coloring register allocator: the weights put on
preference edges should not be divided by 2 in branches of
conditional constructs, because it is not good for performance
and because it leads to ignoring preference edges with 0 weight.
(Eric Stavarache, review by Xavier Leroy)
- #9006: int32 code generation improvements
(Stephen Dolan, designed with Greta Yorsh, review by Xavier Clerc,
Xavier Leroy and Alain Frisch)