Commit Graph

72 Commits (master)

Author SHA1 Message Date
Nicolás Ojeda Bär 43883ae4bc Remove labels after calls, checkbound, and GC points 2020-10-08 20:28:15 +02:00
EduardoRFS f323d2ad67 arm64 runtime: apply ios assembler requirements 2020-07-25 08:36:23 +00:00
EduardoRFS 42943915a7 arm64 runtime: macro for global and local symbols 2020-07-25 08:36:22 +00:00
Xavier Leroy 9fcb295b98 Revised passing of arguments to external C functions
Introduce the type Cmm.exttype to precisely describe arguments to
external C functions, especially unboxed numerical arguments.

Annotate Cmm.Cextcall with the types of the arguments (Cmm.exttype list).
An empty list means "all arguments have default type XInt".

Annotate Mach.Iextcall with the type of the result (Cmm.machtype)
and the types of the arguments (Cmm.exttype list).

Change (slightly) the API for describing calling conventions in Proc:
- loc_external_arguments now takes a Cmm.exttype list,
  in order to know more precisely the types of the arguments.
- loc_arguments, loc_parameters, loc_results, loc_external_results
  now take a Cmm.machype instead of an array of pseudoregisters.
  (Only the types of the pseudoregisters mattered anyway.)

Update the implementations of module Proc accordingly, in every port.

Introduce a new overridable method in Selectgen, insert_move_extcall_arg,
to produce the code that moves an argument of an external C function
to the locations returned by Proc.loc_external_arguments.

Revise the selection of external calls accordingly
(method emit_extcall_args in Selectgen).
2020-07-24 17:39:22 +02:00
Stephen Dolan 2d92955749
Remove Const_pointer (#9578)
Since #9316 was merged, Cconst_pointer is compiled in exactly the same way as Cconst_int. This commit removes the now-redundant Cconst_pointer and Cconst_natpointer.
2020-05-19 15:31:08 +02:00
Stephen Dolan b7716c4625 Update testsuite with new backtrace format, and add test for names 2020-04-27 12:58:53 +01:00
Stephen Dolan 2986beaa78 Replace Location.t with Lambda.scoped_location in Lambda code
This commit threads scopes through translation from Typedtree to
Lambda, extending the scopes when entering functions, modules,
classes and methods.
2020-04-27 12:58:53 +01:00
Nicolás Ojeda Bär 8f3833c4d0
Add RISC-V native-code backend (#9441)
This is a port of ocamlopt for the RISC-V processor in 64-bit mode.
2020-04-24 16:04:50 +02:00
David Allsopp 48e7150cc8 Testsuite is not parallel 2020-02-26 10:08:56 +00:00
David Allsopp 67c011b883
Revert "AppVeyor speed-ups" 2020-04-20 09:55:54 +01:00
David Allsopp 2ddcdf10a8 Testsuite is not parallel 2020-02-26 10:08:56 +00:00
David Allsopp 13786d7d12 Ensure make distclean works on an unconfigured tree 2019-10-15 11:46:36 +01:00
Stephen Dolan de9e630852 Assert that Cassign is only used on Clet_mut-bound variables 2020-02-25 15:23:38 +00:00
Drup 9c8b63f4ce Annotated Asttypes.constant's string with content location. 2019-11-13 16:08:40 +01:00
David Allsopp fb6f58ea69
Merge pull request #8951 from shindere/make-default-target
Let make's default target build the compiler
2019-10-04 14:23:27 +01:00
Sébastien Hinderer 987b0814d7 Let make's default target build the compiler
This commit makes it possible to build the OCaml compiler according to
its configuration by simply runnning make. There is no need to specify
neither world nor world.opt explicitly, although the two targets
remain available.

This commit also introduces (and starts making use of) the
NATIVE_COMPILER build variable whosse value is true when the native
compiler is enabled and false otherwise.
2019-09-30 16:01:29 +02:00
Florian Angeletti a509157eb9 share argument implementation across executable
This commit defines five default argument modules in
Main_args.default. Those modules provide a default implementation
for the argument of ocaml, ocamlnat, ocamlc, ocamlopt, ocamldoc,
ocamlcp, ocamloptp, and expect_test.

Grouping together those implementations allow to share as much as
possible similar implementation across executables. It should make
easier to keep synchronized the various implementation, or reuse
those implementation in alternative drivers.
2019-09-30 15:56:40 +02:00
Florian Angeletti 91c762a427 Merge dump_live and print_live 2019-09-30 15:56:40 +02:00
KC Sivaramakrishnan c298390b5d Fix tests/asmgen for msvc32 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan fdd4d73b43 Domain state support for i386 2019-08-23 09:50:05 +05:30
KC Sivaramakrishnan c06038a0ee Move backtrace support global variables to domain state.
Since we cannot access backtrace position in cmmgen.ml anymore,
Cmm.raise_kind in removed. Instead, we use Lambda.raise_kind. When
assembly code is generated, we reset the backtrace position to 0 in the
case of regular raise. Importantly, the semantics remains the same.
2019-08-23 09:50:05 +05:30
Greta Yorsh e08a9688fc Eliminate dead `ICatch` handlers (#2321) 2019-08-06 12:23:13 +01:00
Sébastien Hinderer de8168c303 Make sure the build variables are defined 2019-05-17 13:58:03 +02: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
Mark Shinwell 618e5dbfbd More debugging information in Cmm terms (#2308)
Following on from GPR#851 and GPR#873, this pull request further enhances debugging information in Cmm terms. This was driven both by manually examining the debugger's behaviour and also by a report received from a user regarding substandard DWARF location information.
2019-03-13 15:40:04 +00:00
Jérémie Dimino 705054b346 Delete the vmthreads library (#2289)
* Delete the deprecated vmthreads library

It was deprecated in 4.08.

* Remove the byte/native argument of init_path

It is no longer necessary.

* Error out when passing --{enable,disable}-vmthreads to ./configure

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
2019-03-11 19:38:16 +01:00
Vincent Laviron 98654c77de Remove loop constructors in Cmm and Mach 2019-02-19 17:00:38 +01:00
Alain Frisch 2e5b9d1ef1
"Alerts" as a generalization of "deprecated" (#1804) 2018-11-15 09:51:35 +01: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
Mark Shinwell 2b5f13c913 GPR#2056 (Backend_var) 2018-09-28 17:59:01 +02: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
Armael a3fb865714 Improve the formatting of sub-errors in error/warning reports (#2035)
* Improve the formatting of sub-errors in error/warning reports

This avoids indenting sub-errors on the right of "Error:" (or "Warning x:"), and
implements more compact printing (the sub-location message is printed on the same
line of the location if it can fit).

* Extend the formatting test demonstrating report printing
2018-09-10 10:04:38 +02:00
Thomas Refis 17d1d782e2 expect_test: cleanup typer state 2018-09-07 09:58:55 +01:00
Armaël Guéneau 79c8a94220 Change (improve) error highlighting in a dumb toplevel 2018-08-08 19:05:23 +02: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
sliquister ae1317caae Add option to dump the output of e.g. -dlambda in a file (#1913) 2018-07-27 08:51:53 +01:00
Armaël Guéneau 0ccb589798 Refactor [Location.print_loc]; use it in [highlight_dumb] and expect_test.ml 2018-07-25 11:52:23 +02: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
Armaël Guéneau eae3925b3d Location: generalize [highlight_dumb] to handle several locations 2018-07-12 11:24:23 +02: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
Simon Fowler ace6af8fc7 Allow non-val payload types in CMM Ccatch (#1833)
Summary
-------
This patch adds explicit type annotations for Ccatch payloads in the CMM
IR, thus supporting payloads which are not of type `val`.

Rationale
---------
While CMM generated from OCaml source will always generate payloads of type
`val`, this is not the case when targeting CMM to compile from a different
language. As a concrete example, I am currently targeting the CMM backend for
compilation of WebAssembly, and require `float` payloads. Additionally, @mshinwell
has noted that such an extension will be useful for flambda2. As a result, this
patch will increase the applicability of the CMM IR as a compilation target.

Updates
-------

25/06/2018: Incorporate review comments by @xclerc

Design
------
The design of the patch is as follows:

  1. Add explicit type annotations to Ccatch handlers. Specifically,
        ```Ccatch (int * (Ident.t list) * expression)```
     becomes
        ```Ccatch (int * (Ident.t * machtype) list * expression)```

  2. By default, in `cmmgen`, select `typ_val` as the `machtype`

  3. Select an appropriate register using the type annotation in `selectgen`,
     instead of defaulting to `typ_val`

  4. Test updates:
     - Update the CMM parser and pretty-printer to require annotations on Ccatch
       handlers
     - Update the existing CMM tests to add the required annotations
     - Add new tests which require the use of floating-point registers, for
       which the compiler would generate invalid ASM prior to this patch

Since all OCaml code will use `typ_val` as before in `cmmgen` and therefore
`selectgen`, compilation for OCaml programs will be identical.
2018-06-29 00:08:50 +02:00
Xavier Clerc 9c182f7e24 Add -dcamlprimc + pass -fdebug-prefix-map when available (#1845)
- Introduce `-dcamlprimc`, to keep the generated C file containing the primitive list
- Use `-fdebug-prefix-map` for compiling temporary C files when this option is supported
2018-06-27 14:56:29 +01:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
David Allsopp 5afcf327f8 Restore copyright notices for cmm parser
Restored from 905658e, as they're no longer in the tests directory.
2018-06-13 09:37:49 +01:00