Commit Graph

20284 Commits (bdd9ca391e3a56253d7480b07bb1a8aac361904c)

Author SHA1 Message Date
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
Sébastien Hinderer 41e4dc1dc8 tools/Makefile: stop considering ocamldep and cvt_emit as precious 2020-06-18 11:13:12 +02:00
Sébastien Hinderer a50d177c2a ocamltest: improve the way executable file extension is determined
Use the EXE build variable rather than OS type to determine the
extension of executable files
2020-06-18 11:07:43 +02:00
Sébastien Hinderer b7d8a97e91 lex/Makefile: simplification 2020-06-18 11:07:43 +02:00
Sébastien Hinderer 2ee6e82925 Makefile: avoid one recursive invocation of make
The `core` target can depend on `coldstart` rather than invoking
`$(MAKE) coldstart` as its first command.
2020-06-18 11:07:43 +02:00
Sébastien Hinderer 1c158f4227 Makefile: introduce the CMPBYT variable 2020-06-18 11:07:43 +02:00
Sébastien Hinderer d9dc10ef0b Fix distclean rule
Commit 13786d7d12 accidentally removed a file twice.
2020-06-18 11:07:43 +02:00
Sébastien Hinderer c530b74e5e tools/ocamlmktop.ml: make use of the configured extension of executalbes
Before this commit, the name of the compiler to use (ocamlc or ocamlc.exe)
was determined base on the OS type. This commit replaces this by
a mere string concatenation of "ocamlc" and the configured extension
for executable files.

This introduces a dependency of tools/ocamlmktop on the compiler's
configuration module.
2020-06-18 11:07:43 +02:00
Sébastien Hinderer 758ab7d1a6 objinfo: take possible .exe extension into account when calling objinfo_helper 2020-06-18 11:07:43 +02:00
Sébastien Hinderer 16006d55b1 Make ext_exe public in the configuration module of the compiler 2020-06-18 11:07:43 +02:00
Sébastien Hinderer 92331f8025 objinfo_helper: slightly generalise usage message
Use argv[0] rather than hardcoding "objinfo_helper".

That way the message is accurate whether there is a ".exe" extension or not.
2020-06-18 11:07:43 +02:00
Xavier Leroy d4dea7afea
Adapt caml_alloc_dummy_infix to new closure representation (#9690)
The first closure info field must be valid.

Also document two other places where no change is needed because of
the new closure representation, but for nonobvious reasons.
2020-06-17 16:03:51 +02:00
Xavier Leroy 0d1f7b208e
Generic hashing for the new closure representation (#9648, #9689)
This commit revises the generic hash functions to take advantage of
the new closure representation: code pointers are directly mixed
into the hash rather than having to be detected using Is_in_value_area.

Currently the new code for closures is activated only in no-naked-pointers
mode, even though it is sound in naked-pointers mode too.

Closes: #2168
2020-06-16 19:05:37 +02:00
Florian Angeletti cc647674d7 Changes: RISC-V has been backported to 4.11.0 2020-06-16 14:43:55 +02:00
Gabriel Scherer 58b3efda09
classify_addr.h: explain the no_naked_pointers value model (#9684)
We are planning to support two configurations (with or without
naked pointers) in the runtime for at least a couple years, so I think
it is useful to explain their value models and corresponding runtime
functions/macros. This should help runtime developers reason about the
code written to support both modes.
2020-06-16 11:16:02 +02:00
Xavier Leroy e4bf109d1e
Signal handling in native code without the page table (#9682)
Signal handlers sometimes need to know whether the signal occurred
in ocamlopt-generated code, as opposed to runtime or C library code.

Today this determination uses a page table lookup to keep track
of dynamically-loaded modules, plus ad-hoc tests for the main program.

This PR uses the code fragment table instead.  That's more reliable,
less ad-hoc, and independent of the page table.

i386nt.asm: add caml_system__code_{begin,end}, ,like in the other ports.
2020-06-15 14:17:42 +02:00
Jacques Garrigue 603506aa34
Add injectivity annotations (#9500) 2020-06-15 13:51:50 +02:00
Xavier Leroy 5a9c5dd5b0
globroots.c: adapt to no-naked-pointers mode (#9683)
Global roots management has a special case for out-of-heap pointers.
This is not compatible with a future removal of the page table.
However, this is just an optimization that can safely be turned off.

This PR treats out-of-heap pointers like major-heap pointers in
no-naked-pointers mode.
2020-06-15 13:39:35 +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
Sadiq Jaffer b8a415f724
Add closure-info field when reifying bytecode (#9681)
The closure built by caml_reify_bytecode was not using the new closure format.
2020-06-14 19:22:01 +02:00
Nicolás Ojeda Bär 13155d81ee
Typo 2020-06-14 18:37:44 +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
Xavier Leroy 2ad3a038bb Changes entry for #9675 2020-06-14 11:46:43 +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
Xavier Leroy 0a2dacbd42 Changes entry for #9655 2020-06-14 11:42:26 +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 faa56c1934 Add Changes entry 2020-06-14 07:57:39 +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 0a11f73c8b Bootstrap after removal of caml_static_{alloc,free_resize} primitives
Follow-up to d6f949608
2020-06-13 18:27:00 +02:00
Xavier Leroy d6f949608d Remove the primitive functions caml_static_{alloc,free,resize}
These primitives are dangerous because they produce naked pointers
outside the OCaml heap, with a risk of "GC pointer confusion".
(After caml_free and a heap extension, the freed memory area can be
reallocated as part of the OCaml heap, causing the naked pointer to
become a bad heap pointer).

These primitives are not used anywhere in the core OCaml system
(in particular they are not exposed via the Obj module).
An OPAM-wide grep shows no uses there either.
2020-06-13 18:23:08 +02:00
Gabriel Scherer cba5a765a2
Merge pull request #9653 from jhjourdan/memprof_no_shutdown
Memprof: getting rid of caml_memprof_shutdown
2020-06-13 13:53:04 +02: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 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
Xavier Leroy fe4b06b990 extern.c: #ifdef-protect a static function
Follow-up to c18409446.  Under macOS an unused static function triggers
a warning.
2020-06-11 20:21:31 +02:00
Xavier Leroy 38d2f5a92a
Merge pull request #9649 from xavierleroy/marshal-new-closure-repr
Marshaling for the new closure representation
2020-06-11 19:56:30 +02:00
Xavier Leroy 919803e09c Changes entry for #9649 2020-06-11 10:59:54 +02:00
Xavier Leroy c18409446e extern.c: use new closure representation to marshal closures
We know where the code pointers, closure info words and infix headers are,
and can output them directly.

Currently activated in no-naked-pointers mode only, but would work in
the other mode as well.
2020-06-11 10:52:13 +02:00
Xavier Leroy 21ce6b02e2 extern.c: refactor the code using auxiliary functions
This makes the core function `extern_rec` easier to read, and will
avoid code duplication in later changes.
2020-06-11 10:51:46 +02:00
Xavier Leroy 08e58c836e
More efficient management of code fragments (#9654)
* Introducing codefrag: a new runtime module to work with code fragments

This module collects all the operations on code fragments performed in
various places of the runtime systems.  Applies both to bytecode and
to native code.

The implementation is based on skiplists, so that "lookup fragment by
PC" and "lookup fragment by number" are efficient (logarithmic in the
number of code fragments).  "Lookup fragment by digest" remains
linear-time.

The new module also improves the handling of digests: now it is
possible to mark a code fragment as "no digest" i.e. not marshal-able.

* Use the new "codefrag" runtime module for marshaling and for the
  debugger interface

Replace the previous handling of code fragments with calls to the
functions provided by the "codefrag" runtime module.
2020-06-11 10:39:19 +02:00
Jacques-Henri Jourdan bee3679aab Memprof: getting rid of caml_memprof_shutdown
This function is not needed since there is no requirement that the OCaml runtime be able to restart once shut down.
2020-06-10 19:18:48 +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
Stephen Dolan 5946b93a85
Refactor skiplist to avoid UB casts (#9660)
This patch removes casts between struct skiplist * and struct skipcell *, and removes the "layout compatibility" fields in skiplist that were there to enable these casts.

The only algorithmic difference is that caml_skiplist_find is now "stop-at" (see discussion here), as this was slightly easier to write in the no-cast style.
2020-06-10 16:40:51 +02:00
Xavier Leroy c2db3288c1 Use type Obj.raw_data to represent code pointers in the REPL trace facility
Using Obj.t is incorrect in no-naked-pointer mode, as it exposes
code pointers as OCaml values.
2020-06-10 16:30:43 +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
Jacques-Henri Jourdan 7aad86fec4
Memprof: disable sampling when memprof is suspended. (#9628)
* Memprof: disable sampling when memprof is suspended.

* Changes.
2020-06-10 13:25:11 +01: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
Gabriel Scherer 6ea0fbdddb
Merge pull request #9602 from garrigue/document-variance-flags
add explanation for variance flags
2020-06-10 13:53:03 +02:00
David Allsopp 2f38a52086
Merge pull request #9625 from dra27/warn-error
--enable-warn-error configure option
2020-06-10 11:32:13 +01:00