Commit Graph

131 Commits (ee8f71101b80496b2ec2c996d29ac33bbaf7cf00)

Author SHA1 Message Date
Damien Doligez ee8f71101b clean up whitespace and cut long lines 2016-02-17 13:36:27 +01:00
Leo White 59aab8d1c2 Support for unroll and and specialise attributes 2016-02-10 14:14:42 +01: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 4b28c6ca99 PR#6422: Allow exceptions under or-patterns in match statements. 2015-12-09 11:19:59 +00: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 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
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 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
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
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
Jérémie Dimino 1d196f4ddd Support [@unboxed] and [@untagged] attributes
Adding [@unboxed] (resp [@untagged]) on a primitive argument means
that the argument must passed unboxed (resp untagged) to the external
function. Adding [@unboxed] (resp [@untagged]) on the result means
that the external function returns its result unboxed (resp untagged).

The unboxing (resp untagging) method is derived from the type.

Currently unboxing is suported for: float, int32, int64 and nativeint.
Untagging is supported for int.

This patch also increases the cm{i,o,a,x,xa} magic numbers as the type
Primitive.description is changed.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16382 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-08-25 16:18:46 +00:00
Gabriel Scherer 90061455e6 GPR#111: `(f [@taillcall]) x y` warns if `f x y` is not a tail-call
(Simon Cruanes)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16010 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2015-04-12 18:26:38 +00:00
Luc Maranget a142a01dae correct PR#6674
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15608 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-25 15:11:40 +00:00
Luc Maranget 3bded3f977 Solve PR#6646, ie avoid introducing huge jump summaries
and unshared default clauses in the presence of many (>= 32) non-matched
constructors.




git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15570 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-11-07 14:13:53 +00:00
Alain Frisch e3ad818fb5 Reintegrate-merge constructors_with_record5 branch.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15556 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-10-14 15:51:30 +00:00
Damien Doligez cbfe627f92 merge changes from branch 4.02 from branching (rev 14852) to 4.02.0+rc1 (rev 15121)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@15125 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-08-22 13:45:02 +00:00
Luc Maranget f8a3649190 Correct PR#6412 by ruling out sharing of Levents
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14804 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-12 14:57:24 +00:00
Jacques Garrigue b56dc4b3df PR#5584: merge open extensible types, extension-patch-4.0.2
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14737 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-05-04 23:08:45 +00:00
Damien Doligez 5b8df637d2 merge branch "safe-string"
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14705 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-29 11:56:17 +00:00
Damien Doligez 7303ac34ca fix some of the whitespace problems in the source
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14582 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-12 10:17:02 +00:00
Luc Maranget 937e37ef1f Suppressed some useless argument of switcher calls
(lifted as a functor argument)



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14559 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-08 09:38:22 +00:00
Luc Maranget fcf3571123 Folllowup to PR#6359, great cleanup of switch actions sharing.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14558 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-07 15:43:20 +00:00
Alain Frisch fa13304327 Distinguish explicitly representation of regular records and inlined records with tag = 0.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record2@14531 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-04 12:37:49 +00:00
Luc Maranget dd55c293ac Fix PR#6359
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14520 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-02 13:22:21 +00:00
Alain Frisch d75e2c8b01 Support for record arguments on exceptions.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record2@14515 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-04-01 11:46:00 +00:00
Alain Frisch 4607a0f8e1 Encode record arguments into extra record declarations.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/constructors_with_record2@14508 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-31 12:20:22 +00:00
Luc Maranget c2a88c27fd #PR6269 Optimized string matching
Noticed that I had to bootstrap to test on ARM, so I commit  a new bootstrap
compiler.



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14479 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-03-21 17:02:44 +00:00
Luc Maranget 89a627f55b PR#6322 Corrected.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14432 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-02-06 13:30:54 +00:00
Jacques Garrigue 3b4d7cf63b Merge module-alias branch (cf. PR#6063)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14394 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2014-01-10 07:53:33 +00:00
Alain Frisch d802a51be6 #6203: change representation of exception values created with a constant constructor: the value is now equal to the exception slot. This avoids some allocation when the constructor is called and an extra indirection on matching against the constructor.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14235 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-18 13:00:58 +00:00
Alain Frisch f31325cbaf #6203, #5935: variants of raise. 'reraise' is currently only inserted by the compiler when an handler does not catch the exception. The default 'raise' always start with a fresh backtrace. There is also 'raise_nostack' which does not trigger the stack trace recording. Bytecode only for now.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14223 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-14 12:31:50 +00:00
Jacques Garrigue 7a904bb8db make path normalization safer; now Core not only compiles but works
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/module-alias@14212 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-04 02:06:40 +00:00
Jacques Garrigue 06d511c857 more exception paths requiring normalization
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/module-alias@14211 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-10-03 12:51:30 +00:00
Damien Doligez 7844495624 Merge branch 4.01 from branching point to 4.01.0+rc1
Command line used:
  svn merge --accept postpone -r 13776:14055 $REPO/version/4.01 .


git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@14060 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-09-04 15:12:37 +00:00
Alain Frisch 525ef9d703 Synchronize with trunk.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13897 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-16 13:34:30 +00:00
Luc Maranget 32bcc186ea Patch for PR#5788
(Exception binding fools pattern matching optimisations)

Hopefully it's complete...





git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13871 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-07-02 16:05:48 +00:00
Xavier Leroy 8cd3272c6d PR#6033 continued: ocamlopt-specific path (inline_lazy_force_switch) was lying about the max value for the argument to the switch.
The whole "let's choose between two implementations of inline_lazy_force" smells.  It should be possible to have one implementation that works well in bytecode and in native.  TBD.



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13761 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-10 11:31:42 +00:00
Xavier Leroy 5b0986b4c5 PR#6033: Matching.inline_lazy_force needs eta-expansion (command-line flags)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13758 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-06-07 17:16:11 +00:00
Luc Maranget ebfc4e6cff Fix PR #5992
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13611 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-25 13:32:17 +00:00
Alain Frisch b36ec9f764 Get rid of the 'explicit arity' flag on Pexp_construct/Ppat_construct. If really requires (for camlp5?), the feature should be reimplemented with attributes.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13549 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-04-17 09:46:52 +00:00
Alain Frisch 6bfcb1da5b Support for quoted strings.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/extension_points@13450 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-26 11:17:17 +00:00
Damien Doligez 03d5a3378a typos in comment
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13399 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-17 15:46:15 +00:00
Damien Doligez c63f9e0957 fix a few problems with whitespace and over-long lines
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13393 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2013-03-09 22:38:52 +00:00
Alain Frisch 0b37b27356 Stop keeping a Path.t to refer to labels and constructors in the Typedtree AST. This is not used internally and it is not a robust way to identify these objects unambiguously anyway
(especially when we will add more powerful disambiguation strategies).  The correct way to identify an item is through the pair (type,name), which can be deduced from the
label_description/constructor_description stored in the Typedtree.



git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13043 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
2012-10-24 12:03:00 +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