Commit Graph

489 Commits (master)

Author SHA1 Message Date
Thomas Refis 6805595f57 introduce local substitutions in signatures
type [params] id := type_expr { and [params] id := type_expr }
    module Uid := extended-module-path
2018-11-09 16:43:43 +00:00
Geoff Gole aa14e7ab13 Fix #mod_use raising exception (MPR#7867) 2018-10-27 14:25:23 +08:00
Armaël Guéneau 6b16bcc4fe Add option -error-style and environment variable OCAML_ERROR_STYLE 2018-10-20 17:11:35 +02:00
Armaël Guéneau f954160614 Add source highlighting for errors & warnings in batch mode 2018-10-19 23:38:25 +02:00
Thomas Refis d68e0e2077
Provide a way to build the bytecode compiler using Dune (#2093) 2018-10-10 16:16:00 +01:00
Nicolás Ojeda Bär 70be1416dc Add support for OCAMLTOP_INCLUDE_PATH 2018-10-10 14:54:47 +02: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
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
Armaël Guéneau c0820e30cb Location: significantly rework the code printing errors and warnings 2018-08-08 17:42:08 +02:00
Thomas Refis b3b86c9b8b toplevels accept -nopervasives 2018-08-07 10:33:08 +01:00
Hugo Heuzard 8043144494 Add locations to attributes
Changes

fix typo
2018-08-06 13:19:28 +01:00
Hugo Heuzard c4dd1e67b5 Add locations to toplevel directives 2018-08-06 11:06:30 +01:00
sliquister ae1317caae Add option to dump the output of e.g. -dlambda in a file (#1913) 2018-07-27 08:51:53 +01:00
Nicolás Ojeda Bär 40bab2d768 Implement reviewer suggestions 2018-07-25 17:58:32 +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
Thomas Refis 2403ffb1b5 typemod: allow items coming from includes to be shadowed 2018-07-25 13:06:38 +01:00
Thomas Refis 445b53182a ctype: remove instance_def which is redundant 2018-07-25 11:12:10 +01:00
Gabriel Radanne 1be47bf7ab Just some tbl things. (#1699) 2018-07-23 13:19:41 +01:00
Valentin Gatien-Baron 1ddb7ad725 rename Clflags.fast as Clflags.unsafe
The variable and the flag got out in sync in
2977939b5a.
2018-07-15 15:08:47 -04:00
Armael 7c9c210884 Move Location.absname to Clflags.absname (#1886) 2018-07-06 13:43:28 +01:00
Valentin Gatien-Baron dd31991312 refactoring the uses of Clflags.include_dirs
- store what was passed on the command line, before expanding
  +foo into path-to-stdlib/foo, instead of randomly doing either
- the toplevel libraries were not expanding the leading + from
  OCAMLPARAM
- make the native toplevel slightly closer to the bytecode one
- remove what looks like duplicated code in ocamldoc
2018-07-01 07:50:33 -04:00
Florian Angeletti 349db3d869
PR#6416 et al.: injective mapping between identifiers and printed names (#1120) 2018-06-26 22:03:45 +02:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
Gabriel Scherer 15c89485f3
Merge pull request #1723 from stedolan/remove-meta-static
Remove Meta.static_{alloc, free}.
2018-05-28 16:14:52 +02:00
Thomas Refis 3efba04eb3 toploop: set Clflags.debug to true from loop, not at toplevel 2018-05-04 09:11:46 -04:00
Stephen Dolan 26f78be56d Add an optional digest parameter to Meta.reify_bytecode. 2018-04-13 17:36:20 +01:00
Stephen Dolan 7f76b23531 Add LongString.blit_string 2018-04-13 17:11:37 +01:00
Stephen Dolan aa1dc8063a Remove Meta.static_{alloc, free}.
The bytecode runtime now represents code to be loaded as LongString.t,
rather than as a naked pointer to a bytecode block.

(This commit breaks Dynlink of bytecode, due to an issue about digests)
2018-04-13 16:29:33 +01:00
Pierre Chambart 0a42259060 Turn flambda invariants checks off by default (#1686) 2018-04-06 09:49:57 +01:00
Jacques Garrigue 3d33bd4ef5
Fix MPR#7751 (#1657)
Fix the toplevel printer, to have it properly load needed cmi's.
2018-03-27 09:25:28 +09:00
Sébastien Hinderer 175ad5b8a3 Fix build of native toplevel broken by GPR#1618 2018-02-20 21:56:45 +01:00
Sébastien Hinderer fa7019437c Add the -dunique-ids and -dno-unique-ids options to the compilers
These options allow to control whether identifiers are made unique by
appending a stamp to them when dumping intermediate representations or not.

The default is to print the stamp, as is done currently.

The "-dno-unique-ids" option is useful e.g. to simplify the comparison
between a produced intermediate reprsentation (-dlambda, say) and the
expected one, in the context of the testsuite, for instance.
2018-02-20 18:02:35 +01:00
Pierre Chambart 6bfa23c08b Replace uses of Lambda.IdentSet by Ident.Set 2018-01-30 19:12:29 +01:00
octachron 0bf9ceaa3f toplevel: remove plugin option in toplevel 2017-09-30 11:03:53 +02:00
Damien Doligez f086eda9c0 add -no-flat-float-array configure option 2017-09-15 18:24:36 +02:00
Mark Shinwell b65096678b Register availability analysis (#856) 2017-09-15 11:08:14 +01:00
David Allsopp 12b20f30f5 Fix -nostdlib option to ocaml
Search path was initialised before options were parsed, meaning that
-nostdlib had no effect.
2017-08-17 15:16:02 +01:00
sliquister 3f76c0525b generalize -dtimings to show allocation, top heap size (#1152) 2017-06-09 12:29:21 +01:00
Gabriel Scherer 2691c40f2f Merge pull request #1164 from adrien-n/toplevel-show-doc-below
toplevel: doc for #show mentions categories above while they're below.
2017-05-25 16:40:09 -04:00
Fabrice Le Fessant 53c9c500bc Strip big strings in toplevel (#1058) 2017-05-11 13:57:08 +02:00
Adrien Nader de82de7611 toplevel: doc for #show mentions categories above while they're below.
The toplevel output for #help seems to be sorted and looks like:

  #show <ident>
    Print the signatures of components from any of the above categories.
  #show_class <ident>
    Print the signature of the corresponding class.
  #show_class_type <ident>
  [...]

Thus the documentation for #show needs to say that the categories are
below, not above. The code is effectful and has the specific #show_*
directives before the general #show one. That's why I expect there is
some kind of sorting done at runtime.
2017-05-08 15:16:28 +02:00
Valentin Gatien-Baron bf96a7ac42 display the output of -dtimings as a hierarchy 2017-03-07 15:43:57 -05:00
Nicolas Ojeda Bar e75c87dc48 Initial import of linear-scan-register-allocator
The code in this commit was written by Marcell Fischbach & Benedikt Meurer.
See [Mantis#5324](http://caml.inria.fr/mantis/view.php?id=5324) for some
context.

The code (which was originally written against 3.12) was ported to trunk by
doing

```bash
git clone https://github.com/bmeurer/ocaml-experimental/
cd ocaml-experimental
git diff master...linear-scan-register-allocator > t.diff
```

and then applying the diff by hand.
2017-02-22 17:09:18 +01:00
Tadeu Zagallo 46676cde6e PR#7060: [toplevel] Print exceptions in installed custom printers (#1035)
Exceptions raised by toplevel printers now include details of the exception itself.
2017-02-10 11:45:02 -05:00
Florian Angeletti 907c49d4d6 fix potential alias loop in #show_module (#777) 2016-12-14 13:14:21 +00:00
Bernhard Schommer bc81c313b0 Added expand to toplevel. (#864)
* Added expand to toplevel.

The toplevel now also accepts -args and -args0. In order to avoid
problems with the overide_args hack now script file is allowed in
expand options.

* Fixed differences between .ml and .mli

* Added missing expand in opttopmain.

* Added some test for broken -args for toplevel.

The test checks whether the toplevel fails if the script file is passed
via args option.

* Corrected test case.

* Updated error case.

Instead of printing the error string, Arg.Bad is raised and a wrapper is
added around the parse_and_expand_dynamic_argv.

* Added begin ... end around try ... with.

* Added working example an strip error path.

* Use sed to remove path and fixed typo.

* Added documentation.

* Also fix typo in reference file.

* Added PR to the corresponding change entry.

* Reworked Changes entry.

* Added new tests and updated documentation.

A script file in a responsefile now only prints an error message instead
of the help.

* Removed duplicated entry.

* Simplified expand logic.

We only remember where the current last expanded option is.

* Use first non_expand position instead.

* Updated error message.
2016-11-07 11:48:56 -05:00
Christoph Höger 0a735b71ba Actually use simplified lambda
Passing the original lambda might lead to illegal remnants of Lifused in the code passed to closure.ml (which will in turn raise an assertion error). This costed me a whole afternoon, I really wish there was a supported, native (or better: agnostic) toplevel.
2016-10-10 16:28:12 +02:00
Leo White caadb9de8a Allow more module aliases in strengthening 2016-07-28 10:13:32 +01:00
Damien Doligez d5a6e50ebe GPR#606: add unboxed types 2016-07-21 13:51:46 +02:00
alainfrisch c8d90398e6 Support -verbose in ocamlnat. 2016-07-20 16:37:52 +02:00
Fabrice Le Fessant d1418bc031 Remove dependency on Dynlink in ocamlnat 2016-07-18 17:49:52 +02:00
Fabrice Le Fessant f26c0ff8b6 Add plugins in the compiler 2016-07-18 17:43:05 +02:00
Fabrice Le Fessant bfc36003aa Add hooks on some compilation phases 2016-07-12 17:59:58 +02:00
Alain Frisch 2865a8c088 Merge pull request #591 from mlasson/ocamlparam
A few modifications to OCAMLPARAM
2016-07-10 14:44:37 +02:00
Pierre Chambart 1624c8e7a0 Also remove the forced dependency dummy code hack for closure
This also share the result type of transl_implementation_flambda
and transl_store_implementation
2016-07-08 16:02:26 +02:00
Pierre Chambart cb388c762a Some cleanup to explicit transl_implementation_flambda return values 2016-07-08 16:02:26 +02:00
Pierre Chambart 7286a4978f Allow to force linking modules without generating dummy code 2016-07-08 16:02:26 +02:00
Mark Shinwell 5f00ce793e Improve location handling in the middle end (version for merging) (#666) 2016-07-06 15:42:29 +01:00
Marc Lasson 465ee34d67 Reads OCAMLPARAM's I directive in toplevel 2016-07-04 09:53:31 +02:00
Marc Lasson 0fd2964dff Use OCAMLPARAM's objects in toplevel
Only the non-native one (it does not support OCAMLPARAM at all atm).
2016-07-04 09:53:23 +02:00
Gabriel Scherer 29b9b271e4 MPR#7189: toplevel #show, follow chains of module aliases
Before this patch,

    module A = struct let x = 1 end;;
    module B = struct module M = A end;;
    module C = B.M;;
    module D = C;;
    #show D;;

would print

    module D = C

now it prints

    module D = C
    module D = B.M
    module D = A
    module D : sig val x : int end

Note that one might expect to read

    module D = C
    module C = ...

instead, but this would result in the next line being

    module B.M = ...

which is not syntactically correct.

Note that this approach could be generalized to other forms of
aliases-following, types in particular.
2016-06-30 06:51:33 -04:00
Jacques Garrigue 3cb6d6c702 PR#7233: GADT equations for non-local abstract types 2016-06-13 09:25:31 +09:00
Damien Doligez 4a2107be8d Merge pull request #575 from shindere/toplever-no-version
Add the -no-version option to the toplevel.
2016-05-10 11:31:26 +02:00
Sébastien Hinderer 3bbf34319e Add the -no-version option to the toplevel.
This option requests the toplevel not to print its version number
at startup.
2016-05-09 17:22:29 +02:00
Sébastien Hinderer 50147913ac Call the '#' sign hash rather than sharp. 2016-05-09 16:34:40 +02:00
Demi Obenour fe05f8fc29 Add `-alias-deps` and `-app-funct`
This was meant for GPR #514, but I forgot to include it.
2016-04-19 12:21:09 -04:00
Demi Obenour 795a4d532d Add explicit command-line flags for currently-default settings
-no-keep-docs
    -no-keep-locs
    -no-principal
    -no-rectypes
    -no-strict-formats
2016-04-18 10:53:51 -04:00
alainfrisch 83ae23568c Renaming block_kind -> value_kind. 2016-04-12 14:49:50 +02:00
alainfrisch 932d806937 Fix for ocamlnat. 2016-04-12 14:49:48 +02:00
alainfrisch 502e4f9336 More warnings when compiling the compiler. 2016-03-15 22:46:35 +01:00
Jeremie Dimino 86daba0e90 Add Toploop.override_sys_argv 2016-03-01 10:36:24 +00:00
Jeremie Dimino b98461c3f3 Add Misc.protect_refs 2016-03-01 10:36:24 +00:00
Mark Shinwell 5dced42768 Merge pull request #480 from mshinwell/flambda_unbox-closures
GPR#480: Flambda fix: try to make Unbox_closures behave more reasonably
2016-02-26 16:18:04 +00:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Damien Doligez ee8f71101b clean up whitespace and cut long lines 2016-02-17 13:36:27 +01:00
Damien Doligez 21dce60dbd Merge pull request #467 from Octachron/manual_4.03.0_end
Manual: #help directive and immediate attribute
2016-02-12 11:16:08 +01:00
Leo White 4253ed1530 Tidy up new command-line parameters 2016-02-11 16:02:02 +00:00
octachron 213f51a77b Manual: synchronize the manual and toplevel help 2016-02-11 16:56:16 +01:00
Mark Shinwell 04445cb4ad Fix ocamlnat build (again) 2016-02-11 14:49:57 +00:00
Mark Shinwell c67bd88eee Addressing CR comments for Flambda 2016-02-10 17:01:33 +01:00
Mark Shinwell f95fb8bbb0 Bug fixes etc for Flambda 2016-02-09 18:38:16 +01:00
Mark Shinwell 7255775076 Fix ocamlnat build 2016-02-09 10:18:58 +01:00
Mark Shinwell a397511031 Import latest Flambda changes 2016-02-09 09:59:26 +01:00
Gabriel Scherer 8cbccbffe4 remove ocamlbuild-specific files 2016-02-01 15:05:18 -05:00
Gabriel Scherer f8f2a6277f remove ocamlbuild from the compiler distribution 2016-02-01 15:05:18 -05:00
Pierre Chambart b0b0f6609c Enable flambda 2016-01-28 15:04:47 +01:00
Thomas Refis 6c29c225eb ocamlnat: fix compilation 2015-12-31 11:20:58 +00:00
Gabriel Scherer 6c91699c6f 'Hint: Did you mean' on misspelled toplevel directives 2015-12-25 20:58:51 +01:00
Gabriel Scherer d7dfe9604e toplevel #help: split the directives into several sections 2015-12-25 19:53:27 +01:00
Gabriel Scherer 43c31e4f08 Add #help directive to the toplevel.
Nick Giannarakis proposed a first patch at
  http://caml.inria.fr/mantis/view.php?id=6113

Berke Durak and Francis Southern proposed two iterations on the patch
at:
  https://github.com/ocaml/ocaml/pull/46
  https://github.com/ocaml/ocaml/pull/376

The present patch contains code and ideas from all three sources.
2015-12-25 19:53:27 +01:00
Mark Shinwell 852efd270e Merge with trunk; remake dependencies 2015-12-22 16:28:35 +00:00
alainfrisch f6b5c9d579 Fix #7101: double file opening when loading .cmo/.cma in the toplevel leads to fd leak. 2015-12-18 15:54:48 +01:00
Pierre Chambart 233e1b1791 Record compiler runtime 2015-12-18 13:33:10 +00:00
Thomas Refis 3a79584852 reindent 2015-12-18 10:39:36 +00:00
Jeremie Dimino d0e62811c0 make ocamlnat build again
Conflicts:
	Changes
	Makefile.shared
2015-12-18 10:39:36 +00:00
Xavier Leroy 8e6606d729 PR#6108, PR#6802: fail cleanly if dynlink.cma or ocamltoplevel.cma are loaded inside the toplevel loop 2015-12-06 12:59:23 +01:00
Damien Doligez cce9cb4546 fix `ocaml -stdin` (was broken by 0296d022) 2015-12-04 16:20:55 +01:00
Hugo Heuzard 9eca3e4519 Parse arbitrary precision integers ..
.. and allow any letter in [g-zG-Z] as modifier (previously 'l','L','n')
Also allow modifier for floats
This give more freedom to ppx rewritters (what about a ppx for zarith)

Checks are performed when translating from Parsetree to Typedtree.
Invalid_literal is raised if the modifier is not recognized ([lLn]?)
Integer_overflow is raised as before.

Lexer: use g-zG-Z for integer literal modifier

Lexer: Allow modifier on float

Clean wrt previous commits

Lexer: use named substring

Cleanup

typo

doc

fix after rebase

rebase on  trunk

Update typecore.ml

Fix printast.ml
2015-12-03 17:20:48 +01:00