Commit Graph

70 Commits (master)

Author SHA1 Message Date
Xavier Leroy 86c8a98f3c
Merge pull request #9948 from nojb/remove_spacetime
The Spacetime memory profiler is not going to be supported in Multicore OCaml, and  is already broken by some of the related changes in OCaml 4.12.  The core development team decided to remove Spacetime support from OCaml 4.12.
2020-10-09 14:43:23 +02:00
Nicolás Ojeda Bär 43883ae4bc Remove labels after calls, checkbound, and GC points 2020-10-08 20:28:15 +02:00
Nicolás Ojeda Bär 3869f71e98 Remove Cblockheader 2020-10-08 20:28:15 +02:00
Greta Yorsh 04bceec6cc
Save Linear IR before emit (#8939)
* Save IR before emit

* Update .depend for linear_format

* Test for -save-ir-after command-line option

* Address review comments

* Add Changes entry
2020-10-07 11:32:40 +01: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 1336ce0c0d Use typing information from Clambda for mutable Cmm variables 2020-02-25 15:03:14 +00:00
Vincent Laviron 60f58174ba
Split cmmgen into generic cmm helpers and clambda-specific transformations (#1963) 2019-10-04 17:49:59 +02:00
Alain Frisch 552858dc5a
Unbox across static handlers (#8735) 2019-10-03 13:22:34 +02:00
Alain Frisch 5c031d2d3d Decide unboxing of let-bound expressions based on their Cmm translation (#2165) 2019-09-17 10:22:08 +02:00
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
Vincent Laviron 4edac52bc5 Move size computations from Cmm to Selectgen
This removes a dependency to Arch in Cmm
2019-05-24 14:20:37 +02: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
Vincent Laviron 98654c77de Remove loop constructors in Cmm and Mach 2019-02-19 17:00:38 +01:00
Mark Shinwell 72378c0ad1
Phantom let support in Cmm (#2070) 2018-10-16 07:20:56 +01:00
Mark Shinwell 2b5f13c913 GPR#2056 (Backend_var) 2018-09-28 17:59:01 +02:00
David Allsopp 02a385f540 GPR#1833 check-typo compliance 2018-07-01 10:55:30 +01: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
Damien Doligez e52f39cbe9 Revert "Replace constant pointers by regular integers (#1580)"
This reverts commit 022051e7bd.
2018-04-06 16:09:53 +02:00
Pierre Chambart 69fb40bb55 Disable CSE for the initialization function (#1455) 2018-03-15 12:59:51 +00:00
Vincent Laviron 022051e7bd Replace constant pointers by regular integers (#1580) 2018-03-15 09:57:53 +00:00
Leo White 1671e5a3af Treat negated float comparisons more directly (#1487)
* Add float comparison test

* Treat negated float comparisons more directly

* Add Changes entry
2018-02-28 14:19:46 +01:00
Mark Shinwell ea5fa10bac Fix evaluation order problem (#966) 2017-02-15 11:14:10 +00:00
Pierre Chambart cadd4c5ba1 Add a recursive flag on the Ccatch construct
When this flag is Nonrecursive, we can avoid iterating on
various passes. This makes exponential time cases more unlikely.
2016-10-28 13:03:59 +02:00
Pierre Chambart c3d056de68 Change Cmm Ccatch construct to allow recursive cases 2016-10-28 13:03:59 +02:00
Mark Shinwell 1a5cbb2b34 Comment 2016-10-17 13:08:47 +01:00
Mark Shinwell 975f2e522d More debuginfo in Cmm 2016-10-12 14:13:05 +01:00
Mark Shinwell cd0bd8aa73 Spacetime: a new memory profiler (#585) 2016-07-29 15:07:10 +01:00
François Bobot bb4a1b4f5d Specialize raise_kind after cmmgen
since the semantic changed. There is no need to check Clflags.debug
   anymore Raise_withtrace, means that traces must be computed (if the
   runtime boolean is true).
2016-07-28 15:29:50 +02:00
Alain Frisch e3ee2805b7 Merge pull request #645 from mshinwell/delete_cmm_label_stuff
Remove Cdefine_label and Clabel_address
2016-07-10 14:52:07 +02:00
Mark Shinwell c843ca0691 Labels after calls, call GC points and checkbound points (again) (#660) 2016-07-06 11:44:00 +01:00
Alain Frisch c3c523109e Revert "Labels after calls, call GC points and checkbound points" 2016-07-01 18:42:51 +02:00
Mark Shinwell 432f87f077 Labels after calls, call GC points and checkbound points (#644) 2016-07-01 15:16:03 +01:00
Mark Shinwell 1d3a6c3038 Rename Cconst_blockheader to Cblockheader (#642) 2016-06-30 07:46:45 +01:00
Mark Shinwell 8e16cdd85d Remove Cdefine_label and Clabel_address 2016-06-29 10:01:03 +01:00
Mark Shinwell ca03b4e500 Decorate more Cmm terms with location information (#627) 2016-06-27 08:49:26 +01:00
Damien Doligez 520fb2df50 Merge tag 4.03.0 into trunk. 2016-04-28 16:13:21 +02: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
Mark Shinwell 933fdb2687 Improved annotations on Psetfield etc 2015-12-18 16:42:40 +00:00
Damien Doligez b860d63145 whitespace cleanup, cut long lines, add some missing headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16415 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-09-11 11:58:31 +00:00
Xavier Leroy ac02f56351 More precise typing at the C-- and Mach level:
- Register type "Addr" is split into
    . "Val" (well-formed OCaml values, appropriate as GC roots)
    . "Addr" (derived pointers within the heap, must not survive a GC)
- memory_chunk "Word" is split into
    . "Word_val" (OCaml value)
    . "Word_int" (native-sized integer, not a pointer into the heap)

Cmmgen was updated to use Word_val or Word_int as appropriate.

Application #1: fail at compile-time if a derived pointer within the heap
survives a GC point (cf. PR#6484).

Application #2: CSE can do a better job across allocation points
(keep factoring expressions of type Int, Val, Float, but not Addr).


git-svn-id: http://caml.inria.fr/svn/ocaml/branches/cmm-mach-types@15568 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-06 08:54:14 +00:00
Xavier Leroy 29b34438e0 - Constant ropagation for float and int32/int64/nativeint arithmetic.
Constant propagation for floats can be turned off with option
  -no-float-const-prop, for codes that change FP rounding modes at
  run-time.
- Clambda / C-- / Mach: represent float constants as FP numbers of type 
  float rather than literals of type string.
- Tested for AMD64; other archs need testing.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14673 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-25 08:41:13 +00:00
Mark Shinwell 583bfd46c2 be explicit when constructing integers that are block headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14464 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-17 14:34:00 +00:00
Benedikt Meurer 3bb161216b Perform constant optimizations for integer division and modulus on the C-- level.
This way we can avoid having to duplicate the same functionality for
every backend, and we may also benefit from other optimizations performed
during C-- generation.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14303 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-19 07:01:54 +00:00
Alain Frisch 164c307ae3 Support for raise variants in ocamlopt. Only amd64 for now.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14226 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-14 14:33:27 +00:00
Damien Doligez def31744f9 remove all $Id keywords
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13013 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-15 17:50:56 +00:00
Xavier Leroy 2eecf2d4c0 PR#5487: addition of CFI directives and a few filename/linenumber info to generated amd64 and i386 assembly files.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12179 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-02-21 17:41:02 +00:00
Damien Doligez 3b507dd1aa renaming of Objective Caml to OCaml and cleanup of copyright headers
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@11156 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2011-07-27 14:17:02 +00:00
Damien Doligez 04b1656222 clean up spaces and tabs
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9547 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2010-01-22 12:48:24 +00:00
Xavier Leroy 4b5512c74c Stack backtraces on uncaught exceptions in native code (merge of the opt_backtrace branch)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7812 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2007-01-29 12:11:18 +00:00