Skip to content

Commit 740e534

Browse files
authored
Merge branch 'main' into merges/release/dev17.9-to-main
2 parents 1cc1f71 + 93b8f0c commit 740e534

File tree

366 files changed

+32842
-7754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

366 files changed

+32842
-7754
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
22
{
33
"name": "F#",
4-
"image": "mcr.microsoft.com/dotnet/sdk:8.0.100-rc.1",
4+
"image": "mcr.microsoft.com/dotnet/sdk:8.0",
55
"features": {
66
"ghcr.io/devcontainers/features/common-utils:2": {},
77
"ghcr.io/devcontainers/features/git:1": {},

.fantomasignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ src/Compiler/Checking/AccessibilityLogic.fs
2020
src/Compiler/Checking/AttributeChecking.fs
2121
src/Compiler/Checking/AugmentWithHashCompare.fs
2222
src/Compiler/Checking/CheckBasics.fs
23-
src/Compiler/Checking/CheckComputationExpressions.fs
2423
src/Compiler/Checking/CheckDeclarations.fs
2524
src/Compiler/Checking/CheckExpressions.fs
2625
src/Compiler/Checking/CheckFormatStrings.fs

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Format src/Compiler/Checking/CheckComputationExpressions.fs, https://github.com/dotnet/fsharp/pull/16512
2+
603a310cdfd9902ec1d29b399377dcc9ac56235b

DEVGUIDE.md

Lines changed: 18 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,25 @@ Where `<version>` corresponds to the latest Visual Studio version on your machin
275275

276276
Use the `Debug` configuration to test your changes locally. It is the default. Do not use the `Release` configuration! Local development and testing of Visual Studio tooling is not designed for the `Release` configuration.
277277

278-
### Writing and running benchmarks
278+
### Benchmarking
279279

280-
Existing compiler benchmarks can be found in `tests\benchmarks\`.
280+
Existing compiler benchmarks can be found in `tests\benchmarks\`. The folder contains READMEs describing specific benchmark projects as well as guidelines for creating new benchmarks. There is also `FSharp.Benchmarks.sln` solution containing all the benchmark project and their dependencies.
281+
282+
To exercise the benchmarking infrastructure locally, run:
283+
284+
(Windows)
285+
```cmd
286+
build.cmd -configuration Release -testBenchmarks
287+
```
288+
289+
(Linux/Mac)
290+
```shell
291+
./build.sh --configuration Release --testBenchmarks
292+
```
293+
294+
This is executed in CI as well. It does the following:
295+
- builds all the benchmarking projects
296+
- does smoke testing for fast benchmarks (executes them once to check they don't fail in the runtime)
281297

282298
### Benchmarking and profiling the compiler
283299

@@ -286,151 +302,6 @@ Existing compiler benchmarks can be found in `tests\benchmarks\`.
286302
* Always build both versions of compiler/FCS from source and not use pre-built binaries from SDK (SDK binaries are crossgen'd, which can affect performance).
287303
* To run `Release` build of compiler/FCS.
288304

289-
### Example benchmark setup using [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet)
290-
291-
1. Perform a clean build of the compiler and FCS from source (as described in this document, build can be done with `-noVisualStudio` in case if FCS/FSharp.Core is being benchmarked/profiled).
292-
293-
2. Create a benchmark project (in this example, the project will be created in `tests\benchmarks\FCSBenchmarks`).
294-
295-
```shell
296-
cd tests\benchmarks\FCSBenchmarks
297-
dotnet new console -o FcsBench --name FcsBench -lang F#
298-
```
299-
300-
3. Add needed packages and project references.
301-
302-
```shell
303-
cd FcsBench
304-
dotnet add package BenchmarkDotNet
305-
dotnet add reference ..\..\..\src\Compiler\FSharp.Compiler.Service.fsproj
306-
```
307-
308-
4. Additionally, if you want to test changes to the FSharp.Core (note that the relative path can be different)
309-
310-
```shell
311-
dotnet add reference ..\..\..\src\FSharp.Core\FSharp.Core.fsproj
312-
```
313-
314-
> as well as the following property have to be added to `FcsBench.fsproj`:
315-
316-
```xml
317-
<PropertyGroup>
318-
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
319-
</PropertyGroup>
320-
```
321-
322-
5. Add a new benchmark for FCS/FSharp.Core by editing `Program.fs`.
323-
324-
```fsharp
325-
open System.IO
326-
open FSharp.Compiler.CodeAnalysis
327-
open FSharp.Compiler.Diagnostics
328-
open FSharp.Compiler.Text
329-
open BenchmarkDotNet.Attributes
330-
open BenchmarkDotNet.Running
331-
332-
[<MemoryDiagnoser>]
333-
type CompilerService() =
334-
let mutable checkerOpt = None
335-
let mutable sourceOpt = None
336-
337-
let parsingOptions =
338-
{
339-
SourceFiles = [|"CheckExpressions.fs"|]
340-
ConditionalDefines = []
341-
DiagnosticOptions = FSharpDiagnosticOptions.Default
342-
LangVersionText = "default"
343-
IsInteractive = false
344-
LightSyntax = None
345-
CompilingFsLib = false
346-
IsExe = false
347-
}
348-
349-
[<GlobalSetup>]
350-
member _.Setup() =
351-
match checkerOpt with
352-
| None ->
353-
checkerOpt <- Some(FSharpChecker.Create(projectCacheSize = 200))
354-
| _ -> ()
355-
356-
match sourceOpt with
357-
| None ->
358-
sourceOpt <- Some <| SourceText.ofString(File.ReadAllText("""C:\Users\vlza\code\fsharp\src\Compiler\Checking\CheckExpressions.fs"""))
359-
| _ -> ()
360-
361-
362-
[<Benchmark>]
363-
member _.ParsingTypeCheckerFs() =
364-
match checkerOpt, sourceOpt with
365-
| None, _ -> failwith "no checker"
366-
| _, None -> failwith "no source"
367-
| Some(checker), Some(source) ->
368-
let results = checker.ParseFile("CheckExpressions.fs", source, parsingOptions) |> Async.RunSynchronously
369-
if results.ParseHadErrors then failwithf "parse had errors: %A" results.Diagnostics
370-
371-
[<IterationCleanup(Target = "ParsingTypeCheckerFs")>]
372-
member _.ParsingTypeCheckerFsSetup() =
373-
match checkerOpt with
374-
| None -> failwith "no checker"
375-
| Some(checker) ->
376-
checker.InvalidateAll()
377-
checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients()
378-
checker.ParseFile("dummy.fs", SourceText.ofString "dummy", parsingOptions) |> Async.RunSynchronously |> ignore
379-
380-
[<EntryPoint>]
381-
let main _ =
382-
BenchmarkRunner.Run<CompilerService>() |> ignore
383-
0
384-
```
385-
386-
> For more detailed information about available BenchmarkDotNet options, please refer to [BenchmarkDotNet Documentation](https://benchmarkdotnet.org/articles/overview.html).
387-
388-
6. Build and run the benchmark.
389-
390-
```shell
391-
dotnet build -c Release
392-
dotnet run -c Release
393-
```
394-
395-
7. You can find results in `.\BenchmarkDotNet.Artifacts\results\` in the current benchmark project directory.
396-
397-
```shell
398-
> ls .\BenchmarkDotNet.Artifacts\results\
399-
400-
Directory: C:\Users\vlza\code\fsharp\tests\benchmarks\FCSBenchmarks\FcsBench\BenchmarkDotNet.Artifacts\results
401-
402-
Mode LastWriteTime Length Name
403-
---- ------------- ------ ----
404-
-a--- 4/25/2022 1:42 PM 638 Program.CompilerService-report-github.md
405-
-a--- 4/25/2022 1:42 PM 1050 Program.CompilerService-report.csv
406-
-a--- 4/25/2022 1:42 PM 1169 Program.CompilerService-report.html
407-
```
408-
409-
> *-report-github.md can be used to post benchmark results to GitHub issue/PR/discussion or RFC.
410-
>
411-
>*-report.csv can be used for comparison purposes.
412-
413-
**Example output:**
414-
415-
``` ini
416-
417-
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.25102
418-
Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
419-
.NET SDK=6.0.200
420-
[Host] : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT DEBUG
421-
Job-GDIBXX : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
422-
423-
InvocationCount=1 UnrollFactor=1
424-
425-
```
426-
427-
| Method | Mean | Error | StdDev | Median | Gen 0 | Gen 1 | Allocated |
428-
|--------------------- |---------:|--------:|--------:|---------:|----------:|----------:|----------:|
429-
| ParsingTypeCheckerFs | 199.4 ms | 3.84 ms | 9.78 ms | 195.5 ms | 4000.0000 | 1000.0000 | 28 MB |
430-
431-
8. Repeat for any number of changes you would like to test.
432-
9. **Optionally:** benchmark code and results can be included as part of the PR for future reference.
433-
434305
## Additional resources
435306

436307
The primary technical guide to the core compiler code is [The F# Compiler Technical Guide](https://github.com/dotnet/fsharp/blob/main/docs/index.md). Please read and contribute to that guide.

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
<Import Project="$(RepoRoot)/Directory.Build.props.user" Condition = "Exists('$(RepoRoot)/Directory.Build.props.user')" />
2525

2626
<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
27+
<BUILDING_WITH_LKG>true</BUILDING_WITH_LKG>
28+
<BUILD_FROM_SOURCE>true</BUILD_FROM_SOURCE>
2729
<DisableAutoSetFscCompilerPath>false</DisableAutoSetFscCompilerPath>
2830
<FSHARPCORE_USE_PACKAGE Condition="'$(FSHARPCORE_USE_PACKAGE)' == ''">true</FSHARPCORE_USE_PACKAGE>
2931
<DISABLE_ARCADE Condition="'$(DISABLE_ARCADE)' == ''">true</DISABLE_ARCADE>

Directory.Build.targets

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,4 @@
1313
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVersion)" />
1414
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
1515
</ItemGroup>
16-
<ItemGroup>
17-
<PackageReference Condition="'$(BUILDING_USING_DOTNET)' == 'true'" Include="Microsoft.DotNet.XliffTasks" Version="$(MicrosoftDotNetXliffTasksVersion)" PrivateAssets="all" />
18-
</ItemGroup>
1916
</Project>

FSharp.Benchmarks.sln

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
23
# Visual Studio Version 17
34
VisualStudioVersion = 17.1.32113.165
45
MinimumVisualStudioVersion = 10.0.40219.1
@@ -24,10 +25,10 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Benchmarks"
2425
EndProject
2526
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FCSSourceFiles", "tests\benchmarks\FCSBenchmarks\FCSSourceFiles\FCSSourceFiles.fsproj", "{0E2A7B27-3AD3-4C1D-BA0D-008A1200946F}"
2627
EndProject
27-
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsharp.ProfilingStartpointProject", "tests\benchmarks\Fsharp.ProfilingStartpointProject\Fsharp.ProfilingStartpointProject.fsproj", "{9F27346B-2FC6-4FD5-A932-4E80F331E6D6}"
28-
EndProject
2928
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Test.Utilities", "tests\FSharp.Test.Utilities\FSharp.Test.Utilities.fsproj", "{0B149238-0912-493E-8877-F831AE01B942}"
3029
EndProject
30+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Benchmarks.Common", "tests\benchmarks\FSharp.Benchmarks.Common\FSharp.Benchmarks.Common.fsproj", "{62DED1EA-6A33-4537-8ED2-118462D0FEE5}"
31+
EndProject
3132
Global
3233
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3334
Debug|Any CPU = Debug|Any CPU
@@ -105,18 +106,20 @@ Global
105106
{0E2A7B27-3AD3-4C1D-BA0D-008A1200946F}.Release|Any CPU.Build.0 = Release|Any CPU
106107
{0E2A7B27-3AD3-4C1D-BA0D-008A1200946F}.ReleaseCompressed|Any CPU.ActiveCfg = Debug|Any CPU
107108
{0E2A7B27-3AD3-4C1D-BA0D-008A1200946F}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
108-
{9F27346B-2FC6-4FD5-A932-4E80F331E6D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
109-
{9F27346B-2FC6-4FD5-A932-4E80F331E6D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
110-
{9F27346B-2FC6-4FD5-A932-4E80F331E6D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
111-
{9F27346B-2FC6-4FD5-A932-4E80F331E6D6}.Release|Any CPU.Build.0 = Release|Any CPU
112-
{9F27346B-2FC6-4FD5-A932-4E80F331E6D6}.ReleaseCompressed|Any CPU.ActiveCfg = Debug|Any CPU
113-
{9F27346B-2FC6-4FD5-A932-4E80F331E6D6}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
114109
{0B149238-0912-493E-8877-F831AE01B942}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
115110
{0B149238-0912-493E-8877-F831AE01B942}.Debug|Any CPU.Build.0 = Debug|Any CPU
116111
{0B149238-0912-493E-8877-F831AE01B942}.Release|Any CPU.ActiveCfg = Release|Any CPU
117112
{0B149238-0912-493E-8877-F831AE01B942}.Release|Any CPU.Build.0 = Release|Any CPU
118113
{0B149238-0912-493E-8877-F831AE01B942}.ReleaseCompressed|Any CPU.ActiveCfg = Debug|Any CPU
119114
{0B149238-0912-493E-8877-F831AE01B942}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
115+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
116+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
117+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
118+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.Proto|Any CPU.Build.0 = Debug|Any CPU
119+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
120+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.Release|Any CPU.Build.0 = Release|Any CPU
121+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.ReleaseCompressed|Any CPU.ActiveCfg = Release|Any CPU
122+
{62DED1EA-6A33-4537-8ED2-118462D0FEE5}.ReleaseCompressed|Any CPU.Build.0 = Release|Any CPU
120123
EndGlobalSection
121124
GlobalSection(SolutionProperties) = preSolution
122125
HideSolutionNode = FALSE

FSharp.Compiler.Service.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Interactive
6161
EndProject
6262
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.UnitTests", "tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj", "{0C0BDAF4-7D47-4BDA-9992-077F63D6B494}"
6363
EndProject
64+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Benchmarks.Common", "tests\benchmarks\FSharp.Benchmarks.Common\FSharp.Benchmarks.Common.fsproj", "{A7ACFD1F-D1B8-483A-A210-200BB6B4BD7E}"
65+
EndProject
6466
Global
6567
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6668
Debug|Any CPU = Debug|Any CPU
@@ -143,6 +145,10 @@ Global
143145
{0C0BDAF4-7D47-4BDA-9992-077F63D6B494}.Debug|Any CPU.Build.0 = Debug|Any CPU
144146
{0C0BDAF4-7D47-4BDA-9992-077F63D6B494}.Release|Any CPU.ActiveCfg = Release|Any CPU
145147
{0C0BDAF4-7D47-4BDA-9992-077F63D6B494}.Release|Any CPU.Build.0 = Release|Any CPU
148+
{A7ACFD1F-D1B8-483A-A210-200BB6B4BD7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
149+
{A7ACFD1F-D1B8-483A-A210-200BB6B4BD7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
150+
{A7ACFD1F-D1B8-483A-A210-200BB6B4BD7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
151+
{A7ACFD1F-D1B8-483A-A210-200BB6B4BD7E}.Release|Any CPU.Build.0 = Release|Any CPU
146152
EndGlobalSection
147153
GlobalSection(SolutionProperties) = preSolution
148154
HideSolutionNode = FALSE
@@ -154,6 +160,7 @@ Global
154160
{35F5F1C5-AE4F-4B5A-8D94-1AF708724FD5} = {AF321816-B4A0-41DD-9A1D-484E8A20C6F6}
155161
{C1950E28-1CB7-4DEC-BB3A-8A0443A17282} = {AF321816-B4A0-41DD-9A1D-484E8A20C6F6}
156162
{07CD957A-3C31-4F75-A735-16CE72E1BD71} = {AF321816-B4A0-41DD-9A1D-484E8A20C6F6}
163+
{A7ACFD1F-D1B8-483A-A210-200BB6B4BD7E} = {AF321816-B4A0-41DD-9A1D-484E8A20C6F6}
157164
EndGlobalSection
158165
GlobalSection(ExtensibilityGlobals) = postSolution
159166
SolutionGuid = {F9A60F3B-D894-4C8E-BA0F-C51115B25A5A}

FSharp.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
106106
src\Compiler\FSCompCheck.fsx = src\Compiler\FSCompCheck.fsx
107107
EndProjectSection
108108
EndProject
109+
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Benchmarks.Common", "tests\benchmarks\FSharp.Benchmarks.Common\FSharp.Benchmarks.Common.fsproj", "{7D482560-DF6F-46A5-B50C-20ECF7C38759}"
110+
EndProject
109111
Global
110112
GlobalSection(SolutionConfigurationPlatforms) = preSolution
111113
Debug|Any CPU = Debug|Any CPU
@@ -416,6 +418,18 @@ Global
416418
{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}.Release|Any CPU.Build.0 = Release|Any CPU
417419
{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}.Release|x86.ActiveCfg = Release|Any CPU
418420
{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}.Release|x86.Build.0 = Release|Any CPU
421+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
422+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Debug|Any CPU.Build.0 = Debug|Any CPU
423+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Debug|x86.ActiveCfg = Debug|Any CPU
424+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Debug|x86.Build.0 = Debug|Any CPU
425+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
426+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Proto|Any CPU.Build.0 = Debug|Any CPU
427+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Proto|x86.ActiveCfg = Debug|Any CPU
428+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Proto|x86.Build.0 = Debug|Any CPU
429+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Release|Any CPU.ActiveCfg = Release|Any CPU
430+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Release|Any CPU.Build.0 = Release|Any CPU
431+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Release|x86.ActiveCfg = Release|Any CPU
432+
{7D482560-DF6F-46A5-B50C-20ECF7C38759}.Release|x86.Build.0 = Release|Any CPU
419433
EndGlobalSection
420434
GlobalSection(SolutionProperties) = preSolution
421435
HideSolutionNode = FALSE
@@ -447,6 +461,7 @@ Global
447461
{209C7D37-8C01-413C-8698-EC25F4C86976} = {B8DDA694-7939-42E3-95E5-265C2217C142}
448462
{BEC6E796-7E53-4888-AAFC-B8FD55C425DF} = {CE70D631-C5DC-417E-9CDA-B16097BEF1AC}
449463
{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1} = {CE70D631-C5DC-417E-9CDA-B16097BEF1AC}
464+
{7D482560-DF6F-46A5-B50C-20ECF7C38759} = {CE70D631-C5DC-417E-9CDA-B16097BEF1AC}
450465
EndGlobalSection
451466
GlobalSection(ExtensibilityGlobals) = postSolution
452467
SolutionGuid = {BD5177C7-1380-40E7-94D2-7768E1A8B1B8}

0 commit comments

Comments
 (0)