Commit Graph

341 Commits (master)

Author SHA1 Message Date
hhugo 49aa87c316
Introduce warning 68 to warn about hidden allocation due to pattern match of mutable field in curried functions (#9751)
Introduce new warning 68
2020-08-17 09:47:36 +01:00
Sébastien Hinderer df9d60f315 Get rid of the YACCFLAGS build variable
It was not used, except in lex/Makefile where this commit replaces its
unique occurrence by its definition in the same file.
2020-08-05 14:46:40 +02:00
Sébastien Hinderer 8087f7f1c5 Build system: simplify installation rules
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.
2020-06-18 11:16:58 +02:00
Gabriel Scherer fab58a938a makefiles: move the inclusion of Makefile.build_config in Makefile.common 2020-05-06 12:10:02 +02: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 9eeead7b3c Use Fun.protect where possible 2019-10-19 11:49:18 +01:00
David Allsopp d0bab08f15 Don't ever call stop_user_input in line_loop
The caller is now always responsible for calling stop_user_input, rather
than only responsible for calling it on error.
2019-10-19 11:47:07 +01:00
David Allsopp 37acb3bf24 Remove use of Printexc.catch from debugger
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.
2019-10-19 10:38:48 +01:00
David Allsopp e2f278c7a4 Preserve backtraces in debugger
Add Primitives.cleanup which allows handlers for unexpected exceptions
to cleanup and reraise the exception with its backtrace.
2019-10-19 10:38:48 +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
Florian Angeletti 95a5399b28
ocamldebug: initialize all functions in Env (#9356)
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.
2020-03-11 09:44:00 +01:00
Florian Angeletti 40e40a9c20 compilerlibs: expose parsers for 'Longident.t's 2020-01-09 16:45:39 +01:00
Florian Angeletti e667d9fb8d debugger: rename parser and lexer modules 2020-01-06 14:14:55 +01:00
Florian Angeletti 816a5088e0 Avoid duplicated mark_loops 2019-10-17 10:03:58 +02:00
Gabriel Scherer 986745cbbc debugger Makefile: use ocamlc.opt when available
On my machine the sequential build time goes from 3.7s to 1.3s
2019-10-12 10:23:29 +02:00
Jeremie Dimino 2d31ebfc8b Add support for [@@immediate64]
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2019-09-24 07:56:15 +01:00
Leo White c19e8b2350 Refactor environment lookup functions 2019-08-15 15:56:50 +01:00
Jacques-Henri Jourdan 78de99ecc2 Xavier Clerc's remarks. 2019-07-16 13:42:04 +02:00
Jacques-Henri Jourdan 593f94055a Dynlink support for ocamldebug
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.
2019-07-16 10:52:48 +02:00
Sébastien Hinderer a201ade7f3 Build system: make ocamllex silent by default (#8664)
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.
2019-05-07 11:32:05 +02:00
Leo White 26389cb4ef Remove out-of-date comment
This comment was made unnecessary by GPR#1610.
2019-04-16 16:29:56 +01:00
Mark Shinwell 72ea849d2a
Move some middle-end files around (#2281)
* 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.
2019-04-01 17:18:47 +01:00
Gabriel Scherer fb99eff734 Debugger: factorize error-reporting logic 2019-03-26 09:00:01 +01:00
Gabriel Scherer d5f8a9f948 Expose Persistent_env.Error and catch it from the debugger
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
```
2019-03-25 16:04:52 +01:00
Mark Shinwell dbede46c2e
Improve the packing mechanism used to build Dynlink (#2268) 2019-03-19 10:26:35 +00:00
Mark Shinwell 2cc1ea26b9 Remove gprof support (#2314)
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.
2019-03-16 19:56:53 +01:00
Mark Shinwell 36c163248d Remove support for compiler plugins (#2276)
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
2019-03-13 11:46:37 +01:00
Gabriel Scherer 93f0ce31bb env refactoring: separate the cmi/crc handling into a persistent_env module
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.
2019-02-18 17:02:47 +01:00
Fourchaux 1946594bd7 Fixing typos in various files (#2246)
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
2019-02-13 14:04:56 +01:00
Jeremie Dimino 7e0862a212 Refactor load path management and initial environment
- 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
2019-01-30 16:36:38 +00:00
Sébastien Hinderer d258bb78ac Build system: use ocamlc -depend rather than ocamldep 2019-01-03 16:43:23 +01:00
Gabriel Scherer 295f71cb96 make alldepend (with new one-dep-per-file printing) 2018-12-12 09:38:49 +01:00
Gabriel Scherer 46ef054330 Makefiles: restructure CAMLDEP usage to easily add flags
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".
2018-12-12 09:30:55 +01:00
Leo White fc1e6ad5a2 Update .depend 2018-11-21 03:39:34 -05:00
Leo White 111d4e1827 Remove positions from paths 2018-11-21 03:39:34 -05:00
Mark Shinwell 6526a0c3d9 Make (nat)dynlink sound 2018-11-12 17:44:26 +00:00
Gabriel Scherer 8396c0b8bc make alldepend 2018-11-11 17:20:27 +01:00
Daniel Bünzli a7afd89003 s/string_of_int/Int.to_string/g 2018-11-07 13:52:02 +01:00
alainfrisch 0d968e357b Move variable printer to Pprintast
- 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).
2018-11-06 13:12:54 +01:00
Thomas Refis d68e0e2077
Provide a way to build the bytecode compiler using Dune (#2093) 2018-10-10 16:16:00 +01:00
Thomas Refis 94b55c1584 consistently make temporary local type idents local idents 2018-09-21 11:47:44 -04:00
Thomas Refis b134588f28 ident: split Local into Local and Scoped
Also rename [create] into [create_scoped] and [create_var] into
[create_local].
2018-09-21 11:47:44 -04:00
Thomas Refis 67f29d1a18 ident: add an explicit scope field
- 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.
2018-09-21 11:47:42 -04:00
Sébastien Hinderer 01b65ac0af Introduce and use ROOTDIR in more makefiles 2018-09-17 14:51:01 +02:00
Sébastien Hinderer ba6362a07d Move config/Makefile to Makefile.config
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.
2018-09-17 14:23:35 +02:00
Gabriel Scherer cbb92d2817 remove unused ocamlyacc dependencies, never put it in boot/ 2018-09-01 23:17:06 +02:00
Jérémie Dimino 9124ab82d1
Deprecate Pervasives (#1605)
- 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
2018-08-27 12:42:14 +01:00
Xavier Clerc 7e29162582 Pass the elements from `BUILD_PATH_PREFIX_MAP` to the assembler (#1930) 2018-07-27 12:25:23 +02:00
François Bobot da3f9f34f5 Use reraise_raw_backtrace in Misc.try_finally
And add labels ~always for previous cleanup function and
    ~exceptionally for new cleanup function in exceptional case
2018-07-25 17:58:32 +02:00