| Anonymous | Login | Signup for a new account | 2013-05-26 08:49 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0004555 | OCaml | OCaml general | public | 2008-05-19 18:34 | 2008-08-27 12:24 | |||
| Reporter | pzimmer | |||||||
| Assigned To | ||||||||
| Priority | normal | Severity | minor | Reproducibility | always | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.10.2 | |||||||
| Target Version | Fixed in Version | 3.11+dev | ||||||
| Summary | 0004555: Compilation of equality involving polymorphic variants not optimized | |||||||
| Description | The following code: let f x = x = `Test generates a call to caml_equal for the comparison. Equivalent code using pattern matching or (==) generates optimized code with an integer comparison. This looks like one trivial optimization case is missing in the compiler. Here is a proposed patch (contributed by Mark Shinwell) that seems to be correct and fixes the problem: --- ocaml-3.10.2/bytecomp/translcore.ml 2007-02-09 08:31:15.000000000 -0500 +++ ocaml-3.10.2-patched/bytecomp/translcore.ml 2008-05-16 18:46:48.000076000 -0400 @@ -279,6 +279,12 @@ let transl_prim prim args = | [{exp_desc = Texp_construct({cstr_tag = Cstr_constant _}, _)}; arg2] when simplify_constant_constructor -> intcomp + | [arg1; {exp_desc = Texp_variant(_, None)}] + when simplify_constant_constructor -> + intcomp + | [{exp_desc = Texp_variant(_, None)}; exp2] + when simplify_constant_constructor -> + intcomp | [arg1; arg2] when has_base_type arg1 Predef.path_int || has_base_type arg1 Predef.path_char -> intcomp | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0004511) pzimmer (reporter) 2008-05-28 15:45 |
Note that I accidentally miscategorized this entry: it should be in "OCaml general" and not in "Caml-light". If one of the admins could fix it, that would be great. Thanks. |
|
(0004588) garrigue (manager) 2008-08-27 12:24 |
Fixed as suggested in CVS head (for 3.11) |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2008-05-19 18:34 | pzimmer | New Issue | |
| 2008-05-28 15:45 | pzimmer | Note Added: 0004511 | |
| 2008-05-28 16:17 | doligez | Status | new => acknowledged |
| 2008-05-28 16:17 | doligez | Category | Caml-light => OCaml general |
| 2008-08-27 12:24 | garrigue | Status | acknowledged => closed |
| 2008-08-27 12:24 | garrigue | Note Added: 0004588 | |
| 2008-08-27 12:24 | garrigue | Resolution | open => fixed |
| 2008-08-27 12:24 | garrigue | Fixed in Version | => 3.11+dev |
| Copyright © 2000 - 2011 MantisBT Group |