From: Stephane Glondu Date: Thu, 3 Sep 2020 12:52:11 +0000 (+0200) Subject: New upstream version 4.10.1 X-Git-Tag: archive/raspbian/4.11.1-5+rpi1~1^2~25^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a561b458a82c9313db2c05811452601e20ddeb41;p=ocaml.git New upstream version 4.10.1 --- diff --git a/Changes b/Changes index fc5591eb..15fd521d 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,45 @@ +OCaml 4.10.1 (20 August 2020) +----------------------------- + +### 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, #9840: Add missing -function-sections flag 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) + +- #9714, #9724: Use the C++ alignas keyword when compiling in C++ in MSVC. + Fixes a bug with MSVC C++ 2015 onwards. + (Antonin Décimo, review by David Allsopp and Xavier Leroy) + +- #9736, #9749: Compaction must start in a heap where all free blocks are + blue, which was not the case with the best-fit allocator. + (Damien Doligez, report and review by Leo White) + +### Tools: + +- #9552: restore ocamloptp build and installation + (Florian Angeletti, review by David Allsopp and Xavier Leroy) + OCaml 4.10.0 (21 February 2020) ------------------------------- @@ -49,7 +91,7 @@ OCaml 4.10.0 (21 February 2020) (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, Nicolas Ojeda Bar, + 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 @@ -226,7 +268,7 @@ OCaml 4.10.0 (21 February 2020) (Florian Angeletti, review and suggestion by Gabriel Scherer) - #9088, #9097: fix operator character classes - (Florian Angelettion, review by Gabriel Scherer, + (Florian Angeletti, review by Gabriel Scherer, report by Clément Busschaert) - #9169: better documentation for the best-fit allocation policy @@ -286,7 +328,7 @@ OCaml 4.10.0 (21 February 2020) * #6792, #8654 ocamldebug now supports programs using Dynlink. This changes ocamldebug messages, which may break compatibility with older emacs modes. - (Whitequark and Jacques-Henri Jourdan, review by Gabriel Scherer + (whitequark and Jacques-Henri Jourdan, review by Gabriel Scherer and Xavier Clerc) - #8621: Make ocamlyacc a Windows Unicode application @@ -432,7 +474,7 @@ OCaml 4.10.0 (21 February 2020) (Florian Angeletti, review by Gabriel Scherer) - #9015: fix fatal error in pprint_ast (#8789) - (Damien Doligez, review by ...) + (Damien Doligez, review by Thomas Refis) ### Bug fixes: @@ -513,6 +555,14 @@ OCaml 4.10.0 (21 February 2020) OCaml 4.09 maintenance branch: ------------------------------ +### Build system: + +- #9383: Don't assume that AWKPATH includes . + (David Allsopp, report by Ian Zimmerman) + +OCaml 4.09.1 (16 Mars 2020): +---------------------------- + - #8855, #8858: Links for tools not created when installing with --disable-installing-byecode-programs (e.g. ocamldep.opt installed, but ocamldep link not created) @@ -594,7 +644,7 @@ OCaml 4.09.0 (19 September 2019): * #2318: Delete the graphics library. This library is now available as a separate "graphics" package in opam. Its new home is: https://github.com/ocaml/graphics - (Jérémie Dimino, review by Nicolas Ojeda Bar, Xavier Leroy and + (Jérémie Dimino, review by Nicolás Ojeda Bär, Xavier Leroy and Sébastien Hinderer) * #2289: Delete the vmthreads library. This library was deprecated in 4.08.0. @@ -658,7 +708,7 @@ OCaml 4.09.0 (19 September 2019): - #2278: Remove native code generation support for 32-bit Intel macOS, iOS and other Darwin targets. - (Mark Shinwell, review by Nicolas Ojeda Bar and Xavier Leroy) + (Mark Shinwell, review by Nicolás Ojeda Bär and Xavier Leroy) - #8547: Optimize matches that are an affine function of the input. (Stefan Muenzel, review by Alain Frisch, Gabriel Scherer) @@ -718,7 +768,7 @@ OCaml 4.09.0 (19 September 2019): fix in #8582 by Mark Shinwell, Xavier Leroy and Anil Madhavapeddy) - #2265: Add bytecomp/opcodes.mli - (Mark Shinwell, review by Nicolas Ojeda Bar) + (Mark Shinwell, review by Nicolás Ojeda Bär) - #2268: Improve packing mechanism used for building compilerlibs modules into the Dynlink libraries @@ -992,7 +1042,7 @@ OCaml 4.08.0 (13 June 2019) pred, is_finite, is_infinite, is_nan, is_integer, trunc, round, next_after, sign_bit, min, max, min_max, min_num, max_num, min_max_num to module Float. - (Christophe Troestler, review by Alain Frish, Xavier Clerc and Daniel Bünzli) + (Christophe Troestler, review by Alain Frisch, Xavier Clerc and Daniel Bünzli) - #1354, #2177: Add fma support to Float module. (Laurent Thévenoux, review by Alain Frisch, Jacques-Henri Jourdan, @@ -1126,7 +1176,7 @@ OCaml 4.08.0 (13 June 2019) - #2094, rewording for "constructor has no type" error - #7565, #2140, more context for universal variable escape in method type - (Florian Angeletti, reviews by Jacques Garrique, Armaël Guéneau, + (Florian Angeletti, reviews by Jacques Garrigue, Armaël Guéneau, Gabriel Radanne, Gabriel Scherer and Jeremy Yallop) - #1913: new flag -dump-into-file to print debug output like -dlambda into @@ -1332,6 +1382,11 @@ OCaml 4.08.0 (13 June 2019) - #7676, #2144: Remove old GC heuristic (Damien Doligez, report and review by Alain Frisch) +* #1683: Change Marshal format to make Custom_tag objects store their + length. Old versions of OCaml will no longer be able to parse new marshalled + files containing custom blocks, but old files will still parse. + (Stephen Dolan) + - #1723: Remove internal Meta.static_{alloc,free} primitives. (Stephen Dolan, review by Gabriel Scherer) @@ -1415,7 +1470,7 @@ OCaml 4.08.0 (13 June 2019) (steinuil, review by Marcello Seri, Gabriel Scherer and Florian Angeletti) - #1797: remove the deprecated Makefile.nt files. - (Sébastien Hinderer, review by Nicolas Ojeda Bar) + (Sébastien Hinderer, review by Nicolás Ojeda Bär) - #1805: fix the bootstrap procedure and its documentation. (Sébastien Hinderer, Xavier Leroy and Damien Doligez; review by @@ -1452,7 +1507,7 @@ OCaml 4.08.0 (13 June 2019) (Sébastien Hinderer, review by Damien Doligez and David Allsopp) - #2148: fix a parallel build bug involving CamlinternalLazy. - (Stephen Dolan, review by Gabriel Scherer and Nicolas Ojeda Bar) + (Stephen Dolan, review by Gabriel Scherer and Nicolás Ojeda Bär) - #2264, #7904: the configure script now sets the Unicode handling mode under Windows according to the value of the variable WINDOWS_UNICODE_MODE. If @@ -2052,11 +2107,6 @@ OCaml 4.07.0 (10 July 2018) - #1753: avoid potential off-by-one overflow in debugger socket path length. (Anil Madhavapeddy) -* #1683: Change Marshal format to make Custom_tag objects store their - length. Old versions of OCaml will no longer be able to parse new marshalled - files containing custom blocks, but old files will still parse. - (Stephen Dolan) - ### Tools: - #7643, #1377: ocamldep, fix an exponential blowup in presence of nested @@ -2361,7 +2411,7 @@ OCaml 4.07.0 (10 July 2018) - #1623: Segfault on Windows 64 bits when expanding wildcards in arguments. (Marc Lasson, review by David Allsopp, Alain Frisch, Sébastien Hinderer, - Xavier Leroy, Nicolas Ojeda Bar) + Xavier Leroy, Nicolás Ojeda Bär) - #1661: more precise principality warning regarding record fields disambiguation. @@ -2554,7 +2604,7 @@ OCaml 4.06.0 (3 Nov 2017): with thread support, will now only suppress Sys_error exceptions in Pervasives.flush_all. This should allow exceedingly unlikely assertion exceptions to escape, which could help reveal bugs in the standard library. - (Markus Mottl, review by Hezekiah M. Carty, Jeremie Dimino, Damien Doligez, + (Markus Mottl, review by Hezekiah M. Carty, Jérémie Dimino, Damien Doligez, Alain Frisch, Xavier Leroy, Gabriel Scherer and Mark Shinwell) - #1034: List.init : int -> (int -> 'a) -> 'a list diff --git a/Makefile b/Makefile index 802196d1..0a95d319 100644 --- a/Makefile +++ b/Makefile @@ -48,11 +48,6 @@ INCLUDES=-I utils -I parsing -I typing -I bytecomp -I file_formats \ COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \ -warn-error A \ -bin-annot -safe-string -strict-formats $(INCLUDES) -ifeq "$(FUNCTION_SECTIONS)" "true" -OPTCOMPFLAGS= -function-sections -else -OPTCOMPFLAGS= -endif LINKFLAGS= ifeq "$(strip $(NATDYNLINKOPTS))" "" diff --git a/Makefile.common.in b/Makefile.common.in index f389d5b0..4087e4ba 100644 --- a/Makefile.common.in +++ b/Makefile.common.in @@ -66,6 +66,10 @@ else ocamlopt_cmd = $(FLEXLINK_ENV) $(ocamlopt) endif +OPTCOMPFLAGS= +ifeq "$(FUNCTION_SECTIONS)" "true" +OPTCOMPFLAGS += -function-sections +endif # By default, request ocamllex to be quiet OCAMLLEX_FLAGS ?= -q diff --git a/VERSION b/VERSION index 98eeedd7..636ba8d7 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -4.10.0 +4.10.1 # The version string is the first line of this file. # It must be in the format described in stdlib/sys.mli diff --git a/appveyor.yml b/appveyor.yml index e055683f..5b4e821a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,7 +26,7 @@ environment: CYG_ROOT: C:/cygwin64 CYG_MIRROR: http://mirrors.kernel.org/sourceware/cygwin/ CYG_CACHE: C:/cygwin64/var/cache/setup - FLEXDLL_VERSION: 0.37 + FLEXDLL_VERSION: 0.38 OCAMLRUNPARAM: v=0,b matrix: - PORT: mingw32 diff --git a/boot/ocamlc b/boot/ocamlc index 71fcc11f..047bb008 100755 Binary files a/boot/ocamlc and b/boot/ocamlc differ diff --git a/boot/ocamllex b/boot/ocamllex index fb586c1f..462fe17b 100755 Binary files a/boot/ocamllex and b/boot/ocamllex differ diff --git a/bytecomp/bytelink.ml b/bytecomp/bytelink.ml index 0065ebd3..d980054c 100644 --- a/bytecomp/bytelink.ml +++ b/bytecomp/bytelink.ml @@ -505,11 +505,13 @@ let link_bytecode_as_c tolink outfile with_main = \nint main(int argc, char **argv)\ \n#endif\ \n{\ +\n caml_byte_program_mode = COMPLETE_EXE;\ \n caml_startup_code(caml_code, sizeof(caml_code),\ \n caml_data, sizeof(caml_data),\ \n caml_sections, sizeof(caml_sections),\ \n /* pooling */ 0,\ \n argv);\ +\n caml_sys_exit(Val_int(0));\ \n return 0; /* not reached */\ \n}\n" end else begin @@ -594,9 +596,15 @@ let fix_exec_name name = let link objfiles output_name = let objfiles = - if !Clflags.nopervasives then objfiles - else if !Clflags.output_c_object then "stdlib.cma" :: objfiles - else "stdlib.cma" :: (objfiles @ ["std_exit.cmo"]) in + match + !Clflags.nopervasives, + !Clflags.output_c_object, + !Clflags.output_complete_executable + with + | true, _, _ -> objfiles + | false, true, false -> "stdlib.cma" :: objfiles + | _ -> "stdlib.cma" :: objfiles @ ["std_exit.cmo"] + in let tolink = List.fold_right scan_file objfiles [] in let missing_modules = Ident.Set.filter (fun id -> not (Ident.is_predef id)) !missing_globals diff --git a/configure b/configure index b8f74728..2dbde09f 100755 --- a/configure +++ b/configure @@ -56,7 +56,7 @@ if test -e '.git' ; then : fi fi # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for OCaml 4.10.0. +# Generated by GNU Autoconf 2.69 for OCaml 4.10.1. # # Report bugs to . # @@ -646,8 +646,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='OCaml' PACKAGE_TARNAME='ocaml' -PACKAGE_VERSION='4.10.0' -PACKAGE_STRING='OCaml 4.10.0' +PACKAGE_VERSION='4.10.1' +PACKAGE_STRING='OCaml 4.10.1' PACKAGE_BUGREPORT='caml-list@inria.fr' PACKAGE_URL='http://www.ocaml.org' @@ -1480,7 +1480,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures OCaml 4.10.0 to adapt to many kinds of systems. +\`configure' configures OCaml 4.10.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1546,7 +1546,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of OCaml 4.10.0:";; + short | recursive ) echo "Configuration of OCaml 4.10.1:";; esac cat <<\_ACEOF @@ -1708,7 +1708,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -OCaml configure 4.10.0 +OCaml configure 4.10.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2371,7 +2371,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by OCaml $as_me 4.10.0, which was +It was created by OCaml $as_me 4.10.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2720,8 +2720,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring OCaml version 4.10.0" >&5 -$as_echo "$as_me: Configuring OCaml version 4.10.0" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring OCaml version 4.10.1" >&5 +$as_echo "$as_me: Configuring OCaml version 4.10.1" >&6;} # Configuration variables @@ -2797,7 +2797,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -VERSION=4.10.0 +VERSION=4.10.1 # Note: This is present for the flexdll bootstrap where it exposed as the old @@ -12461,7 +12461,7 @@ case $ocaml_cv_cc_vendor in #( msvc-*) : outputobj=-Fo; gcc_warnings="" ;; #( *) : - outputobj='-o $(EMPTY)'; case 4.10.0 in #( + outputobj='-o $(EMPTY)'; case 4.10.1 in #( *+dev*) : gcc_warnings="-Wall -Werror" ;; #( *) : @@ -13852,22 +13852,20 @@ esac ;; #( s390x,elf) : default_as="${toolpref}as -m 64 -march=$model" default_aspp="${toolpref}gcc -c -Wa,-march=$model" ;; #( - arm,freebsd|arm64,freebsd) : - default_as="${toolpref}cc -c" - default_aspp="${toolpref}cc -c" ;; #( - *,dragonfly) : - default_as="${toolpref}as" - default_aspp="${toolpref}cc -c" ;; #( *,freebsd) : + default_as="${toolpref}cc -c -Wno-trigraphs" + default_aspp="${toolpref}cc -c -Wno-trigraphs" ;; #( + *,dragonfly) : default_as="${toolpref}as" default_aspp="${toolpref}cc -c" ;; #( amd64,*|arm,*|arm64,*|i386,*) : - default_as="${toolpref}as" case $ocaml_cv_cc_vendor in #( clang-*) : - default_aspp="${toolpref}clang -c -Wno-trigraphs" ;; #( + default_as="${toolpref}clang -c -Wno-trigraphs" + default_aspp="${toolpref}clang -c -Wno-trigraphs" ;; #( *) : - default_aspp="${toolpref}gcc -c" ;; + default_as="${toolpref}as" + default_aspp="${toolpref}gcc -c" ;; esac ;; #( *) : ;; @@ -16011,7 +16009,7 @@ fi if test -z "$BFD_LIB_DIR"; then : BFD_LIB_DIR="/opt/local/lib" fi ;; #( - *-*openbsd*) : + *-*-openbsd*|*-*-freebsd*) : if test -z "$BFD_INCLUDE_DIR"; then : BFD_INCLUDE_DIR="/usr/local/include" fi @@ -17405,7 +17403,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by OCaml $as_me 4.10.0, which was +This file was extended by OCaml $as_me 4.10.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17472,7 +17470,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -OCaml config.status 4.10.0 +OCaml config.status 4.10.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index e3e28fb6..f0987d0a 100644 --- a/configure.ac +++ b/configure.ac @@ -1006,20 +1006,18 @@ AS_CASE(["$arch,$system"], [s390x,elf], [default_as="${toolpref}as -m 64 -march=$model" default_aspp="${toolpref}gcc -c -Wa,-march=$model"], - [arm,freebsd|arm64,freebsd], - [default_as="${toolpref}cc -c" - default_aspp="${toolpref}cc -c"], - [*,dragonfly], - [default_as="${toolpref}as" - default_aspp="${toolpref}cc -c"], [*,freebsd], + [default_as="${toolpref}cc -c -Wno-trigraphs" + default_aspp="${toolpref}cc -c -Wno-trigraphs"], + [*,dragonfly], [default_as="${toolpref}as" default_aspp="${toolpref}cc -c"], [amd64,*|arm,*|arm64,*|i386,*], - [default_as="${toolpref}as" - AS_CASE([$ocaml_cv_cc_vendor], - [clang-*], [default_aspp="${toolpref}clang -c -Wno-trigraphs"], - [default_aspp="${toolpref}gcc -c"])]) + [AS_CASE([$ocaml_cv_cc_vendor], + [clang-*], [default_as="${toolpref}clang -c -Wno-trigraphs" + default_aspp="${toolpref}clang -c -Wno-trigraphs"], + [default_as="${toolpref}as" + default_aspp="${toolpref}gcc -c"])]) AS_IF([test "$with_pic"], [fpic=true @@ -1497,7 +1495,7 @@ AS_IF([test x"$with_bfd" != "xno"], [BFD_INCLUDE_DIR="/opt/local/include"]) AS_IF([test -z "$BFD_LIB_DIR"], [BFD_LIB_DIR="/opt/local/lib"])], - [*-*openbsd*], + [*-*-openbsd*|*-*-freebsd*], [AS_IF([test -z "$BFD_INCLUDE_DIR"], [BFD_INCLUDE_DIR="/usr/local/include"]) AS_IF([test -z "$BFD_LIB_DIR"], diff --git a/manual/manual/library/builtin.etex b/manual/manual/library/builtin.etex index f63d3248..4b1d8056 100644 --- a/manual/manual/library/builtin.etex +++ b/manual/manual/library/builtin.etex @@ -6,7 +6,7 @@ compilation environment, but are not part of any module. As a consequence, they can only be referred by their short names. %\vspace{0.1cm} -\subsection{ss:builtin-types}*{Built-in types} +\subsection*{ss:builtin-types}{Built-in types} %\vspace{0.1cm} \begin{ocamldoccode} diff --git a/ocaml-variants.opam b/ocaml-variants.opam index 2af999ea..ac81f897 100644 --- a/ocaml-variants.opam +++ b/ocaml-variants.opam @@ -1,8 +1,8 @@ opam-version: "2.0" -version: "4.10.0" +version: "4.10.1" synopsis: "OCaml development version" depends: [ - "ocaml" {= "4.10.0" & post} + "ocaml" {= "4.10.1" & post} "base-unix" {post} "base-bigarray" {post} "base-threads" {post} diff --git a/otherlibs/Makefile.otherlibs.common b/otherlibs/Makefile.otherlibs.common index b800ca91..49a146f6 100644 --- a/otherlibs/Makefile.otherlibs.common +++ b/otherlibs/Makefile.otherlibs.common @@ -32,12 +32,7 @@ OC_CPPFLAGS += -I$(ROOTDIR)/runtime COMPFLAGS=-absname -w +a-4-9-41-42-44-45-48 -warn-error A -bin-annot -g \ -safe-string -strict-sequence -strict-formats $(EXTRACAMLFLAGS) ifeq "$(FLAMBDA)" "true" -OPTCOMPFLAGS=-O3 -else -OPTCOMPFLAGS= -endif -ifeq "$(FUNCTION_SECTIONS)" "true" -OPTCOMPFLAGS += -function-sections +OPTCOMPFLAGS += -O3 endif MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib diff --git a/otherlibs/dynlink/Makefile b/otherlibs/dynlink/Makefile index 41cfb485..1ec58124 100644 --- a/otherlibs/dynlink/Makefile +++ b/otherlibs/dynlink/Makefile @@ -35,9 +35,7 @@ COMPFLAGS=-strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48-66 \ -warn-error A \ -bin-annot -safe-string -strict-formats ifeq "$(FLAMBDA)" "true" -OPTCOMPFLAGS=-O3 -else -OPTCOMPFLAGS= +OPTCOMPFLAGS += -O3 endif COMPFLAGS += -I byte diff --git a/otherlibs/systhreads/Makefile b/otherlibs/systhreads/Makefile index 668fb4d1..8c3853a7 100644 --- a/otherlibs/systhreads/Makefile +++ b/otherlibs/systhreads/Makefile @@ -36,9 +36,7 @@ CAMLOPT=$(BEST_OCAMLOPT) $(LIBS) MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib COMPFLAGS=-w +33..39 -warn-error A -g -bin-annot -safe-string ifeq "$(FLAMBDA)" "true" -OPTCOMPFLAGS=-O3 -else -OPTCOMPFLAGS= +OPTCOMPFLAGS += -O3 endif LIBNAME=threads diff --git a/runtime/Makefile b/runtime/Makefile index 963c6dd8..b30f1205 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -359,10 +359,10 @@ $(foreach object_type,$(subst %,,$(object_types)), \ $(ASPP) $(ASPPFLAGS) $(SHAREDLIB_CFLAGS) -o $@ $< domain_state64.inc: caml/domain_state.tbl gen_domain_state64_inc.awk - awk -f gen_domain_state64_inc.awk $< > $@ + $(AWK) -f ./gen_domain_state64_inc.awk $< > $@ domain_state32.inc: caml/domain_state.tbl gen_domain_state32_inc.awk - awk -f gen_domain_state32_inc.awk $< > $@ + $(AWK) -f ./gen_domain_state32_inc.awk $< > $@ amd64nt.obj: amd64nt.asm domain_state64.inc $(ASM)$@ $(ASMFLAGS) $< diff --git a/runtime/backtrace_byt.c b/runtime/backtrace_byt.c index 428e7589..9760300d 100644 --- a/runtime/backtrace_byt.c +++ b/runtime/backtrace_byt.c @@ -320,6 +320,14 @@ static void read_main_debug_info(struct debug_info *di) CAMLassert(di->already_read == 0); di->already_read = 1; + /* At the moment, bytecode programs built with --output-complete-exe + do not contain any debug info. + + See https://github.com/ocaml/ocaml/issues/9344 for details. + */ + if (caml_cds_file == NULL && caml_byte_program_mode == COMPLETE_EXE) + CAMLreturn0; + if (caml_cds_file != NULL) { exec_name = caml_cds_file; } else { diff --git a/runtime/caml/freelist.h b/runtime/caml/freelist.h index 657e6883..8ceae4a5 100644 --- a/runtime/caml/freelist.h +++ b/runtime/caml/freelist.h @@ -28,7 +28,6 @@ extern asize_t caml_fl_cur_wsz; /* See [freelist.c] for usage info on these functions. */ extern header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz); extern void (*caml_fl_p_init_merge) (void); -extern void (*caml_fl_p_reset) (void); extern header_t *(*caml_fl_p_merge_block) (value bp, char *limit); extern void (*caml_fl_p_add_blocks) (value bp); extern void (*caml_fl_p_make_free_blocks) @@ -43,9 +42,6 @@ static inline header_t *caml_fl_allocate (mlsize_t wo_sz) static inline void caml_fl_init_merge (void) { (*caml_fl_p_init_merge) (); } -static inline void caml_fl_reset (void) - { (*caml_fl_p_reset) (); } - static inline header_t *caml_fl_merge_block (value bp, char *limit) { return (*caml_fl_p_merge_block) (bp, limit); } @@ -57,6 +53,7 @@ static inline void caml_make_free_blocks { (*caml_fl_p_make_free_blocks) (p, size, do_merge, color); } extern void caml_set_allocation_policy (intnat); +extern void caml_fl_reset_and_switch_policy (intnat); #ifdef DEBUG static inline void caml_fl_check (void) diff --git a/runtime/caml/misc.h b/runtime/caml/misc.h index 7fea2b14..8eb09931 100644 --- a/runtime/caml/misc.h +++ b/runtime/caml/misc.h @@ -101,6 +101,8 @@ CAMLdeprecated_typedef(addr, char *); /* we need to be able to compute the exact offset of each member. */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define CAMLalign(n) _Alignas(n) +#elif defined(__cplusplus) && _MSC_VER >= 1900 +#define CAMLalign(n) alignas(n) #elif defined(SUPPORTS_ALIGNED_ATTRIBUTE) #define CAMLalign(n) __attribute__((aligned(n))) #elif _MSC_VER >= 1500 diff --git a/runtime/caml/startup.h b/runtime/caml/startup.h index a069a457..abbcd596 100644 --- a/runtime/caml/startup.h +++ b/runtime/caml/startup.h @@ -47,6 +47,14 @@ extern int32_t caml_seek_optional_section(int fd, struct exec_trailer *trail, extern int32_t caml_seek_section(int fd, struct exec_trailer *trail, char *name); +enum caml_byte_program_mode + { + STANDARD /* normal bytecode program requiring "ocamlrun" */, + COMPLETE_EXE /* embeding the vm, i.e. compiled with --output-complete-exe */ + }; + +extern enum caml_byte_program_mode caml_byte_program_mode; + #endif /* CAML_INTERNALS */ #endif /* CAML_STARTUP_H */ diff --git a/runtime/compact.c b/runtime/compact.c index 75c973fa..4196776e 100644 --- a/runtime/compact.c +++ b/runtime/compact.c @@ -168,6 +168,13 @@ static void do_compaction (intnat new_allocation_policy) caml_heap_check (); #endif + /* Make sure the heap is in the right state for compaction: + - all free blocks are blue + - all other blocks are white and contain valid pointers + */ + caml_fl_reset_and_switch_policy (new_allocation_policy); + + /* First pass: encode all noninfix headers. */ { ch = caml_heap_start; @@ -410,10 +417,7 @@ static void do_compaction (intnat new_allocation_policy) structures from scratch. */ { ch = caml_heap_start; - if (new_allocation_policy != -1){ - caml_set_allocation_policy (new_allocation_policy); - } - caml_fl_reset (); + caml_fl_init_merge (); while (ch != NULL){ if (Chunk_size (ch) > Chunk_alloc (ch)){ caml_make_free_blocks ((value *) (ch + Chunk_alloc (ch)), diff --git a/runtime/freelist.c b/runtime/freelist.c index 19c35590..97392403 100644 --- a/runtime/freelist.c +++ b/runtime/freelist.c @@ -246,12 +246,16 @@ static void nf_init_merge (void) #endif } -static void nf_reset (void) +static void nf_init (void) { Next_small (Nf_head) = Val_NULL; nf_prev = Nf_head; caml_fl_cur_wsz = 0; - nf_init_merge (); +} + +static void nf_reset (void) +{ + nf_init (); } /* Note: the [limit] parameter is unused because we merge blocks one by one. */ @@ -693,12 +697,16 @@ static void ff_truncate_flp (value changed) } } -static void ff_reset (void) +static void ff_init (void) { Next_small (Ff_head) = Val_NULL; ff_truncate_flp (Ff_head); caml_fl_cur_wsz = 0; - ff_init_merge (); +} + +static void ff_reset (void) +{ + ff_init (); } /* Note: the [limit] parameter is unused because we merge blocks one by one. */ @@ -1661,7 +1669,7 @@ static void bf_init_merge (void) } } -static void bf_reset (void) +static void bf_init (void) { mlsize_t i; @@ -1673,7 +1681,30 @@ static void bf_reset (void) bf_large_tree = NULL; bf_large_least = NULL; caml_fl_cur_wsz = 0; - bf_init_merge (); +} + +/* Make sure all free blocks are blue and tear down the BF data structures. */ +static void bf_reset (void) +{ + mlsize_t i; + + for (i = 1; i <= BF_NUM_SMALL; i++){ + /* At the beginning of each small free list is a segment of remnants + that were pushed back to the list after splitting. These are white + and they are not in order. We must make them blue before we can + compact or change the allocator policy. + */ + value p = bf_small_fl[i].free; + while (1){ + if (p == Val_NULL || Color_val (p) == Caml_blue) break; + CAMLassert (Color_val (p) == Caml_white); + Hd_val (p) = Bluehd_hd (Hd_val (p)); + p = Next_small (p); + } + } + /* We have no malloced data structures, so we can just call [bf_init] to + clear all our pointers. */ + bf_init (); } static header_t *bf_merge_block (value bp, char *limit) @@ -1812,8 +1843,9 @@ header_t *(*caml_fl_p_allocate) (mlsize_t wo_sz) = &nf_allocate; /* Initialize the merge_block machinery (at start of sweeping). */ void (*caml_fl_p_init_merge) (void) = &nf_init_merge; -/* This is called by caml_compact_heap. */ -void (*caml_fl_p_reset) (void) = &nf_reset; +/* These are called internally. */ +static void (*caml_fl_p_init) (void) = &nf_init; +static void (*caml_fl_p_reset) (void) = &nf_reset; /* [caml_fl_merge_block] returns the head pointer of the next block after [bp], because merging blocks may change the size of [bp]. */ @@ -1851,6 +1883,7 @@ void caml_set_allocation_policy (intnat p) caml_fl_p_allocate = &nf_allocate; caml_fl_p_init_merge = &nf_init_merge; caml_fl_p_reset = &nf_reset; + caml_fl_p_init = &nf_init; caml_fl_p_merge_block = &nf_merge_block; caml_fl_p_add_blocks = &nf_add_blocks; caml_fl_p_make_free_blocks = &nf_make_free_blocks; @@ -1863,6 +1896,7 @@ void caml_set_allocation_policy (intnat p) caml_fl_p_allocate = &ff_allocate; caml_fl_p_init_merge = &ff_init_merge; caml_fl_p_reset = &ff_reset; + caml_fl_p_init = &ff_init; caml_fl_p_merge_block = &ff_merge_block; caml_fl_p_add_blocks = &ff_add_blocks; caml_fl_p_make_free_blocks = &ff_make_free_blocks; @@ -1875,6 +1909,7 @@ void caml_set_allocation_policy (intnat p) caml_fl_p_allocate = &bf_allocate; caml_fl_p_init_merge = &bf_init_merge; caml_fl_p_reset = &bf_reset; + caml_fl_p_init = &bf_init; caml_fl_p_merge_block = &bf_merge_block; caml_fl_p_add_blocks = &bf_add_blocks; caml_fl_p_make_free_blocks = &bf_make_free_blocks; @@ -1884,3 +1919,14 @@ void caml_set_allocation_policy (intnat p) break; } } + +/* This is called by caml_compact_heap. */ +void caml_fl_reset_and_switch_policy (intnat new_allocation_policy) +{ + /* reset the fl data structures */ + (*caml_fl_p_reset) (); + if (new_allocation_policy != -1){ + caml_set_allocation_policy (new_allocation_policy); + (*caml_fl_p_init) (); /* initialize the new allocation policy */ + } +} diff --git a/runtime/startup_byt.c b/runtime/startup_byt.c index 4e9ba799..3fcad7db 100644 --- a/runtime/startup_byt.c +++ b/runtime/startup_byt.c @@ -98,6 +98,8 @@ static int read_trailer(int fd, struct exec_trailer *trail) ? 0 : WRONG_MAGIC; } +enum caml_byte_program_mode caml_byte_program_mode = STANDARD; + int caml_attempt_open(char_os **name, struct exec_trailer *trail, int do_open_script) { diff --git a/stdlib/Compflags b/stdlib/Compflags index 8aa24398..e2262d3c 100755 --- a/stdlib/Compflags +++ b/stdlib/Compflags @@ -17,7 +17,7 @@ case $1 in stdlib.cm[iox]) echo ' -nopervasives -no-alias-deps -w -49' \ - ' -pp "$AWK -f expand_module_aliases.awk"';; + ' -pp "$AWK -f ./expand_module_aliases.awk"';; camlinternalOO.cmx) echo ' -inline 0 -afl-inst-ratio 0';; camlinternalLazy.cmx) echo ' -afl-inst-ratio 0';; # never instrument camlinternalOO or camlinternalLazy (PR#7725) diff --git a/stdlib/Makefile b/stdlib/Makefile index 6d609bc9..5cd25f24 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -26,12 +26,7 @@ COMPFLAGS=-strict-sequence -absname -w +a-4-9-41-42-44-45-48 \ -g -warn-error A -bin-annot -nostdlib \ -safe-string -strict-formats ifeq "$(FLAMBDA)" "true" -OPTCOMPFLAGS=-O3 -else -OPTCOMPFLAGS= -endif -ifeq "$(FUNCTION_SECTIONS)" "true" -OPTCOMPFLAGS += -function-sections +OPTCOMPFLAGS += -O3 endif OPTCOMPILER=$(ROOTDIR)/ocamlopt CAMLOPT=$(CAMLRUN) $(OPTCOMPILER) @@ -258,7 +253,7 @@ SPACE := $(EMPTY) $(EMPTY) depend: $(CAMLDEP) $(DEPFLAGS) $(filter-out stdlib.%,$(wildcard *.mli *.ml)) \ > .depend.tmp - $(CAMLDEP) $(DEPFLAGS) -pp "$(AWK) -f remove_module_aliases.awk" \ + $(CAMLDEP) $(DEPFLAGS) -pp "$(AWK) -f ./remove_module_aliases.awk" \ stdlib.ml stdlib.mli >> .depend.tmp sed -Ee \ 's#(^| )(${subst ${SPACE},|,${UNPREFIXED_OBJS}})[.]#\1stdlib__\2.#g' \ diff --git a/stdlib/sys.mli b/stdlib/sys.mli index eed700a8..0be4ed1a 100644 --- a/stdlib/sys.mli +++ b/stdlib/sys.mli @@ -330,7 +330,7 @@ val enable_runtime_warnings: bool -> unit (** Control whether the OCaml runtime system can emit warnings on stderr. Currently, the only supported warning is triggered when a channel created by [open_*] functions is finalized without - being closed. Runtime warnings are enabled by default. + being closed. Runtime warnings are disabled by default. @since 4.03.0 *) diff --git a/testsuite/Makefile b/testsuite/Makefile index fb33f638..9d7d6dc7 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -259,7 +259,7 @@ clean: .PHONY: report report: @if [ ! -f $(TESTLOG) ]; then echo "No $(TESTLOG) file."; exit 1; fi - @awk -f summarize.awk < $(TESTLOG) + @$(AWK) -f ./summarize.awk < $(TESTLOG) .PHONY: retry-list retry-list: @@ -274,8 +274,8 @@ retry-list: .PHONY: retries retries: - @awk -v retries=1 -v max_retries=$(MAX_TESTSUITE_DIR_RETRIES) \ - -f summarize.awk < $(TESTLOG) > _retries + @$(AWK) -v retries=1 -v max_retries=$(MAX_TESTSUITE_DIR_RETRIES) \ + -f ./summarize.awk < $(TESTLOG) > _retries @test `cat _retries | wc -l` -eq 0 || $(MAKE) $(NO_PRINT) retry-list @rm -f _retries diff --git a/testsuite/tests/output-complete-obj/github9344.ml b/testsuite/tests/output-complete-obj/github9344.ml new file mode 100644 index 00000000..430e5ec8 --- /dev/null +++ b/testsuite/tests/output-complete-obj/github9344.ml @@ -0,0 +1,14 @@ +(* TEST + +use_runtime = "false" + +* setup-ocamlc.byte-build-env +** ocamlc.byte +flags = "-w a -output-complete-exe -ccopt -I${ocamlsrcdir}/runtime" +program = "github9344" +*** run +program = "sh ${test_source_directory}/github9344.sh" +**** check-program-output +*) + +raise Not_found diff --git a/testsuite/tests/output-complete-obj/github9344.reference b/testsuite/tests/output-complete-obj/github9344.reference new file mode 100644 index 00000000..5626c6c6 --- /dev/null +++ b/testsuite/tests/output-complete-obj/github9344.reference @@ -0,0 +1 @@ +Fatal error: exception Not_found diff --git a/testsuite/tests/output-complete-obj/github9344.sh b/testsuite/tests/output-complete-obj/github9344.sh new file mode 100644 index 00000000..7e532312 --- /dev/null +++ b/testsuite/tests/output-complete-obj/github9344.sh @@ -0,0 +1,3 @@ +#!/bin/sh +export OCAMLRUNPARAM=b=1 +./github9344 || true diff --git a/testsuite/tests/output-complete-obj/puts.c b/testsuite/tests/output-complete-obj/puts.c index 528cd946..0fe82138 100644 --- a/testsuite/tests/output-complete-obj/puts.c +++ b/testsuite/tests/output-complete-obj/puts.c @@ -4,5 +4,6 @@ value caml_puts(value s) { puts(String_val(s)); + fflush(stdout); return Val_unit; } diff --git a/testsuite/tests/output-complete-obj/test2.ml b/testsuite/tests/output-complete-obj/test2.ml index 5207823a..bee3d382 100644 --- a/testsuite/tests/output-complete-obj/test2.ml +++ b/testsuite/tests/output-complete-obj/test2.ml @@ -16,6 +16,8 @@ program = "./test2" external puts: string -> unit = "caml_puts" +let _ = at_exit (fun () -> print_endline "Program terminated") + let () = Unix.putenv "FOO" "Hello OCaml!"; puts (Unix.getenv "FOO") diff --git a/testsuite/tests/output-complete-obj/test2.reference b/testsuite/tests/output-complete-obj/test2.reference index 6a561060..32151005 100644 --- a/testsuite/tests/output-complete-obj/test2.reference +++ b/testsuite/tests/output-complete-obj/test2.reference @@ -1 +1,2 @@ Hello OCaml! +Program terminated diff --git a/tools/Makefile b/tools/Makefile index 18aead93..0a7b31b1 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -30,7 +30,7 @@ DESTDIR ?= # Setup GNU make variables storing per-target source and target, # a list of installed tools, and a function to quote a filename for # the shell. -override installed_tools := ocamldep ocamlprof ocamlcp \ +override installed_tools := ocamldep ocamlprof ocamlcp ocamloptp \ ocamlmktop ocamlmklib ocamlobjinfo install_files := @@ -126,6 +126,7 @@ ocamlcp_cmos = config.cmo build_path_prefix_map.cmo misc.cmo profile.cmo \ main_args.cmo $(call byte_and_opt,ocamlcp,$(ocamlcp_cmos) ocamlcp.cmo,) +$(call byte_and_opt,ocamloptp,$(ocamlcp_cmos) ocamloptp.cmo,) opt:: profiling.cmx diff --git a/tools/ci/appveyor/appveyor_build.cmd b/tools/ci/appveyor/appveyor_build.cmd index 1c3d3078..e2c42547 100644 --- a/tools/ci/appveyor/appveyor_build.cmd +++ b/tools/ci/appveyor/appveyor_build.cmd @@ -58,8 +58,8 @@ if "%PORT%" equ "mingw32" ( ) cd "%APPVEYOR_BUILD_FOLDER%" -appveyor DownloadFile "https://github.com/alainfrisch/flexdll/archive/0.37.tar.gz" -FileName "flexdll.tar.gz" || exit /b 1 -appveyor DownloadFile "https://github.com/alainfrisch/flexdll/releases/download/0.37/flexdll-bin-0.37.zip" -FileName "flexdll.zip" || exit /b 1 +appveyor DownloadFile "https://github.com/alainfrisch/flexdll/archive/%FLEXDLL_VERSION%.tar.gz" -FileName "flexdll.tar.gz" || exit /b 1 +appveyor DownloadFile "https://github.com/alainfrisch/flexdll/releases/download/%FLEXDLL_VERSION%/flexdll-bin-%FLEXDLL_VERSION%.zip" -FileName "flexdll.zip" || exit /b 1 rem flexdll.zip is processed here, rather than in appveyor_build.sh because the rem unzip command comes from MSYS2 (via Git for Windows) and it has to be rem invoked via cmd /c in a bash script which is weird(er).