Commit Graph

2774 Commits (master)

Author SHA1 Message Date
Xavier Leroy 82625c6105 test/unwind: exit with nonzero error code in case of failure
Follow-up to d374d7d23
2020-07-28 10:27:07 +02:00
Xavier Leroy ba2b98608a
Merge pull request #9742 from jhjourdan/fix_7810
Make Ephemeron compatible with infix pointers.
2020-07-27 16:51:14 +02:00
John Whitington d0263ac0e4
Merge branch 'trunk' into trunk 2020-07-27 13:53:52 +01:00
Xavier Leroy d374d7d230 tests/unwind: produce trace in case of failure 2020-07-26 11:52:46 +02:00
David Allsopp a651a82488 Fix handling of EOL-at-EOF in ocamltest 2020-07-25 10:04:31 +01:00
EduardoRFS f323d2ad67 arm64 runtime: apply ios assembler requirements 2020-07-25 08:36:23 +00:00
EduardoRFS 42943915a7 arm64 runtime: macro for global and local symbols 2020-07-25 08:36:22 +00:00
Xavier Leroy e41dc9c443
Merge pull request #9752 from xavierleroy/c-calling-conventions
Revised handing of calling conventions for external C functions
2020-07-25 09:50:42 +02:00
Xavier Leroy 9fcb295b98 Revised passing of arguments to external C functions
Introduce the type Cmm.exttype to precisely describe arguments to
external C functions, especially unboxed numerical arguments.

Annotate Cmm.Cextcall with the types of the arguments (Cmm.exttype list).
An empty list means "all arguments have default type XInt".

Annotate Mach.Iextcall with the type of the result (Cmm.machtype)
and the types of the arguments (Cmm.exttype list).

Change (slightly) the API for describing calling conventions in Proc:
- loc_external_arguments now takes a Cmm.exttype list,
  in order to know more precisely the types of the arguments.
- loc_arguments, loc_parameters, loc_results, loc_external_results
  now take a Cmm.machype instead of an array of pseudoregisters.
  (Only the types of the pseudoregisters mattered anyway.)

Update the implementations of module Proc accordingly, in every port.

Introduce a new overridable method in Selectgen, insert_move_extcall_arg,
to produce the code that moves an argument of an external C function
to the locations returned by Proc.loc_external_arguments.

Revise the selection of external calls accordingly
(method emit_extcall_args in Selectgen).
2020-07-24 17:39:22 +02:00
Daniel Bünzli 33dcae9509 Promote failing Dynlink tests: stacktrace line numbers changed. 2020-07-23 11:38:39 +02:00
Daniel Bünzli 1578a359e0 Dynlink.*_unit functions: make sure they call the internal init ().
Otherwise they report inaccurate information before any load
occurs. Closes #9338.
2020-07-23 11:38:39 +02:00
Sébastien Hinderer 9f25b62fb4 Update expected test output
Follow-up to PR #9657
2020-07-21 15:28:54 +02:00
Gabriel Scherer b1d1c0b77c
Merge pull request #9657 from nojb/warning_mnemonics
Add mnemonics for warnings
2020-07-21 11:47:37 +02:00
Nicolás Ojeda Bär 3407c3b22e Update test reference files 2020-07-21 08:11:03 +02:00
Nicolás Ojeda Bär a803cd4cc2
Merge pull request #9781 from yallop/injective-stdlib
Add some injectivity annotations to the standard library.
2020-07-20 19:40:50 +02:00
Nicolás Ojeda Bär 39f637436e Add constructor-mnemonic check to testsuite 2020-07-20 08:31:18 +02:00
Nicolás Ojeda Bär db9b707e0c
Merge pull request #9763 from xavierleroy/remove-old-hash-function
Remove pre-4.00 generic hash function
2020-07-20 08:10:18 +02:00
Matthew Ryan dd7ddf9e71
Fix printing of bindings with polymorphic type annotations and attributes (#9778) 2020-07-20 06:10:13 +02:00
Xavier Leroy cfabfe6edd Add a test for Hashtbl.rebuild 2020-07-19 19:58:06 +02:00
Xavier Leroy 40399cca5e Hashtbl: remove support for pre-4.00 hash tables
When the hash function and the internal representation of hash tables
was changed in 4.00, some compatibility code was left so that "old"
hash tables (created with OCaml < 4.00 and marshaled to files)
could still be operated upon by the functions of the new implementation.

This was 9 years ago, so it is reasonable to expect that none of these
"old" hash tables are still in use.

This commit removes the compatibility code in stdlib/hashtbl.ml.
It still tries to detect "old" hash tables and raise an
Invalid_argument exception instead of crashing.
2020-07-19 19:58:01 +02:00
Jeremy Yallop fb2f26a02e Stdlib injectivity: update tests. 2020-07-18 17:42:06 +01:00
John Whitington 926995b012 Generate moreLabels.mli programatically 2020-07-18 17:12:16 +01:00
John Whitington e8e5b7e73f Make hashtbl.mli / set.mli / map.mli from labeled 2020-07-18 12:03:03 +01:00
Jacques-Henri Jourdan 95400d7ee0 Make Ephemeron compatible with infix pointers. 2020-07-18 08:07:35 +02:00
David Allsopp d2190d192c Adapted lib-stdlabels test for unixLabels 2020-07-17 17:57:15 +01:00
Xavier Leroy 0802bacf4b
Merge pull request #9551 from nojb/microbfd
Implement (in utils/binutils.ml) a simple parser for ELF, Mach-O and PE shared object files.  Use it to get rid of libbfd in ocamlobjinfo and to improve the checking of external primitives during linking in ocamlc.
2020-07-14 10:47:12 +02:00
Thomas Refis 4edc4b9928
pattern aliases do not ignore type constraints (#1655) 2020-07-09 12:20:37 +02:00
Florian Angeletti f879c052b1
Merge pull request #9541 from Engil/instrumented_runtime_manual
Add a chapter for the instrumented runtime
2020-07-08 18:29:44 +02:00
John Whitington dea23a56c5 Restore String.prefix/suffix status quo ante 2020-07-08 12:23:16 +01:00
Thomas Refis 167e66e15d
type_cases: rely on levels to enforce principality (#1931)
Instead of the erasure scheme that was used up to now, where we
considered that the type was always principal.

Note: the erasure still happens when polymorphic variants appear in the
patterns, and the type of the scrutinee contains a Reither.
2020-07-08 10:35:40 +02:00
Enguerrand Decorne f674c275aa instrumented runtime: change environment variable from OCAML_EVENTLOG_FILE to OCAML_EVENTLOG_PREFIX 2020-07-08 03:13:56 +02:00
John Whitington efe8ca02f1 Unify labeled and unlabeled Standard Library modules 2020-07-07 19:34:14 +01:00
Jacques Garrigue 46cec117a4
Fix #9721: Injectivity and recursive modules (#9727) 2020-07-07 09:04:23 +02:00
Nicolás Ojeda Bär 32cc562315 Adapt test 2020-07-02 06:40:10 +02:00
Jacques Garrigue e0ec63ae21
Fix #8747: incorrect principality warning on functional updates of records (#9709) 2020-06-28 23:20:12 +02:00
Leo White 042b1ca737 Fix handling of presence when comparing package types 2020-06-26 14:27:00 +01:00
Leo White cbfd25fe78 Add test for module aliases in package types 2020-06-26 14:24:36 +01:00
Leo White 794a15e5a3 Add tests for missing cmi package type errors 2020-06-26 14:24:36 +01:00
Florian Angeletti 1fb6a464a8
Merge pull request #9244 from lpw25/fix-usage-warnings
Fix usage warnings
2020-06-25 18:21:04 +02:00
Florian Angeletti 457304d075
Merge pull request #9673 from xvw/attempt-to-fix-6633
Add Hint when a module is used in place of a module type
2020-06-25 17:00:37 +02:00
Leo White 1f9be49f02
Merge pull request #9385 from lpw25/fix-copy-scope-bugs
Fix copy scope bugs
2020-06-25 10:59:59 +01:00
Nicolás Ojeda Bär 34dbc549b8
Merge pull request #9533 from bschommer/string-suffix-prefix
String suffix and prefix functions.
2020-06-24 17:39:32 +02:00
Xavier Leroy 4f387e4cb0 Update reference output in no-flat-float-array mode
Follow-up to bd510cdf9
2020-06-24 17:05:42 +02:00
Xavier Leroy a9fad824ca Make some tests conditional on naked pointers support
These tests use the "Is_in_static_data" predicate, which is no longer
supported in no-naked-pointers mode.
2020-06-24 15:25:03 +02:00
xvw 50848feb10 Add Hint when a module is used in place of a module type
Add hint when a module is used instead of a module type or when a
module type is used instead of a module or when a class type is
used instead of a class.
2020-06-24 14:37:03 +02:00
Gabriel Scherer 038fb85bac
Merge pull request #9702 from garrigue/fix9695
Fix #9695: no error when opening an alias to a missing module
2020-06-24 13:23:18 +02:00
Bernhard Schommer e00d7f3a42
Added String prefix and suffix tests.
The functions test if the second argument is a prefix or suffix of the
first argument.
2020-06-24 12:01:55 +02:00
Nicolás Ojeda Bär 7f0dbd4e65
ocamltest: show failing logs (#9696) 2020-06-23 20:47:38 +02:00
Jacques Garrigue ab83af0322 add example without -no-alias-deps 2020-06-23 18:37:37 +02:00
Nicolás Ojeda Bär bd510cdf93
ocamltest: do not compare binaries produced by ocamlopt.opt and ocamlopt.byte (#9677) 2020-06-23 17:36:37 +02:00
Jacques Garrigue 6ccab9b9b0 Fix #9695: no error when opening an alias to a missing module 2020-06-23 15:31:45 +02:00
Xavier Leroy 40a55c71a1 Is_in_static_data is not available in no-naked-pointers mode
This is another classification macro that requires the page table.
Its only uses in the whole OPAM universe is two of our own tests
(tests/asmcomp/is_static.ml and tests/lib-obj/reachable_words_np.ml)
which are now run only in naked-pointers mode.
2020-06-23 10:30:40 +02:00
Xavier Leroy ccb7829ddc Revise testing of Obj.reachable_words
Part of the test makes sense only if the runtime system supports
naked pointers and has a page table to distinguish major heap pointers
from out-of-heap pointers.

This part is split off in a new test, lib-obj/reachable_words_np.ml,
conditionalized on "naked_pointers".
2020-06-22 19:37:22 +02:00
Jacques Garrigue 603506aa34
Add injectivity annotations (#9500) 2020-06-15 13:51:50 +02:00
Jacques Garrigue 24d087325c
Fix #7902: Type-checker infers a recursive type, even though -rectype… (#9556) 2020-06-15 10:26:26 +02:00
Xavier Leroy 400fe3f3a2
Merge pull request #9675 from xavierleroy/no-static-alloc
Remove the caml_static_{alloc,free,resize} primitives, which are unused and incompatible with no-naked-pointers mode.
2020-06-14 11:48:20 +02:00
Nicolás Ojeda Bär 33416d11db
Merge pull request #9469 from lpw25/fix-lazy-backtraces
Better backtraces for lazy values
2020-06-14 11:34:04 +02:00
Leo White 62e286a1c7 Fix unused functor argument warning in toplevel 2020-06-14 08:38:03 +01:00
Leo White b0e1540ac1 Fix missing unused variables warning with functor application 2020-06-14 08:38:03 +01:00
Leo White 1c03659e34 Add another test for usage warnings 2020-06-14 08:38:03 +01:00
Leo White 81902098b6 Fix incorrect copy_scopes in Subst 2020-06-14 08:30:33 +01:00
Leo White 080604989f Add regression tests 2020-06-14 08:25:41 +01:00
Leo White a02707c610 Better backtraces for lazy values 2020-06-14 07:57:35 +01:00
Leo White 9895b28d25 Add tests for backtraces from forcing lazy values 2020-06-14 07:51:31 +01:00
Xavier Leroy b0cd12d1c4 Test intext.ml: do not use the caml_static_alloc primitive
This primitive (from runtime/obj.c) is being phased out because
it returns a naked pointer outside the OCaml heap.

Instead, for the test, use a statically-allocated buffer
that is never visible from OCaml.
2020-06-13 11:39:02 +02:00
Gabriel Scherer c24198550a
Merge pull request #9612 from garrigue/pr6744ex
fix number and add examples for #6744
2020-06-10 14:05:31 +02:00
Nicolás Ojeda Bär 990bc3c892
Merge pull request #9633 from nojb/ocamltest_env_fix
ocamltest: do not overwrite user-defined variables
2020-06-08 13:17:38 +02:00
Gabriel Scherer a3b66f1b32 Parmatch.exhaust: single-row optimization
(See testsuite and code comments for an explanation.)
2020-06-07 08:03:57 +02:00
Gabriel Scherer 06cabea1df
Merge pull request #9608 from trefis/rematch-flattening
pattern-matching refactoring: clarify usage of the Cannot_flatten exception
2020-06-06 21:58:33 +02:00
Thomas Refis 30bb39d7d8 matching: add a test for do_for_multiple_match flattening failure
Note: this is due to mk_alpha_env raising Cannot_flatten during
splitting/precompilation.
2020-06-06 18:46:34 +02:00
Gabriel Scherer 63eb3dad0d Arg: a new Rest_all spec, similar to Rest, that passes all arguments at once
In particular this allow to detect a Rest_all keyword followed by no
arguments at all (an empty list).
2020-06-05 22:06:21 +02:00
Gabriel Scherer 357d624992
Merge pull request #9642 from garrigue/fix9640
Fix #9640: regression introduced by #9623
2020-06-05 21:10:55 +02:00
Xavier Leroy e57785524b Restrict 'test_locations' to 64-bit archs and update expected outputs
Expected outputs contain integer values for the "closure info"
field of some closures.  These values differ in 32 and 64 bits,
since the arity is stored in top 8 bits.  This test would need
different expected outputs for 32- and 64-bit platforms.

To keep things simple, this commit restricts the test
to only run on 64-bit platforms.  Since this changes the locations
2020-06-05 17:48:19 +02:00
Jacques Garrigue b2b9fc3d9a add example 2020-06-05 15:05:48 +02:00
Jacques Garrigue a96a610a95 Fix #9640: regression introduced by #9623 2020-06-05 14:56:51 +02:00
Nicolás Ojeda Bär d8d38752f9 Adapt tests 2020-06-05 07:40:17 +02:00
Gabriel Scherer 84c87bb8f1
Merge pull request #9623 from gasche/unboxed-merge-constraint
fix an environment problem in merge_constraint
2020-06-04 13:16:27 +02:00
Jacques Garrigue abb8db459d
Fix #7520: Odd behaviour of refutation cases with polymorphic variants (#9547) 2020-06-03 17:47:12 +02:00
Jacques Garrigue 13a081b04e
Fix #7741: Failure to report escaping type variable (#9545) 2020-06-03 17:31:38 +02:00
Gabriel Scherer 8b2f64c2ce Typemod.merge_constraint: fix computation of the signature environment
(suggested by Leo White and Jacques Garrigue)
2020-06-03 14:33:55 +02:00
Gabriel Scherer 7068266b32 Typemod.merge_constraint: be careful about the typing environments
This PR fixes an old bug in the interaction between [merge_constraint]
and [Typedecl.transl_with_constraint], where
variance (and now separability) are recomputed in an invalid type
environment. See #9624 and the new tests.
2020-06-03 14:33:50 +02:00
Gabriel Scherer 45248a7602 add a testcase for 'with type <lhs> = <rhs>' scoping 2020-06-03 14:33:12 +02:00
Jacques Garrigue ee20f5e648
Fix the polymorphic recursion problem of #9603 (#9617) 2020-06-02 22:05:30 +02:00
Stephen Dolan fd1bb255e1 More partial application warnings 2020-06-02 12:11:41 +01:00
Stephen Dolan 0d44a6cfe6 Remove Const_pointer from Lambda and Clambda (#9585)
Lambda and Clambda distinguish Const_int from Const_pointer only so
that they can pass the information to Cmm. But now that that
Const_pointer is gone from Cmm (#9578), there's no need for the
distinction in Lambda either.

This PR requires a bootstrap, because the .cmo format changes:
Lambda.structured_constant has one fewer constructor.  The bootstrap
is in the following commit.
2020-06-02 11:19:20 +02:00
Gabriel Scherer 5c9d5db728
Merge pull request #9511 from gasche/parmatch-exhaust-lazy
Parmatch: make `exhaust` (exhaustivity and fragility checking) lazy
2020-05-30 19:01:38 +02:00
Gabriel Scherer d8acfa92e4 parmatch: ensure specialized submatrices are in source order
We produce exhaustivity counter-example in the order of the
specialized submatrices. Having submatrices in source order gives the
nice behavior that the clause that would naturally been inserted first
in the source is given first as a counter-example.

Consider for example:

    function
    | true, true -> true
    | false, false -> false

The two counter-examples are (true, false) and (false, true).

Before this patch, (false, true) would be shown first.
After this patch, (true, false) is shown first.
This corresponds to the following natural completion order:

    function
    | true, true -> true
    | true, false -> ?
    | false, false -> false
    | false, true -> ?

On the other hand, the ordering of the default submatrix, with respect
to the specialized submatrices, is not preserved -- it is always
ordered last.
One could intuitively expect the default submatrix to appear in the
position of the first omega row in the source. We tried this, and
it is not a good idea:
- the change is much more invasive as the interface of
  `build_specialized_submatrices` has to change
- the behavior of the result is in fact unpleasant; it is not
  intuitive to order counter-examples in this way.

For example, consider:

    function
    | _, None -> false
    | true, Some true -> false

The two exhaustivity counter-examples are (true, Some false)
and (false, Some _). The second comes from the default submatrix:
morally it is (_, Some _), with "some other constructor missing from
the column" instead of the first _. There is no reason to suppose that
the user would want to place this (_, Some _) or (false, Some _)
counter-example first in the completed code; indeed, this intuition
would suggest writing an exhaustive covering of patterns of the
form (_, foo), inserted after the first clause, but then the other
clauses below become unnecessary!

When an omega patterns appears high in the column like this, it is
usually because there is a very specific matching condition to the
rest of its row, that justifies some shortcutting behavior. The
program is typically *not* completed by adding more specific matching
conditions.
2020-05-30 17:11:54 +02:00
Gabriel Scherer a8adec16f1 add regression tests for fragile-matching stack overflows 2020-05-30 17:10:37 +02:00
Gabriel Scherer 8f71174eb2 parmatch: make 'exhaust' lazy by returning a Seq.t
This solves exponential-blowup issue with the strict traversal and/or
strict witness computation in cases where an exponential number of
counter-examples is generated. This fixes Stack Overflow and
exponential-time issues on examples using or-patterns heavily,
including one that naturally found its way in real-world user
code (see the following testsuite commit).

We now systematically keep only one counter-example, instead of
letting the type-checker decide whether to discard
counter-examples (in Backtrack_or mode) or to preserve
them (in Refine_or mode).

Note: in the exhaustivity warning, there are sub-messages printed to
indicate that:

- the exhaustivity counter-example is related to an extensible type, or
- that a when-guarded clause does match the counter-example

In both cases the warning is there to explain the counter-example(s)
shown (not a property of all counter-examples); keeping at most one
valid counter-example means that they will be printed less often, but
it is the correct/intended behavior in that case.
2020-05-30 17:10:37 +02:00
Etienne Millon 71e91123c2
Attach package type attributes to core_type (#9615) 2020-05-29 14:29:10 +02:00
Gabriel Scherer 62dcc6e50d
Merge pull request #9613 from gretay-js/fix_compare
Bind arguments of integer and float compare in cmmgen
2020-05-28 13:47:18 +02:00
Gabriel Scherer 9b1bfc3b7c typedecl: correct update separability in transl_with_constraint
fixes #9607
2020-05-27 21:32:36 +02:00
Greta Yorsh 4c25ffcce9 Add a test 2020-05-27 16:59:45 +01:00
Jacques Garrigue e0524b535b fix number and add examples for #6744 2020-05-27 16:28:53 +02:00
Gabriel Scherer 463f1e1b9f add a testsuite case for an [@@unboxed] bug (#9607) reported by Stephen Dolan
Currently the test fails while it should work.
2020-05-27 10:38:09 +02:00
Gabriel Scherer 0c60f27978 remove an unused test reference file 2020-05-27 10:38:09 +02:00
Jacques Garrigue 1bb388bd15
Fix PR#7817: Unsound inclusion check for polymorphic variant (#9546) 2020-05-25 19:12:09 +02:00
Stephen Dolan 9e09fde735
Avoid creating ill-formed blocks in Cmm letrec (#9577)
Use "1" (integer 0) as filler value instead of "0" (null pointer).

Fixes: 7718
2020-05-25 10:11:45 +02:00
Xavier Leroy 89beb4c7f0 Use Sys.command instead of Unix.system to call 'cmp'
Clang's thread sanitizer TSAN reports a (false?) alarm on Unix.system
in multithreaded programs now that Unix.system is implemented
on top of posix_spawn.

This commit replaces Unix.system with Sys.command, which might work
better with TSAN, based on preliminary experiments.

Note that this test is about file I/O, not Unix.system, so the replacement
is acceptable.  In parallel, we need to understand what's happening
with TSAN and posix_spawn.
2020-05-20 19:49:36 +02:00
Stephen Dolan ff6ae43184
Merge pull request #9458 from jhjourdan/memprof_fatal_error_thread_exit
Memprof: fatal error if thread is stopped from a callback.
2020-05-20 16:58:10 +01:00
Xavier Leroy 565c07ceb0 Test redirection of stdout and stderr to the same file descriptor 2020-05-19 19:21:18 +02:00
Stephen Dolan 2d92955749
Remove Const_pointer (#9578)
Since #9316 was merged, Cconst_pointer is compiled in exactly the same way as Cconst_int. This commit removes the now-redundant Cconst_pointer and Cconst_natpointer.
2020-05-19 15:31:08 +02:00
Florian Angeletti faec2de1d6
Merge pull request #9566 from Octachron/testsuite_aliases_and_applicative_functors
tests: aliases and applicative functors
2020-05-18 10:57:29 +02:00
Gabriel Scherer c544d640b6 fix the testsuite (and add -dno-unique-ids where reasonable) 2020-05-16 17:51:54 +02:00
Gabriel Scherer 04d9c425f3 stdlib: provide a sequential interface of the Atomic module from OCaml Multicore
This module provides a purely sequential implementation of the
concurrent atomic references provided by the Multicore OCaml
standard library:

https://github.com/ocaml-multicore/ocaml-multicore/blob/parallel_minor_gc/stdlib/atomic.mli

This sequential implementation is provided in the interest of
compatibility: when people will start writing code to run on
Multicore, it would be nice if their use of Atomic was
backward-compatible with older versions of OCaml without having to
import additional compatibility layers. *)
2020-05-16 17:51:54 +02:00
Sébastien Briais f52fdc2068
Define to_rev_seq in Set and Map module (#9075) 2020-05-15 17:38:45 +02:00
octachron c991225652 tests: aliases and applicative functors
* Enable the full test for 3476
* add the 5058 example
2020-05-15 11:02:05 +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
Nicolás Ojeda Bär f3e6d27e30 Add test 2020-05-13 20:57:21 +02:00
Gabriel Scherer f81e2b6a59
testsuite: remove a slow exhaustiveness check (#9555)
The test takes 14s to run every time we run the checksuite, and it
does not seem to serve an easily identifiable purpose. In theory
similar tests could help detect a performance regression in
exhaustiveness checking, but this test seems to only degrade in
constant factor (#9152 proposed to use ocamlc.opt instead of ocamlc to
run it, but it was declined as "hiding" potential problems, which
suggests constant-factor differences). We do not monitor the testsuite
for 10s timing difference, so it is unlikely that we would notice
a constant-factor difference during automated testing.
2020-05-13 10:52:56 +02:00
Jacques-Henri Jourdan 629fae6dc4 Add test statmemprof/thread_exit_in_callback. 2020-05-11 17:10:13 +02:00
Gabriel Scherer f7ec223df9 add a known-bug test for buggy 'rec' (non)use in the #show command 2020-05-09 08:43:23 +02:00
Gabriel Scherer 3a43b84e8a compare: correctly compare a Closure_tag with an Infix_tag 2020-05-06 22:29:01 +02: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
Nicolás Ojeda Bär e20736dda0
unboxed-primitive-args: test does not require unix (#9517) 2020-04-30 18:26:24 +02:00
David Allsopp 42b8c20cce Fix instrumented-runtime test on OpenBSD 2020-04-30 15:52:50 +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
Stephen Dolan 6923fd1590
fix module_coercion test on no-flat-floatarray mode (#9508) 2020-04-28 17:32:49 +01:00
Jacques-Henri Jourdan 90871480d9 Fix statmemprof/callstacks.ml when --disable-flat-float-array is used.
We do this by using a specific reference file in the case this option is used.
2020-04-27 19:14:55 +02:00
Jacques-Henri Jourdan 687076d662 Remove redundancy in testsuite/tests/statmemprof/comballoc.ml 2020-04-27 18:45:16 +02:00
Stephen Dolan b7716c4625 Update testsuite with new backtrace format, and add test for names 2020-04-27 12:58:53 +01:00
Stephen Dolan 2986beaa78 Replace Location.t with Lambda.scoped_location in Lambda code
This commit threads scopes through translation from Typedtree to
Lambda, extending the scopes when entering functions, modules,
classes and methods.
2020-04-27 12:58:53 +01: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
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
Leo White 2ea16f6a8e Treat `open struct` as `include struct` in toplevel 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
David Allsopp d732593c85 Test for linking archives with no modules 2020-04-22 14:17:29 +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
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
Nicolás Ojeda Bär 91bbdac1f5
Fix asmcomp unit name test for bsd (#9473) 2020-04-19 17:53:57 +02:00
Nicolás Ojeda Bär ec6690fb53
x86 asm: handle unit names with special characters (#9465) 2020-04-19 11:17:00 +02:00
Gabriel Scherer 5722f78e31 add a regression test for issue 9460
See <https://github.com/ocaml/ocaml/issues/9460>.
We currently expect this test to fail on 32bit systems, and succeed on 64bits systems.

Contributed by Richard Jones.
2020-04-18 11:39:25 +02:00
Thomas Refis e01966a8b1 illegal commutation: more information in error message 2020-04-18 11:09:32 +02:00
Thomas Refis 384aa215fa optional arguments eliminated only when followed by unlabelled argument 2020-04-18 11:09:32 +02:00
Thomas Refis 9e0515f554 type_args: forbid optional arguments commuting when [ignore_labels=true] 2020-04-18 11:01:52 +02:00
Thomas Refis 2b1e211df9 type_application: merge sargs and more_sargs 2020-04-18 11:01:52 +02:00
Thomas Refis 046da6cd2e testsuite: -nolabels, commutes now, might get eliminated later 2020-04-18 11:01:52 +02:00
Thomas Refis 245a071938 testsuite: -nolabels and commuting optional arguments 2020-04-18 11:01:52 +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 5f16c55316 Improve usage warnings for recursive modules 2020-04-18 08:08:54 +01:00
Leo White dd8218f8aa Add test for usage warnings of recursive modules 2020-04-18 08:08:54 +01:00
Leo White 8dcdda9674 Prohibit signature local types with constraints 2020-04-18 07:54:12 +01:00
Leo White 17257491b8 Add regression test 2020-04-18 07:54:12 +01:00
David Allsopp 528bd78c25 Add a test for #mod_use 2020-04-17 16:28:20 +01:00