Commit Graph

9428 Commits (15da6d18042500c6e8f9698bf05bebcec456e9d3)

Author SHA1 Message Date
Alain Frisch 15da6d1804 Reports the beginning of the string literal in 'This comment contains an unterminated string literal' errors.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14328 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-29 11:35:50 +00:00
Damien Doligez f093afd67d testsuite/external: update coq, lablgtk, alt-ergo
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14326 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-28 17:50:22 +00:00
Xavier Leroy 7984a93671 Bring stack backtraces up-to-date on PowerPC, incl. reraise.
Tested on PowerPC/Linux.  Needs testing on PowerPC/MacOS X.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14324 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-28 14:43:56 +00:00
Xavier Leroy 140f620413 Debug info was lost when rescheduling "checkbound" instructions.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14323 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-28 14:42:34 +00:00
Xavier Leroy 3d7d4b9269 PR#6243: Make "ocamlopt -g" more resistant to ill-formed locations.
(Reflecting commit r14321 on version/4.01)



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14322 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-28 14:34:45 +00:00
Xavier Leroy 948d520023 PR#6239: a "raise" in -g mode can end up calling a C function (stash_backtrace). Therefore the containing function must not be a leaf function, so that on x86-32/MacOSX and x86-64, the stack is properly 16-realigned on entrance to containing function.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14316 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-27 17:10:35 +00:00
Damien Doligez ed23a31e78 typo in test log message
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14315 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-27 16:02:43 +00:00
Damien Doligez cde0013ef6 update for latest trunk changes
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14314 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-27 15:44:30 +00:00
Jérémie Dimino b30b541b9b Remove camlp4.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14310 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-23 09:11:19 +00:00
Jérémie Dimino 5d917633ad remove camlp4
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/minus-camlp4@14309 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-21 16:23:28 +00:00
Jérémie Dimino 94f29d29c3 removal of camlp4
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/minus-camlp4@14308 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-21 16:17:37 +00:00
Alain Frisch 7335d5f68f caml_backtrace_pos is a 32-bit integer under amd64.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14307 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-19 18:01:05 +00:00
Jacques Garrigue 9b974c162f Fix PR#6241
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14305 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-19 11:07:39 +00:00
Alain Frisch 7c98525d0f Add proper casts.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14304 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-19 10:36:06 +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
Jacques Garrigue ee2eb30198 new version of the patch, using module_type option, and allowing unpacking when no type created
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14302 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-18 12:47:36 +00:00
Jacques Garrigue 2a011d7095 Fix PR#6240
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14299 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-18 01:26:40 +00:00
Alain Frisch df7e6c1ded Missing include (==> implicit declaration of function 'caml_named_value').
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14294 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-15 15:09:51 +00:00
Benedikt Meurer e2827a1bd0 Revert "Don't use emit_parts_list for regular operations."
This reverts commit r14292.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14293 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-14 17:56:15 +00:00
Benedikt Meurer 7fab955f7b Don't use emit_parts_list for regular operations.
Using emit_parts_list does not make sense for any
operation except Ialloc, where we can delay the
computation of simple expression until the allocation
is done. So we try to avoid using emit_parts_list for
regular operations, where the special treatment of
non simple expression conflicts with our special
instruction selection on arm (and arm64). For example
we cannot merge the add and shift operation required
for tagging as soon as there is at least one non
simple expression involved, even though both Cadd
and Clsl do not care at all whether its arguments are
simple or not.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14292 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-14 08:10:03 +00:00
Alain Frisch 4818fbba05 Changelog.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14291 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-13 14:52:21 +00:00
Alain Frisch f16534ef1a Reintegrate raise_variants branch.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14289 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-13 13:55:13 +00:00
Alain Frisch a51080b15a No need for caml_init_exceptions.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14288 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-13 13:16:15 +00:00
Alain Frisch 632d7e20a3 Cleanup.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14287 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-13 13:12:57 +00:00
Jacques Garrigue 37b6979939 update for trunk
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14286 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-13 06:38:38 +00:00
Jacques Garrigue b7ab7460d5 Fix PR#6235 + keep typing of pattern cases independent in principal mode
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14285 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-13 00:16:03 +00:00
Benedikt Meurer c3a2400954 [arm] Improve code selection for shifted arithmetic operations.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14283 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-11 14:10:40 +00:00
Wojciech Meyer 122f4f8600 build: make CAMLOPT_BIN default to "no-opt-compiler-available".
(Patch by Adrien Nader!)

Jacques Garrigue has reported that the testsuite would try to run with a
non-existing opt compiler and that the error wasn't clear.

Now, instead of trying to run:
  -c -I some_dir/ foo.ml
anything that tries to run ocamlopt before it's available will run:
  no-opt-compiler-available -c -I some_dir/ foo.ml
which should hopefully be clearer.

I'm not yet sure why the testsuite didn't abort earlier, noticing that
there was no opt compiler. One possibility is that using "test -e"
without argument (which happens if variables are empty and not quoted
inside shell scripts) succeeds. This will have to be checked.

v2: don't remove the bytecode entry (bad copy-paste)
build: make CAMLOPT_BIN default to "no-opt-compiler-available".

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14278 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-10 12:32:13 +00:00
Wojciech Meyer 928503e9b8 build: always build lex/ and ocamlc with the compiler from boot/.
(Patch by Adrien Nader!)

This is a partial revert of revision 14168 which caused issues when
bootstrapping the compiler. Since these directories don't take long to
build, we can always use a byte-compiled compiler.

Bootstrapping and more generally working on the compiler itself does not
play nice with trying to use the most recent compiler as soon as
possible: imagine you've just modified the compiler but in a way that
breaks it at runtime in a non-obvious way; all the files that are
subsequently built will have been built with your the compiler you will
be debugging.

v2: always build tools/ with boot/ocamlc since most executables link
    against compiler libs.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14277 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-10 12:32:12 +00:00
Wojciech Meyer 7ea8f59082 myocamlbuild.ml: only build with .opt compilers if they're more recent.
(Patch by Adrien Nader!)

The recent change that replaced ocamlcomp*.sh made apparent an old bug
where ocamlbuild could use ocamlc.opt even though ocamlc was newer.

As far as I understand, Unix is not usable in this file because it can be
used for bootstrap. Instead, shell out "test ocamlc.opt -nt ocamlc" in
order to check which one to use.

This has also made me notice another issue in this file: it was checking
that "stdlib.cm*xa*" existed when building with the *byte* compiler.

Note that shelling out may have a fairly high build-time cost on
Windows. We'll see with the Jenkins results.
myocamlbuild.ml: only build with .opt compilers if they're more recent.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14276 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-10 12:32:09 +00:00
Alain Frisch b911754434 Simplify special logic for array bound error (allocate the exception value from Pervasives).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14275 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-08 16:18:21 +00:00
Alain Frisch 171a77daba Fix typos and wording (#6231).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14274 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-08 15:36:36 +00:00
Xavier Leroy e553dc225b PR#6227 continued: problem with preferences between different register classes.
(Cherry-picking commit r14272 from 4.01 bugfix branch.)


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14273 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-08 15:08:34 +00:00
Alain Frisch 07e704dfd5 Remove use of deprecated features (#6227, patch by johnwhitington).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14271 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-07 11:02:51 +00:00
Alain Frisch 7bb3e64160 Do not introduce Obj.raw_tag.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14270 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-06 10:57:20 +00:00
Alain Frisch ff18f681bc #6042: fix msvc64 port.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14268 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-05 14:24:37 +00:00
Gabriel Scherer 9e17f24967 bound checking bug with caml_string_{get,set}{16,32,64}: fix the runtime C code
As notified by Nicolas Trangez, the following program behaves in an
unexpected way by returning 0 instead of failing with an out-of-bound
exception:

  external get16 : string -> int -> int = "%caml_string_get16"
  let test = get16 "" 0

caml_string_get16(str, idx) will access indices (idx) and (idx+1). The
bound-checking code is currently implemented as:

   if (idx < 0 || idx >= caml_string_length(str) - 1) caml_array_bound_error();

This is wrong as caml_string_length returns an mlsize_t which is
unsigned, so substracting 1 gets buggy when the size is 0. The test
should be written as follow:

   if (idx < 0 || idx + 1 >= caml_string_length(str)) caml_array_bound_error();

Note 1: we can exploit this bug to make out-of-bound access to
a string, but I think get16 examples will run into the padding
characters of OCaml strings and behave in a not-too-wrong way. It may
also be the case of get32, but get64 will access 7 bytes, so access
memory outside the string:

  # external set64: string -> int -> int -> unit = "%caml_string_get64";;
  external set64 : string -> int -> int -> unit = "%caml_string_get64"
  # set64 "" 0 0;;
  Segmentation fault

Note 2: this first commit only fixes the C code in byterun/str.c. Only
ocamlc actually uses these functions when the compiler primitive is
used ("%caml_string_get16" instead of "caml_string_get16"). ocamlopt
generates ocaml code directly, and this part has yet to be fixed in
a following commit.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14267 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-05 11:09:29 +00:00
Benedikt Meurer 5b13c68f36 Improve code generation for subtraction.
Given integer constants x and n:
1. If n + x does not overflow, then (x - c) + n is compiled
   to (x + n) - c.
2. If n - x does not overflow, then (c - x) + n is compiled
   to c + (n - x).

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14266 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 21:39:55 +00:00
Benedikt Meurer c04e198410 [arm] Fix bug in div/mod by constant.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14265 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 21:38:49 +00:00
Benedikt Meurer 355e0359fd Further refactor code generation for multiplication.
Recognize negation by multiplication with -1 and generate
subtraction in this case.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14264 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 19:19:07 +00:00
Alain Frisch 8757e726f4 Typo.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14263 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 15:17:29 +00:00
Alain Frisch 78c2b5b151 #6042: fix Intel syntax.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14262 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 14:11:40 +00:00
Benedikt Meurer be7a0310a2 PR#6222: The mls instruction is not available on ARMv6.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14261 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-04 11:27:03 +00:00
Benedikt Meurer 20efbfefe2 [arm] r12 is destroyed for constants that are not a power of 2.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14260 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-02 15:28:26 +00:00
Benedikt Meurer db057d0beb [arm] Optimize integer division and modulus by constant.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14259 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-02 15:19:20 +00:00
Benedikt Meurer 954f8e5605 Compile multiplication by power of 2 constant to left shift.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14258 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-02 12:33:27 +00:00
Xavier Leroy bdb169a04f Follow-up to commit r14254: optimization of immediate division and modulus for ARM64. Completely untested.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14257 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-01 18:10:18 +00:00
Xavier Leroy ec4b2fc9a6 Follow-up to commit r14254: optimization of division and modulus by constants for the I386. Untested; CI will find out.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14256 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-01 17:29:04 +00:00
Xavier Leroy e32b161074 Follow-up to commit r14254: update destroyed_at_oper and max_register_pressure
for immediate Idiv and Imod.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14255 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-01 17:05:21 +00:00
Xavier Leroy ab9f3e38fb PR#6042: optimize integer division and modulus when divisor is constant.
So far, implemented only for amd64.


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14254 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-11-01 16:35:54 +00:00