Now that programs are built with their $(EXE) suffix, their installation
rules can be simplified a bit because most of the programs get installed
under the name they have been built with.
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.
Allow the runtime to display details of any uncaught exception (with
backtraces, if enabled). Unix.handle_unix_error is still used to convert
errors from system calls to a less unmeaningful form.
Switch ocamldebug to compiler-libs in order to avoid hidden dependencies issue.
In particular, the Env module is only fully initialized after the Typemod and Includemod modules have been linked. Calling `Env.find_type` before that initialization may result in an assert false when functor-derived types are involved.
This commit adds dynlink support for ocamldebug. As a side effect, it also:
- factorizes the various functions searching for a code fragment into one,
called [caml_find_code_fragment];
- removes the [caml_register_code_fragment], which does not seem to
be used anywhere, and which clearly should not be used by external code.
This commit makes e.g. make -s world.opt completely
silent when everything works, in order to increase the visibility of
any unexpected message occurring during the build.
This will be useful for instance during CI, in particular it should
make it easier to catch undefined build variables.
The implementation is straightforward. The OCAMLLEX_FLAGS variable is
defined in Makefile.common.in and then used consistently by all
lexing recipes.
In addition, in tools/Makefile, the two rules producing the lexers
from cvt_emit.mll and make_opcodes.mll have been replaced by a
pattern-rule and the useless .SUFFIXES target has been removed.
* Various file moves in the middle end: this is the first stage of improving separation between the middle end and backend.
* Creation of file_formats/ directory (with associated file moves) to hold the definitions of compilation artifact formats.
* Creation of lambda/ directory (with associated file moves) to hold Lambda language definition files, transformation passes and construction passes from Typedtree.
* Disable (hopefully temporarily) dynlink, debugger and ocamldoc for the dune build.
The debugger reimplements its own error-reporting logic without using
the reporter-registration mechanism of the compiler, so it needs to be
adapted after the split between `Env` and `Persistent_env` in #2228.
(Interestingly, this forced me to expose the `Error of error`
exception in the Persistent_signature, which was not the case
before. It was probably a mistake to not expose an exception value
that can be raised by (correctly-written) consumers of the module.)
I noticed the issue while inspecting a testsuite failure (#8544).
Before this patch:
```
$ cat tests/tool-debugger/find-artifacts/_ocamltest/tests/tool-debugger/find-artifacts/debuggee/ocamlc.byte/debuggee.byte.output
Loading program... done.
Breakpoint: 1
10 <|b|>print x;
Uncaught exception: Persistent_env.Error(_)
```
After:
```
$ cat tests/tool-debugger/find-artifacts/_ocamltest/tests/tool-debugger/find-artifacts/debuggee/ocamlc.byte/debuggee.byte.output
Loading program... done.
Breakpoint: 1
10 <|b|>print x;
Debugger [version 4.09.0+dev0-2019-01-18] environment error:
The files /usr/local/lib/ocaml/stdlib.cmi
and [...]_ocamltest/tests/tool-debugger/find-artifacts/debuggee/ocamlc.byte/out/blah.cmi
make inconsistent assumptions over interface Stdlib
```
This commit removes support for gprof-based profiling (the -p option to ocamlopt). It follows a discussion on the core developers' list, which indicated that removing gprof support was a reasonable thing to do. The rationale is that there are better easy-to-use profilers out there now, such as perf for Linux and Instruments on macOS; and the gprof support has always been patchy across targets. We save a whole build of the runtime and simplify some other parts of the codebase by removing it.
After consultation on the core developers' list I am proposing this patch to remove support for compiler plugins.
The main motivations for removing compiler plugins are:
- They are a potential security risk.
- They increase the complexity of the build system and make maintenance of the Dynlink libraries more difficult (although actually, this complexity could probably be reduced after #2268 is merged).
- Many applications of plugins should be able to be expressed by building custom compiler drivers that link against compilerlibs.
* Remove compiler plugins and hooks
* Add new function Dynlink.unsafe_get_global_symbol but keep it outside the documented API.
* Remove otherlibs/dynlink/nodynlink.ml
* Update Changes
Persistent_env is a new module that handles the relation between the
type-checking state and the "persistent" typing information laying in
.cmi files on the filesystem. In particular, it handles the collection
and production of CRC information for the .cmi files being read and
written to the filesystem; the using modules (in our case, only Env)
are in charge of turning the cmi files into higher-level information
(components and signatures).
Persistent_env exposes a type `'a t` of a persistent environment,
which acts as a mutable store of `'a` values. There is no global state
in the module itself: while Env (and thus the OCaml type-checker) uses
a single global persistent environment, it should be possible to
create several independent environments to represent, for example,
several independent type-checking sessions.
Note: Typos found with https://github.com/codespell-project/codespell
Here is the (semi-manual) command used to get (and correct) the typos:
$ codespell -i 3 -w --skip=".png,.gif,./ocaml/boot,./ocaml/.git,./ocaml/manual/styles,./ocaml/manual/manual/htmlman" -L minimise,instal,contructor,"o'caml",cristal,pres,clos,cmo,uint,iff,te,objext,nto,nd,mut,upto,larg,exten,leage,mthod,delte,tim,atleast,langage,hten,iwth,mke,contant,succint,methids,eles,valu,clas,modul,que,classe,missings,froms,defaut,correspondance,differents,configury,reachs,cas,approche,normale,dur,millon,amin,oje,transfert
- Add a Load_path module which caches files lookup
- Instead of falling back to the external environment, allow to
declare in the environment that a module comes from the external
world. This allows persistent structures to shadows non-persistent
ones
This change should be a refactoring no-op.
Before, a DEPFLAGS variable existed in some makefiles to contain
include directories to be passed to ocamldep invocations, but no
support for easily adding command-line flags to ocamldep was available
(invocations would systematically use -slash, which was duplicated
across callsites).
With this PR, a new DEPINCLUDES variable contains the include
directories, and DEPFLAGS is repurposed to contain other command-line
flags for the tool -- currently "slash".
- The code responsible for printing Syntaxerr errors is moved to the
Parse module (so that it can depend on the variable printer in
Pprintast).
- Pprintast becomes a dependency for a few tools that link some
compiler modules in an ad hoc way (they would better be implemented
in terms of compiler-libs).
- Ident.create now takes a scope as argument
- added Ident.create_var to use when the scope doesn't matter
- the current_time and the current_level are unrelated as of this
commit. But one has to remember to bump the level when creating new
scopes.
In order to prepare the transition to autoconf, this commit moves the
configuration Makefile out of the config directory which will disappear
and gives it the name it will have once intstalled, namely Makefile.config.
- inline Pervasives in Stdlib and re-add Pervasives as a deprecated
module that aliases all elements of Stdlib except the stdlib modules.
- remove special case for Stdlib.Pervasives in printtyp.ml