···1111 *blit_* function during Mark phase
1212 (François Bobot, reported by Stephen Dolan, reviewed by Damien Doligez)
13131414+- #10549: Stack overflow detection and naked pointers checking for ARM64
1515+ (Xavier Leroy, review by Stephen Dolan)
1616+1717+1418### Code generation and optimizations:
15191620### Standard library:
···3337 to emulate Unix.socketpair (only available on Windows 1803+)
3438 (Antonin Décimo, review by David Allsopp)
35394040+- #10469: Add Thread.set_uncaught_exception_handler and
4141+ Thread.default_uncaught_exception_handler.
4242+ (Enguerrand Decorne, review by David Allsopp)
4343+3644### Tools:
37453846- #3959, #7202, #10476: ocaml, in script mode, directive errors
···4250- #10524: Directive argument type error now shows expected and received type.
4351 (Wiktor Kuchta, review by Gabriel Scherer)
44525353+- #10560: Disable colors if the env variable `NO_COLOR` is set. If
5454+ `OCAML_COLOR` is set, its setting takes precedence over `NO_COLOR`.
5555+ (Nicolás Ojeda Bär, report by Gabriel Scherer, review by Daniel Bünzli,
5656+ Gabriel Scherer and David Allsopp)
5757+4558### Manual and documentation:
46594760- #7812, #10475: reworded the description of the behaviors of
···6174- #10407: Produce more detailed error messages that contain full error traces
6275 when module inclusion fails.
6376 (Antal Spector-Zabusky, review by Florian Angeletti)
7777+7878+- #10531: add naked_pointers to ocamlc -config exporting NAKED_POINTERS from
7979+ Makefile.config.
8080+ (Damien Doligez, review by Mark Shinwell and Gabriel Scherer)
64816582### Internal/compiler-libs changes:
6683···186203 platforms without AFL support.
187204 (David Allsopp, review by Xavier Leroy)
188205206206+- #10195: Speed up GC by prefetching during marking
207207+ (Stephen Dolan, review by Xavier Leroy, Guillaume Munch-Maccagnoni,
208208+ Jacques-Henri Jourdan and Damien Doligez)
209209+189210* #10098: Improve command-line parsing in ocamlrun: strictly recognise options,
190211 be more informative for `ocamlrun -I` and support `--` for terminating options
191212 parsing.
···415436416437- #9632: Document incremental build solutions with opam
417438 (Vincent Laviron, review by Daniel Bünzli and Gabriel Scherer)
439439+440440+- #10497: Styling changes in the post-processed HTML manual (webman)
441441+ (Wiktor Kuchta, review by Florian Angeletti)
418442419443### Compiler user-interface and warnings:
420444···699723- #10376: Link runtime libraries correctly on msvc64 in -output-complete-obj
700724 (David Allsopp, review by Gabriel Scherer)
701725726726+- #10380: Correct handling of UTF-8 paths in configure on Windows
727727+ (David Allsopp, review by Sébastien Hinderer)
728728+702729- #10449: Fix major GC work accounting (the GC was running too fast).
703730 (Damien Doligez, report by Stephen Dolan, review by Nicolás Ojeda Bär
704731 and Sadiq Jaffer)
732732+733733+- #10450, #10558: keep %apply and %revapply primitives working with abstract
734734+ types. This breach of backward compatibility was only present in the alpha
735735+ releases of OCaml 4.13.0 .
736736+ (Florian Angeletti, review by Thomas Refis and Leo White)
705737706738- #10454: Check row_more in nondep_type_rec.
707739 (Leo White, review by Thomas Refis)
···717749-------------------------------
718750719751### Bug fixes:
752752+753753+- #10442, #10446: Fix regression in the toplevel to #directory caused by
754754+ corrections and improvements to the Load_path in #9611. #directory now
755755+ adds the path to the start of the load path again (so files in the newly
756756+ added directory take priority).
757757+ (David Allsopp, report by Vasile Rotaru, review by Florian Angeletti
758758+ and Nicolás Ojeda Bär)
720759721760- #10478: Fix segfault under Windows due to a mistaken initialization of thread
722761 ID when a thread starts.
···263263 $(OUTPUTEXE)$(1) $(2)
264264endif # ifeq "$(TOOLCHAIN)" "msvc"
265265266266-# The following variables were defined only in the Windows-specific makefiles.
267267-# They were not defined by the configure script used on Unix systems,
268268-# so we also make sure to provide them only under Windows
269269-# User code should absolutely not rely on their presence because
270270-# in the future their definition may be moved to a more private part of
271271-# the compiler's build system
272272-ifeq "$(UNIX_OR_WIN32)" "win32"
273273- CYGPATH=cygpath -m
274274- DIFF=/usr/bin/diff -q --strip-trailing-cr
275275- FIND=/usr/bin/find
276276- SORT=/usr/bin/sort
277277- SET_LD_PATH=PATH="$(PATH):$(LD_PATH)"
278278-else # ifeq "$(UNIX_OR_WIN32)" "win32"
279279- # On Unix, make sure FLEXLINK is defined but empty
280280- SORT=sort
281281- CYGPATH=echo
282282- SET_LD_PATH=CAML_LD_LIBRARY_PATH="$(LD_PATH)"
283283-endif # ifeq "$(UNIX_OR_WIN32)" "win32"
284284-285266FLEXLINK_FLAGS=@flexlink_flags@
286267FLEXLINK_CMD=flexlink
287268FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS)
+1-1
README.stock.adoc
···111111112112https://ocaml.org/community/
113113114114-In particular, the IRC channel `#ocaml` on https://freenode.net/[Freenode] has a
114114+In particular, the IRC channel `#ocaml` on https://libera.chat/[Libera] has a
115115long history and welcomes questions.
116116117117== Bug Reports and User Feedback
···254254.B never
255255disable color output.
256256257257-The default setting is
257257+The environment variable "OCAML_COLOR" is considered if \-color is not
258258+provided. Its values are auto/always/never as above.
259259+260260+If \-color is not provided, "OCAML_COLOR" is not set and the environment
261261+variable "NO_COLOR" is set, then color output is disabled. Otherwise,
262262+the default setting is
258263.B auto,
259264and the current heuristic
260265checks that the "TERM" environment variable exists and is
261266not empty or "dumb", and that isatty(stderr) holds.
262262-263263-The environment variable "OCAML_COLOR" is considered if \-color is not
264264-provided. Its values are auto/always/never as above.
265267266268.TP
267269.BI \-error\-style \ mode
+6-4
man/ocamlc.m
···268268.B never
269269disable color output.
270270271271-The default setting is
271271+The environment variable "OCAML_COLOR" is considered if \-color is not
272272+provided. Its values are auto/always/never as above.
273273+274274+If \-color is not provided, "OCAML_COLOR" is not set and the environment
275275+variable "NO_COLOR" is set, then color output is disabled. Otherwise,
276276+the default setting is
272277.B auto,
273278and the current heuristic
274279checks that the "TERM" environment variable exists and is
275280not empty or "dumb", and that isatty(stderr) holds.
276276-277277-The environment variable "OCAML_COLOR" is considered if \-color is not
278278-provided. Its values are auto/always/never as above.
279281280282.TP
281283.BI \-error\-style \ mode
+6-4
man/ocamlopt.m
···224224.B never
225225disable color output.
226226227227-The default setting is
227227+The environment variable "OCAML_COLOR" is considered if \-color is not
228228+provided. Its values are auto/always/never as above.
229229+230230+If \-color is not provided, "OCAML_COLOR" is not set and the environment
231231+variable "NO_COLOR" is set, then color output is disabled. Otherwise,
232232+the default setting is
228233.B auto,
229234and the current heuristic
230235checks that the "TERM" environment variable exists and is
231236not empty or "dumb", and that isatty(stderr) holds.
232232-233233-The environment variable "OCAML_COLOR" is considered if \-color is not
234234-provided. Its values are auto/always/never as above.
235237236238.TP
237239.BI \-error\-style \ mode
+1-2
manual/src/Makefile
···3344export LD_LIBRARY_PATH ?= "$(SRC)/otherlibs/unix/:$(SRC)/otherlibs/str/"
55export DYLD_LIBRARY_PATH ?= "$(SRC)/otherlibs/unix/:$(SRC)/otherlibs/str/"
66-SET_LD_PATH = CAML_LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)
7687TEXQUOTE = $(SRC)/runtime/ocamlrun ../tools/texquote2
98···136135 echo "% are inserted through the Makefile, which should be updated";\
137136 echo "% when a new warning is documented.";\
138137 echo "%";\
139139- $(SET_LD_PATH) $(SRC)/boot/ocamlrun $(SRC)/ocamlc -warn-help \
138138+ $(SRC)/boot/ocamlrun $(SRC)/ocamlc -warn-help \
140139 | LC_ALL=C sed -e 's/^ *\([0-9][0-9]*\) *\[\([a-z][a-z-]*\)\]\(.*\)/\\item[\1 "\2"] \3/' \
141140 -e 's/^ *\([0-9A-Z][0-9]*\) *\([^]].*\)/\\item[\1] \2/'\
142141 | sed -e 's/@/\\@/g' \
···126126 \item["always"] enable colors unconditionally;
127127 \item["never"] disable color output.
128128\end{description}
129129-The default setting is 'auto', and the current heuristic
130130-checks that the "TERM" environment variable exists and is
131131-not empty or "dumb", and that 'isatty(stderr)' holds.
132129133130The environment variable "OCAML_COLOR" is considered if "-color" is not
134131provided. Its values are auto/always/never as above.
132132+133133+If "-color" is not provided, "OCAML_COLOR" is not set and the environment
134134+variable "NO_COLOR" is set, then color output is disabled. Otherwise,
135135+the default setting is 'auto', and the current heuristic
136136+checks that the "TERM" environment variable exists and is
137137+not empty or "dumb", and that 'isatty(stderr)' holds.
135138}%notop
136139137140\notop{%
···145145 Signal handlers attached to the signals in [sigs] will not
146146 be invoked. The signals [sigs] are expected to be blocked before
147147 calling [wait_signal]. *)
148148+149149+(** {1 Uncaught exceptions} *)
150150+151151+val default_uncaught_exception_handler : exn -> unit
152152+(** [Thread.default_uncaught_exception_handler] will print the thread's id,
153153+ exception and backtrace (if available). *)
154154+155155+val set_uncaught_exception_handler : (exn -> unit) -> unit
156156+(** [Thread.set_uncaught_exception_handler fn] registers [fn] as the handler
157157+ for uncaught exceptions.
158158+159159+ If the newly set uncaught exception handler raise an exception,
160160+ {!default_uncaught_exception_handler} will be called. *)
+1-1
parsing/parsetree.mli
···381381 | Pexp_open of open_declaration * expression
382382 (* M.(E)
383383 let open M in E
384384- let! open M in E *)
384384+ let open! M in E *)
385385 | Pexp_letop of letop
386386 (* let* P = E in E
387387 let* P = E and* P = E in E *)
+9
runtime/caml/misc.h
···7676 #define Noreturn
7777#endif
78787979+/* Manually preventing inlining */
8080+#if defined(__GNUC__)
8181+ #define Caml_noinline __attribute__ ((noinline))
8282+#elif defined(_MSC_VER)
8383+ #define Caml_noinline __declspec(noinline)
8484+#else
8585+ #define Caml_noinline
8686+#endif
8787+7988/* Export control (to mark primitives and to handle Windows DLL) */
80898190#ifndef CAMLDLLIMPORT
···11-#2 "stdlib/sys.mlp"
11+(* @configure_input@ *)
22+#2 "stdlib/sys.ml.in"
23(**************************************************************************)
34(* *)
45(* OCaml *)
···1314(* special exception on linking described in the file LICENSE. *)
1415(* *)
1516(**************************************************************************)
1616-1717-(* WARNING: sys.ml is generated from sys.mlp. DO NOT EDIT sys.ml or
1818- your changes will be lost.
1919-*)
20172118type backend_type =
2219 | Native
···128125129126(* The version string is found in file ../VERSION *)
130127131131-let ocaml_version = "%%VERSION%%"
128128+let ocaml_version = "@VERSION@"
132129133130(* Optimization *)
134131
···1717#include <stdio.h>
1818#include <stdlib.h>
1919#include <time.h>
2020-#include <caml/mlvalues.h>
2121-2222-/* This stub isn't needed for msvc32, since it's already in asmgen_i386nt.asm */
2323-#if !defined(_MSC_VER) || !defined(_M_IX86)
2424-void caml_call_gc()
2525-{
2626-2727-}
2828-#endif
29203021/* This stub isn't needed for msvc32, since it's already in asmgen_i386nt.asm */
3122#if !defined(_MSC_VER) || !defined(_M_IX86)
···74657566#endif
76677777-CAMLprim value run_prog(value varg1, value varg2, value varg3)
6868+int main(int argc, char **argv)
7869{
7979- long arg1 = Long_val(varg1);
8080- long arg2 = Long_val(varg2);
8181- long arg3 = Long_val(varg3);
8282- if (arg1+arg2+arg3) {}; /* squash unused var warnings */
8370#ifdef UNIT_INT
8471 { extern long FUN(void);
8572 extern long call_gen_code(long (*)(void));
8673 printf("%ld\n", call_gen_code(FUN));
8774 }
8875#else
7676+ if (argc < 2) {
7777+ fprintf(stderr, "Usage: %s [int arg]\n", argv[0]);
7878+ exit(2);
7979+ }
8980#ifdef INT_INT
9081 { extern long FUN(long);
9182 extern long call_gen_code(long (*)(long), long);
9292- printf("%ld\n", call_gen_code(FUN, arg1));
8383+ printf("%ld\n", call_gen_code(FUN, atoi(argv[1])));
9384 }
9485#endif
9586#ifdef INT_FLOAT
9687 { extern double FUN(long);
9788 extern double call_gen_code(double (*)(long), long);
9898- printf("%f\n", call_gen_code(FUN, arg1));
8989+ printf("%f\n", call_gen_code(FUN, atoi(argv[1])));
9990 }
10091#endif
10192#ifdef FLOAT_CATCH
···113104 long * a, * b;
114105 long i;
115106116116- srand(arg2 ? arg2 : time(0));
117117- n = arg1;
107107+ srand(argc >= 3 ? atoi(argv[2]) : time((time_t *) 0));
108108+ n = atoi(argv[1]);
118109 a = (long *) malloc(n * sizeof(long));
119110 for (i = 0 ; i < n; i++) a[i] = rand() & 0xFFF;
120111#ifdef DEBUG
···138129 { extern void checkbound1(long), checkbound2(long, long);
139130 extern void call_gen_code(void *, ...);
140131 long x, y;
141141- x = arg1;
142142- if (arg2) {
143143- y = arg2;
132132+ x = atoi(argv[1]);
133133+ if (argc >= 3) {
134134+ y = atoi(argv[2]);
144135 if ((unsigned long) x < (unsigned long) y)
145136 printf("Should not trap\n");
146137 else
···156147 printf("OK\n");
157148 }
158149#endif
159159- return Val_unit;
150150+ return 0;
160151}
+1-1
testsuite/tests/backtrace/callstack.reference
···1212Called from Callstack.f1 in file "callstack.ml", line 12, characters 27-32
1313Called from Callstack.f2 in file "callstack.ml", line 13, characters 27-32
1414Called from Callstack.f3 in file "callstack.ml", line 14, characters 27-32
1515-Called from Thread.create.(fun) in file "thread.ml", line 41, characters 8-14
1515+Called from Thread.create.(fun) in file "thread.ml", line 47, characters 8-14
···11+Thread 1 killed on uncaught exception Uncaught_exception_handler.CallbackExn
22+Raised at Uncaught_exception_handler.fn in file "uncaught_exception_handler.ml", line 28, characters 12-113
33+Called from Thread.create.(fun) in file "thread.ml", line 47, characters 8-14
44+[thread 2] caught Uncaught_exception_handler.CallbackExn
55+Raised at Uncaught_exception_handler.fn in file "uncaught_exception_handler.ml", line 28, characters 12-113
66+Called from Thread.create.(fun) in file "thread.ml", line 47, characters 8-14
77+Thread 2 killed on uncaught exception Uncaught_exception_handler.CallbackExn
88+Raised at Uncaught_exception_handler.fn in file "uncaught_exception_handler.ml", line 28, characters 12-113
99+Called from Thread.create.(fun) in file "thread.ml", line 47, characters 8-14
1010+Thread 2 uncaught exception handler raised Uncaught_exception_handler.UncaughtHandlerExn
1111+Raised at Uncaught_exception_handler.handler in file "uncaught_exception_handler.ml", line 26, characters 2-26
1212+Called from Thread.create.(fun) in file "thread.ml", line 53, characters 10-41
···4242(* PR#10081 *)
4343let bump ?(cap = 100) x = min cap (x + 1)
4444let _f x = bump @@ x (* no warning 48 *)
4545+4646+(* Abstract functions *)
4747+let _ =
4848+ let module A:sig
4949+ type f
5050+ type x
5151+ val succ: f
5252+ val zero:x
5353+ external (@@): f -> x -> int = "%apply"
5454+ end = struct
5555+ type f = int -> int
5656+ type x = int
5757+ let succ = succ
5858+ let zero = 0
5959+ external (@@): f -> x -> int = "%apply"
6060+ end in
6161+ A.(succ @@ zero)
+17
testsuite/tests/prim-revapply/revapply.ml
···3030type t = A | B
3131type s = A | B
3232let _f (x : t) = x |> function A -> 0 | B -> 1
3333+3434+(* Abstract functions *)
3535+let _ =
3636+ let module A:sig
3737+ type f
3838+ type x
3939+ val succ: f
4040+ val zero:x
4141+ external (|>): x -> f -> int = "%revapply"
4242+ end = struct
4343+ type f = int -> int
4444+ type x = int
4545+ let succ = succ
4646+ let zero = 0
4747+ external (|>): x -> f -> int = "%revapply"
4848+ end in
4949+ A.(zero |> succ)
···7777 let d = expand_directory Config.standard_library s in
7878 Dll.add_path [d];
7979 let dir = Load_path.Dir.create d in
8080- Load_path.add dir;
8080+ Load_path.prepend_dir dir;
8181 toplevel_env :=
8282 Stdlib.String.Set.fold
8383 (fun name env ->
+34-4
typing/typecore.ml
···27422742 | Pexp_ifthenelse (_, e1, Some e2) -> is_inferred e1 && is_inferred e2
27432743 | _ -> false
2744274427452745+(* check if the type of %apply or %revapply matches the type expected by
27462746+ the specialized typing rule for those primitives.
27472747+*)
27482748+type apply_prim =
27492749+ | Apply
27502750+ | Revapply
27512751+let check_apply_prim_type prim typ =
27522752+ match get_desc typ with
27532753+ | Tarrow (Nolabel,a,b,_) ->
27542754+ begin match get_desc b with
27552755+ | Tarrow(Nolabel,c,d,_) ->
27562756+ let f, x, res =
27572757+ match prim with
27582758+ | Apply -> a, c, d
27592759+ | Revapply -> c, a, d
27602760+ in
27612761+ begin match get_desc f with
27622762+ | Tarrow(Nolabel,fl,fr,_) ->
27632763+ is_Tvar fl && is_Tvar fr && is_Tvar x && is_Tvar res
27642764+ && Types.eq_type fl x && Types.eq_type fr res
27652765+ | _ -> false
27662766+ end
27672767+ | _ -> false
27682768+ end
27692769+ | _ -> false
27702770+27452771(* Merge explanation to type clash error *)
2746277227472773let with_explanation explanation f =
···29472973 let funct, sargs =
29482974 let funct = type_sfunct sfunct in
29492975 match funct.exp_desc, sargs with
29502950- | Texp_ident (_, _, {val_kind = Val_prim {prim_name = "%revapply"}}),
29762976+ | Texp_ident (_, _,
29772977+ {val_kind = Val_prim {prim_name="%revapply"}; val_type}),
29512978 [Nolabel, sarg; Nolabel, actual_sfunct]
29522952- when is_inferred actual_sfunct ->
29792979+ when is_inferred actual_sfunct
29802980+ && check_apply_prim_type Revapply val_type ->
29532981 type_sfunct actual_sfunct, [Nolabel, sarg]
29542954- | Texp_ident (_, _, {val_kind = Val_prim {prim_name = "%apply"}}),
29552955- [Nolabel, actual_sfunct; Nolabel, sarg] ->
29822982+ | Texp_ident (_, _,
29832983+ {val_kind = Val_prim {prim_name="%apply"}; val_type}),
29842984+ [Nolabel, actual_sfunct; Nolabel, sarg]
29852985+ when check_apply_prim_type Apply val_type ->
29562986 type_sfunct actual_sfunct, [Nolabel, sarg]
29572987 | _ ->
29582988 funct, sargs
···5959 we are starting from an empty cache, we can avoid checking whether a unit
6060 name already exists in the cache simply by adding entries in reverse
6161 order. *)
6262-let add dir =
6262+let prepend_add dir =
6363 List.iter (fun base ->
6464 let fn = Filename.concat dir.Dir.path base in
6565 STbl.replace !files base fn;
···6969let init l =
7070 reset ();
7171 dirs := List.rev_map Dir.create l;
7272- List.iter add !dirs
7272+ List.iter prepend_add !dirs
73737474let remove_dir dir =
7575 assert (not Config.merlin || Local_store.is_bound ());
7676 let new_dirs = List.filter (fun d -> Dir.path d <> dir) !dirs in
7777 if List.compare_lengths new_dirs !dirs <> 0 then begin
7878 reset ();
7979- List.iter add new_dirs;
7979+ List.iter prepend_add new_dirs;
8080 dirs := new_dirs
8181 end
8282···9595 STbl.replace !files_uncap ubase fn)
9696 dir.Dir.files;
9797 dirs := dir :: !dirs
9898+9999+let append_dir = add
9810099101let add_dir dir = add (Dir.create dir)
102102+103103+(* Add the directory at the start of load path - so basenames are
104104+ unconditionally added. *)
105105+let prepend_dir dir =
106106+ assert (not Config.merlin || Local_store.is_bound ());
107107+ prepend_add dir;
108108+ dirs := !dirs @ [dir]
100109101110let is_basename fn = Filename.basename fn = fn
102111
+11-2
utils/load_path.mli
···2323*)
24242525val add_dir : string -> unit
2626-(** Add a directory to the load path *)
2626+(** Add a directory to the end of the load path (i.e. at lowest priority.) *)
27272828val remove_dir : string -> unit
2929(** Remove a directory from the load path *)
···6060 sub-directories of this directory. *)
6161end
62626363-val add : Dir.t -> unit
6363+val[@deprecated] add : Dir.t -> unit
6464+(** Old name for {!append_dir} *)
6565+6666+val append_dir : Dir.t -> unit
6767+(** [append_dir d] adds [d] to the end of the load path (i.e. at lowest
6868+ priority. *)
6969+7070+val prepend_dir : Dir.t -> unit
7171+(** [prepend_dir d] adds [d] to the start of the load path (i.e. at highest
7272+ priority. *)
64736574val get : unit -> Dir.t list
6675(** Same as [get_paths ()], except that it returns a [Dir.t list]. *)