Commit Graph

3242 Commits (8a46d76bf9359b5cc505b3f2f9c81eb624c631fa)

Author SHA1 Message Date
Sébastien Briais f52fdc2068
Define to_rev_seq in Set and Map module (#9075) 2020-05-15 17:38:45 +02:00
Xavier Leroy 914dd057b5
win32unix: quote the arguments to the Unix.exec* functions (#9550)
Otherwise, arguments get split at spaces.
This is the same quoting that the Win32 implementation of
Unix.create_process does.

A test was added.

Fixes: 9320
2020-05-14 18:15:10 +02:00
Florian Angeletti 1a8a4dfd85
Merge pull request #9552 from Octachron/forgotten_ocamloptp
Restore ocamloptp
2020-05-14 16:10:05 +02:00
Gabriel Scherer 229df94da5 Changes 2020-05-14 10:28:42 +02:00
octachron 0963b0c6b6 Restore ocamloptp 2020-05-14 10:11:42 +02:00
Gabriel Scherer b3434751e2
Merge pull request #9520 from trefis/rematch-make_matching-cleanup
pattern-matching refactoring: refactor the `make_<foo>_matching` functions
2020-05-14 09:21:07 +02:00
Nicolás Ojeda Bär ea835ee45e Changes 2020-05-13 20:57:21 +02:00
Xavier Leroy c17f6c2956
Protect against bad rounding of mtime / atime / ctime stats (#9505)
Some file systems maintain time stamps with sub-second resolution, up
to nanosecond resolution.  When converting from a "(seconds, nanoseconds)"
timestamp to a floating-point timestamp, rounding to nearest can produce
"seconds + 1" as a result, i.e. the integer part of the FP timestamp
is not equal to "seconds".  As described in #9490, this is a problem
in some cases.

This commit implements a more careful conversion of "(seconds,
nanoseconds)" pairs to FP timestamps so that the integer part of the
FP result is always "seconds".

Both the otherlibs/unix and the otherlibs/win32unix implementations are affected
and corrected.

Closes: #9490
2020-05-13 18:43:46 +02:00
David Allsopp b6c8b35e2d
Make -flarge-toc the default for PowerPC (#9557)
Introduce -fsmall-toc in order to access the previous behaviour and
document both options in the manual and ocamlopt manpage.
2020-05-13 18:23:37 +02:00
Gabriel Scherer 065139617f matching: factorize the make_*_matching functions
Before, each head construction had a `make_<foo>_matching` construct that
was responsible for three things:
- consuming the argument from the argument list
  (the "argument" is a piece of lambda code to access
   the value of the current scrutinee)
- building arguments for the subpatterns of the scrutinee
  and pushing them to the argument list
- building a `cell` structure out of this, representing a head group
  during compilation

Only the second point is really specific to each construction.

This refactoring turns this second point into a construct-specific
`get_expr_args_<foo>` function (similarly to `get_pat_args_<foo>`),
and moves the first and third point to a generic `make_matching`
function.

Note: this commit contains a minor improvement to the location used to
force (lazy ..) arguments.
2020-05-13 17:18:08 +02:00
David Allsopp 9c0412f41a Always permit triplet-prefixed ld in PACKLD
Fixes #7121
2020-05-13 10:21:46 +01:00
Xavier Leroy 3a408ff3e8
Modernize signal handling on Linux i386, PowerPC64, and s390x (#9543)
OCaml's signal handlers need to know the state of the processor when the signal was received. The approach standardized by the Single Unix specification is to use 3-argument signal handing functions and the SA_SIGINFO flag to sigaction. However, as the Linux man page for sigaction says,

Undocumented:
Before the introduction of SA_SIGINFO, it was also possible to get some
additional information, namely by using a sa_handler with a second
argument of type struct sigcontext. See the relevant Linux kernel
sources for details. This use is obsolete now.

For historical reasons, the i386, PowerPC and s390x Linux ports of OCaml still use the undocumented, obsolete approach, while the other Linux ports use the modern SA_SIGINFO approach. 

For consistency and future-proofing, this PR updates the i386, PowerPC64, and s390x Linux ports to use the modern approach to signal handling.  PowerPC32 was left as before because of technical subtleties and lack of hardware to test changes.

The new code for PowerPC 64 bits includes the trick proposed in PR#1795 to support Musl in addition to Glibc on ppc64le.
2020-05-13 11:15:13 +02:00
Jacques-Henri Jourdan aa64e70bc1 Changes 2020-05-11 15:56:13 +02:00
Florian Angeletti c86a5d8d11
#9189: avoid one-letter make variables (#9281) 2020-05-11 12:21:59 +02:00
Gabriel Scherer 3a43b84e8a compare: correctly compare a Closure_tag with an Infix_tag 2020-05-06 22:29:01 +02:00
Gabriel Scherer ffbea08d02 Changes entry 2020-05-06 12:10:02 +02:00
Xavier Leroy f2587c1fb1
Merge pull request #9529 from dra27/macos-gnu-make
Further C dependency fixes
2020-05-06 09:53:45 +02:00
octachron 273f2f8c7d Changes: move 9228 to 4.11.0 section 2020-05-05 15:12:42 +02:00
David Allsopp d4009ac4e3 Move 9437 to 4.10 2020-05-05 10:13:23 +01:00
David Allsopp 21654fcbf2 Move Changes entry for 9531 to 4.10 2020-05-04 14:28:48 +01:00
Hannes Mehnert 3f7e56c40d
configure: support bfd on FreeBSD (#9531)
On FreeBSD, libbfd is - similarly to OpenBSD - not installed by default, but
can be added via the devel/libbfd port. This will install libbfd into the
/usr/local prefix, thus configure needs to look there for include and library
2020-05-04 14:26:32 +01:00
Florian Angeletti 24806a0223
Merge pull request #9228 from yallop/map-documentation
Fix some issues in the Map documentation
2020-05-04 09:49:53 +02:00
David Allsopp 312ec987b6 Update Changes 2020-05-03 17:07:17 +01:00
KC Sivaramakrishnan 9355b4e8f5
Initialise in caml_obj_block / Obj.new_block only when necessary (#9513)
caml_alloc returns initialised blocks for tag < No_scan_tag. Otherwise,
initialise the blocks as necessary.

For Abtract_tag, Double_tag and Double_array_tag, the initial contents
are irrelevant.

Uninitialised Custom_tag objects are difficult to use correctly. Hence,
reject custom block allocations through Obj.new_block.

For String_tag, the last byte encodes the string length. Hence, reject
zero-length string objects. Initialise the last byte which encodes the
length to ensure non-negative lengths for uninitialised strings.
2020-05-02 18:47:16 +02:00
Gabriel Scherer 876af2567e
Merge pull request #9493 from trefis/rematch-matcher-unification
pattern-matching refactoring: merge the two matchers
2020-05-02 08:46:50 +02:00
Gabriel Scherer ae4621c03c Changes 2020-05-01 21:56:15 +02:00
David Allsopp c8dcbac5c9 Update Changes entry 2020-05-01 11:19:26 +01:00
Jeremy Yallop afe681cc16 Fix some issues in the Map documentation:
- Add the key argument in the description of 'merge'
  - Note that the keys of 'union f m1 m2' are a subset of the
    input keys, not all the keys, since

        bindings (union (fun _ _ _ -> None) m m) = []

  - Fix grammar in the descriptions of 'filter', 'union', 'merge'
  - Fix mismatched variable name in the description of 'partition'
  - Note that 'find' and 'find_opt' return values, not bindings
2020-04-30 16:10:00 +01:00
Enguerrand Decorne b7f0494df5 Rewrite the instrumented runtime to store traces in the CTF format.
The instrumentation code in the instrumented runtime was replaced
with new APIs to gather runtime statistics and output them in a new format
(Common Trace Format).
This commit also exposes new functions in the Gc module to pause or resume
instrumentation during a program execution (Gc.eventlog_pause and
Gc.eventlog_resume).
2020-04-30 10:32:01 +02:00
Jeremy Yallop 2e30946419
Support marshalling of bigarrays with dimensions that don't fit in 4 bytes (#8791)
Use a variable-length encoding (suggested by @stedolan) for dimensions that supports dimensions up to 2^64-1 each.

Change the marshalling identifier for bigarrays:_bigarray ~> _bigarr02
The identifier change reflects a change in the bigarray marshalling format.
2020-04-29 18:51:01 +02:00
Hannes Mehnert ec24f98bec
remove caml_init_ieee_floats() (#9506)
This used to call fpsetmask(0) on FreeBSD systems (< 4). FreeBSD 4 is not
anymore supported since 2007, it is safe to remove this code now.
2020-04-28 16:19:23 +02:00
Leo White f6e5592965
Merge pull request #9246 from lpw25/avoid-rechecking-functor-applications
Avoid rechecking functor applications
2020-04-28 12:04:47 +01:00
Stephen Dolan fa037cb0d6 Changes 2020-04-27 12:58:53 +01:00
Anarchos abfd5d87bb
Compiling for Haiku OS: network functions reside in libnetwork (#9486)
Compiling for Haiku : network functions reside in libnetwork
2020-04-27 10:36:28 +01:00
Xavier Leroy 080ac7421c
Update documentation for the Thread module and deprecate some functions (#9419)
- Deprecate Thread.kill, Thread.wait_read, Thread.wait_write
  for reasons explained in the documentation comments.
- Update documentation comments for Thread functions.
- Deprecate ThreadUnix module, documented as deprecated since 2002
  (commit 0a47a75d56).
- In the manual, remove leftover mentions of the VM threads
  implementation; focus on the system threads implementation.
- In the manual, remove the documentation of ThreadUnix.

Closes: #9206
2020-04-25 19:13:34 +02:00
Xavier Leroy 68c6f89409
Use diversion when calling external tools with a very long argument list (#9492)
It's not just on Windows that the length of the command passed to Sys.command
can exceed system limits:
- On Linux there is a per-argument limit of 2^17 bytes
  (the whole command is a single argument to /bin/sh)
- On macOS with default parameters, the limit is between 70000 and 80000
- On BSDs with default parameters, the limit is around 2^18.

In parallel, response files (@file) are supported by all the C compilers
we've encountered: GCC, Clang, Intel's ICC, and even CompCert.  They all
seem to follow quoting rules similar to that of the native shell
for the contents of the response file.

This commit forces the use of a response file when the total size of
the arguments to the linker is greater than 2^16.

Arguments passed via a response file are quoted using Filename.quote
as if they were passed on the command line.

Closes: #9482
Closes: #8549
2020-04-25 19:09:35 +02:00
Nicolás Ojeda Bär 1e98c52e93
Link std_exit.cmo into binaries compiled with -output-complete-exe (#9495) 2020-04-25 13:01:03 +02:00
Mark Shinwell df20ccf838 Fix recursive module initialisation that does not terminate (#9497)
This fixes the bug reported in issue 9494 and adds a test case.

Closes: #9494 
(cherry picked from commit ff98901d11fb01ba224772c402763df20d246635)
2020-04-24 17:50:19 +02:00
Leo White fdc21de7ca Add Changes entry 2020-04-24 16:37:14 +01:00
Nicolás Ojeda Bär 1eb26aefba Move Changes entry to the right place 2020-04-24 17:28:14 +02:00
Nicolás Ojeda Bär 8f3833c4d0
Add RISC-V native-code backend (#9441)
This is a port of ocamlopt for the RISC-V processor in 64-bit mode.
2020-04-24 16:04:50 +02:00
madroach 82700678b2
Don't include stdio.h in caml/misc.h (#9483)
* Don't include stdio.h in caml/misc.h
There is no need to include stdio.h in caml/misc.h
This seems to have happened by accident in commit cddec18fde
On OpenBSD, stderr and stdout are macros defined in stdio.h
ppx_expect uses stderr and stdout as identifiers in
collector/expect_test_collector_stubs.c where caml/misc.h is included.
This confuses the C compiler, because the macro will get expanded where an identifier is expected.

* Remove fallback NULL definition in caml/misc.h

ISO C guarantees that NULL is defined in <stddef.h>

* include missing stdio in tests/compatibility/stub.c
2020-04-24 14:27:32 +02:00
Leo White 2a50fef1ae
Merge pull request #9415 from lpw25/fix-open-struct-in-flambda-toplevel
Treat `open struct` as `include struct` in toplevel
2020-04-23 14:00:24 +01:00
Gabriel Scherer 4943a373f3
Merge pull request #9464 from gasche/rematch-exceptionless-matcher
pattern-matching refactoring: simplify `Default_env.specialize_matrix` by avoiding exceptions
2020-04-23 12:18:13 +02:00
Leo White 00a0c5a975 Add Changes entry 2020-04-23 10:51:44 +01:00
Thomas Refis 9f49a71e90
Add forgotten substitution when compiling anonymous modules (#9477)
Fixes #9375
2020-04-23 10:55:40 +02:00
Gabriel Scherer 6e153b1e71 matching: remove the OrPat exception by handling Tpat_or on the caller side
(This commit is more tricky than the previous ones in the patchset
and requires a careful review.)

This refactoring clarifies and simplifies the specialize_matrix logic
by getting rid of the OrPat exception used in a higher-order
way (or sometimes not used in certain matchers, when it is possible to
"push" the or-pattern down in the pattern). Instead it uses an
arity-based criterion to implement the or-pattern-related logic once
in the specializer, instead of having to implement it in each
matcher. As a result, the compiler improves a bit as it will push
or-patterns down during specialization in valid situations that were
not implemented before -- probably because they are not terribly
important in practice: all constant and arity-1 constructs benefit
from optimized or-pattern handling, in particular the following are
new:
- lazy patterns
- non-constant polymorphic variants
- size-one records and arrays
2020-04-22 21:32:38 +02:00
Damien Doligez ea4542d819 first commit after branching 4.11.0 2020-04-22 17:33:19 +02:00
Damien Doligez e92d13c986 last commit before branching 4.11 2020-04-22 17:28:08 +02:00
David Allsopp e6ab329541 Don't call the archiver/librarian for empty .cmxa 2020-04-22 14:56:02 +01:00
Xavier Leroy 83598da1ab
Merge pull request #9392 from stedolan/visit-once
Visit registers at most once in Coloring.iter_preferred.
2020-04-22 09:38:08 +02:00
David Allsopp a7dbb977de
Merge pull request #8631 from dra27/unify--c
Use same cflags and cppflags for ocamlc -c and ocamlopt -c (#7678)
2020-04-21 14:15:54 +01:00
Stephen Dolan d5dadae8ed
Make Cconst_symbol have typ_int to fix no-naked-pointers mode (#9282) 2020-04-21 12:06:19 +01:00
David Allsopp f4dc3003d5
Merge pull request #9457 from dra27/fix-mod_use
Fix #mod_use in toplevel
2020-04-20 16:13:26 +01:00
David Allsopp 515030352a Move Changes entry 2020-04-20 15:29:49 +01:00
Greta Yorsh 0ba942cb29 Add an entry to Changes 2020-04-20 13:59:09 +01:00
Florian Angeletti c5a1f91900
Merge pull request #9345 from Octachron/reproducible_env
Reproducible env summaries
2020-04-20 14:20:57 +02:00
Gabriel Scherer 702e34fbe5
Merge pull request #9463 from lthls/fix_int64_cmm_typ
Fix Cmm type of unboxed integers in Clet_mut
2020-04-20 11:34:15 +02:00
Florian Angeletti c041b0389e env summary: don't record implicit cmi files
We don't want to record the state of the file system at the start
of the compilation in the compiled files.
Consequently, we only add persistent modules to the env summary
if they have an observable action on the initial environment.
This is only the case if they shadow a non-persistent module of the
initially opened library (which can only be Stdlib currently).
2020-04-20 10:13:20 +02:00
Thomas Refis 0d92d18e61
Merge pull request #9411 from trefis/type_args-merge-sargs
forbid optional arguments reordering with -nolabels
2020-04-18 13:01:51 +02:00
Gabriel Scherer 5c0e138bb4 Changes entry 2020-04-18 11:43:09 +02:00
Xavier Leroy da12974492
Turn off PIE for musl-based Linux on platforms other than amd64 and s390x (#9456)
Alpine Linux and perhaps other musl-based Linux distributions produce
position-independent executables (PIEs) by default.  If non-PIC object
files are given to the linker, it silently produces a wrong executable
that crashes when run.  This is the case for ocamlopt-generated code,
which by default is not PIC except on amd64 (x86_64) and s390x (Z systems).

Closes: #7562
2020-04-18 11:16:23 +02:00
Thomas Refis a321395fca Further Changes 2020-04-18 11:09:32 +02:00
Thomas Refis 73a3f9083e Changes 2020-04-18 11:02:09 +02:00
Leo White a40889d6d9
Merge pull request #9393 from lpw25/improve-recmodule-usage-warnings
Improve recursive module usage warnings
2020-04-18 09:11:22 +01:00
Leo White 2c8f99e0ba Add Changes entry 2020-04-18 08:10:52 +01:00
Leo White 6dcb77077a Add Changes entry 2020-04-18 07:56:44 +01:00
Leo White adc354c167
Merge pull request #9452 from lpw25/add-locations-to-docstring-attributes
Add locations to docstring attributes
2020-04-17 22:30:36 +01:00
David Allsopp 5abff44a3f Fix #mod_use in toplevel
Regression from #9283.

Fixes #9455
2020-04-17 16:14:01 +01:00
Gabriel Scherer 9568154248
Merge pull request #9389 from Anukriti12/trunk
call_linker now returns exit_code for better user response on linking_error, fixes #7141
2020-04-17 17:05:56 +02:00
Florian Angeletti 9108648867
Merge pull request #9409 from Octachron/yet_another_implicit_deps_error
packed modtype lookup can fail due to missing cmi
2020-04-17 16:28:19 +02:00
David Allsopp c29450548a
Merge pull request #9057 from dra27/debugging-the-debugger
Aid debugging the debugger
2020-04-17 12:15:34 +01:00
Leo White a5da4162b1 Add Changes entry 2020-04-17 11:20:10 +01:00
octachron 35dbd85b3e packed modtype lookup can fail due to missing cmi
This commit removes an assert false and makes the missing
cmi case behaves like the abstract case.
2020-04-17 11:22:38 +02:00
David Allsopp 43c84d2750
Merge pull request #9335 from dra27/fix-stdlib-manpages
Correct implementation of --disable-stdlib-manpages
2020-04-17 10:17:16 +01:00
Leo White 59fac074fe
Merge pull request #9349 from lpw25/inline-hint
Add [@inlined hint] attribute
2020-04-17 08:27:58 +01:00
Xavier Leroy 67ada54ce3
Reimplement output_value using a hash table to detect sharing (#9353)
The previous implementation was doing temporary in-place modifications
of the OCaml value being marshaled.  This is incompatible with
Multicore OCaml.
2020-04-16 17:56:28 +02:00
Leo White 3dee10ec6a Add Changes entry 2020-04-16 15:58:09 +01:00
Gabriel Scherer 761383d597 Changes 2020-04-15 17:33:38 +02:00
Guillaume Munch-Maccagnoni b1fdc44547
Install a pretty printer for the Fun.Finally_raised exception (#9266) 2020-04-13 19:09:47 +02:00
Stephen Dolan 2208a4cbe6
Fix tail-call optimisation with a mutable ref (#9443)
Fix tail-call optimisation with a mutable ref
(Clet_mutable was not recognized properly in tail position.)

Add a test for tail-call optimisation with a mutable ref
2020-04-13 18:20:56 +02:00
Xavier Leroy 88a1bceb1b
configure: use cc as assembler with clang and for all FreeBSD platforms (#9437)
In recent FreeBSD, `cc` is Clang and `ld` is LLD, the LLVM linker, but
`as` is still GNU binutils.  Moreover, Clang contains its own
assembler and does not call `as`.  Consequently, object files produced
by invoking `as` directly are slightly different from those produced
by `cc`.

This can cause obscure errors such as issue #9068: `ld -r` fails when
combining objects produced by `as` and objects produced by `cc`.

The workaround is to use `cc` as the assembler.  We already did that
for the ARM and ARM64 targets, but #9068 shows that it is necessary
for AMD64 too.  Just use `cc` as assembler for all FreeBSD targets.

Similar issues were reported under Linux when clang and LLD are used
instead of GCC and binutils.  We already used clang as the preprocessed
assembler in this case.  Also use clang as the assembler in this case.

Closes: #9068
2020-04-11 11:17:11 +02:00
Xavier Leroy 286d4d6390 Update Changes for PR#9426 2020-04-08 19:17:36 +02:00
Jacques Garrigue d67c704c4d
In `{expr with ...}`, always evaluate `expr` even if all labels are redefined (#9432)
This commit reverts c1a7ace (originally c545e04), which was a
temporary fix that is no longer needed because it was superseded by
#6608.

The temporary fix caused `{expr with lbl1 = e1; ... }` to not evaluate
`expr` if all labels of its type are overriden.  As reported in #7696
this is not desirable.  Reverting the temporary fix causes `expr` to
be evaluated always.

As a consequence, a corner case of value "let rec" is no longer accepted.
The corresponding test was updated.

Closes: #7696
2020-04-08 18:58:43 +02:00
Xavier Leroy 3d4564c54b Update Changes 2020-04-08 10:13:19 +02:00
Xavier Leroy d235f167fa
PowerPC, System Z: do not reset backtrace_pos in caml_raise_exception (#9428)
* PowerPC, System Z: do not reset backtrace_pos in caml_raise_exception
* Add Changes entry
2020-04-07 15:47:55 +02:00
Gabriel Scherer 2e82c0e843 Changes entry for the refactoring of the pattern-matching compiler 2020-04-07 15:25:06 +02:00
Gabriel Scherer 7bc2663a0e
Merge pull request #9422 from Anukriti12/gcd
replaced fib example with gcd in coreexample.etex
2020-04-07 15:08:58 +02:00
Florian Angeletti abda688b03
Merge pull request #1706 from Octachron/extension_disambiguated_bis
Spellchecker hints and type-directed disambiguation for extensible variants: bis
2020-04-06 11:28:37 +02:00
Anukriti12 97b9bed89e replaced fib example with gcd in coreexample.etex 2020-04-05 16:54:36 +05:30
octachron 4f9f41e73a disambiguation for extension constructors
This commit exposes all extension constructors when looking up for
a construction with a given type in the environment.

This makes constructor disambiguation work for extension constructors.

Going one step further, when the name of an extension constructors
is misspelled, we cannot rely on the type to find all possible
names. However, since we are in an error path, we have some
path at hand.
Thus, this commit alters the "lookup_from_type" function in the
Constructor module to make it scan the whole environment for
extension constructors with the right type.

This commit should not change anything for labels and standard constructors.
2020-04-03 16:05:23 +02:00
Gabriel Scherer 1d76e2ca91
Merge pull request #9365 from gasche/Set-Map-filter_map
Map.filter_map and Set.filter_map
2020-04-02 17:59:51 +02:00
Gabriel Scherer 86066c8a59 Changes -- and justification.
On my machine, running the whole testsuite generates 1.5Gio of test
data. I have 11 workdirs for the OCaml repository (versions from 4.08
to trunk, plus several experimental workdirs); at any point in time
there can be more than a dozen gibibytes of test data on my disk, and
this is too much.

I use the test data saved by ocamltest when a test fails, to diagnose
the failure. I don't remember ever looking at the test data of
a succesful test.

The present patchset changes ocamltest to, by default, discard the
test directory of succesful tests -- the test artefacts are kept only
when there is a failure.

If one wishes to preserve the test data of succesful tests, one should
explicitly pass the -keep-test-dir-on-success flag. The
testsuite/Makefile is then changed to pass this flag if the user set
the KEEP_TEST_DIR_ON_SUCCESS variable to a non-empty value.
2020-04-02 16:19:56 +02:00
Gabriel Scherer 017d4a3ead
Merge pull request #9254 from gasche/memprof-record
Gc.Memprof.start: take a record instead of 5 optional parameters
2020-04-02 02:27:55 +02:00
Gabriel Scherer ff6b20098f Gc.Memprof.start: take a record instead of 5 optional parameters
The Gc.Memprof module provides a low-level API, that will hopefully be
paired with user libraries that provide high-level instrumentation
choices.

A natural question is: how are the higher-level API going to expose
their choice of instrumentation to their users? With the current
Memprof.start API (before this patch), they would have to either
provide their own `start` function wrapping Memprof.start, or provide
a tuple of callbacks for to their users to pass to Memprof.start
themselves.

    val start : params -> unit
    (* or *)
    val callback : params ->
      ((allocation -> foo option) * (allocation -> bar option) * ... )

With an explicit record, it is easier for libraries to expose an
instrumentation choice (possibility parametrized over
user-provided settings):

    val tracker : params -> (foo, bar) Gc.Memprof.tracker

In addition, providing a record instead of optional parameters makes
it much easier to provide "default settings" (helper functions) that
instantiates the types `'minor` and `'ḿajor`, see for example
`simple_tracker` in this patch (which stores the same information for
the minor and major heap, and does not observe promotion), or to later
define checking predicates that can verify that a given choice of
callbacks is sensible (for example: providing a major-dealloc callback
but no promotion callback (dropping all tracked value on promotion) is
probably not a good idea).

Bootstrap: to avoid requiring an awkward bootstrap, this commit keeps
the (now unused) function caml_memprof_start_byt unchanged -- it is
used in the bootstrap binaries, so removing it would break the
build. The intention is to remove it in the following commit.
2020-04-01 16:37:28 +02:00
Jeremie Dimino 05c209f5c9 Move changelog entry for #9344's fix in 4.10 section
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2020-04-01 14:41:28 +01:00
Gabriel Scherer 1cd6e4451f Map.filter_map and Set.filter_map 2020-03-31 15:01:41 +02:00
Stephen Dolan 89bb08b778 Changes entry 2020-03-31 12:34:02 +01:00
Anukriti12 7feaeb52a1
Merge branch 'trunk' into trunk 2020-03-31 15:50:39 +05:30
Gabriel Scherer f8758a8bf8
Merge pull request #9403 from muskangarg21/warn67
Added warning 67 description and nitpick for "."
2020-03-31 10:34:34 +02:00
muskangarg21 e831b47457 Added: Warning 67 description. 2020-03-30 21:51:54 +05:30
Sébastien Hinderer d51d823326
Merge pull request #9222 from gasche/fix-ocamltest-dependencies
fix Makefile dependencies of ocamltest
2020-03-30 17:31:58 +02:00
YOSHIMURA Yuu 49d0580093
Remove sudo:false in .travis.yml (#9402) 2020-03-28 17:15:48 +00:00
Gabriel Scherer f4915d5f20 minor Changes change 2020-03-28 16:48:30 +01:00
octachron 3e7de343e7 fix attribute examples in the manual 2020-03-27 17:12:23 +01:00
muskangarg21 4019c33aaa
Stdlib: added Printf.ikbprintf, Printf.ibprintf (#9364) 2020-03-26 14:28:00 +01:00
Greta Yorsh 824ce35492
Replace caml_int_compare and caml_float_compare with primitives (#2324) 2020-03-26 10:58:10 +01:00
Gabriel Scherer bc3246c528
Merge pull request #9374 from muskangarg21/refactor
Refactor typing/typeclass.ml class environments
2020-03-25 21:50:56 +01:00
Stephen Dolan b4e34ae220 Fix Changes entry 2020-03-25 15:31:53 +00:00
muskangarg21 52dc5d793b [Refactor]: Typing/typeclass.ml 2020-03-24 04:33:45 +05:30
Anukriti12 8f235efdf5 call_linker now returns exit_code for better error response on linking_error, fixes #7141 2020-03-23 06:12:05 +05:30
David Allsopp e4f3aa8c81 Don't assume . in AWKPATH
Ensure all script invocations explicitly refer to a directory.
2020-03-20 09:38:33 +00:00
Jérémie Dimino c7de942730
Fix #9344 (#9368)
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2020-03-17 11:38:45 +00:00
Stephen Dolan 6246d5ce03
Merge pull request #9367 from stedolan/unify-backtraces
Make bytecode and native-code backtraces agree
2020-03-17 10:45:34 +00:00
Florian Angeletti 3dd86faa2c
Merge pull request #9357 from muskangarg21/makedepend
[Ocamldep] [TOOLS] : -nocwd argument to not include current dir to search path
2020-03-17 10:18:31 +01:00
Gabriel Scherer 18e545207d
Merge pull request #9362 from stedolan/memprof-debuginfo-fix
Avoid looking up nonexistent Comballoc debuginfo
2020-03-17 06:57:02 +01:00
Stephen Dolan 97f15cde1c Changes entry 2020-03-16 18:15:09 +00:00
Jérémie Dimino e54876a869
Add a new toplevel directive #use_output "<command>"
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
2020-03-16 17:48:41 +00:00
muskangarg21 e0b31a6abc TOOLS: Ocamldep arg to not include current dir to search path 2020-03-16 01:00:08 +05:30
Gabriel Scherer c811c713f1 minor Changes files 2020-03-14 15:10:38 +01:00
Nicolás Ojeda Bär 57d329e07b
Deprecate -annot (#2141)
* Move driver code from Cmt2annot to Read_cmt
* Move cmt2annot.ml into typing/
* make depend
* Use standard error handling
* Move specific logic to read_cmt
* Do not pass full cmt record as argument
* Better locations
* Emit .annot files produced from cmt data
* Remove direct calls to Stypes
* Deprecate -annot
* Changes
* make depend
* Adapt doc
* make -C tools depend
2020-03-13 12:59:34 +01:00
Stephen Dolan 05afee9edd Avoid looking up nonexistent Comballoc debuginfo 2020-03-12 13:19:32 +00:00
Florian Angeletti 95a5399b28
ocamldebug: initialize all functions in Env (#9356)
Switch ocamldebug to compiler-libs in order to avoid hidden dependencies issue. 

In particular, the Env module is only fully initialized after the Typemod and Includemod modules have been linked. Calling `Env.find_type` before that initialization may result in an assert false when functor-derived types are involved.
2020-03-11 09:44:00 +01:00
Stephen Dolan 4d4a056bc7
Micro-optimise allocations on amd64 to save a register (#9280)
There's no need for allocation on amd64 to clobber the %rax register. It's only used in one case (-compact out-of-line allocation of >3 words), and only used there to do a single subtraction. That subtraction can be done by the caller at no code size penalty, freeing up %rax.

Inside amd64.S functions, %r11 can be used instead of %rax as temporary.  %r11 is destroyed by PLT stub code, so on ELF platforms it costs nothing to use.
2020-03-09 19:52:36 +01:00
Gabriel Scherer 0fff7a43c5
Merge pull request #9196 from gasche/clarify-disambiguation-3
disambiguation: improve the interface of `NameChoice.disambiguate`
2020-03-09 13:39:32 +01:00
Gabriel Scherer bf6c8d4b95 disambiguation: improve the API of NameChoice.disambiguate 2020-03-07 14:35:05 +01:00
Thomas Refis c323d11144
Merge pull request #8934 from trefis/usage
Stop relying on location to track usage
2020-03-06 16:49:44 +01:00
Florian Angeletti b82d5194c2
Merge pull request #9343 from lpw25/fix-short-paths-environments
Re-enable `-short-paths` for some error messages
2020-03-06 09:38:40 +01:00
Sébastien Briais cc4a075e9b
Define Seq.cons and Seq.append. (#9077)
* Define Seq.cons and Seq.append.
2020-03-06 09:26:38 +01:00
Stephen Dolan 0c39193cc2
Merge pull request #9316 from stedolan/cmm-let-mut
Use typing information from Clambda for mutable Cmm variables
2020-03-05 14:08:04 +00:00
Stephen Dolan a2800410cf update Changes 2020-03-05 12:52:08 +00:00
Thomas Refis 6063e73d3a Changes 2020-03-05 13:35:14 +01:00
Thomas Refis 70370d7004
Merge pull request #9275 from lpw25/short-circuit-simple-inclusion-checks
Short circuit simple inclusion checks
2020-03-05 12:03:24 +01:00
Leo White c5bd0d8d6b Add Changes entry 2020-03-05 09:44:18 +00:00
Leo White 7b99835711 Add Changes entry 2020-03-04 15:34:23 +00:00
Leo White 190637137a Add Changes entry 2020-03-04 14:42:05 +00:00
David Allsopp 9c5d7c1112 Correct implementation of --disable-stdlib-manpages 2020-02-26 15:07:17 +00:00
David Allsopp fb375c5c42 Reformat .travis.yml env blocks 2020-02-26 11:21:02 +00:00
David Allsopp ac2a9dd188 Cease committing C dependendency information
When building for the first time, the only requirement is that generated
header files have been built (jumptbl.h, version.h and opnames.h).
Detailed dependency information is only required when headers have been
edited.

COMPUTE_DEPS in Makefile.config controls whether C dependency
information should be generated on a per-file basis. This variable is
controlled by a new --disable-dependency-generation in configure which
is enabled for Git checkouts and disabled for tarballs (i.e. releases).

The Microsoft C compiler (cl) cannot generate dependencies in a
consistent way which we can consume, so for a Git checkout configure
searches for an additional C compiler in order to compute dependencies.
This is obviously not required for a user-build.

As a result, the MSVC port can now safely run make alldepend, since only
OCaml dependency information is committed to the repo after this change.

CI does not need to waste time testing the dependency information,
because it only tests a single build. A single Travis job has been added
which tests the build system code to generate the dependency information
(and provides a single `make -j` run in CI, although Inria's CI also
tests parallel building continuously).
2020-04-17 14:11:22 +01:00
Glenn Slotte 4823934182
Document base case of List.for_all and List.exists (#9325)
* Document the base case (`[ ]`) of List.for_all and List.exists
2020-02-26 09:51:01 +01:00
Stephen Dolan 1336ce0c0d Use typing information from Clambda for mutable Cmm variables 2020-02-25 15:03:14 +00:00
Nicolás Ojeda Bär e35105a9bb Fix typo in Changes 2020-02-22 10:20:11 +01:00
Gabriel Scherer 9d8897db14
Merge pull request #9318 from trefis/empty_in_or_pattern
Fix exhaustivity checking in presence of empty types
2020-02-21 13:12:34 +01:00
Stefan Muenzel 96f36f6bc9 move changes from 4.09 to 4.10 2020-02-21 08:24:35 +08:00
Thomas Refis 5422ba1345 Changes 2020-02-19 10:39:43 +01:00
Florian Angeletti eda8b362c2
Merge pull request #9311 from shindere/fix-bfd-libraries-detection
Yet another fix to BFD support
2020-02-18 12:26:33 +01:00
Florian Angeletti e03e29fd6d
Merge pull request #9182 from gasche/clarify-disambiguation-2
NameChoice (disambiguation): more refactoring
2020-02-18 12:25:15 +01:00
Sébastien Hinderer eb2fe19be7 Yet another fix to BFD support
This commit uses the previously computed set of options for linking
dynamic libraries (DLLIBS) in stead of hard-coding "-ldl" when trying
to find which libraries to link to get BFD support.

For instance, this fixes the build on OpenBSD64 where the use of
"-ldl" caused an error.
2020-02-17 14:46:28 +01:00
octachron dcebfa1617 output-complete-obj .so: link runtime c libraries
This commit align the behavior of output-complete-obj and output-obj
when building shared libraries
2020-02-17 10:10:45 +01:00
Arseniy Alekseyev 59ca2a6350
Merge branch 'trunk' into faster-Weak.blit 2020-02-14 11:56:51 +00:00
David Allsopp 648d7a4a3f
Merge pull request #9250 from dra27/disable-ocamltest
Add --disable-ocamltest to configure
2020-02-14 10:32:43 +00:00
Florian Angeletti 9b36ee9cda
Merge pull request #9302 from shindere/bfd-ld
Fix support for the bfd library
2020-02-14 10:15:51 +01:00
David Allsopp fd6c0e3a03 Don't built ocamltest on release builds
--enable-ocamltest is paranoidly included in the CI scripts, although
the trees are never pushed with a release VERSION at the tip.
2020-02-13 16:53:07 +00:00
Sébastien Hinderer 4199406243 Fix support for the bfd library
There was a regression: -ldl was not tried to link with the bfd library.

This commit fixes this regression.
2020-02-13 17:42:10 +01:00
David Allsopp d26d37bf97
Merge pull request #1176 from dra27/c89_headers
Aid compatibility with older Microsoft C compilers
2020-02-13 15:17:30 +00:00
Arseniy Alekseyev 629585da20
Merge branch 'trunk' into faster-Weak.blit 2020-02-13 13:25:22 +00:00
Florian Angeletti 72a6fa423e
Merge pull request #9300 from Octachron/manual_split_expression_grammar
manual: reference chapter, split the grammar of expressions
2020-02-12 14:32:55 +01:00
Florian Angeletti 23b9369a9b manual: reference, split expression grammar 2020-02-12 10:58:20 +01:00
David Allsopp a87ad8f18b Use -Wdeclaration-after-statement
This GCC flag encourages development of C files which will compile
without error on older Microsoft C compilers.
2020-02-11 10:07:04 +00:00
David Allsopp ecb79b2d56 Fix spacetime builds 2020-02-11 10:00:53 +00:00
Florian Angeletti edabf2008c Merge pull request #9292 from lpw25/fix-best-fit-32-bit
Fix bug in best-fit on 32-bit

(cherry picked from commit 9e52341ece4e8c73087d622d2900cf3a97c6fe7b)
2020-02-11 10:45:36 +01:00
David Allsopp e5ca88f4fe Remove erroneous inline from runtime/win32.c 2020-02-11 09:34:23 +00:00
David Allsopp 3aab294513 Replace static inline with Caml_inline
The inline keyword is consequently no longer forced on MSVC builds.
2020-02-11 09:33:55 +00:00
Nicolás Ojeda Bär 87296ee8e0
Dynlink: preserve module initializers backtrace (#9183)
* dynlink: preserve backtrace of module initializers
* Stabilize debug event sort
* Update test reference file
2020-02-06 07:21:23 +01:00
Gabriel Scherer edee8cea3e
Merge pull request #9279 from stedolan/optimise-callstacks-again
Avoid scanning the stack twice when collecting callstacks in Memprof.
2020-02-05 17:15:14 +01:00
Stephen Dolan d6a3a8c58e
Merge pull request #9277 from dbuenzli/objinfo-c-metadata
Objinfo c metadata
2020-02-04 15:53:37 +00:00
Stephen Dolan 20f6a17ae3 Review 2020-02-04 11:03:07 +00:00
Stephen Dolan 060f6e8e47 Avoid scanning the stack twice when collecting callstacks in Memprof. 2020-02-03 10:51:53 +00:00
Pieter Goetschalckx 99224a96b7
Quoted extensions in comments, ocamllex and ocamlyacc (#9166)
* Support quoted extensions in comments
* Support quoted extensions in ocamllex
* Support quoted extensions in ocamlyacc
* Fix copying of comments in ocamlyacc
2020-02-03 10:55:28 +01:00
Daniel Bünzli 47b9410b33 objinfo: print cm[x]a extra C object, options and dlls in the cli order.
Follow up to #4949. Closes #9276.
2020-01-31 15:12:47 +01:00
Florian Angeletti c7b1fe8513
manual: a cautionary internal runtime API section (#9257) 2020-01-31 13:54:31 +01:00
Florian Angeletti 38230a7fa7
Merge pull request #9274 from Octachron/unload_module_lookup
Printtyp: don't touch the file system
2020-01-31 13:44:57 +01:00
Gabriel Scherer 5d3fc5692a
Merge pull request #9271 from stedolan/bytecode-backtrace-fix-again
Fix bytecode backtrace generation when large integers are present.
2020-01-31 08:57:11 +01:00
Florian Angeletti 51292c2956 Printtyp: don't read cmis when printing
This commit adds a function in Printtyp for searching elements of
the printing environment without reading cmis.
This function is used to ensure that the printing of types does not
trigger unrelated errors by trying to access cmis on the file system.
2020-01-30 18:07:59 +01:00
Gabriel Scherer e1addb7962
Merge pull request #9269 from Octachron/fix_annot
#9218: wrong file name error with -annot and inline records
2020-01-30 08:41:20 +01:00
Florian Angeletti 807c162069 Move change to 4.10 2020-01-29 17:06:10 +01:00
Arseniy Alekseyev 315620d22f
Merge branch 'trunk' into faster-Weak.blit 2020-01-29 13:30:09 +00:00
Stephen Dolan 8dd88c792d Fix bytecode backtrace generation when large integers are present.
Again.
2020-01-29 10:14:33 +00:00
Gabriel Scherer 13ab6b4a64
Merge pull request #2188 from rlepigre/recursive-yet-unboxed
Recursive yet unboxed
2020-01-29 10:16:33 +01:00
Florian Angeletti 62699c1ce3 review 2020-01-29 10:00:15 +01:00
Gabriel Scherer 7e41a961e9
Merge pull request #9268 from stedolan/bytecode-backtrace-fix
Fix bytecode backtrace generation when large integers are present
2020-01-28 22:39:30 +01:00
Stephen Dolan d0e0cc8280
Merge pull request #9230 from stedolan/memprof-native
Memprof support for native allocations
2020-01-28 16:59:11 +00:00
Florian Angeletti 9f696f0a8e 9218, avoid module/type path collitsion
In presence of -annot, the type printer can be requested to print the
inner path of inline records (i.e "t.A"). Before this commit, the
printing of these paths could trigger a lookup to a module with a
invalid name "t".
If this lookup fails this is fine.
However, if there is a cmi file in the environment sharing the name "t",
the lookup can partially succeed (since cmi are not required to start
with a capital letter) until we compare the module name stored in the
cmi with the requested module name.
Obviously, the valid module name "T" of the cmi cannot match the invalid
module name "t" that was requested, and the cmi reader raises a wrong
module file name error.

This commit avoids this whole process by detecting in the type printer
when we are printing an inlined record type constructor.
2020-01-28 16:30:56 +01:00
Arseniy Alekseyev e447fb152b Make `Weak.blit` and `Ephemeron.blit_key` faster 2020-01-28 15:04:07 +00:00
Stephen Dolan 994cf75fbc Fix bytecode backtrace generation when large integers are present 2020-01-28 15:00:11 +00:00
Rodolphe Lepigre e8533dcb0e Update changelog. 2020-01-28 12:09:33 +01:00
Raphael Sousa Santos c9d7cc7da4 Add Printexc.default_uncaught_exception_handler (issue #9248)
Printexc.uncaught_exception_handler ceases to be an option ref and becomes
a ref to the handler function initialized to
Printexc.default_uncaught_exception_handler.
2020-01-26 12:00:27 +01:00
Stephen Dolan 07bf49db5b Statmemprof support for native allocations (incl. Comballoc) 2020-01-25 22:55:56 +01:00
Gabriel Scherer d408e58ea1
Merge pull request #9261 from lthls/rec_check_ignore_fix
Fix soundness bug in Rec_check with anonymous let module
2020-01-24 22:06:37 +01:00
Gabriel Scherer a6825861ee
Merge pull request #9247 from jhjourdan/memprof-byte-loc
Memprof: get precise callstacks when memory is allocated directly in the bytecode interpreter
2020-01-24 22:06:00 +01:00
Vincent Laviron 6bc250e8e6 Rewrite Changes entry 2020-01-24 18:12:04 +01:00
Vincent Laviron 930ec4a9b4 Move Changes entry to 4.10 2020-01-24 18:11:00 +01:00
Vincent Laviron 236e15fbae Update Changes 2020-01-24 17:05:52 +01:00
Vincent Laviron e67806a1aa Changes 2020-01-24 14:32:12 +01:00
Gabriel Scherer 646d30404e Merge pull request #9253 from Octachron/easier_compat
4.10, #9205: move back caml_* to thematic headers

(cherry picked from commit 036495ba5c97ff96962d1e6f746e72a5836a4946)
2020-01-21 22:02:57 +01:00
Florian Angeletti dc56d71b53 types: allow class type paths in #t 2020-01-20 17:21:02 +01:00
Leo White 33d4540a9d Add Changes entry 2020-01-20 13:48:16 +00:00
David Allsopp b03c1c78c7 Add --disable-ocamltest 2020-01-16 16:50:27 +00:00
David Allsopp 075154df54 Define ARCH_ALIGN_INT64
Missed in the autoconf conversion
2020-01-16 16:03:17 +00:00
Gabriel Scherer 82d7971b4f
Merge pull request #9237 from gasche/format-update-geometry
Format.pp_update_geometry: formatter -> (geometry -> geometry) -> unit
2020-01-15 22:37:37 +01:00
Jeremy Yallop 73a37d45f8 Add Seq.unfold. 2020-01-15 15:38:46 +00:00
Jacques-Henri Jourdan c4d7bcd352 Memprof: get precise callstacks when memory is allocated directly in the bytecode interpreter.
This includes two changes: first, in bytegen.ml, we add a pseudo-event after every allocation or closure instruction. Second, in the interpreter, we save the current PC in the interpreter stack in [Setup_for_gc].
2020-01-15 11:59:51 +01:00
Gabriel Scherer c41b282899 Format.pp_update_geometry: formatter -> (geometry -> geometry) -> unit
This lets users write code that is robust to the addition of new
geometry fields.

    Format.(pp_update_geometry ppf (fun geo -> {geo with ...}))

Today the only way to set the geometry is

    Format.pp_set_geometry ppf ~margin ~max_indent

we cannot add optional parameters after the [ppf] argument, and adding
new labeled parameters would break user code.

(Also: it's often convenient to work with the record directly, for
example to reset a previous geometry saved with [pp_get_geometry];
this is indirectly provided by [pp_update_geometry].)
2020-01-14 16:26:21 +01:00
Gabriel Scherer 09da7dd659 [minor] fix PR number in Changes
(report by Gaëtan Gilbert)
2020-01-14 15:35:29 +01:00
Jacques-Henri Jourdan e1a22e80fb Memprof API: cannot be start if already running, cannot be stopped if not already running. 2020-01-14 10:42:16 +01:00
Jeremy Yallop 38eb6d5f64
Add Array.for_all2 and Array.exists2 (#9235)
* Partially revert "Removed for_all2, exists2 and find again."

This partially reverts commit 83dcf62ebf.

(Restore for_all2 and exists2.)

* Partially revert "Fixed typos and changed exists2 and for_all2."

This partially reverts commit 7a082785be.

* Array.(for_all2,exists2): simplify documentation; add @since annotations

* Changes: remove trailing whitespace
2020-01-13 13:52:39 +00:00
Jacques-Henri Jourdan 0c8416478c Drop support for tags in memprof.
They are somewhat difficult to handle for native allocations, and it is not clear how useful they are. Moreover, they are easy to add back since [Gc.Memprof.allocation] is a private record.
2020-01-11 13:19:10 +01:00
Gabriel Scherer 8a79f6ce59
Merge pull request #9021 from Octachron/longident_parser
Expose parsers for Longident.t
2020-01-10 11:23:09 +01:00
Florian Angeletti 4fdba2f638 Merge pull request #9185 from hhugo/fix-unused-open
fix spurious 'unused open' warning with classes and polymorphic variants

(cherry picked from commit d2c4e791fad6340c74abf741af3e79eb1f9c20d7)
2020-01-10 09:49:02 +01:00
Gabriel Scherer 8d8e991ced
Merge pull request #9208 from gasche/dno-locations
-dno-locations: hide source locations (and debug events) from intermediate-representation dumps
2020-01-10 06:56:48 +01:00
Florian Angeletti 40e40a9c20 compilerlibs: expose parsers for 'Longident.t's 2020-01-09 16:45:39 +01:00
Gabriel Scherer fc9f00509d Changes entry for #9212
(cherry picked from commit 7bf11b9d8c79b187d7b460f1656d601f6a29a1a0)
2020-01-09 15:28:42 +01:00
Gabriel Scherer 8938886721 -dno-locations: hide source locations (and debug events) from IR dumps
This PR was tested with also the -dsel, -dlinear output (also fixed to
not-print locations), but the output is architecture-dependent so this
part of the test was removed.
2020-01-09 15:25:16 +01:00
Stephen Dolan 7c281fd8c3 changes 2020-01-09 11:00:48 +00:00
Stephen Dolan ad76dbe42d Restore the bytecode stack after an allocation.
If an asynchronus callback does enough calls to reallocate the
stack, then the interpreter should restore it from extern_sp
after the GC returns.
2020-01-09 10:57:07 +00:00
Gabriel Scherer 96c3ed8859
Merge pull request #9231 from jhjourdan/after_event_c_tailcall
Make ocamlc preserve events after primitives even if they are at tail position.
2020-01-09 10:00:24 +01:00
Jacques-Henri Jourdan 52661f14a4 Make ocamlc preserve events after primitives even if they are at tail position. 2020-01-09 00:16:42 +01:00
Gabriel Scherer 0a0078b91d Changes: 8190 was cherry-picked in the 4.09 branch 2020-01-08 10:27:29 +01:00
Gabriel Scherer 57d0b65e52 Changes: 8855, 8858 were backported into 4.09 (a while ago) 2020-01-08 10:27:29 +01:00
Gabriel Scherer 9e4528b104 Changes: #9128 was cherry-picked in the 4.09 branch 2020-01-08 10:27:29 +01:00
Gabriel Scherer 73bed21afe
Merge pull request #9225 from stedolan/bytecode-debug-info-dropped
Do not drop bytecode debug info after C calls
2020-01-07 22:05:09 +01:00
Stephen Dolan 2d21433573 Do not drop bytecode debug info after C calls 2020-01-07 10:32:41 +00:00
Jacques-Henri Jourdan 975bc47f51 Make sure the atom table and minor heap have their own dedicated pages.
We need to make sure they do not share a page with code, otherwise the
GC and the polymorphic hash and comparison functions will follow code
pointers and potentially trigger a segfault.
2020-01-06 14:16:12 +01:00
Gabriel Scherer d45e39d1fd fix Makefile dependencies of ocamltest
The ocamltest modules depend on core-compiler modules and get linked
with compilerlibs archives, but those dependencies were not recorded
in the makefile, leading to incremental build errors.

(A particular error I encountered is that ocamltest/Ocaml_actions now
depends on Lambda through Cmo_format, but was not correctly rebuilt
after Lambda changes, leading to link-time failure when linking
ocaml_actions.cmo and ocamlcommon.cma together.)

This commit adds dependencies on the compilerlibs archives, as a proxy
for the corresponding compiler modules.
2020-01-06 12:30:48 +01:00
Gabriel Scherer ec1a31369a
Merge pull request #9215 from gasche/improve-dynlink-dependencies
dynlink: improve dynlink_compilerlibs dependencies
2020-01-06 11:36:27 +01:00
Gabriel Scherer 8b17107737 dynlink: improve dynlink_compilerlibs dependencies
Before this PR, dynlink_compilerlibs/foo.cmi would not depend on
dynlink_compilerlibs/foo.mli, resulting in object files not being
properly recomputed in incremental-rebuild scenarios.

Before dynlink_compilerlibs/foo.mli depends on
dynlink_compilerlibs/.depend which in turn depends on all copied
source files, the present change has the impact of having the .depend
being regenerated much more often. We change its generator from
$(CAMLRUN) boot/ocamlc to $(BEST_OCAMLDEP) (using ocamlc.opt
when available); on my machine, when ocamlc.opt is available, the
.depend step goes from 0.6s to 0.2s.
2020-01-04 15:16:27 +01:00
Gabriel Scherer 2fba4c0ce6 Changes: missing reviewer 2020-01-03 18:15:57 +01:00
Gabriel Scherer 52b5815d7e compilerlibs archives: add dependencies on .mli-only compilation units
Before this commit, the Makefile for compilerlibs archives only tracks
their dependencies on implementation object files (.cmo,
.cmx). .mli-only files in those directories result in a .cmi without
a .cmo.

The main makefile uses dependencies on compilerlibs archives as
a proxy for all dependencies on the corresponding compiler
modules. This assumption was broken by .mli-only modules not being
dependencies on the archives.

For example, rebuilding compilerlibs archives would not refresh
file_format/cmxs_format.cmi. The following steps would lead to a build
failure:

    make core
    make ocamltools
    <add a new blank line at the beginning of utils/misc.mli>
    make ocamltools

    File "/home/gasche/Prog/ocaml/github-trunk/tools/objinfo.ml", line 1:
    Error: The files /home/gasche/Prog/ocaml/github-trunk/utils/misc.cmi
           and /home/gasche/Prog/ocaml/github-trunk/file_formats/cmxs_format.cmi
           make inconsistent assumptions over interface Misc
2019-12-26 21:09:13 +01:00
Xavier Leroy 584b1429e9 Fix Changes entry for #9207 #9210 2019-12-26 13:25:47 +01:00
Andreas Abel 0d97917cd2 Make sure ocamlyacc can handle 255 entry points (#9210)
The previous promised limit of ocamlyacc was 256 entry points, but
on some platforms (x86 at least) the actual limit was 127 due to representation of 
bucket->entry as char.  Switching to unsigned char extends the limit to 255.

I introduced a constant MAX_ENTRY_POINT as a synonym of MAXCHAR to
handle checks against the limit consistently over the different modules
of ocamlyacc.

Extensions beyond 255 entry points would require a bit more work (which
looks unrewarding) since entry points are currently identified by a single byte
at the beginning of the input stream.

Fixes: #9207
2019-12-26 11:02:13 +01:00
Armaël Guéneau 61d2352dc9
Merge pull request #9197 from gasche/improve-lambda-printing
formatter margins and color handling: revert #244
2019-12-21 16:07:16 +01:00
Gabriel Scherer 8c36e799b0 revert #244
The logic in this patch is wrong:
- setting the margins is not the responsibility of the color-handling code
- because setup_colors is called at inpredictable times (on the first error/warning),
  the logic makes it very difficult to correctly set margins for `{str,err}_formatter`

The patch was originally proposed in the caml-list discussion
  https://sympa.inria.fr/sympa/arc/caml-list/2015-09/msg00164.html
but it does not convincingly solve the problem:
- there is no reason to use `std_formatter`
  rather than `err_formatter` as a reference, and
- the user can set the both margins themselves anyway.

In particular, since the 4.08 changes to error/warning
representations, we don't use intermediary formatters anymore to
produce error/warning messages, so setting `Formatter.std_formatter`
directly works as expected *when* this formatter is used to print to
the toplevel (the current default, which may change in the future).

Note: We have an API in `Location` to access and configure
error/warning formatters, but it is not accessible from the
toplevel. Changing the margins without using this API is fragile.
For example, utop and expect-tests change the formatter away from the
default.
2019-12-21 15:44:42 +01:00
Jacques-Henri Jourdan 7dbbfce890 New ephemeron-free API for Memprof.
The user can register several callbacks, which are called for various
events during the block's lifetime. We need to maintain a data
structure for tracked blocks in the runtime. When using threads,
callbacks can be called concurrently in a reentrant way, so the
functions manipulating this data structure need to be reentrant.
2019-12-21 10:21:48 +01:00
Gabriel Scherer 0da925c68d
Merge pull request #9193 from stedolan/matching-switch-tuple
Make tuple matching optimisation apply to Lswitch and Lstringswitch
2019-12-19 16:20:20 +01:00
Stephen Dolan 291cbaf1d1 Make tuple matching optimisation apply to Lswitch and Lstringswitch. 2019-12-19 14:29:34 +00:00
Gabriel Scherer 8703865a3a Changes entry 2019-12-19 13:28:37 +01:00
JPR b15df35b62 Fixing people's names 2019-12-17 21:11:37 +01:00
Sébastien Hinderer a831ba1adc objinfo_hellper fix
This commit modifies objinfo_helper so that the caml_plugin_header
symbol is also looked up in the static symbol table, if it is
not found in the dynamic one.

This is useful e.g. on Windows where the symbol can not be found
without this commit.

It is also necessary to look for the _-prefixed version of the symbol.
2019-12-17 10:10:14 +01:00
Gabriel Scherer 8eb54e9265
Merge pull request #9178 from gasche/clarify-disambiguation
NameChoice (disambiguation): minor refactoring
2019-12-16 11:16:48 +01:00
Gabriel Scherer 7623001b88 name disambiguation: more structure for type kinds
(joint work with Thomas Refis)
2019-12-12 21:04:33 +01:00
Xavier Leroy b332ce73da Update Changes for PR#9180 2019-12-12 19:20:42 +01:00
Gabriel Scherer 5b1b8dad1a
Merge pull request #9169 from gasche/best-fit-manual
better documentation for the best-fit allocation policy
2019-12-11 10:01:12 +01:00
Gabriel Scherer 238e483eb8 better documentation for the best-fit allocation policy 2019-12-10 21:40:50 +01:00
Stephen Dolan 0d666df3fc Move a wayward Changes entry 2019-12-10 08:26:30 +00:00
Florian Angeletti fe993d4948 Changes: move #8844 to the user-interface section
(cherry picked from commit cd1e05fe8d0fcb09a35425acde6cb8e421d81a85)
2019-12-09 17:02:43 +01:00
madroach 34e6149044 win32unix: Register printer for Unix_error (#9106)
Just like we do in the otherlibs/unix/ implementation of the Unix module.
2019-12-07 19:24:10 +01:00
Gabriel Scherer 5736ae5091 reorder 4.10 Changes entries and fill missing details 2019-12-07 17:07:02 +01:00
Gabriel Scherer 12b041eef9 [minor] Changes fixes 2019-12-07 09:01:16 +01:00
Florian Angeletti 721c182dfc manual: changes and documentation 2019-12-06 10:09:21 +01:00
Florian Angeletti f4c5373d58 manual: add links to section anchors 2019-12-05 17:15:38 +01:00
Fourchaux 1f9474c63c Fixing typos (#9162) 2019-12-04 19:38:02 +00:00
Gabriel Scherer f572295def
Merge pull request #463 from gasche/robust-ocamlobjinfo
objinfo: tell when the object file comes from a different OCaml version
2019-12-03 10:36:13 +01:00
Gabriel Scherer 314154ad69 objinfo: tell when the object file comes from a different OCaml version
When passed an object file that comes from a different OCaml version,
objinfo will currently just detect that the magic number is not what
it expects, and claim it is not a valid file. This is irritating.

The error message output by objinfo now looks like this:

    File /home/gasche/.opam/4.08.0/lib/astring/astring.cmi
    Wrong magic number:
    this tool only supports object files produced by compiler version
    	4.11.0+dev0-2019-10-18
    This seems to be a compiled interface file (cmi) for an older version of OCaml.
2019-12-03 00:08:30 +01:00
Gabriel Scherer 9d81d6a10e new Misc.Magic_number module for magic number handling
This module was originally inspired by js_of_ocaml Misc.MagicNumber module
https://github.com/ocsigen/js_of_ocaml/blob/151b811/compiler/util.cppo.ml#L277-L347

It provides parsing and validation function for magic numbers, that
can tell the difference between "not a valid magic number" and "a
valid magic number, but with another version", and print user-friendly
user messages about it.

It does not contain any knowledge for where to find the magic number
in an OCaml file (this depends on the file format); the parsing
function should be called with an input channel already at the right
position for whichever format is expect.
2019-12-03 00:08:29 +01:00
Jacques Garrigue 27ef14dab9
Fix exhaustivity of GADTs coming from incomplete unification (#9154) 2019-12-02 20:49:51 +01:00
Sébastien Hinderer 1c0424c80e ocamltest: draft of reference manual (tutorial section) 2019-11-28 18:04:53 +01:00
Sébastien Hinderer 69316099b0 Fix BFD support on OpenBSD 2019-11-28 16:20:03 +01:00
Florian Angeletti 92c7fd19e3 update Changes 2019-11-28 11:46:22 +01:00
Greta Yorsh 6daaf62904 Do not emit references to dead labels (spacetime) (#9097) 2019-11-26 12:06:19 +00:00
Gabriel Scherer 05f15cf215
Merge pull request #8820 from Drup/stringquot
Quoted extensions
2019-11-25 21:26:53 +01:00
David Allsopp 75983ab9b1 Ensure Makefile.config gets Windows-style prefix
Prefix may be passed to configure using a Cygwin-style PATH (e.g.
`./configure --prefix ~/local`). Use cygpath to ensure that the correct
version gets written to Makefile.config, or the resulting compiler has
an invalid default stdlib path.
2019-11-25 14:14:59 +01:00
Gabriel Scherer ec5a85c26f [minor] Changes fix
the PR number was missing, as reported by Gaëtan Gilbert.
2019-11-23 22:36:45 +01:00
David Allsopp fe31a0179d Move #9130 to 4.10 in Changes 2019-11-21 13:55:45 +00:00
David Allsopp 504d95c275 Fix formatting of closing brace in records 2019-11-21 12:06:53 +00:00
Jacques-Henri Jourdan 50fd3d39d8 Make [caml_stat_resize_noexc] compatible with the [realloc] API when the old block is NULL (#9119) 2019-11-18 10:48:14 +01:00
David Allsopp 2c82bfb35b
Merge pull request #9121 from dra27/fix-force-safe-string
Fix error in patch to configure.ac from #1859, with follow-on corrections
2019-11-17 08:44:38 +00:00
Konstantin Romanov a9b0ca44d2 Add set_position and set_filename to Lexing. 2019-11-16 22:14:16 +00:00
Gabriel Scherer a68d8d6e49 Changes: add missing statmemprof PRs 2019-11-15 14:01:58 +01:00
Gabriel Scherer fc14b25989 Changes: #9113 was backported to trunk 2019-11-15 13:53:07 +01:00
Gabriel Scherer fa3dfaa6a8
Merge pull request #9120 from mmottl/fix-minor-ratio-bug
Fix GC ratio multiplier bug
2019-11-15 13:47:19 +01:00
Markus Mottl 7cab2fdeaa Updated Changes with bugfix for #9073, #9120 2019-11-14 11:16:25 -05:00
Kate e0ee2f7a05 Fix configure: Define the CAML_SAFE_STRING variable when force-safe-string is on 2019-11-14 11:18:43 +00:00
Gabriel Scherer 757a64464f ocamldoc: better support of multiline code blocks in the manpage backend
Before, `man Map` would show:

```
For instance: module IntPairs = struct type t = int * int let compare (x0,y0) (x1,y1) = match Stdlib.compare x0 x1 with 0 -> Stdlib.compare y0 y1 |
c -> c end module PairsMap = Map.Make(IntPairs) let m = PairsMap.(empty |> add (0,1) hello |> add (1,0) world )
```

Now it shows:

```
For instance:
     module IntPairs =
       struct
         type t = int * int
         let compare (x0,y0) (x1,y1) =
           match Stdlib.compare x0 x1 with
               0 -> Stdlib.compare y0 y1
             | c -> c
       end

     module PairsMap = Map.Make(IntPairs)

     let m = PairsMap.(empty |> add (0,1) "hello" |> add (1,0) "world")
```

(in both cases the code is in bold)
2019-11-14 11:31:05 +01:00
Drup 5050cc7ed1 Add changes. 2019-11-13 14:54:28 +01:00
Gabriel Scherer 6465616fd9 improved error messages for exceptions in signature errors
Example:

    module Test : sig
      exception Foo
    end = struct
    end

Before this PR:

    Modules do not match: sig end is not included in sig exception Foo end
    The extension constructor `Foo' is required but not provided

After this PR (second line changed):

    Modules do not match: sig end is not included in sig exception Foo end
    The exception `Foo' is required but not provided
2019-11-12 14:16:39 +01:00
Gabriel Scherer a5e121621d
Merge pull request #9060 from gasche/protect_refs-backtraces
Misc.protect_refs: use Fun.protect to protect the backtrace
2019-11-07 20:44:34 +01:00
Gabriel Scherer f5252e9840 Misc.protect_refs: use Fun.protect to protect the backtrace
Currently Fun.protect and Misc.try_finally can be used in code that
tries carefully to preserve the first-failure backtrace, but
Misc.protect_refs cannot. This PR fixes the discrepancy. See #9057 for
a use-case.

See the GPR ( https://github.com/ocaml/ocaml/pull/9060 ) for an
in-depth discussion of the potential performance impact of this
change.
2019-11-07 14:43:17 +01:00
Gabriel Scherer e7c681d14d typedtree: make the pat_desc field of patterns immutable 2019-11-07 14:41:59 +01:00
Gabriel Scherer 65e6874026
Merge pull request #9098 from Octachron/manual_operator_chars
manual: operator char classes description
2019-11-07 14:36:48 +01:00
Bernhard Schommer e5ebec7058 Fold map function for List (#8894)
The fold_map function is quite common combination of fold and map
which allow it to pass an accumulator through map.
2019-11-07 14:12:58 +01:00
Leo White fb33b74bca Relax the level handling when unifying row fields (#9064) 2019-11-07 09:38:46 +00:00
Florian Angeletti e3f83d58dc manual: fix operator char classes 2019-11-06 16:03:24 +01:00
Gabriel Scherer 92bfafc1ac
Merge pull request #8805 from stedolan/statmemprof-comballoc-native
Keep information about allocation sizes, for statmemprof, and use during GC.
2019-11-06 13:44:14 +01:00
Simon Parry f43323be52 Fix toplevel show directive to work with constructors
The show directive now has some basic facility to show
useful information for constructors of "normal" values,
exceptions and other non-exception extension constructors.

Also updated show_type to print out recursion status
with a default of Trec_first.
2019-11-05 20:02:03 +00:00
Gabriel Scherer b667fec2e7
Merge pull request #9079 from garrigue/refactor-ppat_of_type
Typecore.type_pat: refactor ppat_of_type and Need_backtrack in wildcards
2019-11-04 17:03:32 +01:00
Jacques Garrigue da3295c3af Typecore.type_pat: refactor ppat_of_type and Need_backtrack in wildcards
There is a small, desirable change of behavior in this PR:
we do not backtrack on all wildcard pattern explosions,
only on those where ppat_of_type knows there will be GADTs.
As a result, some exhaustivity counter-examples
have been improved with more cases (see testsuite for an example).
2019-11-04 15:20:56 +01:00
Gabriel Scherer a71d42b682
Merge pull request #8938 from gretay-js/stop-before-emit
Stop before emit
2019-11-04 15:13:33 +01:00
Stephen Dolan 8c155a04be Changes 2019-11-04 14:13:05 +00:00
Gabriel Scherer 312253ce82 split patterns into "value patterns" and "computation patterns"
Value patterns match on a value (the result of computation), while
computation patterns handle the effects (hint hint) of
a computation. The only forms of computation patterns in OCaml today
are value patterns and exception patterns (exception p).

The sub-pattern `p` of the `lazy p` construction should be
a computation pattern, rather than a value pattern. This pull-request
does not make this change.

Most of the changes in this PR are boilerplate -- it really is a lot
of work now to add a new syntactic category to the typed-tree
syntax. This boilerplate is fairly automatic and should be easy to
review.

There is a subtle part to the patch, though: the implementation of the
pattern type-checking. It now has to reconstruct the value/computation
distinction (absent from the parse-tree), and return values from two
different types. Instead of splitting the type-checker in several
functions (which risked code duplications), I choose to use a GADT to
have the same [type_pat] function return two different types depending
on the caller. This is the least invasive way to adapt this part of
the codebase, whose inherent complexity is so large (unfortunately)
that adding a GADT to the mix barely makes a difference.
2019-10-31 13:29:16 +01:00
Greta Yorsh 4d7d53c805 Add Changes entry 2019-10-30 19:05:23 +00:00
Gabriel Scherer 03c33f5005
Merge pull request #9078 from gasche/ocamltest-all-compilerlibs
ocamltest: enable working with all compilerlibs
2019-10-30 15:32:35 +01:00
Gabriel Scherer 5c3d4afd6a ocamltest: enable working with all compilerlibs
ocamltest maintains a list of "subdirectories where .cmi files of
compilerlibs modules are", and uses "include ocamlcommon" to make the
content of ocamlcommon.cma available.

The present PR updates the list of subdirectories (driver/ was not
included, so Compmisc.initial_env() was unusable) and creates modifier
names (like "ocamlcommon") for all compilerlibs archives.
2019-10-30 14:47:45 +01:00
Gabriel Scherer dd47fafbf5
Merge pull request #9076 from gasche/install-all-compilerlibs
Makefile: install all compiler-libs archives instead of a manual listing
2019-10-30 11:56:48 +01:00
Gabriel Scherer 8b237caad1
Merge pull request #9074 from Octachron/regularity_error_message
#9069: reworded error messages for non-regular structural types
2019-10-30 11:04:18 +01:00
Florian Angeletti ee32976da1 reworded errors for non-regular structural types
* explicitly mention that the type definition is non-regular
* avoid implicit permutation in type parameters
* don't try to propose a "fix"
2019-10-30 10:02:31 +01:00
Gabriel Scherer b0d1d6084c Makefile: install all compiler-libs archives instead of a manual listing
The issue #9050 comes (partly) from #2281 forgetting to add the
compilerlibs/ocamlmiddleend archives in the installation target. The
present patch should solve this issue once and for all, by using
a wildcard to install all archives that have been built in
compilerlibs/, instead of using a manual listing.

Compared to trunk, the following extra files are installed in
$(LIBDIR)/compilerlibs: ocamlmiddleend.{a,cma,cmxa}. There are no
other changes in the installed-files list.
2019-10-29 18:07:51 +01:00
Nicolas Ojeda Bar bf997d5b29 Changes 2019-10-29 12:37:17 +01:00
zapashcanon c0e4096eaa add List.filteri to the stdlib (#9059) 2019-10-29 09:45:19 +01:00
Stephen Dolan b0ad600b88 Use a more compact representation of debug information.
Locations of inlined frames are now represented as contiguous
sequences rather than linked lists.

The frame tables now refer to debug info by 32-bit offset rather
than word-sized pointer.
2019-10-22 11:46:35 +01:00
David Allsopp 61ce607f1e Fix placement of #9031 in Changes 2019-10-19 20:33:50 +01:00