Skip to content

Commit 70e1130

Browse files
dsymeKevinRansom
authored andcommitted
comment state machine compilation (dotnet#6626)
* comment state machine compilation * add signature file * add signature files
1 parent 454764b commit 70e1130

File tree

9 files changed

+189
-67
lines changed

9 files changed

+189
-67
lines changed

fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@
434434
<Compile Include="$(FSharpSourcesRoot)/fsharp/CheckFormatStrings.fs">
435435
<Link>Logic/CheckFormatStrings.fs</Link>
436436
</Compile>
437+
<Compile Include="$(FSharpSourcesRoot)/fsharp/FindUnsolved.fsi">
438+
<Link>Logic/FindUnsolved.fsi</Link>
439+
</Compile>
437440
<Compile Include="$(FSharpSourcesRoot)/fsharp/FindUnsolved.fs">
438441
<Link>Logic/FindUnsolved.fs</Link>
439442
</Compile>
@@ -473,9 +476,15 @@
473476
<Compile Include="$(FSharpSourcesRoot)/fsharp/InnerLambdasToTopLevelFuncs.fs">
474477
<Link>Optimize/InnerLambdasToTopLevelFuncs.fs</Link>
475478
</Compile>
479+
<Compile Include="$(FSharpSourcesRoot)/fsharp/LowerCallsAndSeqs.fsi">
480+
<Link>Optimize/LowerCallsAndSeqs.fsi</Link>
481+
</Compile>
476482
<Compile Include="$(FSharpSourcesRoot)/fsharp/LowerCallsAndSeqs.fs">
477483
<Link>Optimize/LowerCallsAndSeqs.fs</Link>
478484
</Compile>
485+
<Compile Include="$(FSharpSourcesRoot)/fsharp/autobox.fsi">
486+
<Link>Optimize/autobox.fsi</Link>
487+
</Compile>
479488
<Compile Include="$(FSharpSourcesRoot)/fsharp/autobox.fs">
480489
<Link>Optimize/autobox.fs</Link>
481490
</Compile>

src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@
447447
<Compile Include="..\CheckFormatStrings.fs">
448448
<Link>Logic\CheckFormatStrings.fs</Link>
449449
</Compile>
450+
<Compile Include="..\FindUnsolved.fsi">
451+
<Link>Logic\FindUnsolved.fsi</Link>
452+
</Compile>
450453
<Compile Include="..\FindUnsolved.fs">
451454
<Link>Logic\FindUnsolved.fs</Link>
452455
</Compile>
@@ -468,8 +471,6 @@
468471
<Compile Include="..\TypeChecker.fs">
469472
<Link>Logic\TypeChecker.fs</Link>
470473
</Compile>
471-
472-
<!-- includes the optimizer and code generator -->
473474
<Compile Include="..\Optimizer.fsi">
474475
<Link>Optimize\Optimizer.fsi</Link>
475476
</Compile>
@@ -488,9 +489,15 @@
488489
<Compile Include="..\InnerLambdasToTopLevelFuncs.fs">
489490
<Link>Optimize\InnerLambdasToTopLevelFuncs.fs</Link>
490491
</Compile>
492+
<Compile Include="..\LowerCallsAndSeqs.fsi">
493+
<Link>Optimize\LowerCallsAndSeqs.fsi</Link>
494+
</Compile>
491495
<Compile Include="..\LowerCallsAndSeqs.fs">
492496
<Link>Optimize\LowerCallsAndSeqs.fs</Link>
493497
</Compile>
498+
<Compile Include="..\autobox.fsi">
499+
<Link>Optimize\autobox.fsi</Link>
500+
</Compile>
494501
<Compile Include="..\autobox.fs">
495502
<Link>Optimize\autobox.fs</Link>
496503
</Compile>

src/fsharp/FindUnsolved.fsi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
4+
module internal FSharp.Compiler.FindUnsolved
5+
6+
open FSharp.Compiler.Tast
7+
open FSharp.Compiler.Tastops
8+
open FSharp.Compiler.TcGlobals
9+
open FSharp.Compiler.Import
10+
11+
/// Find all unsolved inference variables after type inference for an entire file
12+
val UnsolvedTyparsOfModuleDef: g: TcGlobals -> amap: ImportMap -> denv: DisplayEnv -> mdef : ModuleOrNamespaceExpr * extraAttribs: Attrib list -> Typar list

src/fsharp/LowerCallsAndSeqs.fs

Lines changed: 122 additions & 59 deletions
Large diffs are not rendered by default.

src/fsharp/LowerCallsAndSeqs.fsi

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
module internal FSharp.Compiler.LowerCallsAndSeqs
4+
5+
open FSharp.Compiler.Tast
6+
open FSharp.Compiler.TcGlobals
7+
open FSharp.Compiler.Import
8+
open FSharp.Compiler.Range
9+
10+
/// An "expr -> expr" pass that eta-expands under-applied values of
11+
/// known arity to lambda expressions and beta-var-reduces to bind
12+
/// any known arguments. The results are later optimized by the peephole
13+
/// optimizer in opt.fs
14+
val LowerImplFile: g: TcGlobals -> assembly: TypedImplFile -> TypedImplFile
15+
16+
/// Analyze a TAST expression to detect the elaborated form of a sequence expression.
17+
/// Then compile it to a state machine represented as a TAST containing goto, return and label nodes.
18+
/// The returned state machine will also contain references to state variables (from internal 'let' bindings),
19+
/// a program counter (pc) that records the current state, and a current generated value (current).
20+
/// All these variables are then represented as fields in a hosting closure object along with any additional
21+
/// free variables of the sequence expression.
22+
val LowerSeqExpr: g: TcGlobals -> amap: ImportMap -> overallExpr: Expr -> (ValRef * ValRef * ValRef * ValRef list * Expr * Expr * Expr * TType * range) option

src/fsharp/Optimizer.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,10 +1689,6 @@ let (|AnyQueryBuilderOpTrans|_|) g = function
16891689
Some (src, (fun newSource -> Expr.App (v, vty, tyargs, [builder; replaceArgs(newSource :: rest)], m)))
16901690
| _ -> None
16911691

1692-
let mkUnitDelayLambda (g: TcGlobals) m e =
1693-
let uv, _ = mkCompGenLocal m "unitVar" g.unit_ty
1694-
mkLambda m uv (e, tyOfExpr g e)
1695-
16961692
/// If this returns "Some" then the source is not IQueryable.
16971693
// <qexprInner> :=
16981694
// | query.Select(<qexprInner>, <other-arguments>) --> Seq.map(qexprInner', ...)

src/fsharp/autobox.fsi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
module internal FSharp.Compiler.AutoBox
4+
5+
open FSharp.Compiler.Tast
6+
open FSharp.Compiler.TcGlobals
7+
open FSharp.Compiler.Import
8+
9+
/// Rewrite mutable locals to reference cells across an entire implementation file
10+
val TransformImplFile: g: TcGlobals -> amap: ImportMap -> implFile: TypedImplFile -> TypedImplFile
11+
12+

src/fsharp/import.fs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ type AssemblyLoader =
3737
abstract RecordGeneratedTypeRoot : ProviderGeneratedType -> unit
3838
#endif
3939

40-
41-
4240
//-------------------------------------------------------------------------
4341
// Import an IL types as F# types.
4442
//-------------------------------------------------------------------------

vsintegration/Utils/LanguageServiceProfiling/Options.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ let FCS (repositoryDir: string) : Options =
142142
@"src\fsharp\ConstraintSolver.fs"
143143
@"src\fsharp\CheckFormatStrings.fsi"
144144
@"src\fsharp\CheckFormatStrings.fs"
145+
@"src\fsharp\FindUnsolved.fsi"
145146
@"src\fsharp\FindUnsolved.fs"
146147
@"src\fsharp\QuotationTranslator.fsi"
147148
@"src\fsharp\QuotationTranslator.fs"
@@ -155,7 +156,9 @@ let FCS (repositoryDir: string) : Options =
155156
@"src\fsharp\DetupleArgs.fs"
156157
@"src\fsharp\InnerLambdasToTopLevelFuncs.fsi"
157158
@"src\fsharp\InnerLambdasToTopLevelFuncs.fs"
159+
@"src\fsharp\LowerCallsAndSeqs.fsi"
158160
@"src\fsharp\LowerCallsAndSeqs.fs"
161+
@"src\fsharp\autobox.fsi"
159162
@"src\fsharp\autobox.fs"
160163
@"src\fsharp\IlxGen.fsi"
161164
@"src\fsharp\IlxGen.fs"

0 commit comments

Comments
 (0)