This commit adds a new thread-related module Semaphore, implementing
counting semaphores and binary semaphores.
The two kinds of semaphores are presented as two different
abstract types in two sub-modules, Counting and Binary.
* remove the unused is_native_tail_call_heuristic forward reference
This forward-reference from Lambda to Asmcomp was used to generate
machine-specific tailcall information in -annot output; this only use
was removed in 57d329e07b, so we can now
remove it to simplify the codebase.
The logic was non-trivial and might be useful again in the future.
* [minor] testsuite: convert warnings/w51.ml to an expect-test
* [minor] translattribute: refactor attribute payload deconstruction
* [@tailcall false]: warn if the call *is* a tailcall
(+ constructor renaming suggested by Nicolás during review)
* Changes
* testsuite: add an example with the 'invalid payload' exception
(suggested by Nicolás during review)
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.
- Mutex.lock raises Sys_error if the mutex is already locked by the
calling thread.
- Mutex.unlock raises Sys_error if the mutex is unlocked or locked
by another thread.
Add the corresponding tests.
Co-authored-by: David Allsopp <david.allsopp@metastack.com>
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>
Rewrite check_scope_escape using proper marking and unmarking
This uses the Btype.snapshot/backtrack mechanism, to ensure that we
always undo marking on types from the environment and to avoid a
`try ... with ...` construction for each recursive call.
This is a wrapper around the _exit system call. It has been implemented
in otherlibs/unix/exit.c for a long time but never exported.
This commit exports and documents it as `Unix._exit`.
The Unix implementation of `establish_server` is changed to use `_exit`
and to have gender-neutral comments.
A test was added to check that OCaml finalization actions are not performed.
type t += A = M.A [@a]
was pretty-printed as
type t += A[@a] = M.A
[obviously wrong, also not accepted by parser]
With tests for extension-constructors and exceptions.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch pr-extension-constructor-rebind-pprint-4.11
# Changes to be committed:
# modified: Changes
# modified: parsing/pprintast.ml
# modified: testsuite/tests/parsetree/source.ml
#
# Untracked files:
# Changes.orig
# parsing/pprintast.ml.orig
# testsuite/tests/parsetree/source.ml.orig
# testsuite/tests/parsetree/source.ml.rej
#
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch pr-polyvariant-pprint
# Your branch is up to date with 'my-fork/pr-polyvariant-pprint'.
#
# Changes to be committed:
# modified: Changes
#
# Untracked files:
# Changes.orig
# parsing/pprintast.ml.orig
# testsuite/tests/parsetree/source.ml.orig
# testsuite/tests/parsetree/source.ml.rej
#
a type "[ | w ]" must be printed with the "|", or it won't be
reparseable.
with tests, Changes entry.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch pr-polyvariant-pprint
# Changes to be committed:
# modified: Changes
# modified: parsing/parsetree.mli
# modified: parsing/pprintast.ml
# modified: testsuite/tests/parsetree/source.ml
#
# Untracked files:
# Changes.orig
# parsing/pprintast.ml.orig
# testsuite/tests/parsetree/source.ml.orig
# testsuite/tests/parsetree/source.ml.rej
#
`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.