Commit Graph

575 Commits (b155f28361e7182fd14a82eae3ce27e628c57fac)

Author SHA1 Message Date
octachron 075bf9bed6 doc: remove unprefix trick 2018-09-03 13:59:32 +01:00
Gabriel Scherer a0d2aeb7e1 Menhir update test: use POSIX (find .. -prune -newer) instead of bash's -nt 2018-09-02 12:04:05 +02:00
Gabriel Scherer cbb92d2817 remove unused ocamlyacc dependencies, never put it in boot/ 2018-09-01 23:17:06 +02:00
Gabriel Scherer ac265e9ea3 (minor) remove unused CAMLYACC variables 2018-09-01 23:17:06 +02:00
Gabriel Scherer d09349f631 rename parsing/parser_menhir into parsing/parser 2018-09-01 23:17:06 +02:00
Gabriel Scherer e6ecea4008 remove the yacc parser
The large diff in boot/menhir/parser_menhir.ml comes from the fact
that the token list is now included in it, instead of being merely
a reference to the yacc parsers' Parser.token type.
2018-09-01 23:17:06 +02:00
Gabriel Scherer f571282d7d menhir parser: rename MenhirLib into CamlinternalMenhirLib
The goal of this change is to avoid conflicts encountered by
compiler-libs users that would also use their own MenhirLib runtime
for their own parsers.

I first tried to implement a solution to this module-name-conflict
issue using module aliases and -open, but this proven too fragile and
too difficult to get right.
2018-09-01 23:17:04 +02:00
Gabriel Scherer cbea1b6b69 menhir parser: move .mlyp to .mly, no cpp step anymore 2018-09-01 23:17:04 +02:00
Gabriel Scherer fc89685a17 Makefile: emit a warning if parser_menhir.mlyp is more recent 2018-09-01 23:17:03 +02:00
Gabriel Scherer 9a38c848fc Setup and use a Menhir parser for the OCaml grammar (REBASE POINT)
Uses the new $symbolstartpos feature of Menhir
to get locations identical to the OCamlYacc ones.

REBASE POINT: at the point of this commit, using a diff program
on parser.mly and parser_menhir.mlyp should give identical results
after the header code. If you rebase the Menhir-parser patchset
against a newer ocamlyacc parser (parser.mly), those two files
will have diverged, and you need to merge the parser.mly change
back into parser_menhir.mlyp -- and then deal with them in the
rest of the patch series.
2018-09-01 23:17:03 +02:00
Drup abc0b7e3ed Add compile_common.ml which contains the basic compilation pipeline.
Factorize the part from compile.ml and optcompile.ml.
2018-07-27 15:07:43 +02:00
Xavier Clerc 7e29162582 Pass the elements from `BUILD_PATH_PREFIX_MAP` to the assembler (#1930) 2018-07-27 12:25:23 +02:00
Gabriel Radanne 1be47bf7ab Just some tbl things. (#1699) 2018-07-23 13:19:41 +01:00
Xavier Clerc cd06e22582 Shadow the polymorphic comparison in the middle-end (#1811) 2018-07-11 13:50:02 +02:00
Valentin Gatien-Baron 7a6758b03b makefile: install .cmx from middle end directory 2018-07-01 18:49:30 -04:00
Valentin Gatien-Baron 7973231f60 makefile: define OPTCOMP, the native equivalent of BYTECOMP 2018-07-01 18:49:30 -04:00
Sébastien Hinderer d3e73595e5 Merge the asmrun and byterun directories into the runtime directory 2018-06-28 17:50:33 +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
Sébastien Hinderer 507f27ccb0 Makefile, .gitignore: remove `make backup` leftovers 2018-06-20 17:16:35 +02:00
Sébastien Hinderer 85fa27f7e9 Rename C compiler related build variables
This commit renames a few C compiler related build variables so that
they are reserved for the build system. They will then be re-introduced,
but this time as user varialbes whose value can be freely customized
when compiling the package, without risking to conflict with those
command-line flags that are required by the build system itself.

Here are the variables this commit renames:

- CFLAGS -> OC_CFLAGS
- CPPFLAGS -> OC_CPPFLAGS
- LDFLAGS -> OC_LDFLAGS

Note: before this commit the compilation of scheduler.c in
otherlibs/threads was relying on make's implicit rule to compile C files.

Since this commit stops using the standard variables for flags,
it is necessary to introduce an explicit rule to compile C files
and that makes use of the newly introduced variables.
2018-06-20 14:01:42 +02:00
David Allsopp 02a3091a7d Export ARCH64 to config/Makefile as well as m.h
Allows it to be used more easily in the build system.
2018-06-11 22:52:00 +01:00
Sébastien Hinderer 96545e8cd0 Document the bootstrap procedure
* Remove the now obsolete comments at the beginning of the main Makefile
 * Move and fix documentation of the bootstrap from INSTALL to
   HACKING-bootstrap.adoc
 * Update install instructions
2018-05-31 15:45:25 +02:00
Sébastien Hinderer 4a2fa2978f Root Makefile enhancements
This commit contains the following fixes and enhancements to the
root Makefile:

 * coreall: add dependency on runtime
 * all: before this commit, this target was depending on runtime and started
   by making coreall. This commit simplifies this and just makes this target
   depend on coreall, which is both simpler and semantically more accurate.
 * compare: let this target exit if the comparison fails
 * bootstrap: this commit removes the final invocation to make compare.
   The comparison was actually done twice, (1) as the final step of coreboot
   and (2) as the final step of bootstrap. The motivation for that was to
   ensure that the comparison messages were not lost and did appear last.
   Actually, it turns out that if the comparison fails, it makes no
   sense to continue the bootstrap process. That's why compare now exits
   immediately when it fails and there is thus no need to perform it twice.
 * Get rid of backup and restore targets which have become obsolete
   with the use of a revision control system
2018-05-31 14:35:57 +02:00
Sébastien Hinderer b2240b9878 Make sure the make_opcode tool is run using byterun/ocamlrun
This tool is used to compile ocamlc. Given that make_opcodes is itself
recompiled as part of the bootstrap process, it needs to be run on the new
(rather than old) runtime. In other words, make_opcodes needs to be run
using byterun/ocamlrun rather than boot/ocamlrun.

This commit fixes this.
2018-05-31 14:35:57 +02:00
Sébastien Hinderer ecb42aa78f Makefile: the promote-cross target should use cp rather than stripdebug
The compiler's bootstrap procedure involves calling the promote-cross
target of the root Makefile.

When this target is invoked e.g. in the context of an executable
magic number update, it is actually not possible to use the stripdebug
tool.

Thus, this commit makes sure the promote-cross target uses cp
to promote the bytecode tools, rather than stripdebug.

This is not an issue because in the promote rule used later
during the bootstrap the stripdebug tool can be used, so that the
bytecode executables one gets after a complete bootstrap will remain
small and won't contain any debugging symbol.
2018-05-31 14:35:57 +02:00
Sébastien Hinderer 712f08872a Root Makefile: clean testsuite only once
There were two recipes to run make clean in the testsuite directory.
This commit gets rid of one of them.
2018-05-29 16:46:06 +02:00
Sébastien Hinderer 0704a4b78a Root Makefile: simplify tests target
* Remove dependencies

 * Simplify recipe
2018-05-29 16:45:58 +02:00
Thomas Refis e63e8421a1 move Rec_check out of typecore 2018-05-23 10:53:53 +01:00
Mark Shinwell 8054e4f819 Add configure option to not install ".byte" executables (#1776)
In environments where the executables compiled to native code,
such as ocamlopt.opt, are always used in preference to the bytecode
versions then space can be saved by not installing the latter.
This patch provides a configure option to do such. It is relatively lightly
engineered; in particular, it won't complain if the native code executables
aren't themselves being built; but given this is an option for knowledgeable
users we think that it is reasonable.
2018-05-14 10:44:01 +02:00
Mark Shinwell ea2d6a1e31
Add configure options to control installation of source artifacts (#1777) 2018-05-14 08:15:44 +01:00
Xavier Clerc d88dbba9a0 Flambda: Add [Closure_origin.t] to trace inlined functions (merged) (#1707) 2018-04-10 10:33:28 +01:00
Leo White 656aa42677 Organise and simplify translation of primitives 2018-04-09 13:00:01 +01:00
Leo White bc9f032e2a Reduce cmx sizes by sharing variable names (#1627) 2018-04-09 08:43:47 +01:00
Xavier Clerc 835cad1686 Further reduce the size of cmx files (flambda) (#1666) 2018-04-09 07:46:50 +01:00
Pierre Chambart 0a42259060 Turn flambda invariants checks off by default (#1686) 2018-04-06 09:49:57 +01:00
Nicolás Ojeda Bär ab16747647
Merge pull request #1537 from nojb/remove_boot_ocamldep
Remove boot/ocamldep
2018-03-29 21:47:41 +02:00
Gabriel Scherer 3702f53692 factorize common makefile definitions in Makefile.common 2018-03-29 17:04:05 +02:00
Gabriel Scherer afcd29eb0c makefiles: turn the 'install' command into a variable
(Suggestion made by Sébastien Hinderer during review.)
2018-03-29 14:40:23 +02:00
Gabriel Scherer 3a0c7d97f3 Makefile: rename INSTALL_FLEXDLL into INSTALL_FLEXDLLDIR for consistency 2018-03-29 14:40:23 +02:00
Gabriel Scherer ecfd39f127 makefiles: use 'install' instead of 'cp' in 'make install' targets
I can observe weird performance bottlenecks on my machine caused by
the use of 'cp' in the 'install' scripts of OCaml. When installing
into a directory that is already populated by an existing
installation, 'make install' can routinely take 10s on my machine¹. After this
change it reliably takes 1.5s, independently of whether the
destination is already populated or not.

¹: a brtfs filesystem on an old-ish SSD

Why I care
----------

An extra 10s delay due to 'make install' can be noticeable in tight
change-build-install-test feedback loops for a compiler change where
we change the compiler, have a fast 'make world.opt' due to
incremental builds, install the change and test it -- possibly after
installing a couple opam packages, which can be fairly quick.

Partial diagnosis
-----------------

The performance issue seems to be caused by the fact that 'cp' (at
least the GNU coreutils version), when the file already exists,
replaces it by opening it in writeonly+truncate mode and writing the
file content ('strace' shows that the delay is caused within an
'openat' call). In particular, using the --remove-destination option
(which changes 'cp' to just remove the destination file before
copying) removes the performance issue, but this option seems missing
from the BSD/OSX 'cp' so it could cause portability issue.

Change
------

The present commit rewrites the 'install' targets of all Makefiles to
use the 'install' command instead. 'install' by default gives
executable-like permission to the destination file, instead of reusing
the source file's permissions, so we specify manually the permission
modes, depending on whether the installed file is an executable (or
dynamically-linked library) or just data (including other compiled
object files).

Testing
-------

I checked manually that the permissions of the installed files are
identical to the ones of the current 'cp'-using targets, except for
some '.mli' file in middle_end which currently have +x bits enabled
for no good reason.

Remark: To test this, playing with the DESTDIR variable is very useful
(this lets you install to a new directory (or the same as before)
without having to re-run the configure script). I used the following,
fairly slow shell script to collect permissions:

    for f in $(find $DESTDIR); do \
      echo $(basename $f) $(ls -l $f | cut -d' ' -f1); \
    done | sort

Remark: it is important to run `sync` in-between 'make install' runs
to avoid timing effects due to filesystem or disk caching
strategies. I believe that this corresponds to the natural time delay
(and unrelated disk activity) that would occur in realistic
change-install-test feedback loops.
2018-03-29 14:40:22 +02:00
Nicolás Ojeda Bär 524907a2dc Use boot/ocamlc -depend instead of tools/ocamldep to make depend 2018-03-28 22:15:08 +02:00
Nicolas Ojeda Bar 1ec9e3aa7e Remove boot/ocamldep 2018-03-28 22:15:08 +02:00
Sébastien Hinderer 18b9e58710 Make it possible to control where test results are logged
This commit logs the output of running tests to the file given in
the TESTLOG build variable whose value defaults to _log.
2018-03-21 12:32:22 +01:00
Xavier Clerc 52919a7340 Make the `check_all_arches` target no-op on 32-bit architectures. (#1671) 2018-03-20 15:33:58 +00:00
Gabriel Scherer 0489cfaf9e build_path_prefix_map: update .depend and Makefiles 2018-03-01 17:41:28 +01:00
David Allsopp 34767a4bb3 Determine runtop includes using OTHERLIBRARIES 2018-02-25 11:24:38 +00:00
David Allsopp f8864d9ec2 Don't build opt.opt in natruntop 2018-02-25 10:13:16 +00:00
David Allsopp 87b5712eba Sync runtop and natruntop and add otherlibs
RUNTOP and NATRUNTOP now include the same directories and include all
the directories in otherlibs.
2018-02-25 10:13:15 +00:00
Jeremie Dimino 84304a3282 Core review work
- Apply the __ heuristic more systematically
- Update tests
- Fix Windows builds
2018-02-12 08:29:17 +00:00
Gabriel Scherer 3882302fa6
Merge pull request #1434 from damiendoligez/makefile-cleanup
Makefile cleanup
2017-12-10 17:14:12 +01:00