Commit Graph

2207 Commits (master)

Author SHA1 Message Date
John Whitington 1d68ac08dc Fix deprecations 2020-08-03 13:38:28 +01:00
John Whitington 13965773ed Tildes back in ~random parameter in Hashtbl.create 2020-08-03 13:01:33 +01:00
John Whitington 0af3a1a805 Small fixes from @dra27's comments 2020-08-03 12:46:16 +01:00
John Whitington 1c258b463f Fix label warnings 2020-07-31 15:51:11 +01:00
John Whitington a5ed794b4c Check-typo and indenting all done 2020-07-31 14:24:50 +01:00
John Whitington 35a3470a9d Better indentation for moreLabels.mli patches 2020-07-31 12:38:45 +01:00
John Whitington 6e0557f6d7 Labeled and unlabeled @sinces automatically 2020-07-30 17:21:22 +01:00
John Whitington 0fbeee11be Fix smaller review comments from @dra27 2020-07-30 13:26:20 +01:00
John Whitington 85491c8867 Tildes back in labeled modules 2020-07-29 14:58:01 +01:00
John Whitington dd1f3789f2 Tilde removal in place. Now will put them back in. 2020-07-29 13:58:22 +01:00
John Whitington 28f624b919 check-typo fixes 2020-07-27 15:53:57 +01:00
John Whitington 902ca08055 Fix tools/unlabel to deal with Hashtbl injectivity 2020-07-27 15:44:35 +01:00
John Whitington e5e7b9591a Restore docstring variable brackets 2020-07-27 14:42:30 +01:00
John Whitington 22a158b7b2 Fix injectivity type 2020-07-27 14:32:48 +01:00
John Whitington 44403b16e8 Merge branch 'trunk' of https://github.com/johnwhitington/ocaml into trunk 2020-07-27 14:15:11 +01:00
John Whitington bec7f8ff3d Restore Hashtbl.rebuild in .mli, fix docstring 2020-07-27 14:12:54 +01:00
John Whitington d0263ac0e4
Merge branch 'trunk' into trunk 2020-07-27 13:53:52 +01:00
John Whitington 33fdfffd5f Resolving conflicts with injectivity work 2020-07-27 13:49:42 +01:00
John Whitington 7f922569c0 Replacing {!X.y} in doc comments with {!y} 2020-07-27 13:39:12 +01:00
John Whitington 1f2daa31d3 Added injectivity annots back (clash with GPR9781) 2020-07-23 19:08:46 +01:00
David Allsopp f341db8dbe Add Sys.rmdir 2020-07-21 15:36:43 +01:00
David Allsopp 9a7a17c012 Add Sys.mkdir 2020-07-21 14:15:40 +01:00
Sébastien Hinderer f3ff1337a1 Build system: honour the CFLAGS and CPPFLAGS build variables
With this commit, it becomes possible to provide C compiler and preprocessor
flags to use in addition to those defined by the build system.

As required by the GNU coding standards, the flags can be provided
either at configure or at make invocation.

The provided CFLAGS and CPPFLAGS will also be taken into account
when C code is compiled by ocamlc/ocamlopt.

This commit removes the explicit reference to CFLAGS in the
configuration for the xlc compiler, since it is not necessary any longer.
2020-08-06 14:30:50 +02:00
Jeremy Yallop 395a47eed9
Add Bigarray 'init' functions (#9779)
Add Bigarray init functions.
2020-08-05 13:26:10 +01:00
David Allsopp 8905edd382 Trivial correction to stdlib/HACKING.adoc 2020-08-04 15:01:50 +01:00
Jacques Garrigue 302d735ce8
Righteous ambivalence (#9767)
* Fix #9759: Typing without -principal is broken in 4.11 and trunk
* compile stdlib in -principal mode
* never modify generic part of ty_expected_explained
* use generic_instance where possible
* add comment for -no-principal in stdlib__oo.cmi
2020-07-29 09:10:17 +09: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
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
Xavier Leroy a6f03cc10f Add Hashtbl.rebuild function
This provides an officially-sanctioned, guaranteed-to-work way to
import a hash table that has been built with an old version of OCaml
(say, before 4.00) and marshaled to persistent storage.
2020-07-19 19:38:25 +02:00
John Whitington 1d19609646 Match documentation and labels 2020-07-19 13:34:25 +01:00
John Whitington 926995b012 Generate moreLabels.mli programatically 2020-07-18 17:12:16 +01:00
Jeremy Yallop 0aa72dd034 Add some injectivity annotations to the standard library. 2020-07-18 15:50:42 +01:00
John Whitington e8e5b7e73f Make hashtbl.mli / set.mli / map.mli from labeled 2020-07-18 12:03:03 +01:00
Stephen Dolan 523fba919b
Extend Printexc API for raw backtrace entries (#9663) 2020-07-13 11:13:12 +01:00
John Whitington e870b8a9a9 More check-typo fixes 2020-07-08 15:09:10 +01:00
John Whitington 0f2954b263 Fixes per travis check-typo and travis changes 2020-07-08 14:13:08 +01:00
John Whitington f410787b81 Better warning for developers 2020-07-08 12:52:57 +01:00
John Whitington dea23a56c5 Restore String.prefix/suffix status quo ante 2020-07-08 12:23:16 +01:00
John Whitington efe8ca02f1 Unify labeled and unlabeled Standard Library modules 2020-07-07 19:34:14 +01:00
Florian Angeletti 75aa1ee0bc
Merge pull request #9712 from Octachron/version_format
New format for the OCaml version string
2020-07-03 10:20:20 +02:00
octachron cd813bc1b0 Update version format 2020-07-02 16:47:03 +02:00
Et7f3 c4851b0ff0
Consistently use @raise tags in Stdlib docs (#8644) 2020-06-30 14:06:45 +01:00
Leo White 6302b1e0cc
Merge pull request #9670 from lpw25/stat-full-major-collections
Report full major collections in Gc stats
2020-06-26 12:31:47 +01:00
Leo White dfd0c0cc77 Report full major collections in Gc stats 2020-06-25 14:24:41 +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
Thomas Refis 7bf55c6c54 dune: temporarily remove use of new primitive before building 2020-06-24 15:07:16 +02:00
Bernhard Schommer ddb1b5e4b5
Use new String.is_suffix function. 2020-06-24 12:01:55 +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
Xavier Leroy e52bf321fd Reimplement Obj.reachable_word using a hash table to detect sharing
The previous implementation (caml_obj_reachable_words in runtime/obj.c)
was using the mark bits of block headers to detect sharing.

This is not compatible with Multicore OCaml.

This commit reimplements caml_obj_reachable_words to detect sharing
with a hash table of addresses already seen.

The implementation reuses the hash table used to detect sharing
during marshaling (commit 67ada54ce), and other bits of the marshaler,
hence the function caml_obj_reachable_words was moved to runtime/extern.c.

In no-naked-pointers mode, to anticipate the disappearance of the page
table, statically-allocated blocks cannot be treated specially and will
be counted towards the size.  This change of semantics is mentioned
in the documentation for Obj.reachable_words.
2020-06-22 19:37:22 +02:00
Gabriel Scherer bdbf5c30fd
Update camlinternalMod and Obj.new_block for new closure representation (#9691)
* camlinternalMod: use closure metadata for copying a closure over another

This change is careful to avoid writing a value into what was
previously a raw field or conversely, clearing fields that change
category first.

We also clear the end of the block, to make it easier to reason about
lifetime of values that could have been referenced there. (We don't
expect this to make a different in practice.)

* Obj: new submodule Closure giving basic access to closure metadata

* Ensure that Obj.new_block returns a sensible uninitialized closure

* Changes
2020-06-19 17:41:08 +02:00
Sébastien Hinderer bdd9ca391e Add the $(EXE) suffix to all programs at build rather than install time
This commit touches neither boot/ocamlc nor boot/ocamllex

It has the side-effect of fixing the cleanup rules which did not use the
$(EXE) extension when removing a file although it was produced with the
$(EXE) extension.
2020-06-18 11:16:55 +02:00
Xavier Leroy 791fe017df
Merge pull request #9655 from xavierleroy/obj-bits
Introduce type Obj.raw_data and functions Obj.raw_field, Obj.set_raw_field to manipulate out-of-heap pointers in no-naked-pointers mode, and more generally  all other data that is not a well-formed OCaml value
2020-06-14 11:44:04 +02:00
Gabriel Scherer f333db8b0f
Merge pull request #9662 from gadmm/fix-dune-build
Fix dune build after using Atomic in Stdlib
2020-06-11 21:43:09 +02:00
Sébastien Hinderer b94a3776a0
Remove temporary installation hacks (#9659)
* Remove temporary hack related to the Num library

This is a follow-up to commit 3de0115bfe

* Also do some cleanup in stdlib/Makefiile
2020-06-10 16:42:53 +02:00
Xavier Leroy ec33006c0a Add type Obj.raw_data and functions Obj.raw_field, Obj.set_raw_field
Some OCaml objects contain data that cannot be safely represented
as an OCaml value (type Obj.t).  For example, in no-naked-pointers mode,
this is the case for code pointers inside closures, and for the
"custom operations" pointers inside custom blocks.

This PR introduces a type Obj.raw_data (an alias for nativeint)
to encapsulate this data, and functions
Obj.raw_field / Obj.set_raw_field to read and write the "raw" contents
of fields of blocks.

Note: just like it is wrong to access code pointers and custom operations
using Obj.field / Obj.set_field, it is wrong to access regular fields
possibly containing pointers into the OCaml heap using
Obj.raw_field / Obj.set_raw_field.  The OCaml heap block can be
reclaimed or moved after its address was captured by Obj.raw_field.
Symmetrically, Obj.set_raw_field on a regular field bypasses the
write barrier of the GC.
2020-06-10 16:29:37 +02:00
Guillaume Munch-Maccagnoni 3a1901d873 Fix dune build
Introduce CamlinternalAtomic since Stdlib cannot refer to
Stdlib__-prefixed modules without breaking the dune build.

No change entry needed.
2020-06-10 14:29:21 +02:00
octachron 8875357638 review and change entry for #9618 2020-06-08 08:59:01 +02:00
octachron 99f0910081 format: document structural box quirk 2020-06-08 08:58:25 +02:00
octachron b6ba1823c0 format: comment max indent induced line splits 2020-06-08 08:47:39 +02:00
octachron 982d4a378e Format: margin documentation precision 2020-06-08 08:47:39 +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
Xavier Leroy 5890df0ad1 Update documentation of Digest module
State more clearly that MD5 is not cryptographically secure.
2020-05-18 11:33:06 +02:00
Guillaume Munch-Maccagnoni 1e4eea19ef Make at_exit forward-compatible with multicore 2020-05-16 22:58:07 +02:00
Guillaume Munch-Maccagnoni a469b4d0af Implement at_exit with Atomics
Atomic becomes a dependency of Stdlib
2020-05-16 22:58:07 +02:00
Guillaume Munch-Maccagnoni abe982165b Fix data race in at_exit and Printexc.register_printer with systhreads 2020-05-16 22:57:34 +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
Nicolás Ojeda Bär 4a44bf1767 Expose %loc_FUNCTION as __FUNCTION__ 2020-05-13 20:57:21 +02:00
Christophe Troestler c920ea142b
Fix comment about NaN propagation (#9536)
Fix documentation comment about NaN propagation

Closes: #7891

Co-authored-by: David Allsopp <david.allsopp@metastack.com>
2020-05-12 15:35:04 +02:00
Florian Angeletti c86a5d8d11
#9189: avoid one-letter make variables (#9281) 2020-05-11 12:21:59 +02:00
Gabriel Scherer fd789b5cec [minor] stdlib/Makefile: remove redundant clean action
There is already a more precise

    clean::
            rm -f $(CAMLHEADERS)

rule above.

(Change suggested by David Allsopp.)
2020-05-06 12:10:02 +02:00
Gabriel Scherer fab58a938a makefiles: move the inclusion of Makefile.build_config in Makefile.common 2020-05-06 12:10:02 +02: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
Josh Berdine a282c170f9
Update stdlib/ephemeron.mli
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
2020-05-03 00:25:54 +01:00
Josh Berdine 5e2b28decc Fix ephemeron documentation typos
Signed-off-by: Josh Berdine <josh@berdine.net>
2020-05-02 22:46:48 +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
Edwin Török f66e395c70 Fix docs: runtime warnings are not enabled by default
The docs on this are out of date: they say runtime warnings are enabled by
default, but the source code has a commit 6c90da4 pointing to
https://github.com/ocaml/ocaml/pull/210 that disables them by default.

It seems like enabling runtime warnings by default never made its way into a
release and the docs could just be updated to say that runtime warnings are
disabled by default.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
2020-04-27 21:38:58 +01:00
Stephen Dolan 0040c5d783 Print function names (derived from Lambda.scoped_location) in backtraces
Function names now appear in backtraces and are available via Printexc.
2020-04-27 12:58:53 +01: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
Greta Yorsh b823c8d8fc Remove stray newlines 2020-04-20 13:56:53 +01:00
Greta Yorsh 7271919a47 Check FLAMBDA in Makefile.common.in to update OPTCOMPFLAGS 2020-04-20 13:56:53 +01:00
Greta Yorsh 44af4aea7c Check FUNCTION_SECTIONS in Makefile.common.in to update OPTCOMPFLAGS 2020-04-20 13:56:53 +01:00
Greta Yorsh 7465e9f2c7 Define OPTCOMPFLAGS in Makefile.common.in 2020-04-20 13:56:53 +01:00
David Allsopp 3a40b2fd94 Introduce Makefile.build_config.in
This moves the configure-generated parts of Makefile.common to a
separate (generated) Makefile, allowing Makefile.common to be a normal
Makefile.

OCaml's build system Makefile's now include Makefile.build_config (which
itself includes Makefile.config) but Makefile.config is still installed
as before. This allows configure to generate variables which are
specific to the build process and are not intended to be exported to the
installation.
2020-04-17 13:53:49 +01:00
David Allsopp 13786d7d12 Ensure make distclean works on an unconfigured tree 2019-10-15 11:46:36 +01:00
David Allsopp d4a566573f Allow make to be invoked before configure
This should be improved to give better warnings for when Makefile.config
and Makefile.common are required.
2018-12-04 10:28:36 +00:00
Guillaume Munch-Maccagnoni b1fdc44547
Install a pretty printer for the Fun.Finally_raised exception (#9266) 2020-04-13 19:09:47 +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 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
Gabriel Scherer 1cd6e4451f Map.filter_map and Set.filter_map 2020-03-31 15:01:41 +02:00
muskangarg21 4019c33aaa
Stdlib: added Printf.ikbprintf, Printf.ibprintf (#9364) 2020-03-26 14:28:00 +01:00
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
zapashcanon 75bc37d4d9
fix doc comment for seq type 2020-03-19 21:39:06 +01:00
zapashcanon a8a3c55b18
fix doc comment for unit type 2020-03-18 20:22:08 +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
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
Gabriel Scherer b237282e97 Merge pull request #9270 from gadmm/doc_stack_overflow
Documentation: Stack_overflow is reliable, Out_of_memory is not.
(cherry picked from commit 84f62eee5d26efb936cde0e799b7aaa39e46c010)
2020-01-29 11:08:57 +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
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