Commit Graph

2207 Commits (master)

Author SHA1 Message Date
Guillaume Munch-Maccagnoni 2109946e0f
Ensure atomicity in the Atomic module is respected by flambda (#10035)
Prevent inlining of some of the functions, otherwise Flambda can move unrelated allocations inside the critical sections, making them non-atomic.
2020-11-24 11:48:33 +01:00
Jacques-Henri Jourdan 328ebc1ea3
Merge pull request #10025 from stedolan/memprof-custom
Track caml_alloc_custom_mem allocations with Statmemprof
2020-11-24 10:06:52 +01:00
Vincent Laviron a09a2a20f8 Update .depend 2020-11-21 12:19:18 +01:00
Vincent Laviron 0f30379ad9 Use Sys.opaque_identity instead 2020-11-21 12:19:18 +01:00
Vincent Laviron e78db7b6a5 Prevent inlining of CamlinternalLazy.force 2020-11-21 11:42:17 +01:00
Stephen Dolan 6a3af5c926 Add Gc.Memprof.allocation_source 2020-11-17 11:17:52 +00:00
David Allsopp 692bd73123 OCAMLRUNPARAM=b=2 => load debuginfo
Load the debug information during runtime startup if OCAMLRUNPARAM=b=2.
This guards against the specific case of running out of fds, since the
debug information can't then be loaded.
2018-12-11 10:17:04 +01:00
David Allsopp 43b28fac00 Improve error messages when loading backtrace info
Before, any errors when loading bytecode backtrace information were
fatal and the error message was potentially misleading.
2018-12-11 08:54:49 +01:00
David Allsopp 46c7122888 Merge pull request #9840 from dra27/fix-9839
Partial revert of 9165: don't build the compiler with -O3 in flambda

(cherry picked from commit 6ce1c60ca97ee962ebf5d5218628bc388536325e)
2020-10-30 11:29:17 +01:00
Jacques-Henri Jourdan 6d3065be78 Memprof: get rid of the idx_ptr pointers.
Instead, we use a thread-local variable [callback_status] which
contains the index of the corresponding entry when a callback is
running. We can do this since there can only be one running callback
at the same time in a given thread.

This lifts the restriction forbidding the call of Thread.exit from a
memprof callback.
2020-10-19 17:11:11 +02:00
Jacques-Henri Jourdan f83d71830d Memprof: provide the guarantee that an allocation callback is always run in the same thread the allocation takes place.
This is done by using a local entry array for each thread, containing
tracked blocks whose allocation callback has not yet been called.

This allows some simplification in the code running callbacks for
young allocations. Indeed, since the entry array is local to one
thread, we know for sure that it cannot be modified during a callback,
and therefore we no longer need to remember the indices of the
corresponding new entries.
2020-10-19 17:08:17 +02:00
Jacques-Henri Jourdan d1800821df Gc.Memprof.stop does no longer try to run pending callbacks.
This is only effetive in native mode, since function calls in bytecode
mode will trigger polling and hence run pending callbacks.
2020-10-19 16:41:13 +02:00
Xavier Leroy 8b7ff3532c
Move the examples of labeled functions to StdLabels (#9976)
In the old days, the interfaces of the labeled modules
(ArrayLabels, BytesLabels, ListLabels, StringLabels)
started with short examples of labelings.

Now, the interfaces of the non-labeled modules
(Array, Bytes, List, String) are automatically generated
from the interfaces of the labeled modules.  As a side effect,
the interfaces of Array, Bytes, List and String also start
with short examples of labelings, which is somewhat strange.

This commit reorganizes the documentation as follows:
- The documentation of the StdLabels module is expanded, and includes
  the examples of labeled functions previously scattered in
  ArrayLabels, BytesLabels, ListLabels, StringLabels.
- Array, Bytes, List, String and their labeled counterparts
  briefly mention the labeled modules and point to StdLabels,
  but no longer contain examples.
2020-10-15 15:07:31 +02:00
Mehdi Bouaziz 6ab6052e15
[hashtbl] Restore ongoing traversal status after filter_map_inplace (#8746) 2020-10-12 15:12:09 +02:00
Xavier Leroy 86c8a98f3c
Merge pull request #9948 from nojb/remove_spacetime
The Spacetime memory profiler is not going to be supported in Multicore OCaml, and  is already broken by some of the related changes in OCaml 4.12.  The core development team decided to remove Spacetime support from OCaml 4.12.
2020-10-09 14:43:23 +02:00
Damien Doligez 0069123c61
clean up and fix GC message 0x1 (#9949) 2020-10-09 12:02:00 +02:00
Nicolás Ojeda Bär 540996d21e Remove Spacetime 2020-10-08 20:28:12 +02:00
Xavier Leroy af48d9fe8f
Add a naked pointers dynamic checker (#9956)
This is selected at configure-time, option --enable-naked-pointers-checker.

The major GC warns when it detects out-of-heap pointers that could cause the no-naked-pointers runtime system to crash.

This is supported on x86-64 only, but on all ports (Unix and Windows).

Added tests involving naked pointers in tests/runtime-naked-pointers

Co-authored-by: KC Sivaramakrishnan <kc@kcsrk.info>
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
Co-authored-by: Enguerrand Decorne <decorne.en@gmail.com>
2020-10-05 14:44:31 +02:00
Joan Thibault 3e7532a49a
Fixed typo in String.mli (#9936)
Replaced 'escape' by 'escaped'
2020-09-24 14:12:58 +02:00
Daniel Bünzli 2bc93f5791
String documentation improvements (#9891)
* String documentation improvements.

* Regenerate string.mli.
2020-09-23 23:01:35 +02:00
Thomas Refis 7d9e60daa4
dune: build stdlib without injectivity annotations (#9932) 2020-09-22 10:31:48 +02:00
Gabriel Scherer 0a1ed638c4
Merge pull request #9918 from OCamlPro-Coquera/trunk
Stdlib.Format: missing `since` annotation for formatter_out_functions
2020-09-15 11:54:36 +02:00
Florian Angeletti d0e983e2aa
Merge pull request #9745 from johnwhitington/trunk
Unify labeled and unlabeled Standard Library module interfaces
2020-09-15 11:07:25 +02:00
Albin Coquereau dedbb708ce move since tag to type definition 2020-09-15 10:33:11 +02:00
Albin Coquereau 0da6ca1f11 Add a comment that out_indent is part of formatter_out_functions since ocaml 4.06.0 2020-09-15 09:58:20 +02:00
Florian Angeletti bc4d260de7
Merge pull request #9865 from raphael-proust/pp_print_seq
Stdlib.Format: add pp_print_seq
2020-09-14 16:52:11 +02:00
John Whitington 2d217e7c44 assoc -> assoc_opt 2020-09-11 20:07:44 +01:00
John Whitington bcc16f692b Fix two little errors 2020-09-11 18:10:12 +01:00
John Whitington a866c6d07f Fix reference to tools/unlabel 2020-09-11 14:39:12 +01:00
John Whitington c3f6cd7ff7 Merge remote-tracking branch 'upstream/trunk' into trunk 2020-09-11 14:14:38 +01:00
John Whitington 69c59b172d Take account of GPR#9668 2020-09-10 21:01:02 +01:00
John Whitington fc101ae849 Rename tools/unlabel --> tools/sync_stdlib_docs 2020-09-10 19:17:43 +01:00
John Whitington 5fd8236343 Fix comment regarding NaN in Array.sort 2020-09-10 18:10:29 +01:00
John Whitington 99645f901b Adds readme to stdlib/templates 2020-09-10 18:08:00 +01:00
Gabriel Scherer 03839754f4
List.equal, List.compare (#9668)
`List.equal f foo bar` is nicer than
`List.length foo = List.length bar && List.for_all2 f foo bar`.

Note: with List.compare there is a risk of users having opened the
List module, and then using 'compare' from the stdlib unqualified. For
example:

    List.(sort compare foo bar)

Such code will break (type error), and has to be fixed by using
Stdlib.compare. Stdlib is available since OCaml 4.07; people wishing
to support both 4.12 and older releases would have to avoid opening
List, or rebind 'compare' locally.
2020-09-09 20:01:04 +02:00
Xavier Leroy 1b48b5aa3c
Merge pull request #9872 from xavierleroy/seek-text-channels
Revised {in,out}_channel_length and seek_in for channels in text mode
2020-09-08 09:52:22 +02:00
Xavier Leroy 83c762974b Document the issue with pos_{in,out} and files opened in text mode
Add changes for 9872
2020-09-08 09:51:35 +02:00
David Allsopp 558424dcbb
Merge pull request #9851 from yallop/obj-tag-noalloc
Mark Obj.tag [@@noalloc]
2020-09-07 14:34:04 +01:00
Jeremy Yallop 1a8aa5428e Add partition_map to ListLabels. 2020-09-03 22:23:00 +02:00
Gabriel Scherer ca6f3ee057 List.partition_map : (a -> (b, c) Either.t) -> a list -> b list * c list 2020-09-02 13:59:53 +02:00
Gabriel Scherer 25e59d63d8 Add `'a Either.t = Left of 'a | Right of 'b`
```ocaml
val left : 'a -> ('a, 'b) t
val right : 'b -> ('a, 'b) t
val is_left : ('a, 'b) t -> bool
val is_right : ('a, 'b) t -> bool
val find_left : ('a, 'b) t -> 'a option
val find_right : ('a, 'b) t -> 'b option
val map_left : ('a1 -> 'a2) -> ('a1, 'b) t -> ('a2, 'b) t
val map_right : ('b1 -> 'b2) -> ('a, 'b1) t -> ('a, 'b2) t
val map : left:('a1 -> 'a2) -> right:('b1 -> 'b2) -> ('a1, 'b1) t -> ('a2, 'b2) t
val fold : left:('a -> 'c) -> right:('b -> 'c) -> ('a, 'b) t -> 'c
val equal :
  left:('a -> 'a -> bool) -> right:('b -> 'b -> bool) ->
  ('a, 'b) t -> ('a, 'b) t -> bool
val compare :
  left:('a -> 'a -> int) -> right:('b -> 'b -> int) ->
  ('a, 'b) t -> ('a, 'b) t -> int
```

Unlike [result], no [either] type is made available in Stdlib,
one needs to access [Either.t] explicitly:

- This type is less common in typical OCaml codebases,
  which prefer domain-specific variant types whose constructors
  carry more meaning.
- Adding this to Stdlib would raise warnings in existing codebases
  that already use a constructor named Left or Right:
  + when opening a module that exports such a name,
    warning 45 is raised
  + adding a second constructor of the same name in scope kicks
    in the disambiguation mechanisms, and warning 41 may now
    be raised by existing code.

If the use becomes more common in the future we can always
revisit this choice.
2020-09-02 13:59:53 +02:00
Raphaël Proust bed23dfbbc Stdlib.Format: add pp_print_seq 2020-09-01 17:51:34 +02:00
Jeremy Yallop 491cc88b33 Mark Obj.tag [@@noalloc] 2020-08-21 10:29:31 +01:00
John Whitington 7bb80d434e "final" fixes 2020-08-06 14:18:18 +01:00
John Whitington af6ad84d6d Restore tilde-removal, other little fixes 2020-08-05 17:39:59 +01:00
John Whitington 5e5423b1f2 Compflags @since removal for .cmti files for odoc 2020-08-05 16:36:37 +01:00
John Whitington 35cb3e550f Float.Array(Labels) generated by tools/unlabel 2020-08-05 15:39:33 +01:00
John Whitington d42970a989 @since modifications only happen on labeled files 2020-08-05 13:52:44 +01:00
John Whitington 53f753d772 remove double @sinces 2020-08-03 15:26:44 +01:00
John Whitington 66638cf700 ~prefix fix 2020-08-03 14:12:58 +01:00