Commit Graph

931 Commits (9e181ca8f446d238ba279bc22fef9d166d4f38b0)

Author SHA1 Message Date
Vincent Laviron 796f419b4c Fix duplication of code in Cmmgen (#1370)
* Fix duplicates in Cmmgen when handling switches with no default and not all cases

* Improve handling of incomplete Lambda switches in Flambda

* Add test (for reference) and changes

* Fix nitpick

* Cleanup: split the switch stores to reflect usage

* Improve compilation of incomplete switches with flambda

* Split switch stores into context-aware and -unaware versions

* Credit reviewers

* Go back to a single Switch.t_store type
2017-10-06 14:44:51 +02:00
Stephen Dolan 7ed63d4ff3 afl-fuzz instrumentation fix for classes.
Disable class initialisation cache when compiling with afl-fuzz
instrumentation enabled. See MPR#7612
2017-10-05 16:54:10 +01:00
Nicolas Ojeda Bar 799f36d3e6 Rename: use _os suffix 2017-09-27 11:55:53 +02:00
Nicolas Ojeda Bar ecaebcad4a Fix -output-obj C file argv signature 2017-09-27 10:49:30 +01:00
Jacques Garrigue 70b02405e0 Merge pull request #1365 from yallop/let-rec-patch-406
GPR#556, PR#7215, PR#7231, PR#6738: Add a new check that 'let rec' bindings are well formed.
2017-09-22 15:37:10 +09:00
Leo White e1fd8d5d3a Merge pull request #1332 from bobot/fix_output_complete_obj
[OCamlc] fixes output-complete-object
2017-09-16 06:54:58 +01:00
François Bobot 1343658f5d [OCamlc] use OUTPUTOBJ and move CAML_INTERNAL
in the generated file instead of in the command line
2017-09-15 21:28:59 +02:00
Damien Doligez f086eda9c0 add -no-flat-float-array configure option 2017-09-15 18:24:36 +02:00
Damien Doligez cd3dbe79be add `floatarray` type and primitives to prepare for -no-flat-float-array option
NOTE: you need to bootstrap after this commit
2017-09-15 18:24:36 +02:00
yallop 9f626af109 Fix for bytecode size computation with generic arrays (#1325)
* Treat genarray creation as nonrec in bytecode size computations.
* Add tests for generic array creation in let rec bindings.
* Bring the Pgenarray clauses together in code size computations.
2017-09-15 17:40:47 +02:00
Leo White e458e45e0c Merge pull request #1308 from lpw25/impure-inactive
Only treat pure patterns as inactive
2017-09-14 13:26:48 +01:00
François Bobot 8afe629b5f [OCamlc] fixes output_complete_object
ocamlc complained that the temporary files it just created existed.
   since ed60dece81575305b5f1f7394cdda652b65b037a and
   19d3bccf48fee6e5e91e65e9f8a5d07c49d2afd4
2017-09-13 17:28:56 +02:00
Xavier Clerc b492e91780 Replace `%b` specifiers (deprecated) with `%B` ones in the compiler. 2017-09-13 14:00:22 +01:00
Leo White 41bfd8e8ef Only treat pure patterns as inactive 2017-09-11 15:31:42 +01:00
Gabriel Scherer 5a33dc3f2a Merge pull request #1195 from lpw25/merge-more-functions
Merge functions based on partiality rather than Parmatch.irrefutable
2017-09-01 10:34:41 +02:00
Alain Frisch 7eba1178ea Remove spurious semicolons after non-unit expressions (#1305) 2017-08-29 15:14:50 +01:00
Fourchaux 72cfdd56e9 Typos and basic grammar error fixing (#1280) 2017-08-10 11:59:23 +01:00
Pierre Chambart 837ecff306 Fix MPR#7259 by implementing switch branch sharing for flambda (#603) 2017-08-09 13:20:31 +01:00
Mark Shinwell 826b0ea158 Fixes 2017-08-01 10:36:31 +01:00
Mark Shinwell 9e90a37794 Merge remote-tracking branch 'ocaml/trunk' into functor_currying-trunk 2017-07-31 15:28:41 +01:00
Alain Frisch fd47ba9649 Support 'let open' in class and class type expressions (#1249)
* Support 'let open' in class and class type expressions.

* Adapt ocamlprof.

* Adapt ocamldoc.

* Add tests.

* Changelog.

* Manual.
2017-07-20 08:17:30 +02:00
Gabriel Scherer 987810ca60 PR#7563: deprecate transl_path and use transl_{module,value,extension,class}_path instead
excellent suggestion by Jacques Garrigue and Leo White
2017-06-23 07:10:01 -04:00
Gabriel Scherer 5fc84708d1 tentative fix for PR#7563 (module/extension name clash)
There was a bug when a constructor of the same name as a module alias
was referenced from another module.
2017-06-23 00:27:20 -04:00
Leo White afd03f2934 merge-more-functions 2017-06-08 12:27:37 +01:00
Gabriel Scherer 2072b5d063 Merge pull request #1187 from Octachron/document_plugins
Manual: minimal documentation for compiler plugins
2017-06-04 10:43:59 -04:00
octachron 7a2a68a513 GPR#1187: describe lambda plugin hooks 2017-06-01 23:12:10 +02:00
Mark Shinwell a01ca4772b Add Lev_module_definition debugging event (#857) 2017-05-31 10:38:55 +01:00
Mark Shinwell cd8a4a9c5d Functors 2017-05-25 16:20:39 +01:00
Jacques Garrigue 528ee7eb54 Stop pushing default arguments when there is an unlabeled argument (#1174)
* Stop pushing default arguments on the first unlabeled argument (if there are defaults before), cf. PR#7531.
2017-05-15 22:47:57 +09:00
hhugo b14e6fee9b Compiler: -compat-32 flag when building cmo/cma. (#896)
* Complier: -compat-32 flag when building cmo/cma.

Compiler: refactor -compat-32 support

Update Changes

Complier: more -compat-32 checks in emitcode.

* add tests for the -compat-32 flag
2017-05-05 07:18:40 +01:00
Max Mouratov 9ef45bbd13 runtime: caml_startup_pooled function added 2017-03-17 20:50:16 +05:00
Mark Shinwell b1ec44f15e Add location information to Lswitch (#859) 2017-03-15 15:09:58 +00:00
yallop b50792c7a6 Fix for PR7447: incorrect code generation for nested recursive bindings (#995) 2017-03-10 16:47:24 +00:00
Gabriel Scherer 40ad626cc3 Merge pull request #972 from dra27/string-primitive-compatibility
Make %string_safe_set and %string_unsafe_set deprecated aliases for bytes versions
2017-03-08 20:49:17 -05:00
Gabriel Scherer a62dd60dee Merge pull request #1040 from dhekir/trunk
fix several typos in comments
2017-02-22 20:26:50 -05:00
Mark Shinwell 766d970e78 Add caml_startup_exn 2017-02-21 11:49:12 +01:00
Xavier Leroy a162156c61 PR#7479: make sure "ocamlc -pack" is only given .cmo and .cmi files, and that "ocamlopt -pack" is only given .cmx and .cmi files 2017-02-19 17:47:33 +01:00
Mark Shinwell 2711420da8 Fix fatal error when compiling objects with Flambda (#965) 2017-02-15 12:18:53 +00:00
François Bobot 50e9b96564 Recover "Merge pull request #378 from bobot/feature/reraise_raw_backtrace_primitive"
This reverts commit f1b63d4a57.
It is the second time #378 tried to be recovered (e6c779ada8).
2017-02-14 09:21:45 -05:00
Daniel b9dd14cdaf fix several typos in comments 2017-02-13 17:09:50 +01:00
Xavier Leroy 56ff448d1f Make -linkall applicable to single compilation units
With this commit, "ocamlc -c -linkall" or "ocamlopt -c -linkall" produce object files that have the "force link" flag set.  Once put in library files (.cma/.cmxa), these object files will always be linked when the library is linked, even if no definition from the object file is referenced.  However, other object files in the library can still be removed if none of their definitions are referenced.

In this respect, we get finer-grained control on which object files should always be linked, typically because they contain important initialization code.
2017-01-15 20:48:39 +01:00
Leo White 7b1ce6db0b Merge pull request #957 from lpw25/lambda-stubs
Add stub marker to lambda code
2017-01-10 11:03:16 +00:00
Jérémie Dimino 5ed72007f8 Deprecate Bigarray.*.map_file and add Unix.map_file (#997)
To break the circular dependency between Bigarray and Unix, a CamlinternalBigarray module was added to the stdlib. This module defines all the types used by the compiler to produce optimized code for bigarrays.

Thanks to David Allsopp for fixing Windows tests.
2017-01-10 10:03:24 +00:00
alainfrisch c2d7e4a41f Apply standard indentation (as defined by .ocp-indent) and minor whitespace change. 2017-01-03 15:29:44 +01:00
alainfrisch 6cb99cd582 Make Semantics_of_primitives.for_primitive total so that it can be used in more contexts. 2017-01-03 15:21:15 +01:00
alainfrisch 5dce0914e2 Move Semantics_of_primitives to bytecomp/ and use it in closure. 2017-01-03 15:21:15 +01:00
Frédéric Bour d1eecfc604 Distinguish root and heap values in Lambda.initialization (#673) 2016-12-27 11:43:36 +00:00
Alain Frisch 9dbcb1ec6c Improve compilation time for toplevel include(struct ... end : sig ... end) (#832)
* Improve compilation time for toplevel include(struct ... end : sig ... end)

This is intended to fix MPR#7357, which uses the natural way
of specifying an inline signature for a unit without using an external
.mli file.

The trick is similar than the one applied for compiling

  module X = (struct ... end : sig ... end)

Identifiers of the inner structure are "lifted" as extra fields
to the top-level structure.

* Changelog.
2016-12-21 14:38:41 +01:00
Leo White 0c38bbd11c Add stub marker to lambda code 2016-12-14 17:32:24 +00:00
Stephane Glondu 7c6c1f3624 objinfo: dump globals defined in bytecode executables 2016-12-14 08:44:55 -05:00
Damien Doligez 4b9e196d52 restore compatibility for String.{unsafe_set,create,fill} 2016-12-14 13:20:17 +00:00
Hongbo Zhang dba0e49351 treat %string_safe_set as %byte_safe_set 2016-12-14 13:20:10 +00:00
Leo White 18060fb09e Fix [@@inline] with default parameters in flambda (#880) 2016-12-14 13:14:21 +00:00
Mark Shinwell a01802fc84 Re-enable Simplif ref-to-variables in Flambda mode 2016-12-14 13:14:21 +00:00
Pierre Chambart 8703a360d5 Fix lack of link error when missing modules providing externals (#837, PR#7371)
* Check that all the required modules are provided
   Also remove provided cmo from the required globals
* Remove required globals from packs when provided
* Remove provided globals after adding required ones
   Pack modules can require globals they provide.
* Dumpobj tool can print relocation information
2016-12-14 13:14:21 +00:00
Damien Doligez 2c521d23bd fix whitespace and overlong lines 2016-12-14 13:14:21 +00:00
alainfrisch 2224c65fc3 Expose function to map from Lambda's structured constants to Obj.t. Useful for the js_of_ocaml compiler. 2016-11-09 23:56:24 +01:00
Mark Shinwell 2da2fcdb66 Annotate Texp_function with an Ident.t for the parameter (#831) 2016-10-14 09:34:50 +01:00
Pierre Chambart 575f20368d Avoid checking twice if divisor is zero (#702)
* Avoid checking twice if divisor is zero

The flambda branch before merging assumed that Pdivint and Pmodint where
already checked when entering Cmmgen. This was not the case anymore
after merging and this change was lost. This fix this overlook by adding
an annotation to the Pdivint and Pmodint primitive telling whether the
division by zero was already checked.

The reason to move the test generation to Closure_conversion in the
flambda branch was to allow the division primitive to be considered as
pure without needing to check for the effective value of the
divisor. This simplified Semantics_of_primitives a lot.

* Bigarray div and mod also carry safety information

* Handle bigint div and mod like int div and mod in closure_conversion

* Update Changes

* Test for divisions by zero

* Turn Pdivbint and Pmodbint argument into an inline record
2016-10-05 16:42:40 +02:00
Fourchaux 0658e05c5f Typos (inside '/bytecomp/matching.ml' comments) (#741) 2016-08-31 13:59:19 +02:00
Hongbo Zhang eb0c6551f0 remove string_(un)safe_set 2016-08-07 11:41:50 -04:00
Hongbo Zhang a36cd4c4ec add needed lambda IR for safe string 2016-08-07 11:07:10 -04:00
Damien Doligez 0b4fbc2b30 fix whitespace, long lines, headers 2016-08-01 16:06:59 +02:00
Pierre Chambart 5f5070c63c Share a few more equal branches 2016-07-28 19:38:18 +02:00
alainfrisch 5e2ceda3a2 Introduce a proper type for classifying values. 2016-07-28 00:29:53 +02:00
alainfrisch 2c61f011c6 Add comment. 2016-07-28 00:18:26 +02:00
alainfrisch 4608603105 lazy on float const will not be shortcircuited, opaque is not necessary for them. 2016-07-27 10:19:27 +02:00
alainfrisch f49938c1d5 Fix merge bugs. 2016-07-27 10:19:27 +02:00
Alain Frisch a382643571 Share logic between type-based opt for array and lazy
The logic for arrays was more clever than the one for compiling 'lazy
x' without a forward block.  In particular, it knows that concrete
data types (records, variants, open variants) cannot be floats (they
cannot be lazy either).  This commits reuses this logic for deciding
if 'lazy x' must introduce a forward block.  Now, the only difference
between the two cases is the abstract built-in type 'lazy_t'.

This commits also robustifies the classification logic to explicitly
deal with all kinds of types; and it removes an unused function.
2016-07-27 10:19:27 +02:00
Alain Frisch 1cc5ce79d4 Improve type-based optim for arrays of lazy values. 2016-07-27 10:19:27 +02:00
Alain Frisch e5698d6bcb Improve type-based optimization: do not forget about 'bytes'. 2016-07-27 10:19:27 +02:00
Alain Frisch dbd9c151fd Avoid more forward blocks when compiling 'lazy x'
This commits reuses the machinery introduced for [@@immediate] in
order to improve the detection of cases where the forward block is not
needed for compiling `lazy x`.  This detects some new cases such as
closed polymorphic variants with only constant constructors, or
abstract types marked with [@@immediate].
2016-07-27 10:19:27 +02:00
Alain Frisch b544563384 Expand abbreviations before deciding if 'lazy x' requires a forward block
This avoids introducing a forward block in cases such as:

   type t = int -> int
   let f (x : t) = lazy x
2016-07-27 10:19:27 +02:00
Alain Frisch acaeb400a5 Move logic to decide is 'lazy x' requires a forward block to Typeopt. 2016-07-27 10:19:27 +02:00
Alain Frisch 2ebeb1ef54 Improve detection of intarray
This commits reuses the machinery introduced for [@@immediate] in
order to improve the detection of the Pintarray case.  This detects
some new cases such as closed polymorphic variants with only constant
constructors, or abstract types marked with [@@immediate].
2016-07-27 10:19:27 +02:00
Mark Shinwell 333a5160bd Fix MPR 7301 (Flambda versus lazy) (#713) 2016-07-26 14:10:35 +01:00
Gabriel Scherer 4217e99fcf add a clarification comment in bytecomp/simplif.ml
See
  https://github.com/ocaml/ocaml/pull/517#issuecomment-235013881
2016-07-25 21:28:08 -04:00
Damien Doligez faed766524 Merge pull request #606 from damiendoligez/unboxed-types
Unboxed types
2016-07-25 15:34:30 +02:00
Alain Frisch ee1355c0a8 Missing Ctype.repr
An expression `lazy x` (where x is a value identifier) can be compiled
either as a simple reference to x or to the construction
of a forward block pointing to that value.  The simple scheme is used
when x cannot be a float or a lazy value.  This is determined based on
the type of the sub-expression x.  There was a missing Ctype.repr, which
has the effect that the compiler

    let f g =
      (lazy g), (g ())

would miss the fact that g has a function type; it would thus build a
forward block, whereas swapping the tuple components avoided that block.
2016-07-25 09:43:23 +02:00
Damien Doligez d5a6e50ebe GPR#606: add unboxed types 2016-07-21 13:51:46 +02:00
alainfrisch 32f0e2120c Detect unused module declarations. 2016-07-18 10:35:19 +02:00
Fabrice Le Fessant bfc36003aa Add hooks on some compilation phases 2016-07-12 17:59:58 +02:00
Pierre Chambart b8e9604fd8 Record evaluation order is always the same
The expressions defining a record are evaluated from the last field in
the type definition to the first one.
2016-07-11 16:51:20 +02:00
Pierre Chambart 24f947e95d Change Texp_record into an inline record 2016-07-11 16:51:20 +02:00
Pierre Chambart c2e66f0097 Switch declaration and definition order in Tepx_record fields 2016-07-11 16:51:20 +02:00
Pierre Chambart 6f010f987c Merge record label descriptions and definition into a single array 2016-07-11 16:51:20 +02:00
Pierre Chambart 05d0663e9d Use the type information to annotate updated record allocation 2016-07-11 16:50:36 +02:00
Pierre Chambart 338da55d31 Clean translcore record case using the change in Texp_record 2016-07-11 16:50:36 +02:00
Pierre Chambart 3f00684169 Change Texp_record contents to ease the use
It also allows to recover the type of kept fields in a
{ record with field = expr } expression
2016-07-11 16:50:36 +02:00
Pierre Chambart 25d24e38c2 Also remove linking hack for bytecode
Adds the required_globals information to bytecode compilation units.

This patch also bootstrap ocamlc. The cmo format is changed by this
commit, there is no way around bootstraping here. Note that ocamldep and
ocamllex does not rely on the cmo format, so they are not present in
this commit.

Changes in tests:

* Update test/transprim/comparison_table.ml.reference:
    The (opaque (global List!)) expression is not present anymore

* Update tests/no-alias-deps/aliases.cmo.reference
    The output of objinfo changed
2016-07-08 16:02:26 +02:00
Pierre Chambart c59e0ecb2f Comment the Lambda.program type. 2016-07-08 16:02:26 +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
Gabriel Scherer c141fa5f22 record field update: benchmarks say that max_young_wosize is a strict bound here 2016-07-07 11:47:01 -04:00
Gabriel Scherer 755427318e Fix wrong condition order in record update code
Pierre Chambart luckily caught an error in the code of PR#538 with
a condition in the wrong order -- which de-optimizes instead of
optimizing as it should. The wrong change was in 4f824bf.
2016-07-07 11:35:09 -04:00
Mark Shinwell 5f00ce793e Improve location handling in the middle end (version for merging) (#666) 2016-07-06 15:42:29 +01:00
Gabriel Scherer b3216f0f84 Merge pull request #538 from OlivierNicole/efficient-record-update
PR#6217 Improve perf. of functional record update
2016-06-25 22:08:30 -04:00
Sébastien Hinderer 766ca57138 Fix the -use-runtime option.
This option was broken, as can be seen by using it to compile the
following helloworld.ml program:

let _ = Printf.printf "Hello, world!\n%!"

Then from OCaml's toplevel source directory, compile as follows:

./ocamlc.opt -use-runtime ${HOME}/src/ocaml/byterun/ocamlrun \
  -nostdlib -I stdlib -o helloworld.byte helloworld.ml

And do:

head -1 helloworld.byte

See the double #! at the beginning of the line.

The first one comes from the "header" file which is included and is
correct (it would be a different header on Windows).

The second one is hard-coded and should be removed, this is what
this patch does.
2016-06-08 22:40:37 +02:00
Frédéric Bour 28dc832030 Make backtraces aware of inlining (#247) 2016-05-25 14:00:37 +01:00
Jacques Garrigue 6712be88f0 add Path.compare 2016-05-09 09:35:05 -04:00
alainfrisch 2d927bd8d5 Merge branch 'bb_sys_backend_type' of https://github.com/bloomberg/ocaml into bloomberg-bb_sys_backend_type 2016-05-02 18:12:38 +02:00
Damien Doligez 520fb2df50 Merge tag 4.03.0 into trunk. 2016-04-28 16:13:21 +02:00
Hongbo Zhang 6c3a01bb7c prepare backend_type primitive 2016-04-24 17:42:23 -04:00
Jacques Garrigue 40796a2e1b Fix PR#7230 2016-04-22 11:20:14 +09:00
Nicolas Ojeda Bar 1dfac1f12b Preserve backtraces in match ... with exception e -> ...
When translating into Lambda we treat the case of exception
handlers in match forms in the same way as exception handler in
try .. with in order to preserve backtraces.

A small test is included as well.
2016-04-18 11:45:46 -04:00
Jacques-Henri Jourdan 1915e20c5b Fix mantis PR 7168 by creating a safety margin in the bytecode stack. 2016-04-15 11:28:38 +02:00
Pierre Chambart 7ffc739c4d Remove some Flambda specificities to translcore
This prevents some type annotations to be propagated to the middle-end,
but this is not really important as those only concern constants which
already provide all the usefull information about their shape.
2016-04-12 14:51:17 +02:00
alainfrisch 34ba646f0d More compact printer and fix test. 2016-04-12 14:51:15 +02:00
Pierre Chambart 15705f695e Translcore propagates more block type information 2016-04-12 14:49:55 +02:00
Pierre Chambart 3ad95a3a59 Also record type information for int 2016-04-12 14:49:54 +02:00
Pierre Chambart f7dcbf21e7 Annotate Let_mutable with the kind of value 2016-04-12 14:49:52 +02:00
Pierre Chambart f4665bee42 Annotate each field of a block separately 2016-04-12 14:49:51 +02:00
alainfrisch 83ae23568c Renaming block_kind -> value_kind. 2016-04-12 14:49:50 +02:00
alainfrisch d8d6abd681 Simplify printlambda: do not show Pgenblock annotation. 2016-04-12 14:49:46 +02:00
alainfrisch 9b7e5868f2 Detect all let-bindings to unboxable floats. 2016-04-12 14:49:43 +02:00
alainfrisch 4bf9ad6a3c Keep the approx on all Llet nodes, not only variables. 2016-04-12 14:49:42 +02:00
alainfrisch c996f5f18d Keep track of mutable variables obtained by eliminating local references holding aun unboxable number type. Then force unboxing of such variables to avoid repeated boxing every time the reference is assigned. 2016-04-12 14:49:40 +02:00
Olivier Nicole 4f824bf4d9 Replace ">" with ">=" 2016-04-11 17:03:02 +02:00
Olivier Nicole 00bc0a9f59 Replace value with constant and improve comments 2016-04-11 16:54:16 +02:00
Olivier Nicole 8469aadf96 PR#6217 Improve perf. of functional record update 2016-04-11 10:20:56 +02:00
Mark Shinwell fef9257fd1 Fix spelling mistake in comment 2016-03-31 15:40:51 +01:00
Jacques Garrigue ba82f8f072 Fix PR#7182: external in recursive module 2016-03-16 17:23:15 +01:00
alainfrisch 502e4f9336 More warnings when compiling the compiler. 2016-03-15 22:46:35 +01:00
alainfrisch 43f90e9f58 Local let exceptions. 2016-03-15 22:02:55 +01: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
Mark Shinwell 4137939cd7 Make warning 59 less unhelpful (includes work by Runhang Li) 2016-02-11 14:35:18 +00:00
Mark Shinwell 70f88c43aa Add specialise attribute support to Printlambda 2016-02-11 10:43:59 +00:00
Damien Doligez e5a1b8b4c4 Merge pull request #455 from vouillon/debug
Provide more debugging information to Js_of_ocaml
2016-02-10 15:28:36 +01:00
Leo White 59aab8d1c2 Support for unroll and and specialise attributes 2016-02-10 14:14:42 +01:00
Damien Doligez 1c28b231ef Revert "PR#6475: accept -o in ocamlc when compiling C files"
This reverts commit 1d8e590c54.

Conflicts:
	Changes
	bytecomp/bytelink.ml
	driver/optcompile.ml
	ocamlbuild/ocaml_specific.ml
	ocamlbuild/testsuite/internal.ml
	utils/ccomp.ml
2016-02-10 10:34:02 +01:00
Jerome Vouillon ef535cdb2e Fix indentation 2016-02-02 16:54:49 +01:00
Jerome Vouillon 188e59fae5 Add debugging 'pseudo' events at the end of structures
This debugging event provides information regarding the structure items.
It is ignored by the OCaml debugger but is used by Js_of_ocaml to
preserve variable names for debugging purpose.
2016-02-02 16:54:44 +01:00
Will Crichton 50dd38d4b6 Add support for immediate attribute 2016-02-02 11:45:07 +00:00
Pierre Chambart b0b0f6609c Enable flambda 2016-01-28 15:04:47 +01:00
Mark Shinwell 20d1951566 Merge pull request #417 from chambart/flambda_prereq-duparray_and_array_mutability
GPR#417: Add explicit duplication of literal arrays
2016-01-21 16:05:44 +00:00
alainfrisch 87de6a160d Useless bindings, unit patterns, whitespace. 2016-01-19 23:40:55 +01:00
Pierre Chambart fbd87e9081 Const_float_array are constant for branch merging 2016-01-15 16:07:59 +01:00
Mark Shinwell d489fd2038 comments 2016-01-15 14:54:33 +00:00
Mark Shinwell 0664a1cf03 Alter array patch after feedback from jdimino 2016-01-15 14:49:01 +00:00
Pierre Chambart 9668c45aab Avoid using Pmakearray instead of Const_float_array 2016-01-15 15:33:16 +01:00
Gabriel Scherer 9bc195f313 Merge pull request #426 from nojebar/compile-with-principal
Build compiler with with -principal
2016-01-14 13:53:49 -05:00
Mark Shinwell 5548d4e3ed Merge remote-tracking branch 'ocaml/trunk' into flambda_prereq-popaque 2016-01-14 16:47:31 +00:00
Nicolas Ojeda Bar c242a29b12 Compile with -principal 2016-01-14 15:29:41 +01:00
Mark Shinwell adfa454154 Minor change to split_default_wrapper (see comment in Closure_conversion) 2016-01-14 10:25:53 +00:00
Mark Shinwell 22c15cc2c1 Debuginfo.to_location and Location.print_compact 2016-01-13 16:20:23 +00:00
Mark Shinwell 6dd5c69302 Add comment to translmod.ml 2016-01-13 13:37:58 +01:00
Pierre Chambart 354bd48f20 Prim makearray 2016-01-12 19:51:06 +01:00
Pierre Chambart 9c60ae1692 Add the opaque primitive 2016-01-12 19:24:22 +01:00
Mark Shinwell 74b8b6ab5e Merge pull request #360 from mshinwell/flambda_prereq-init_assign
GPR#360: Propagate whether or not stores are initializing, etc.
2016-01-12 18:18:27 +01:00
Mark Shinwell 9d9e11b94c Merge pull request #412 from mshinwell/flambda_prereq-lambda_map
GPR#412: Add Lambda.map
2016-01-12 17:02:32 +01:00
Mark Shinwell 869b25cd3a Import Lambda.map 2016-01-12 16:29:29 +01:00
Mark Shinwell 029e1bbbbc Merge remote-tracking branch 'ocaml/trunk' into flambda_prereq-init_assign 2016-01-12 15:33:54 +01:00
Mark Shinwell cf06b87981 remake .depend 2016-01-12 15:18:58 +01:00
Mark Shinwell 2a3e730aa3 Merge pull request #390 from mshinwell/flambda_prereq-module_size
GPR#390: Compute module block size in transl_structure
2016-01-12 14:07:27 +01:00
Mark Shinwell 6a650a4a5a Printlambda.string_of_primitive -> Printlambda.name_of_primitive 2016-01-04 16:59:06 +00:00
Mark Shinwell 095ef83d3e Add Printlambda.string_of_primitive 2016-01-04 16:57:22 +00:00
Mark Shinwell 1959272069 Compute module block size in transl_structure 2016-01-04 12:56:18 +00:00
Mark Shinwell b53e5789bc Move split_default_wrapper to Simplif 2015-12-23 16:24:52 +00:00
Gabriel Scherer 571b72412b Merge pull request #359 from mshinwell/flambda_prereq-move-debuginfo
Move Debuginfo into bytecomp/
2015-12-20 12:45:08 +01:00
Pierre Chambart 58d6da114e Handle inline attribute on functors and mark functor functions 2015-12-18 19:53:24 +00:00
Mark Shinwell 933fdb2687 Improved annotations on Psetfield etc 2015-12-18 16:42:40 +00:00
Mark Shinwell 4f0badde0c move Debuginfo into bytecomp/ 2015-12-18 16:26:30 +00:00
Xavier Leroy 884c1c81bd Revert "PR#6537, PR#5333, PR#4080: fix stack overflow in the compiler when -pack'ing a module that includes a module of the same name."
This reverts commit 02b1696cc2.

Problems with -pack appear while compiling Camlp4.  Temporarily reverting this commit so that Camlp4 compiles again.  To be investigated further.

Attempting to see if this commit is the source of the problem.
2015-12-16 17:32:15 +01:00
Mark Shinwell f2ad502a37 Merge pull request #345 from trefis/stupéflip-vite
GPR#345: indentation in translmod
2015-12-15 10:45:15 +00:00
Gabriel Scherer d071da2880 Revert GPR#305 (exception patterns under or-patterns) from trunk
This week we merged several changes from Thomas Refis, to allow the
use of exception patterns under or-patterns, to write code such as

  match foo x with
    | None | exception Not_found -> ...
    | Some -> ...

Unfortunately, I failed to properly assess the impact of this change,
and in particular to make sure that Luc Maranget had properly reviewed
this code -- any change to the pattern-matching machinery should be
reviewed by Luc.

The problem that I had not foreseen and that he would have immediately
realized is that, while adapting the pattern-matching *compiler* is
relatively easy (Thomas inserted a transformation at the right place
to separate exception patterns from the others and handle them
separately, using the staticraise construct used by the
pattern-matching compiler to avoid duplicating the
right-hand-side branch), adapting the pattern-matching warnings
machinery is both more subtle and easier to overlook (it may fail
silently and nobody notices, unlike wrong code production). This part
of the compiler is subtle and best understood by Luc, but he does not
have the time to do a proper review of those changes in the timeframe
for the 4.03 feature freeze (mid-December).

I believe the right move in this case, implemented in the present
commit, is to revert the change from trunk (this is not a feature that
we must *imperatively* have in 4.03), do a proper job of understanding
the changes, and integrate the change when we are confident it is
ready. I hope to do this in 2016, together with Luc Maranget and
Thomas Refis -- hopefully this would allow Thomas and I to be more
confident when changing the pattern-matching machinery in the future.

Revert "Merge pull request #343 from trefis/pr7083"
This reverts commit 22681b8d2a, reversing
changes made to a24e4edf0a.

Revert "Merge pull request #341 from trefis/or-exception"
This reverts commit f8f68bd329, reversing
changes made to 1534fe8082.

Revert "Merge pull request #305 from trefis/or-exception"
This reverts commit cfeda89396, reversing
changes made to 77cf36cf82.
2015-12-12 11:20:21 +01:00
Thomas Refis cdf1741890 indentation in translmod 2015-12-11 16:24:56 +00:00
alainfrisch 02b1696cc2 PR#6537, PR#5333, PR#4080: fix stack overflow in the compiler when -pack'ing a module that includes a module of the same name. 2015-12-11 15:36:02 +01:00
alainfrisch a24e4edf0a #5995: better naming of exceptions when compiling with -for-pack. 2015-12-11 11:53:09 +01:00
Thomas Refis 4b28c6ca99 PR#6422: Allow exceptions under or-patterns in match statements. 2015-12-09 11:19:59 +00:00
alainfrisch 9d4b3a4513 Fix PR#7067: performance regression when compiling large nested structures in native code. 2015-12-07 15:07:50 +01:00
Simon Cruanes 6c5665393e fix 0007026
- remove write barrier for constant poly variants
- add tests
2015-12-06 19:24:31 +01:00
Gabriel Scherer c6b5a28d77 Merge pull request #320 from gasche/revert-user-defined-indexing-operators
Revert user defined indexing operators
2015-12-06 17:56:40 +01:00
maranget e8625747fa PR#6805 Duplicated expression in case of hole in a non-failing switch. 2015-12-03 17:52:50 +01:00
alainfrisch fa743fd605 PR6939: improve fix. 2015-12-03 16:30:07 +01:00
alainfrisch fab5144d99 PR#6939: Segfault with improper use of let-rec. 2015-12-03 14:57:39 +01:00
alainfrisch 9879d54989 #6865: restore previous behavior for 'let _ = expr' in the toplevel, i.e. it prints the result of 'expr'. 2015-12-03 09:26:36 +01:00
alainfrisch 01bf671f33 PR#6865: remove special case for "let _ = expr" structure items.
This form used to produce Pstr_eval instead of Pstr_let.  This would
probably come as a suprise for people matching on the Parsetree (e.g.
for a ppx).  This special case is now removed.

To avoid a (probably harmless) regression in bytecode, the compilation
of "let _ = ..." bindings (including local ones) is optimized to remove
a useless introduction of a variable (which would occupy a stack slot
otherwise).

The source code printer (-dsource) now prints Pstr_eval as ";;expr",
which should always be ok.  One could avoid ";;" at the beginning of
the structure, but since it is allowed, it is probably not worth adding
complexity here.
2015-12-02 23:39:19 +01:00
Jeremie Dimino 62fb2c58d6 Fix PR#6920
Make sure correct debugging informations are generated for %apply and
%revapply.
2015-11-30 10:27:29 +00:00
Gabriel Scherer 1552d30d16 Revert "Add a special syntax for index operators"
This reverts commit 16bc43219c.

(Conflict resolution: bytecomp/translcore.ml:prim_makearray was
dead code and has since been removed)
2015-11-29 21:01:30 +01:00
Jeremie Dimino ebd830b85b Add support for [%ocaml.extension_constructor <path>]
Translate [%ocaml.extension_constructor <path>] to the
runtime-representation of the extension constructor denoted by
<path>. This allows one to get the extension constructor without
having to create a dummy value.
2015-11-27 18:17:14 +00:00
Nicolas Ojeda Bar a524920aa2 Remove Typedtree.optional
From comments in typedtree.mli:

When introduced in 2000, this [type] enabled a more efficient code
generation for optional arguments. However, today the information is
redundant as labels are passed to [transl_apply] too. Could be cleaned
up.
2015-11-25 00:37:46 +01:00
alainfrisch fe68945a20 Only the return idents are useful in pat_bound_idents, simplify accordingly. 2015-11-24 15:43:26 +01:00
Nicolas Ojeda Bar aaed35bf87 Turn Lapply case of Lambda.lambda into a record 2015-11-22 23:08:47 +01:00
Jacques Garrigue eb0de16ee0 Fix PR#4166, PR#6959: force linking when calling external C primitives 2015-11-13 13:59:14 +09:00
Damien Doligez 7cb9a80744 simplify .gitignore; remove .ignore files and tools/setignore; adjust tools/check-typo 2015-11-06 16:25:05 +01:00
François Bobot c0f19965f4 Make specialized compare unboxed
- float
    - int32
    - int64
    - nativeint

  Not for int because the comparison is done directly on the untagged version.
  Useful mainly for floats since they can be stored unboxed in records or arrays.
2015-11-05 13:07:03 +01:00
Mark Shinwell e9d4dc28c7 Merge pull request #270 from mshinwell/immutable_exceptions
GPR#270: Make transl_exception_constructor generate Immutable blocks
2015-11-02 14:50:21 +00:00
Mark Shinwell f923aa767b push the correct patch 2015-10-28 14:15:11 +00:00
Mark Shinwell ee17bfc0ce look at all labels when determining mutability of a record resulting from 'with' 2015-10-28 13:58:30 +00:00
Mark Shinwell 17e1078cce transl_exception_constructor now uses Immutable 2015-10-28 10:56:49 +00:00
Jacques Garrigue a335b18a45 merge branches/gadt-warnings
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16532 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-23 08:33:44 +00:00
Mark Shinwell 7d5a2ecde8 add missing files (Translattribute)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16531 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-23 08:28:59 +00:00
Mark Shinwell e27e699fca GPR#173: Attributes to control inlining
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16530 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-23 08:18:08 +00:00
Alain Frisch 923ad0ec47 Remove or comment-out dead code.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16515 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 16:08:12 +00:00
Jacques Garrigue e34f40ad87 switch to 'pat -> .' and add P/Texp_unreachable
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gadt-warnings@16507 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-16 00:13:40 +00:00
Alain Frisch aaeda7763b #4800: better compilation of tuple assignment (joint work Gabriel Scherer / Alain Frisch).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16501 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-15 12:07:08 +00:00
Gabriel Scherer 489dbbd440 Correction of spelling errors in comments
(user 'octachron')

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16483 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-09 20:41:53 +00:00
Gabriel Scherer 5882fdea22 General translation of french comments
(user 'octachron')

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16474 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-10-09 20:41:38 +00:00