Commit Graph

2887 Commits (1cd6e4451f04af4871675d0eecd48b3bac262b67)

Author SHA1 Message Date
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
David Allsopp e0b7c0ed49
Merge pull request #9031 from db4/fix-win32-overflow-detection
Unregister win32 stack overflow handler in caml_shutdown()
2019-10-19 20:31:42 +01:00
David Allsopp dd492d84a5
Merge pull request #9051 from dra27/fix-9043
Add missing local root in win32 `Unix.select`
2019-10-19 08:55:23 +01:00
Gabriel Scherer 7b111e5640 sections for the working-version Changelog 2019-10-18 23:08:32 +02:00
Florian Angeletti c67cb28116 create an OCaml 4.10.0 section in Changes 2019-10-18 18:41:22 +02:00
Gabriel Scherer cc7231f5a9
Merge pull request #9030 from gasche/refactor-type_pat
typecore: a proper datatype for type_pat modes
2019-10-18 15:42:27 +02:00
Leo White 25edeab66b
Improve errors for first-class modules (#8903)
* Improve errors for first-class modules

* Changes based on Jacques' suggestions

* Add Changes entry
2019-10-18 11:41:48 +01:00
Gabriel Scherer 01a34208c3
Merge pull request #9046 from gasche/disable-warning-30-by-default
disable warning 30 (same constructor/label used in two mutually-recursive declarations)
2019-10-18 11:54:05 +02:00
Gabriel Scherer fe8ccc846d typecore: a proper datatype for type_pat modes
This type describes the parameter space of the [type_pat] function
(which type-checks of patterns, and in fact does quite a bit more) in
a way that also documents its behavior.

The code ends up being slightly more verbose at places: it's always
shorter to access one of four independent arguments than to go get the
information inside one record structure. But now it is clear which
parameters are meaningful in which situation, and I believe the code
is easier to read.

(This is joint work with Florian Angeletti)
2019-10-18 11:50:49 +02:00
Gabriel Scherer 9a0ebc18d4
Merge pull request #8993 from gadmm/resource-safe-api-pt1
Resource-safe C interface, part 1 (the 4.10 backwards-compatibility edition)
2019-10-18 07:02:36 +02:00
David Allsopp a30823a2dc Obey GC Rule 5 in win32unix/select.c 2019-10-17 21:08:50 +01:00
David Allsopp 81f9cb1903 Fix missing root in select.c 2019-10-17 19:37:09 +01:00
Guillaume Munch-Maccagnoni 890bb908e8 Changes 2019-10-17 20:14:19 +02:00
Leo White ec77196cb2
Limit GC credit to 1.0 (#8667)
* Limit GC credit to 1.0

* Add Changes entry
2019-10-17 15:41:26 +01:00
Florian Angeletti 6f772ec21c
Merge pull request #8860 from Octachron/safer_type_expr_printer
#8856: cyclic type expressions in error submessages
2019-10-17 16:28:04 +02:00
Gabriel Scherer e18564d839
Merge pull request #8981 from gretay-js/incompatible-o-c
Fix check for incompatible -c and -o options
2019-10-17 11:44:46 +02:00
Florian Angeletti 816a5088e0 Avoid duplicated mark_loops 2019-10-17 10:03:58 +02:00
Gabriel Scherer dcfc1b8b81 fix the 7636 Changelog 2019-10-17 09:56:00 +02:00
Gabriel Scherer 92a260fdf6 disable warning 30 (same constructor/label used in two mutually-recursive decls)
Warning 30 warns when the same constructor/label is used in two
mutually-recursive type declarations. This warning (added in OCaml
3.12, 2010) was meaningful at the time where constructor/label
conflicts had a shadowing semantics: the "last" definition would mean,
while ideally mutually-recursive definitions should not be strictly
ordered but defined "all at once".

Since OCaml 4.01 (2013) we support type-based disambiguation of
constructor/label names and it is now common to write code such as,
say

    type pattern = Var of var | ...
    type expr = Var of var | ...

(no warning, of course). But warning 30 fires if you instead write

    type pattern = Var of var | ...
    and expr = Var of var | ...

This doesn't make much sense, and in particular it certainly makes no
sense to enable this warning by default. The present PR disables it by
default.
2019-10-16 18:25:54 +02:00
Jacques Garrigue c147442b01
Fix #7636 using expansion for vanishing parameters (#9040) 2019-10-16 18:02:40 +02:00
Gabriel Scherer 81420443a3
Merge pull request #9037 from gadmm/resource-safe-api-pt0
Resource-safe C interface, part 0
2019-10-16 13:59:10 +02:00
Guillaume Munch-Maccagnoni 2433b9373f Separate caml_check_urgent_gc back into GC actions and async callbacks
In 8691, caml_check_urgent_gc was merged with the function that runs
asynchronous callbacks. The rationale was that caml_check_urgent_gc
already runs finalisers, and so could have run any asynchronous
callbacks.

We agreed on a different strategy: we know that users could not rely
on asynchronous callbacks being called at this point, so take the
opportunity to make it callback-safe, like was done for allocation
functions.

The new check_urgent_gc no longer calls finalisers (nor any
callbacks), and instead two internal functions are introduced:

* caml_do_urgent_gc_and_callbacks : function to perform actions
  unconditionally.

* caml_check_urgent_gc_and_callbacks : function that checks for
  something to do, and then executes all actions (GC and callbacks).
2019-10-15 19:24:41 +02:00
Stephen Dolan 71f3ec4091 Clear destination registers before sqrt instruction on amd64 (#9041)
This avoids a partial register stall.
2019-10-15 19:04:20 +02:00
Greta Yorsh 860efce4d0 Update Changes 2019-10-15 13:18:05 +01:00
Damien Doligez 01bdd5bbc4
best-fit allocator (#8809) 2019-10-15 13:52:16 +02:00
David Allsopp 36b7a70713 Deprecate the addr typedef (#8896)
The typedef was guarded by CAML_INTERNALS, but given its accidental use
in the public Is_young macro, mark the typedef as deprecated in case
CAML_INTERNALS is being defined "in the wild" to workaround this.
2019-10-14 19:34:07 +02:00
Dmitry Bely 245b71bee6 Unregister win32 stack overflow handler in caml_shutdown() 2019-10-14 15:49:01 +03:00
Stephen Dolan fd568688d7 Remove the transformation untag_int(tag_int x) = x. (#9032)
This transformation is incorrect for certain large values of x,
as it can get the wrong value in the high bit. In certain cases
where the high bit is not used (esp. storing a byte into a string),
the transformation is kept intact.

Fixes #9028.
2019-10-14 14:39:17 +02:00
Xavier Leroy 05759f10e0
Merge pull request #9006 from stedolan/int32-compilation
Int32 code generation improvements on 64 bit platforms: fewer sign extensions + faster AMD64 instruction sequence for zero extensions.
2019-10-14 14:35:09 +02:00
Thomas Refis 79f1c73462
Warn about unused functor parameters (#8891) 2019-10-14 11:11:01 +01:00
Gabriel Scherer 5f0607d1f3 Changes: fix the placement of the #8651 entry 2019-10-14 11:59:44 +02:00
Stephen Dolan 0852266a07 Improve code-generation for 32-to-64-bit zero-extension on amd64. 2019-10-14 10:45:15 +01:00
Gabriel Scherer cc1a05b055
Merge pull request #8651 from proux01/printf-h
Add printf '%#F' to output floats in hexadecimal OCaml constants
2019-10-14 11:43:01 +02:00
Jacques-Henri Jourdan 23e5bfa3bb Better stack backtraces for C calls in bytecode (#8641)
The previous mechanism worked for C calls that raise an exception, but not for C calls that call back into OCaml code which raises an exception.

This commit addresses the issue by saving the PC in the interpreter stack before a C call, so that the backtrace mechanism always sees it.

However, if an external is declared in the .ml file and exposed in the .mli file as a val, then ocamlc generates a wrapper that adds a spurious entry in the stack frame. In this PR, this change in behavior results in the re-declaration of Printexc.get_callstack as an external instead of a val, so that the spurious stack frame does not appear in call stacks obtained from Printexc.get_callstack.
2019-10-12 18:25:58 +02:00
Gabriel Scherer e48615c779
Merge pull request #8840 from gasche/tools-ocamlc.opt
Build system: use ocaml{c,opt}.opt instead of ocaml{c,opt} when available
2019-10-12 14:01:03 +02:00
Gabriel Scherer 39071d185e Changes 2019-10-12 10:30:34 +02:00
David Allsopp 96de3229cf Don't use addr typedef in Is_young
addr type is internal, but Is_young is not.
2019-10-12 08:45:27 +01:00
Jacques-Henri Jourdan 7db098bde6 Update Changes. 2019-10-11 11:19:39 +02:00
Xavier Leroy d29a01e049
Merge pull request #8670 from stedolan/stack-overflow-fix
Fix stack overflow detection with systhreads.
2019-10-11 10:30:01 +02:00
Gabriel Scherer 065fea1edd
Merge pull request #9023 from Octachron/only_raise_need_backtrack_inside_or
type_pat: restrict the use of Need_backtrack
2019-10-10 18:30:48 +02:00
Thomas Refis 8e928caea7
a better representation for modules with no name (#8908) 2019-10-09 14:15:37 +01:00
Florian Angeletti 15f19d4a09 Changes 2019-10-08 18:55:31 +02:00
Gabriel Scherer e8c2bf8477
Merge pull request #9015 from damiendoligez/fix-pr8789
Fix #8789
2019-10-07 22:07:49 +02:00
Gabriel Scherer 7e34c1ea1e
Merge pull request #8995 from dra27/dev-opts
Allow development configure options to be stored in Git 🏅
2019-10-05 18:44:25 +02:00
Gabriel Scherer e232369580
Merge pull request #8835 from dra27/save-the-planet
New configure option to disable building and installing library manpages
2019-10-05 16:52:16 +02:00
David Allsopp 4f09104d88 Allow by-host worktree-sharable configure caches
The Git configuration value ocaml.configure-cache can be used to specify
a directory to keep autoconf cache files in, relative to the worktree
root (so `git config ocaml.configure-cache .` enables the feature, and
`git config --global ocaml.configure-cache ..` enables it for all
worktrees, assuming they're at the same level).

autoconf's --cache-file option speeds up future runs of configure by
caching the results of previous tests. The cache is invalidated if any
environment variables differ (e.g. LDFLAGS) or if the build-host-target
triplet differs. This is a nuisance on Windows, where configure is both
very slow and it's also common to build with multiple different --host
values.

This PR allows a tree to be quickly reconfigured from one Windows port
to another.
2019-10-05 14:50:57 +01:00
David Allsopp 345fd4c3f9 Allow Git config options to be passed to configure
The Git configuration value ocaml.configure is now passed to the
configure script's arguments before $@ if (and only if) OCaml is being
configured from a Git clone.

This allows, for example:

- Developer-specific preferences (e.g. `--disable-ocamldoc` or
  `--disable-debug-runtime`)
- Automatic use of autoconf cach files (-C option)

It is implemented by inserting a test at the top of `configure`, which
is bypassed if `.git` doesn't exist.
2019-10-05 14:50:35 +01:00
Jacques Garrigue 16a13e668b
fix issue #8792 and replace log_type by set_type_desc in Btype (#9018) 2019-10-05 13:17:57 +02:00
Vincent Laviron 60f58174ba
Split cmmgen into generic cmm helpers and clambda-specific transformations (#1963) 2019-10-04 17:49:59 +02:00
David Allsopp d01f0b7d71 Add reviewer for #8951 2019-10-04 14:38:33 +01:00
Damien Doligez 454ee52984 Fix #8789 2019-10-04 15:25:26 +02:00
David Allsopp fb6f58ea69
Merge pull request #8951 from shindere/make-default-target
Let make's default target build the compiler
2019-10-04 14:23:27 +01:00
Nicolás Ojeda Bär 46ca15365a
Merge pull request #8971 from nojb/filename_nul
Add Filename.null
2019-10-03 18:05:52 +02:00