You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7439 Reporter: markghayden Assigned to:@gasche Status: resolved (set by @gasche on 2016-12-22T18:48:43Z) Resolution: fixed Priority: normal Severity: minor Platform: AMD64 (others) OS: MacOS OS Version: 10.12.2 Version: 4.04.0 Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1 Category: back end (clambda to assembly)
Bug description
When pattern matching constant values, the optimizer uses jump tables even if all the resulting values are themselves constants. Now that Ocaml is so much better about identifying constants, wouldn't it be better to use lookup tables when the results are all constants. The examples below all use jump-tables where each target simply loads a constant value and returns.
type t = A | B | C | D ;;
let f = function
| A -> 0
| B -> 1
| C -> 2
| D -> 3
;;
let g = function
| A -> "A"
| B -> "B"
| C -> "C"
| D -> "D"
;;
let h v =
match v with
| A -> f
| B -> (fun _ -> 1)
| C -> (fun _ -> 2)
| D -> (fun _ -> 3)
;;
Steps to reproduce
Compile above code with 4.04.0+flambda with "-O3 -unbox-closures"
Original bug ID: 7439
Reporter: markghayden
Assigned to: @gasche
Status: resolved (set by @gasche on 2016-12-22T18:48:43Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: AMD64 (others)
OS: MacOS
OS Version: 10.12.2
Version: 4.04.0
Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Category: back end (clambda to assembly)
Bug description
When pattern matching constant values, the optimizer uses jump tables even if all the resulting values are themselves constants. Now that Ocaml is so much better about identifying constants, wouldn't it be better to use lookup tables when the results are all constants. The examples below all use jump-tables where each target simply loads a constant value and returns.
type t = A | B | C | D ;;
let f = function
| A -> 0
| B -> 1
| C -> 2
| D -> 3
;;
let g = function
| A -> "A"
| B -> "B"
| C -> "C"
| D -> "D"
;;
let h v =
match v with
| A -> f
| B -> (fun _ -> 1)
| C -> (fun _ -> 2)
| D -> (fun _ -> 3)
;;
Steps to reproduce
Compile above code with 4.04.0+flambda with "-O3 -unbox-closures"
File attachments
The text was updated successfully, but these errors were encountered: