-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3b7530
commit 6c86e4f
Showing
2 changed files
with
81 additions
and
881 deletions.
There are no files selected for viewing
58 changes: 11 additions & 47 deletions
58
tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Regression17607.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,31 @@ | ||
open System | ||
open System.Diagnostics | ||
|
||
// 16 byte struct | ||
[<Struct>] | ||
type Point2D(x: double, y: double) = | ||
member _.X = x | ||
member _.Y = y | ||
|
||
// Will create a tail il instruction and force a tail call. This is will become | ||
// a fast tail call on unix x64 as the caller and callee have equal stack size | ||
let fifth() = | ||
let rec fifthMethodFirstCallee(iterationCount, firstArg: Point2D, secondArg: Point2D, thirdArg: Point2D, fourthArg: Point2D, fifthArg: Point2D) = | ||
if firstArg.X <> 10.0 then -100 | ||
else if firstArg.Y <> 20.0 then -101 | ||
else if secondArg.X <> 30.0 then -102 | ||
else if secondArg.Y <> 40.0 then -103 | ||
else if thirdArg.X <> 10.0 then -104 | ||
else if thirdArg.Y <> 20.0 then -105 | ||
else if fourthArg.X <> 30.0 then -106 | ||
else if fourthArg.Y <> 40.0 then -107 | ||
else if fifthArg.X <> 10.0 then -108 | ||
else if fifthArg.Y <> 20.0 then -109 | ||
else if iterationCount = 0 then | ||
let rec fifthMethodFirstCallee(iterationCount, firstArg: int) = | ||
if iterationCount = 0 then | ||
100 | ||
else if iterationCount % 2 = 0 then | ||
fifthMethodSecondCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg) | ||
fifthMethodSecondCallee(iterationCount - 1, firstArg) | ||
else | ||
fifthMethodFirstCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg) | ||
fifthMethodFirstCallee(iterationCount - 1, firstArg) | ||
|
||
and fifthMethodSecondCallee(iterationCount, firstArg, secondArg, thirdArg, fourthArg, fifthArg) = | ||
if firstArg.X <> 10.0 then -150 | ||
else if firstArg.Y <> 20.0 then -151 | ||
else if secondArg.X <> 30.0 then -152 | ||
else if secondArg.Y <> 40.0 then -153 | ||
else if thirdArg.X <> 10.0 then -154 | ||
else if thirdArg.Y <> 20.0 then -155 | ||
else if fourthArg.X <> 30.0 then -156 | ||
else if fourthArg.Y <> 40.0 then -157 | ||
else if fifthArg.X <> 10.0 then -158 | ||
else if fifthArg.Y <> 20.0 then -159 | ||
else if iterationCount = 0 then | ||
and fifthMethodSecondCallee(iterationCount, firstArg) = | ||
if iterationCount = 0 then | ||
101 | ||
else if iterationCount % 2 = 0 then | ||
fifthMethodSecondCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg) | ||
fifthMethodSecondCallee(iterationCount - 1, firstArg) | ||
else | ||
fifthMethodFirstCallee(iterationCount - 1, firstArg, secondArg, thirdArg, fourthArg, fifthArg) | ||
fifthMethodFirstCallee(iterationCount - 1, firstArg) | ||
|
||
let point = Point2D(10.0, 20.0) | ||
let secondPoint = Point2D(30.0, 40.0) | ||
|
||
let retVal = fifthMethodFirstCallee(1000000, point, secondPoint, point, secondPoint, point) | ||
|
||
if retVal <> 100 && retVal <> 101 then | ||
printfn "Method -- Failed, expected result: 100 or 101, calculated: %d" retVal | ||
-5 | ||
else | ||
0 | ||
fifthMethodFirstCallee(1000000, 158_423) | ||
|
||
|
||
[<EntryPoint>] | ||
let main argv = | ||
let startTime = Stopwatch.StartNew() | ||
for i in 0..100 do | ||
ignore (fifth ()) | ||
let elapsedTime = startTime.Elapsed.TotalMilliseconds | ||
printfn "%fms" elapsedTime | ||
0 | ||
fifth () |
Oops, something went wrong.