diff --git a/FSharp.Benchmarks.sln b/FSharp.Benchmarks.sln index e04c208232f..f690db4eaf8 100644 --- a/FSharp.Benchmarks.sln +++ b/FSharp.Benchmarks.sln @@ -13,10 +13,6 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.DependencyManager.Nu EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "MicroPerf", "tests\benchmarks\CompiledCodeBenchmarks\MicroPerf\MicroPerf.fsproj", "{ED766F38-BD2B-436B-AF73-7BE6FAE061DD}" EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "TaskPerf", "tests\benchmarks\CompiledCodeBenchmarks\TaskPerf\TaskPerf\TaskPerf.fsproj", "{4779C245-9B85-4491-85EB-B0AF6D818E81}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaskPerfCSharp", "tests\benchmarks\CompiledCodeBenchmarks\TaskPerf\TaskPerfCSharp\TaskPerfCSharp.csproj", "{38CAA9B6-E4B8-42CB-B4E3-C2DC7D481913}" -EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{66E23120-5E94-49AE-A263-24583007F5F5}" EndProject Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HistoricalBenchmark.Runner", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.Runner\HistoricalBenchmark.Runner.fsproj", "{2A1289B1-1539-48CB-BE03-807FE4BC0387}" @@ -71,18 +67,6 @@ Global {ED766F38-BD2B-436B-AF73-7BE6FAE061DD}.Release|Any CPU.Build.0 = Release|Any CPU {ED766F38-BD2B-436B-AF73-7BE6FAE061DD}.ReleaseCompressed|Any CPU.ActiveCfg = Debug|Any CPU {ED766F38-BD2B-436B-AF73-7BE6FAE061DD}.Proto|Any CPU.ActiveCfg = Debug|Any CPU - {4779C245-9B85-4491-85EB-B0AF6D818E81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4779C245-9B85-4491-85EB-B0AF6D818E81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4779C245-9B85-4491-85EB-B0AF6D818E81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4779C245-9B85-4491-85EB-B0AF6D818E81}.Release|Any CPU.Build.0 = Release|Any CPU - {4779C245-9B85-4491-85EB-B0AF6D818E81}.ReleaseCompressed|Any CPU.ActiveCfg = Debug|Any CPU - {4779C245-9B85-4491-85EB-B0AF6D818E81}.Proto|Any CPU.ActiveCfg = Debug|Any CPU - {38CAA9B6-E4B8-42CB-B4E3-C2DC7D481913}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {38CAA9B6-E4B8-42CB-B4E3-C2DC7D481913}.Debug|Any CPU.Build.0 = Debug|Any CPU - {38CAA9B6-E4B8-42CB-B4E3-C2DC7D481913}.Release|Any CPU.ActiveCfg = Release|Any CPU - {38CAA9B6-E4B8-42CB-B4E3-C2DC7D481913}.Release|Any CPU.Build.0 = Release|Any CPU - {38CAA9B6-E4B8-42CB-B4E3-C2DC7D481913}.ReleaseCompressed|Any CPU.ActiveCfg = Debug|Any CPU - {38CAA9B6-E4B8-42CB-B4E3-C2DC7D481913}.Proto|Any CPU.ActiveCfg = Debug|Any CPU {66E23120-5E94-49AE-A263-24583007F5F5}.Debug|Any CPU.ActiveCfg = Release|Any CPU {66E23120-5E94-49AE-A263-24583007F5F5}.Release|Any CPU.ActiveCfg = Release|Any CPU {66E23120-5E94-49AE-A263-24583007F5F5}.Release|Any CPU.Build.0 = Release|Any CPU diff --git a/FSharp.sln b/FSharp.sln index 5ce2e4eeb35..8846c08339a 100644 --- a/FSharp.sln +++ b/FSharp.sln @@ -42,10 +42,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Benchmarks", "Benchmarks", tests\benchmarks\README.md = tests\benchmarks\README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaskPerfCSharp", "tests\benchmarks\CompiledCodeBenchmarks\TaskPerf\TaskPerfCSharp\TaskPerfCSharp.csproj", "{CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TaskPerf", "tests\benchmarks\CompiledCodeBenchmarks\TaskPerf\TaskPerf\TaskPerf.fsproj", "{51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FSharp.Compiler.Service.Tests support", "FSharp.Compiler.Service.Tests support", "{452EED3C-AA87-471F-B9AC-0F4479C5820C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSharp_Analysis", "tests\service\data\CSharp_Analysis\CSharp_Analysis.csproj", "{F8743670-C8D4-41B3-86BE-BBB1226C352F}" @@ -64,6 +60,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{4E4F41D9-8 docs\large-inputs-and-stack-overflows.md = docs\large-inputs-and-stack-overflows.md docs\memory-usage.md = docs\memory-usage.md docs\optimizations.md = docs\optimizations.md + docs\optimizations-equality.md = docs\optimizations-equality.md docs\overview.md = docs\overview.md EndProjectSection EndProject @@ -274,30 +271,6 @@ Global {9B4CF83C-C215-4EA0-9F8B-B5A77090F634}.Release|Any CPU.Build.0 = Release|Any CPU {9B4CF83C-C215-4EA0-9F8B-B5A77090F634}.Release|x86.ActiveCfg = Release|Any CPU {9B4CF83C-C215-4EA0-9F8B-B5A77090F634}.Release|x86.Build.0 = Release|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Debug|x86.ActiveCfg = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Debug|x86.Build.0 = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Proto|Any CPU.ActiveCfg = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Proto|Any CPU.Build.0 = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Proto|x86.ActiveCfg = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Proto|x86.Build.0 = Debug|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Release|Any CPU.Build.0 = Release|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Release|x86.ActiveCfg = Release|Any CPU - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB}.Release|x86.Build.0 = Release|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Debug|x86.ActiveCfg = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Debug|x86.Build.0 = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Proto|Any CPU.ActiveCfg = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Proto|Any CPU.Build.0 = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Proto|x86.ActiveCfg = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Proto|x86.Build.0 = Debug|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Release|Any CPU.Build.0 = Release|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Release|x86.ActiveCfg = Release|Any CPU - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4}.Release|x86.Build.0 = Release|Any CPU {F8743670-C8D4-41B3-86BE-BBB1226C352F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F8743670-C8D4-41B3-86BE-BBB1226C352F}.Debug|Any CPU.Build.0 = Debug|Any CPU {F8743670-C8D4-41B3-86BE-BBB1226C352F}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -448,8 +421,6 @@ Global {FAC5A3BF-C0D6-437A-868A-E962AA00B418} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {DDFD06DC-D7F2-417F-9177-107764EEBCD8} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {9B4CF83C-C215-4EA0-9F8B-B5A77090F634} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77} - {CF9F3F98-7BFB-4945-A4A5-668DF0AC65AB} = {CE70D631-C5DC-417E-9CDA-B16097BEF1AC} - {51B569A8-17C5-4EBD-8AAC-240E0B3AD8C4} = {CE70D631-C5DC-417E-9CDA-B16097BEF1AC} {452EED3C-AA87-471F-B9AC-0F4479C5820C} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {F8743670-C8D4-41B3-86BE-BBB1226C352F} = {452EED3C-AA87-471F-B9AC-0F4479C5820C} {7BFA159A-BF9D-4489-BF46-1B83ACCEEE0F} = {452EED3C-AA87-471F-B9AC-0F4479C5820C} diff --git a/VisualFSharp.sln b/VisualFSharp.sln index 42158c3431d..271379acd31 100644 --- a/VisualFSharp.sln +++ b/VisualFSharp.sln @@ -143,10 +143,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryProject", "vsintegra EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TutorialProject", "vsintegration\ProjectTemplates\TutorialProject\TutorialProject.csproj", "{2937CBEC-262D-4C94-BE1D-291FAB72E3E8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TaskPerfCSharp", "tests\benchmarks\CompiledCodeBenchmarks\TaskPerf\TaskPerfCSharp\TaskPerfCSharp.csproj", "{D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}" -EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "TaskPerf", "tests\benchmarks\CompiledCodeBenchmarks\TaskPerf\TaskPerf\TaskPerf.fsproj", "{03596D51-754D-4644-8E23-84EC9532ABDC}" -EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.ComponentTests", "tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.fsproj", "{0610FB97-7C15-422A-86FD-32335C6DF14D}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Service", "src\Compiler\FSharp.Compiler.Service.fsproj", "{B5A9BBD9-2F45-4722-A6CA-BAE3C64CD4E2}" @@ -823,30 +819,6 @@ Global {2937CBEC-262D-4C94-BE1D-291FAB72E3E8}.Release|Any CPU.Build.0 = Release|Any CPU {2937CBEC-262D-4C94-BE1D-291FAB72E3E8}.Release|x86.ActiveCfg = Release|Any CPU {2937CBEC-262D-4C94-BE1D-291FAB72E3E8}.Release|x86.Build.0 = Release|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Debug|x86.ActiveCfg = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Debug|x86.Build.0 = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Proto|Any CPU.ActiveCfg = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Proto|Any CPU.Build.0 = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Proto|x86.ActiveCfg = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Proto|x86.Build.0 = Debug|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Release|Any CPU.Build.0 = Release|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Release|x86.ActiveCfg = Release|Any CPU - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0}.Release|x86.Build.0 = Release|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Debug|x86.ActiveCfg = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Debug|x86.Build.0 = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Proto|Any CPU.ActiveCfg = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Proto|Any CPU.Build.0 = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Proto|x86.ActiveCfg = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Proto|x86.Build.0 = Debug|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Release|Any CPU.Build.0 = Release|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Release|x86.ActiveCfg = Release|Any CPU - {03596D51-754D-4644-8E23-84EC9532ABDC}.Release|x86.Build.0 = Release|Any CPU {0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|Any CPU.Build.0 = Debug|Any CPU {0610FB97-7C15-422A-86FD-32335C6DF14D}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -1137,8 +1109,6 @@ Global {44155269-9B30-43DA-B97F-4F36F887B211} = {12EF27FD-A34B-4373-860A-F9FCE9651859} {B53D9D05-8EF7-43A6-9A5B-0B113CBC54F8} = {12EF27FD-A34B-4373-860A-F9FCE9651859} {2937CBEC-262D-4C94-BE1D-291FAB72E3E8} = {12EF27FD-A34B-4373-860A-F9FCE9651859} - {D5ECF8DF-E150-4AE3-B613-AB2B0FFA93E0} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} - {03596D51-754D-4644-8E23-84EC9532ABDC} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {0610FB97-7C15-422A-86FD-32335C6DF14D} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} {B5A9BBD9-2F45-4722-A6CA-BAE3C64CD4E2} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77} {14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449} diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml new file mode 100644 index 00000000000..a3f9bb53187 --- /dev/null +++ b/azure-pipelines-PR.yml @@ -0,0 +1,893 @@ +# CI and PR triggers +trigger: + branches: + include: + - main + - dev16.1 + - feature/* + - release/* + paths: + include: + - '*' + exclude: + - .github/* + - docs/ + - .vscode/* + - .devcontainer/* + - tests/scripts/ + - attributions.md + - CODE_OF_CONDUCT.md + - DEVGUIDE.md + - INTERNAL.md + - Language-Version-History.md + - License.txt + - README.md + - release-notes.md + - TESTGUIDE.md + +pr: + branches: + include: + - main + - dev16.1 + - feature/* + - release/* + paths: + include: + - '*' + exclude: + - .github/* + - docs/ + - attributions.md + - CODE_OF_CONDUCT.md + - DEVGUIDE.md + - INTERNAL.md + - Language-Version-History.md + - License.txt + - README.md + - release-notes.md + - TESTGUIDE.md + +variables: + - name: _TeamName + value: FSharp + - name: _BuildConfig + value: Release + - name: _PublishUsingPipelines + value: true + - name: _DotNetArtifactsCategory + value: .NETCore + - name: VisualStudioDropName + value: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber) + - name: Codeql.Enabled + value: true + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - name: _DotNetValidationArtifactsCategory + value: .NETCoreValidation + - group: DotNet-FSharp-SDLValidation-Params + - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}: + - name: RunningAsPullRequest + value: true + # Pick up pool provider name behavior from shared yaml template + - template: /eng/common/templates/variables/pool-providers.yml + +# Variables defined in yml cannot be overridden at queue time; instead overridable variables must be defined in the web UI. +# Commenting out until something like this is supported: https://github.com/Microsoft/azure-pipelines-yaml/pull/129 +#variables: +#- name: SkipTests +# defaultValue: false + +stages: +- stage: build + displayName: Build + jobs: + + #-------------------------------------------------------------------------------------------------------------------# + # Signed build # + #-------------------------------------------------------------------------------------------------------------------# + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.9') }}: + - template: /eng/common/templates/job/onelocbuild.yml + parameters: + MirrorRepo: fsharp + MirrorBranch: release/dev17.9 + LclSource: lclFilesfromPackage + LclPackageId: 'LCL-JUNO-PROD-FSHARP' + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enableMicrobuild: true + enablePublishBuildArtifacts: true + enablePublishTestResults: false + enablePublishBuildAssets: true + enablePublishUsingPipelines: $(_PublishUsingPipelines) + enableSourceBuild: true + enableTelemetry: true + helixRepo: dotnet/fsharp + jobs: + - job: Full_Signed + pool: + name: $(DncEngInternalBuildPool) + demands: ImageOverride -equals windows.vs2022preview.amd64 + timeoutInMinutes: 300 + variables: + - group: DotNet-Symbol-Server-Pats + - group: DotNet-DevDiv-Insertion-Workflow-Variables + - name: _SignType + value: Real + steps: + - checkout: self + clean: true + - template: /eng/restore-internal-tools.yml + - script: eng\CIBuild.cmd + -configuration $(_BuildConfig) + -prepareMachine + -testAllButIntegration + -officialSkipTests $(SkipTests) + /p:SignType=$(_SignType) + /p:DotNetSignType=$(_SignType) + /p:MicroBuild_SigningEnabled=true + /p:OverridePackageSource=https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json + /p:TeamName=$(_TeamName) + /p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines) + /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:OfficialBuildId=$(BUILD.BUILDNUMBER) + /p:PublishToSymbolServer=true + /p:VisualStudioDropName=$(VisualStudioDropName) + /p:GenerateSbom=true + env: + NativeToolsOnMachine: true + - script: .\tests\EndToEndBuildTests\EndToEndBuildTests.cmd -c $(_BuildConfig) + displayName: End to end build tests + continueOnError: true + condition: always() + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + continueOnError: true + condition: ne(variables['SkipTests'], 'true') + - task: PublishBuildArtifacts@1 + displayName: Publish Test Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_BuildConfig)' + ArtifactName: 'Test Logs' + publishLocation: Container + continueOnError: true + condition: ne(variables['SkipTests'], 'true') + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact Packages + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\packages\$(_BuildConfig)' + ArtifactName: 'Packages' + condition: succeeded() + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact VSSetup + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(_BuildConfig)\Insertion' + ArtifactName: 'VSSetup' + condition: succeeded() + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact Nightly + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(_BuildConfig)\VisualFSharpDebug.vsix' + ArtifactName: 'Nightly' + condition: succeeded() + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact Symbols + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\SymStore\$(_BuildConfig)' + ArtifactName: 'NativeSymbols' + condition: succeeded() + - task: ms-vseng.MicroBuildTasks.4305a8de-ba66-4d8b-b2d1-0dc4ecbbf5e8.MicroBuildUploadVstsDropFolder@1 + displayName: Upload VSTS Drop + inputs: + DropName: $(VisualStudioDropName) + DropFolder: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(_BuildConfig)\Insertion' + AccessToken: $(dn-bot-devdiv-drop-rw-code-rw) + condition: succeeded() + + #-------------------------------------------------------------------------------------------------------------------# + # PR builds without logs publishing # + #-------------------------------------------------------------------------------------------------------------------# + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enableMicrobuild: false + enablePublishBuildArtifacts: false + enablePublishTestResults: false + enablePublishBuildAssets: false + enablePublishUsingPipelines: $(_PublishUsingPipelines) + enableSourceBuild: false + enableTelemetry: true + helixRepo: dotnet/fsharp + jobs: + # Determinism, we want to run it only in PR builds + - job: Determinism_Debug + condition: eq(variables['Build.Reason'], 'PullRequest') + variables: + - name: _SignType + value: Test + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + timeoutInMinutes: 90 + strategy: + maxParallel: 2 + matrix: + regular: + _experimental_flag: '' + experimental_features: + _experimental_flag: '' + steps: + - checkout: self + clean: true + - task: UseDotNet@2 + displayName: install SDK + inputs: + packageType: sdk + useGlobalJson: true + includePreviewVersions: false + workingDirectory: $(Build.SourcesDirectory) + installationPath: $(Build.SourcesDirectory)/.dotnet + - script: .\eng\test-determinism.cmd -configuration Debug + env: + FSHARP_EXPERIMENTAL_FEATURES: $(_experimental_flag) + displayName: Determinism tests with Debug configuration + - task: PublishPipelineArtifact@1 + displayName: Publish Determinism Logs + inputs: + targetPath: '$(Build.SourcesDirectory)/artifacts/log/Debug' + artifactName: 'Determinism_Debug Attempt $(System.JobAttempt) Logs' + continueOnError: true + condition: not(succeeded()) + + # Check FSComp.txt error code sorting and code formatting + - job: CheckCodeFormatting + pool: + vmImage: $(UbuntuMachineQueueName) + steps: + - checkout: self + clean: true + - script: dotnet --list-sdks + displayName: Report dotnet SDK versions + - task: UseDotNet@2 + displayName: install SDK + inputs: + packageType: sdk + useGlobalJson: true + includePreviewVersions: true + workingDirectory: $(Build.SourcesDirectory) + installationPath: $(Agent.ToolsDirectory)/dotnet + - script: dotnet tool restore + env: + DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1 + displayName: Install tools + - script: dotnet fsi src/Compiler/FSCompCheck.fsx + env: + DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1 + displayName: Check error code sorting in src/Compiler/FSComp.txt + - script: dotnet fantomas . --check + env: + DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1 + displayName: Check code formatting (run 'dotnet fantomas .' to fix) + + # Check whether package with current version has been published to nuget.org + # We will try to restore both FSharp.Core and FCS and if restore is _successful_, package version needs to be bumped. + # NOTE: The check now runs on all branches (not just release), + # because we want to catch cases when version is desynched and we didn't update it. + # It is also helping the release notes automation to be up to date with packages versions. + - job: Check_Published_Package_Versions + # condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), or(startsWith(variables['System.PullRequest.SourceBranch'], 'release/dev'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/dev'))) + pool: + vmImage: $(UbuntuMachineQueueName) + strategy: + maxParallel: 2 + matrix: + FCS: + _project: "FSharp.Compiler.Service_notshipped.fsproj" + FSCore: + _project: "FSharp.Core_notshipped.fsproj" + steps: + - checkout: self + clean: true + - task: UseDotNet@2 + displayName: install SDK + inputs: + packageType: sdk + useGlobalJson: true + includePreviewVersions: true + workingDirectory: $(Build.SourcesDirectory) + installationPath: $(Agent.ToolsDirectory)/dotnet + - pwsh: ./check.ps1 -project $(_project) + workingDirectory: $(Build.SourcesDirectory)/buildtools/checkpackages + env: + DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1 + displayName: Check published package version + + + #-------------------------------------------------------------------------------------------------------------------# + # PR builds # + #-------------------------------------------------------------------------------------------------------------------# + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - template: /eng/common/templates/jobs/jobs.yml + parameters: + enableMicrobuild: true + enablePublishBuildArtifacts: true + enablePublishTestResults: false + enablePublishBuildAssets: true + enablePublishUsingPipelines: $(_PublishUsingPipelines) + enableSourceBuild: true + enableTelemetry: true + helixRepo: dotnet/fsharp + jobs: + + - job: WindowsLangVersionPreview + pool: + # The PR build definition sets this variable: + # WindowsMachineQueueName=Windows.vs2022.amd64.open + # and there is an alternate build definition that sets this to a queue that is always scouting the + # next preview of Visual Studio. + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + timeoutInMinutes: 120 + steps: + - checkout: self + clean: true + + - script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:FSharpLangVersion=preview + env: + NativeToolsOnMachine: true + displayName: Build + + - task: PublishBuildArtifacts@1 + displayName: Publish Build BinLog + condition: always() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog' + ArtifactName: 'Windows Release build binlogs' + ArtifactType: Container + parallel: true + + - job: WindowsNoRealsig_testCoreclr + pool: + # The PR build definition sets this variable: + # WindowsMachineQueueName=Windows.vs2022.amd64.open + # and there is an alternate build definition that sets this to a queue that is always scouting the + # next preview of Visual Studio. + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + timeoutInMinutes: 120 + steps: + - checkout: self + clean: true + + - script: eng\CIBuild.cmd -compressallmetadata -norealsig -testCoreclr -configuration Release + env: + NativeToolsOnMachine: true + displayName: Build + + - task: PublishBuildArtifacts@1 + displayName: Publish Build BinLog + condition: always() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog' + ArtifactName: 'Windows Release build binlogs' + ArtifactType: Container + parallel: true + + - job: WindowsNoRealsig_testDesktop + pool: + # The PR build definition sets this variable: + # WindowsMachineQueueName=Windows.vs2022.amd64.open + # and there is an alternate build definition that sets this to a queue that is always scouting the + # next preview of Visual Studio. + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + timeoutInMinutes: 120 + steps: + - checkout: self + clean: true + + - script: eng\CIBuild.cmd -compressallmetadata -norealsig -testDesktop -configuration Release + env: + NativeToolsOnMachine: true + displayName: Build + + - task: PublishBuildArtifacts@1 + displayName: Publish Build BinLog + condition: always() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog' + ArtifactName: 'Windows Release build binlogs' + ArtifactType: Container + parallel: true + + - job: WindowsStrictIndentation + pool: + # The PR build definition sets this variable: + # WindowsMachineQueueName=Windows.vs2022.amd64.open + # and there is an alternate build definition that sets this to a queue that is always scouting the + # next preview of Visual Studio. + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + timeoutInMinutes: 120 + steps: + - checkout: self + clean: true + + - script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:AdditionalFscCmdFlags=--strict-indentation+ + env: + NativeToolsOnMachine: true + displayName: Build + + - task: PublishBuildArtifacts@1 + displayName: Publish Build BinLog + condition: always() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog' + ArtifactName: 'Windows Release build binlogs' + ArtifactType: Container + parallel: true + + - job: WindowsNoStrictIndentation + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + timeoutInMinutes: 120 + steps: + - checkout: self + clean: true + + - script: eng\CIBuild.cmd -compressallmetadata -configuration Release /p:AdditionalFscCmdFlags=--strict-indentation- + env: + NativeToolsOnMachine: true + displayName: Build + + - task: PublishBuildArtifacts@1 + displayName: Publish Build BinLog + condition: always() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/Release\Build.VisualFSharp.sln.binlog' + ArtifactName: 'Windows Release build binlogs' + ArtifactType: Container + parallel: true + + # Windows With Compressed Metadata + - job: WindowsCompressedMetadata + variables: + - name: XUNIT_LOGS + value: $(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration) + - name: __VSNeverShowWhatsNew + value: 1 + pool: + # The PR build definition sets this variable: + # WindowsMachineQueueName=Windows.vs2022.amd64.open + # and there is an alternate build definition that sets this to a queue that is always scouting the + # next preview of Visual Studio. + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + timeoutInMinutes: 120 + strategy: + maxParallel: 5 + matrix: + desktop_release: + _configuration: Release + _testKind: testDesktop + coreclr_release: + _configuration: Release + _testKind: testCoreclr + fsharpqa_release: + _configuration: Release + _testKind: testFSharpQA + vs_release: + _configuration: Release + _testKind: testVs + transparent_compiler_release: + _configuration: Release + _testKind: testCoreclr + + ${{ if eq(variables['Build.Reason'], 'Flaky, disabled, was PullRequest') }}: + inttests_release: + _configuration: Release + _testKind: testIntegration + steps: + - checkout: self + clean: true + + - powershell: eng\SetupVSHive.ps1 + displayName: Setup VS Hive + condition: or(eq(variables['_testKind'], 'testVs'), eq(variables['_testKind'], 'testIntegration')) + + # yes, this is miserable, but - https://github.com/dotnet/arcade/issues/13239 + - script: eng\CIBuild.cmd -compressallmetadata -configuration $(_configuration) -$(_testKind) + env: + NativeToolsOnMachine: true + displayName: Build / Test + condition: and( ne(variables['_testKind'], 'testIntegration'), ne(variables['System.JobName'], 'transparent_compiler_release') ) + + - script: eng\CIBuild.cmd -compressallmetadata -configuration $(_configuration) -$(_testKind) + env: + TEST_TRANSPARENT_COMPILER: 1 + NativeToolsOnMachine: true + displayName: Build / Test Transparent Compiler + condition: and( eq(variables['System.JobName'], 'transparent_compiler_release'), ne(variables['_testKind'], 'testIntegration') ) + + - script: eng\CIBuild.cmd -compressallmetadata -configuration $(_configuration) -$(_testKind) + env: + NativeToolsOnMachine: true + displayName: Build / Integration Test + continueOnError: true + condition: eq(variables['_testKind'], 'testIntegration') + + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_configuration)' + continueOnError: true + condition: ne(variables['_testKind'], 'testFSharpQA') + - task: PublishBuildArtifacts@1 + displayName: Publish Tests BinLog + condition: always() + continueOnError: true + inputs: + PathToPublish: '$(Build.SourcesDirectory)\artifacts\log/$(_configuration)\Build.VisualFSharp.sln.binlog' + ArtifactName: 'Windows $(_configuration) $(_testKind) test binlogs' + ArtifactType: Container + parallel: true + - task: PublishBuildArtifacts@1 + displayName: Publish Test Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)' + ArtifactName: 'Windows $(_configuration) $(_testKind) test logs' + publishLocation: Container + continueOnError: true + condition: always() + - script: dotnet build $(Build.SourcesDirectory)/eng/DumpPackageRoot/DumpPackageRoot.csproj + displayName: Dump NuGet cache contents + condition: failed() + - task: PublishBuildArtifacts@1 + displayName: Publish NuGet cache contents + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\NugetPackageRootContents' + ArtifactName: 'NuGetPackageContents Windows $(_testKind)' + publishLocation: Container + continueOnError: true + condition: failed() + + # Mock official build + - job: MockOfficial + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + steps: + - checkout: self + clean: true + - pwsh: .\eng\MockBuild.ps1 + displayName: Build with OfficialBuildId + + # Linux + - job: Linux + pool: + vmImage: $(UbuntuMachineQueueName) + variables: + - name: _SignType + value: Test + steps: + - checkout: self + clean: true + - script: ./eng/cibuild.sh --configuration $(_BuildConfig) --testcoreclr + displayName: Build / Test + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + continueOnError: true + condition: always() + - task: PublishBuildArtifacts@1 + displayName: Publish Test Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + ArtifactName: 'Linux $(_BuildConfig) test logs' + publishLocation: Container + continueOnError: true + condition: failed() + - script: dotnet build $(Build.SourcesDirectory)/eng/DumpPackageRoot/DumpPackageRoot.csproj + displayName: Dump NuGet cache contents + condition: failed() + - task: PublishBuildArtifacts@1 + displayName: Publish NuGet cache contents + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/NugetPackageRootContents' + ArtifactName: 'NuGetPackageContents Linux' + publishLocation: Container + continueOnError: true + condition: failed() + + # MacOS + - job: MacOS + pool: + vmImage: macos-11 + variables: + - name: _SignType + value: Test + steps: + - checkout: self + clean: true + - script: ./eng/cibuild.sh --configuration $(_BuildConfig) --testcoreclr + env: + COMPlus_DefaultStackSize: 1000000 + displayName: Build / Test + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + continueOnError: true + condition: always() + - task: PublishBuildArtifacts@1 + displayName: Publish Test Logs + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + ArtifactName: 'MacOS $(_BuildConfig) test logs' + publishLocation: Container + continueOnError: true + condition: failed() + - script: dotnet build $(Build.SourcesDirectory)/eng/DumpPackageRoot/DumpPackageRoot.csproj + displayName: Dump NuGet cache contents + condition: failed() + - task: PublishBuildArtifacts@1 + displayName: Publish NuGet cache contents + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/NugetPackageRootContents' + ArtifactName: 'NuGetPackageContents Mac' + publishLocation: Container + continueOnError: true + condition: failed() + + # End to end build + - job: EndToEndBuildTests + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + strategy: + maxParallel: 2 + matrix: + regular: + _experimental_flag: '' + experimental_features: + _experimental_flag: '' + steps: + - checkout: self + clean: true + - script: .\Build.cmd -c Release -pack + env: + NativeToolsOnMachine: true + FSHARP_EXPERIMENTAL_FEATURES: $(_experimental_flag) + - script: .\tests\EndToEndBuildTests\EndToEndBuildTests.cmd -c Release + env: + FSHARP_EXPERIMENTAL_FEATURES: $(_experimental_flag) + displayName: End to end build tests + + # Up-to-date - disabled due to it being flaky + #- job: UpToDate_Windows + # pool: + # vmImage: windows-latest + # steps: + # - checkout: self + # clean: true + # - task: PowerShell@2 + # displayName: Run up-to-date build check + # inputs: + # filePath: eng\tests\UpToDate.ps1 + # arguments: -configuration $(_BuildConfig) -ci -binaryLog + + # Run Build with Fsharp Experimental Features + # Possible change: --times:$(Build.SourcesDirectory)/artifacts/log/Release/compiler_timing.csv + + # Plain FCS build Windows + - job: Plain_Build_Windows + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + variables: + - name: _BuildConfig + value: Debug + steps: + - checkout: self + clean: true + - script: dotnet --list-sdks + displayName: Report dotnet SDK versions + - task: UseDotNet@2 + displayName: install SDK + inputs: + packageType: sdk + useGlobalJson: true + includePreviewVersions: true + workingDirectory: $(Build.SourcesDirectory) + installationPath: $(Agent.ToolsDirectory)/dotnet + - script: dotnet build .\FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\" + workingDirectory: $(Build.SourcesDirectory) + displayName: Regular rebuild of FSharp.Compiler.Service.sln + continueOnError: true + condition: always() + + # Plain FCS build Linux + - job: Plain_Build_Linux + pool: + vmImage: $(UbuntuMachineQueueName) + variables: + - name: _BuildConfig + value: Debug + steps: + - checkout: self + clean: true + - script: dotnet --list-sdks + displayName: Report dotnet SDK versions + - task: UseDotNet@2 + displayName: install SDK + inputs: + packageType: sdk + useGlobalJson: true + includePreviewVersions: true + workingDirectory: $(Build.SourcesDirectory) + installationPath: $(Agent.ToolsDirectory)/dotnet + - script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\" + workingDirectory: $(Build.SourcesDirectory) + displayName: Regular rebuild of FSharp.Compiler.Service.sln + continueOnError: true + condition: always() + + # Plain FCS build Mac + - job: Plain_Build_MacOS + pool: + vmImage: macos-11 + variables: + - name: _BuildConfig + value: Debug + steps: + - checkout: self + clean: true + - script: dotnet --list-sdks + displayName: Report dotnet SDK versions + - task: UseDotNet@2 + displayName: install SDK + inputs: + packageType: sdk + useGlobalJson: true + includePreviewVersions: true + workingDirectory: $(Build.SourcesDirectory) + installationPath: $(Agent.ToolsDirectory)/dotnet + - script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\" + workingDirectory: $(Build.SourcesDirectory) + displayName: Regular rebuild of FSharp.Compiler.Service.sln + continueOnError: true + condition: always() + + # Build and run fast benchmarks + - job: Benchmarks + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + variables: + - name: _BuildConfig + value: Release + steps: + - checkout: self + clean: true + - script: eng\CIBuild.cmd -configuration $(_BuildConfig) -testBenchmarks + displayName: Smoke test fast benchmarks + continueOnError: true + condition: always() + + # Test trimming on Windows + - job: Build_And_Test_AOT_Windows + pool: + name: $(DncEngPublicBuildPool) + demands: ImageOverride -equals $(WindowsMachineQueueName) + strategy: + maxParallel: 2 + matrix: + compressed_metadata: + _kind: "-compressAllMetadata" + classic_metadata: + _kind: "" + variables: + - name: _BuildConfig + value: Release + steps: + - checkout: self + clean: true + - task: UseDotNet@2 + displayName: install SDK + inputs: + packageType: sdk + useGlobalJson: true + includePreviewVersions: true + workingDirectory: $(Build.SourcesDirectory) + installationPath: $(Agent.ToolsDirectory)/dotnet + - script: dotnet --list-sdks + displayName: Report dotnet SDK versions + - script: .\Build.cmd $(_kind) -pack -c $(_BuildConfig) + env: + NativeToolsOnMachine: true + displayName: Initial build and prepare packages. + - script: $(Build.SourcesDirectory)/tests/AheadOfTime/check.cmd + displayName: Build, trim, publish and check the state of the trimmed app. + workingDirectory: $(Build.SourcesDirectory)/tests/AheadOfTime + - task: PublishPipelineArtifact@1 + displayName: Publish Trim Tests Logs + inputs: + targetPath: './artifacts/log/Release/AheadOfTime/Trimming/' + artifactName: 'Trim Test Logs Attempt $(System.JobAttempt) Logs $(_kind)' + continueOnError: true + condition: always() + + # Arcade-powered source build + # turned off until https://github.com/dotnet/source-build/issues/1795 is fixed + # - template: /eng/common/templates/jobs/jobs.yml + # parameters: + # enablePublishUsingPipelines: true + # enablePublishBuildArtifacts: true + # enablePublishBuildAssets: true + # artifacts: + # publish: + # artifacts: true + # manifests: true + # runSourceBuild: true + # sourceBuildParameters: + # includeDefaultManagedPlatform: true + +#---------------------------------------------------------------------------------------------------------------------# +# Post Build # +#---------------------------------------------------------------------------------------------------------------------# +- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: eng/common/templates/post-build/post-build.yml + parameters: + publishingInfraVersion: 3 + # Symbol validation is not entirely reliable as of yet, so should be turned off until https://github.com/dotnet/arcade/issues/2871 is resolved. + enableSymbolValidation: false + # SourceLink improperly looks for generated files. See https://github.com/dotnet/arcade/issues/3069 + enableSourceLinkValidation: false + # Enable SDL validation, passing through values from the 'DotNet-FSharp-SDLValidation-Params' group. + SDLValidationParameters: + enable: true + params: >- + -SourceToolsList @("policheck","credscan") + -ArtifactToolsList @("binskim") + -BinskimAdditionalRunConfigParams @("IgnorePdbLoadError < True","Recurse < True") + -TsaInstanceURL $(_TsaInstanceURL) + -TsaProjectName $(_TsaProjectName) + -TsaNotificationEmail $(_TsaNotificationEmail) + -TsaCodebaseAdmin $(_TsaCodebaseAdmin) + -TsaBugAreaPath $(_TsaBugAreaPath) + -TsaIterationPath $(_TsaIterationPath) + -TsaRepositoryName "FSharp" + -TsaCodebaseName "FSharp-GitHub" + -TsaPublish $True + -PoliCheckAdditionalRunConfigParams @("UserExclusionPath < $(Build.SourcesDirectory)/eng/policheck_exclusions.xml") + +#---------------------------------------------------------------------------------------------------------------------# +# VS Insertion # +#---------------------------------------------------------------------------------------------------------------------# +- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - template: eng/release/insert-into-vs.yml + parameters: + componentBranchName: refs/heads/release/dev17.9 + insertTargetBranch: rel/d17.9 + insertTeamEmail: fsharpteam@microsoft.com + insertTeamName: 'F#' + completeInsertion: 'auto' diff --git a/docs/index.md b/docs/index.md index 5cf45e2a9ff..7eca2572ae2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -14,6 +14,7 @@ Welcome to [the F# compiler and tools repository](https://github.com/dotnet/fsha * [Large inputs and stack overflows](large-inputs-and-stack-overflows.md) * [Memory usage](memory-usage.md) * [Optimizations](optimizations.md) +* [Equality optimizations](optimizations-equality.md) * [Project builds](project-builds.md) * [Tooling features](tooling-features.md) diff --git a/docs/optimizations-equality.md b/docs/optimizations-equality.md index acabd8caa2b..c8ac637fecc 100644 --- a/docs/optimizations-equality.md +++ b/docs/optimizations-equality.md @@ -11,12 +11,12 @@ This spec is about the semantics and performance of the following coding constru It is also about the semantics and performance of uses of the following `FSharp.Core` constructs which, after inlining, generate code that contains an equality check at the specific `EQTYPE` * `HashIdentity.Structural<'T>` -* `{Array,Seq,List}.contains` -* `{Array,Seq,List}.countBy` +* `{Array,Seq,List}.contains` +* `{Array,Seq,List}.countBy` * `{Array,Seq,List}.groupBy` -* `{Array,Seq,List}.distinct` -* `{Array,Seq,List}.distinctBy` -* `{Array,Seq,List}.except` +* `{Array,Seq,List}.distinct` +* `{Array,Seq,List}.distinctBy` +* `{Array,Seq,List}.except` All of which have implied equality checks. Some of these operations are inlined, see below, which in turn affects the semantics and performance of the overall operation. @@ -203,10 +203,9 @@ let f (x: float32) (y: float32) = (x = y) * Semantics: User expects call to `IEquatable` if present, but F# spec says call `this.Equals(box that)`, in practice these are the same * Perf expected: no boxing -* Compilation today: `GenericEqualityIntrinsic` -* Perf today: always boxes (Problem3 ❌) +* Compilation today: EqualityComparer.Default +* Perf today: good ✅ * [sharplab](https://sharplab.io/#v2:DYLgZgzgNALiCWwA+BYAUMApjABGHAFAB4g4DKAnhDJgLYB0AIgIY0Aq8tmA8mJNgEocFHAF5CRMcIHogA==) -* Note: [#16615](https://github.com/dotnet/fsharp/pull/16615) will improve things here since we'll start avoiding boxing ### F# struct type (records, tuples - with compiler-generated structural equality) @@ -262,10 +261,9 @@ If we did, the devirtualizing optimization should reduce to this directly, which * Semantics: User expects structural * Perf expected: User expects perf is sum of constituent parts -* Compilation today: `GenericEqualityIntrinsic` -* Perf today: hand-optimized ([here](https://github.com/dotnet/fsharp/blob/611e4f350e119a4173a2b235eac65539ac2b61b6/src/FSharp.Core/prim-types.fs#L1562)) for some primitive element types ✅ but boxes each element if "other" is struct or generic, see Problem3 ❌, Problem4 ❌ +* Compilation today: either ``FSharpEqualityComparer_PER`1::get_EqualityComparer().Equals(...)`` or ``FSharpEqualityComparer_PER`1::get_EqualityComparer().Equals(...)`` +* Perf today: good ✅ * [sharplab for `byte[]`](https://sharplab.io/#v2:DYLgZgzgPgsAUMApgFwARlQCgB4lQIwE9lEBtAXQEpVDUBeLbemy+IA=) -* Note: ([#16615](https://github.com/dotnet/fsharp/pull/16615)) will improve this compiling to either ``FSharpEqualityComparer_PER`1::get_EqualityComparer().Equals(...)`` or ``FSharpEqualityComparer_PER`1::get_EqualityComparer().Equals(...)`` ### F# large reference record/union type @@ -282,17 +280,15 @@ Here "tiny" means the compiler-generated structural equality IS inlined. * Semantics: User expects structural by default * Perf expected: User expects perf is sum of constituent parts, type-specialized if generic -* Compilation today: flattened, calling `GenericEqualityERIntrinsic` on struct and generic fields -* Perf today: boxes on struct and generic fields, see Problem3 ❌, Problem4 ❌ -* Note: [#16615](https://github.com/dotnet/fsharp/pull/16615) will help, compiling to ``FSharpEqualityComparer_ER`1::get_EqualityComparer().Equals(...)`` on struct and generic fields +* Compilation today: ``FSharpEqualityComparer_ER`1::get_EqualityComparer().Equals(...)`` +* Perf today: good ✅ ### Generic `'T` in non-inlined generic code * Semantics: User expects the PER equality semantics of whatever `'T` actually is * Perf expected: User expects no boxing -* Compilation today: `GenericEqualityERIntrinsic` -* Perf today: boxes if `'T` is any non-reference type (Problem4 ❌) -* Note: [#16615](https://github.com/dotnet/fsharp/pull/16615) will improve this compiling to ``FSharpEqualityComparer_ER`1::get_EqualityComparer().Equals(...)`` +* Compilation today: ``FSharpEqualityComparer_ER`1::get_EqualityComparer().Equals(...)`` +* Perf today: good ✅ ### Generic `'T` in recursive position in structural comparison @@ -300,10 +296,9 @@ This case happens in structural equality for tuple types and other structural ty * Semantics: User expects the PER equality semantics of whatever `'T` actually is * Perf: User expects no boxing -* Compilation today: `GenericEqualityWithComparerIntrinsic LanguagePrimitives.GenericComparer` -* Perf today: boxes for if `'T` is any non-reference type (Problem4 ❌) +* Compilation today: ``FSharpEqualityComparer_ER`1::get_EqualityComparer().Equals(...)`` +* Perf today: good ✅ * [Sharplab](https://sharplab.io/#v2:DYLgZgzgPgsAUMApgFwARlQCgB4iwSwDs0AqVAEwHsBXAIyVTIHIAVASjdQE9UBeLbH25t48TCVFxB/LpIC0cosCJEA5goB8kgOKJCiAE74AxgFEAjtQCGy5D0Gy48BUpWF1crU7gAJKxAALAGFKAFsABysDRAA6XX0jM0sbfDsAMX80B1R5RUJlQjVNHT1DEwtrWy4ASWIjQggTAB4WAEZGVBYAJg6WAGYNVAdcgHlw5HxQ/AAvQ00sckQAN3wDNHiypMrUmrqiRuMRbwyIZAqbCBZqcKQ+1AAZK3drVUQABSMpiaXECDjSxIhCJRQwCVoAGmwXUhfU4mC4EK40K4sNyrkK7mK3iQaGMYUi0QMQkezysrw+k1S+B+fw2gPxIIM8Dp5WSVQA6qlggzCSdcTzQdh2gjUAAyUXMgGs7Z2TnIbnA3mZVB4xWCnpIsUSuAsrYpWVcoEEwx8lUConYO4o3KDSQ4s1qon8EmqF7vT5Umn/BImI2M+DGRDmIbC9rigNBoYanrhnVSvUcw3m2rIeoHB3Gi1WvqSEhHeBAA==) -* Note: [#16615](https://github.com/dotnet/fsharp/pull/16615) will compile to ``FSharpEqualityComparer_ER`1::get_EqualityComparer().Equals(...)`` and avoid boxing in many cases ## Techniques available to us diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md index 83a1b23aa9f..148f3734185 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.300.md @@ -15,6 +15,7 @@ * Fix release inline optimization, which leads to MethodAccessException if used with `assembly:InternalsVisibleTo`` attribute. ([Issue #16105](https://github.com/dotnet/fsharp/issues/16105), ([PR #16737](https://github.com/dotnet/fsharp/pull/16737)) * Enforce AttributeTargets on let values and functions. ([PR #16692](https://github.com/dotnet/fsharp/pull/16692)) * Enforce AttributeTargets on union case declarations. ([PR #16764](https://github.com/dotnet/fsharp/pull/16764)) +* Disallow using base to invoke an abstract base method. ([Issue #13926](https://github.com/dotnet/fsharp/issues/13926), [PR #16773](https://github.com/dotnet/fsharp/pull/16773)) ### Added @@ -35,3 +36,4 @@ * Reverted [#16348](https://github.com/dotnet/fsharp/pull/16348) `ThreadStatic` `CancellationToken` changes to improve test stability and prevent potential unwanted cancellations. ([PR #16536](https://github.com/dotnet/fsharp/pull/16536)) * Refactored parenthesization API. ([PR #16461])(https://github.com/dotnet/fsharp/pull/16461)) * Optimize some interpolated strings by lowering to string concatenation. ([PR #16556](https://github.com/dotnet/fsharp/pull/16556)) +* Integral range optimizations. ([PR #16650](https://github.com/dotnet/fsharp/pull/16650)) diff --git a/docs/release-notes/.Language/8.0.md b/docs/release-notes/.Language/8.0.md index ad829f0a6b9..1e2dc00f2cd 100644 --- a/docs/release-notes/.Language/8.0.md +++ b/docs/release-notes/.Language/8.0.md @@ -1,3 +1,7 @@ -### Added +### Fixed -* `while!` ([Language suggestion #1038](https://github.com/fsharp/fslang-suggestions/issues/1038), [PR #14238](https://github.com/dotnet/fsharp/pull/14238)) \ No newline at end of file +* Disallow using base to invoke an abstract base method ([Issue #13926](https://github.com/dotnet/fsharp/issues/13926), [PR #16773](https://github.com/dotnet/fsharp/pull/16773)) + +### Added + +* `while!` ([Language suggestion #1038](https://github.com/fsharp/fslang-suggestions/issues/1038), [PR #14238](https://github.com/dotnet/fsharp/pull/14238)) diff --git a/docs/release-notes/.Language/preview.md b/docs/release-notes/.Language/preview.md index a4dd48f213d..eb7ddd08e54 100644 --- a/docs/release-notes/.Language/preview.md +++ b/docs/release-notes/.Language/preview.md @@ -1,5 +1,6 @@ ### Added +* Lower integral ranges to fast loops in more cases and optimize list and array construction from ranges. ([PR #16650](https://github.com/dotnet/fsharp/pull/16650)) * Better generic unmanaged structs handling. ([Language suggestion #692](https://github.com/fsharp/fslang-suggestions/issues/692), [PR #12154](https://github.com/dotnet/fsharp/pull/12154)) * Bidirectional F#/C# interop for 'unmanaged' constraint. ([PR #12154](https://github.com/dotnet/fsharp/pull/12154)) * Make `.Is*` discriminated union properties visible. ([Language suggestion #222](https://github.com/fsharp/fslang-suggestions/issues/222), [PR #16341](https://github.com/dotnet/fsharp/pull/16341)) diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props index 550215bd643..3bfd9f80fc4 100644 --- a/eng/SourceBuild.props +++ b/eng/SourceBuild.props @@ -11,7 +11,9 @@ The build script passes in the full path of the sln to build. This must be overridden in order to build the cloned source in the inner build. --> - + $(InnerBuildArgs) /p:Projects="$(InnerSourceBuildRepoRoot)\Microsoft.FSharp.Compiler.sln" @@ -23,7 +25,8 @@ --> + BeforeTargets="RunInnerSourceBuildCommand" + Condition="'$(ArcadeBuildFromSource)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'"> --tfm $(SourceBuildBootstrapTfm) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e683f21d846..41c7f6365b1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/source-build-reference-packages - d1c092f24a18f5ed76631fc6c865f706aca5d90f + 936b4a4b4b8a74b65098983660c5814fb4afee15 diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 7f303178553..fecefad1434 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -5640,10 +5640,8 @@ let resolveILMethodRefWithRescope r (td: ILTypeDef) (mref: ILMethodRef) = possibles |> List.filter (fun md -> mref.CallingConv = md.CallingConv - && - // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct - (md.Parameters, argTypes) - ||> List.lengthsEqAndForall2 (fun p1 p2 -> r p1.Type = p2) + && (md.Parameters, argTypes) + ||> List.lengthsEqAndForall2 (fun p1 p2 -> r p1.Type = p2) && // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct r md.Return.Type = retType) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index c82a5edf6f3..457a3489576 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -511,14 +511,6 @@ module TcRecdUnionAndEnumDeclarations = let TcUnionCaseDecl (cenv: cenv) env parent thisTy thisTyInst tpenv hasRQAAttribute (SynUnionCase(Attributes synAttrs, SynIdent(id, _), args, xmldoc, vis, m, _)) = let g = cenv.g - let attrs = - // The attributes of a union case decl get attached to the generated "static factory" method - // Enforce that the union-cases can only be targeted by attributes with AttributeTargets.Method - if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargetsUnionCaseDeclarations) then - TcAttributes cenv env AttributeTargets.Method synAttrs - else - TcAttributes cenv env AttributeTargets.UnionCaseDecl synAttrs - let vis, _ = ComputeAccessAndCompPath g env None m vis None parent let vis = CombineReprAccess parent vis @@ -571,6 +563,23 @@ module TcRecdUnionAndEnumDeclarations = let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some names) + let attrs = + (* + The attributes of a union case decl get attached to the generated "static factory" method. + Enforce union-cases AttributeTargets: + - AttributeTargets.Method + type SomeUnion = + | Case1 of int // Compiles down to a static method + - AttributeTargets.Property + type SomeUnion = + | Case1 // Compiles down to a static property + *) + if g.langVersion.SupportsFeature(LanguageFeature.EnforceAttributeTargetsUnionCaseDeclarations) then + let target = if rfields.IsEmpty then AttributeTargets.Property else AttributeTargets.Method + TcAttributes cenv env target synAttrs + else + TcAttributes cenv env AttributeTargets.UnionCaseDecl synAttrs + Construct.NewUnionCase id rfields recordTy attrs xmlDoc vis let TcUnionCaseDecls (cenv: cenv) env (parent: ParentRef) (thisTy: TType) (thisTyInst: TypeInst) hasRQAAttribute tpenv unionCases = diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index e15d9e9463f..852be12aff0 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -1307,14 +1307,14 @@ and CheckILBaseCall cenv env (ilMethRef, enclTypeInst, methInst, retTypes, tyarg match tryTcrefOfAppTy g baseVal.Type with | ValueSome tcref when tcref.IsILTycon -> try - // This is awkward - we have to explicitly re-resolve back to the IL metadata to determine if the method is abstract. - // We believe this may be fragile in some situations, since we are using the Abstract IL code to compare - // type equality, and it would be much better to remove any F# dependency on that implementation of IL type - // equality. It would be better to make this check in tc.fs when we have the Abstract IL metadata for the method to hand. - let mdef = resolveILMethodRef tcref.ILTyconRawMetadata ilMethRef + let mdef = + match tcref.ILTyconInfo with + | TILObjectReprData(scoref, _, _) -> + resolveILMethodRefWithRescope (rescopeILType scoref) tcref.ILTyconRawMetadata ilMethRef + if mdef.IsAbstract then errorR(Error(FSComp.SR.tcCannotCallAbstractBaseMember(mdef.Name), m)) - with _ -> () // defensive coding + with _ -> () | _ -> () CheckTypeInstNoByrefs cenv env m tyargs diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 52a5a184823..5846712049b 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1597,6 +1597,7 @@ featureBooleanReturningAndReturnTypeDirectedPartialActivePattern,"Boolean-return featureEnforceAttributeTargetsOnFunctions,"Enforce AttributeTargets on functions" featureEnforceAttributeTargetsUnionCaseDeclarations,"Enforce AttributeTargets on union case declarations" featureLowerInterpolatedStringToConcat,"Optimizes interpolated strings in certain cases, by lowering to concatenation" +featureLowerIntegralRangesToFastLoops,"Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops." 3354,tcNotAFunctionButIndexerNamedIndexingNotYetEnabled,"This value supports indexing, e.g. '%s.[index]'. The syntax '%s[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3354,tcNotAFunctionButIndexerIndexingNotYetEnabled,"This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation." 3355,tcNotAnIndexerNamedIndexingNotYetEnabled,"The value '%s' is not a function and does not support index notation." diff --git a/src/Compiler/FSharp.Compiler.Service.fsproj b/src/Compiler/FSharp.Compiler.Service.fsproj index 6963e31d2b3..60820dc2b69 100644 --- a/src/Compiler/FSharp.Compiler.Service.fsproj +++ b/src/Compiler/FSharp.Compiler.Service.fsproj @@ -366,8 +366,8 @@ - - + + @@ -505,12 +505,12 @@ - - - - - - + + + + + + diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index dd7133224e8..3103d8b159e 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -88,6 +88,7 @@ type LanguageFeature = | EnforceAttributeTargetsOnFunctions | EnforceAttributeTargetsUnionCaseDeclarations | LowerInterpolatedStringToConcat + | LowerIntegralRangesToFastLoops /// LanguageVersion management type LanguageVersion(versionText) = @@ -203,6 +204,7 @@ type LanguageVersion(versionText) = LanguageFeature.EnforceAttributeTargetsOnFunctions, previewVersion LanguageFeature.EnforceAttributeTargetsUnionCaseDeclarations, previewVersion LanguageFeature.LowerInterpolatedStringToConcat, previewVersion + LanguageFeature.LowerIntegralRangesToFastLoops, previewVersion ] static let defaultLanguageVersion = LanguageVersion("default") @@ -349,6 +351,7 @@ type LanguageVersion(versionText) = | LanguageFeature.EnforceAttributeTargetsOnFunctions -> FSComp.SR.featureEnforceAttributeTargetsOnFunctions () | LanguageFeature.EnforceAttributeTargetsUnionCaseDeclarations -> FSComp.SR.featureEnforceAttributeTargetsUnionCaseDeclarations () | LanguageFeature.LowerInterpolatedStringToConcat -> FSComp.SR.featureLowerInterpolatedStringToConcat () + | LanguageFeature.LowerIntegralRangesToFastLoops -> FSComp.SR.featureLowerIntegralRangesToFastLoops () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index 5be15a88284..4f0fe835ffa 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -79,6 +79,7 @@ type LanguageFeature = | EnforceAttributeTargetsOnFunctions | EnforceAttributeTargetsUnionCaseDeclarations | LowerInterpolatedStringToConcat + | LowerIntegralRangesToFastLoops /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/Optimize/LowerComputedCollections.fs b/src/Compiler/Optimize/LowerComputedCollections.fs index 2de57119ff3..7ceff0a676c 100644 --- a/src/Compiler/Optimize/LowerComputedCollections.fs +++ b/src/Compiler/Optimize/LowerComputedCollections.fs @@ -2,9 +2,10 @@ module internal FSharp.Compiler.LowerComputedCollectionExpressions -open Internal.Utilities.Library +open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AccessibilityLogic open FSharp.Compiler.DiagnosticsLogger +open FSharp.Compiler.Features open FSharp.Compiler.InfoReader open FSharp.Compiler.LowerSequenceExpressions open FSharp.Compiler.MethodCalls @@ -255,18 +256,178 @@ let (|SeqToArray|_|) g expr = | ValApp g g.seq_to_array_vref (_, [seqExpr], m) -> ValueSome (seqExpr, m) | _ -> ValueNone +module List = + /// Makes an expression that will build a list from an integral range. + let mkFromIntegralRange tcVal (g: TcGlobals) amap m overallElemTy overallSeqExpr start step finish = + let collectorTy = g.mk_ListCollector_ty overallElemTy + + /// let collector = ListCollector () in + /// + /// collector.Close () + let mkListInit mkLoop = + mkCompGenLetMutableIn m "collector" collectorTy (mkDefault (m, collectorTy)) (fun (_, collector) -> + let reader = InfoReader (g, amap) + let loop = mkLoop (fun _idxVar loopVar -> mkCallCollectorAdd tcVal g reader m collector loopVar) + let close = mkCallCollectorClose tcVal g reader m collector + mkSequential m loop close + ) + + mkOptimizedRangeLoop + g + (m, m, m, DebugPointAtWhile.No) + (overallElemTy, overallSeqExpr) + (start, step, finish) + (fun count mkLoop -> + match count with + | Expr.Const (value = IntegralConst.Zero) -> + mkNil g m overallElemTy + + | Expr.Const (value = _nonzeroConstant) -> + mkListInit mkLoop + + | _dynamicCount -> + mkListInit mkLoop + ) + +module Array = + /// Whether to check for overflow when converting a value to a native int. + [] + type Ovf = + /// Check for overflow. We need this when passing the count into newarr. + | CheckOvf + + /// Don't check for overflow. We don't need to check when indexing into the array, + /// since we already know count didn't overflow during initialization. + | NoCheckOvf + + /// Makes an expression that will build an array from an integral range. + let mkFromIntegralRange g m overallElemTy overallSeqExpr start step finish = + let arrayTy = mkArrayType g overallElemTy + + let convToNativeInt ovf expr = + let ty = stripMeasuresFromTy g (tyOfExpr g expr) + + let conv = + match ovf with + | NoCheckOvf -> AI_conv DT_I + | CheckOvf when isSignedIntegerTy g ty -> AI_conv_ovf DT_I + | CheckOvf -> AI_conv_ovf_un DT_I + + if typeEquiv g ty g.int64_ty then + mkAsmExpr ([conv], [], [expr], [g.nativeint_ty], m) + elif typeEquiv g ty g.nativeint_ty then + mkAsmExpr ([conv], [], [mkAsmExpr ([AI_conv DT_I8], [], [expr], [g.int64_ty], m)], [g.nativeint_ty], m) + elif typeEquiv g ty g.uint64_ty then + mkAsmExpr ([conv], [], [expr], [g.nativeint_ty], m) + elif typeEquiv g ty g.unativeint_ty then + mkAsmExpr ([conv], [], [mkAsmExpr ([AI_conv DT_U8], [], [expr], [g.uint64_ty], m)], [g.nativeint_ty], m) + else + expr + + let ilTy, ilBasicTy = + let ty = stripMeasuresFromTy g overallElemTy + + if typeEquiv g ty g.int32_ty then g.ilg.typ_Int32, DT_I4 + elif typeEquiv g ty g.int64_ty then g.ilg.typ_Int64, DT_I8 + elif typeEquiv g ty g.uint64_ty then g.ilg.typ_UInt64, DT_U8 + elif typeEquiv g ty g.uint32_ty then g.ilg.typ_UInt32, DT_U4 + elif typeEquiv g ty g.nativeint_ty then g.ilg.typ_IntPtr, DT_I + elif typeEquiv g ty g.unativeint_ty then g.ilg.typ_UIntPtr, DT_U + elif typeEquiv g ty g.int16_ty then g.ilg.typ_Int16, DT_I2 + elif typeEquiv g ty g.uint16_ty then g.ilg.typ_UInt16, DT_U2 + elif typeEquiv g ty g.sbyte_ty then g.ilg.typ_SByte, DT_I1 + elif typeEquiv g ty g.byte_ty then g.ilg.typ_Byte, DT_U1 + elif typeEquiv g ty g.char_ty then g.ilg.typ_Char, DT_U2 + else error (InternalError ($"Unable to find IL type for integral type '{overallElemTy}'.", m)) + + /// (# "newarr !0" type ('T) count : 'T array #) + let mkNewArray count = + mkAsmExpr + ( + [I_newarr (ILArrayShape.SingleDimensional, ilTy)], + [], + [convToNativeInt CheckOvf count], + [arrayTy], + m + ) + + /// let array = (# "newarr !0" type ('T) count : 'T array #) in + /// + /// array + let mkArrayInit count mkLoop = + mkCompGenLetIn m "array" arrayTy (mkNewArray count) (fun (_, array) -> + let loop = mkLoop (fun idxVar loopVar -> mkAsmExpr ([I_stelem ilBasicTy], [], [array; convToNativeInt NoCheckOvf idxVar; loopVar], [], m)) + mkSequential m loop array) + + mkOptimizedRangeLoop + g + (m, m, m, DebugPointAtWhile.No) + (overallElemTy, overallSeqExpr) + (start, step, finish) + (fun count mkLoop -> + match count with + | Expr.Const (value = IntegralConst.Zero) -> + mkArray (overallElemTy, [], m) + + | Expr.Const (value = _nonzeroConstant) -> + mkArrayInit count mkLoop + + | _dynamicCount -> + mkCompGenLetIn m (nameof count) (tyOfExpr g count) count (fun (_, count) -> + let countTy = tyOfExpr g count + + // count < 1 + let countLtOne = + if isSignedIntegerTy g countTy then + mkILAsmClt g m count (mkTypedOne g m countTy) + else + mkAsmExpr ([AI_clt_un], [], [count; mkTypedOne g m countTy], [g.bool_ty], m) + + // if count < 1 then + // [||] + // else + // let array = (# "newarr !0" type ('T) count : 'T array #) in + // + // array + mkCond + DebugPointAtBinding.NoneAtInvisible + m + arrayTy + countLtOne + (mkArray (overallElemTy, [], m)) + (mkArrayInit count mkLoop) + ) + ) + let LowerComputedListOrArrayExpr tcVal (g: TcGlobals) amap overallExpr = // If ListCollector is in FSharp.Core then this optimization kicks in if g.ListCollector_tcr.CanDeref then - match overallExpr with + // […] | SeqToList g (OptionalCoerce (OptionalSeq g amap (overallSeqExpr, overallElemTy)), m) -> - let collectorTy = g.mk_ListCollector_ty overallElemTy - LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr - + match overallSeqExpr with + // [start..finish] + // [start..step..finish] + | IntegralRange g (_, (start, step, finish)) when g.langVersion.SupportsFeature LanguageFeature.LowerIntegralRangesToFastLoops -> + Some (List.mkFromIntegralRange tcVal g amap m overallElemTy overallSeqExpr start step finish) + + // [(* Anything more complex. *)] + | _ -> + let collectorTy = g.mk_ListCollector_ty overallElemTy + LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr + + // [|…|] | SeqToArray g (OptionalCoerce (OptionalSeq g amap (overallSeqExpr, overallElemTy)), m) -> - let collectorTy = g.mk_ArrayCollector_ty overallElemTy - LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr + match overallSeqExpr with + // [|start..finish|] + // [|start..step..finish|] + | IntegralRange g (_, (start, step, finish)) when g.langVersion.SupportsFeature LanguageFeature.LowerIntegralRangesToFastLoops -> + Some (Array.mkFromIntegralRange g m overallElemTy overallSeqExpr start step finish) + + // [|(* Anything more complex. *)|] + | _ -> + let collectorTy = g.mk_ArrayCollector_ty overallElemTy + LowerComputedListOrArraySeqExpr tcVal g amap m collectorTy overallSeqExpr | _ -> None else diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 4f713fb4d5d..b1758206a44 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -810,6 +810,18 @@ type TcGlobals( let v_range_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_Range" , None , None , [vara], ([[varaTy];[varaTy]], mkSeqTy varaTy)) let v_range_step_op_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "op_RangeStep" , None , None , [vara;varb], ([[varaTy];[varbTy];[varaTy]], mkSeqTy varaTy)) let v_range_int32_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt32" , None , None , [], ([[v_int_ty];[v_int_ty];[v_int_ty]], mkSeqTy v_int_ty)) + let v_range_int64_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt64" , None , None , [], ([[v_int64_ty];[v_int64_ty];[v_int64_ty]], mkSeqTy v_int64_ty)) + let v_range_uint64_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUInt64" , None , None , [], ([[v_uint64_ty];[v_uint64_ty];[v_uint64_ty]], mkSeqTy v_uint64_ty)) + let v_range_uint32_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUInt32" , None , None , [], ([[v_uint32_ty];[v_uint32_ty];[v_uint32_ty]], mkSeqTy v_uint32_ty)) + let v_range_nativeint_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeIntPtr" , None , None , [], ([[v_nativeint_ty];[v_nativeint_ty];[v_nativeint_ty]], mkSeqTy v_nativeint_ty)) + let v_range_unativeint_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUIntPtr" , None , None , [], ([[v_unativeint_ty];[v_unativeint_ty];[v_unativeint_ty]], mkSeqTy v_unativeint_ty)) + let v_range_int16_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeInt16" , None , None , [], ([[v_int16_ty];[v_int16_ty];[v_int16_ty]], mkSeqTy v_int16_ty)) + let v_range_uint16_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeUInt16" , None , None , [], ([[v_uint16_ty];[v_uint16_ty];[v_uint16_ty]], mkSeqTy v_uint16_ty)) + let v_range_sbyte_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeSByte" , None , None , [], ([[v_sbyte_ty];[v_sbyte_ty];[v_sbyte_ty]], mkSeqTy v_sbyte_ty)) + let v_range_byte_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeByte" , None , None , [], ([[v_byte_ty];[v_byte_ty];[v_byte_ty]], mkSeqTy v_byte_ty)) + let v_range_char_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeChar" , None , None , [], ([[v_char_ty];[v_char_ty];[v_char_ty]], mkSeqTy v_char_ty)) + let v_range_generic_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeGeneric" , None , None , [vara], ([[varaTy];[varaTy]], mkSeqTy varaTy)) + let v_range_step_generic_op_info = makeIntrinsicValRef(fslib_MFOperatorIntrinsics_nleref, "RangeStepGeneric" , None , None , [vara;varb], ([[varaTy];[varbTy];[varaTy]], mkSeqTy varaTy)) let v_array_length_info = makeIntrinsicValRef(fslib_MFArrayModule_nleref, "length" , None , Some "Length" , [vara], ([[mkArrayType 1 varaTy]], v_int_ty)) let v_array_get_info = makeIntrinsicValRef(fslib_MFIntrinsicFunctions_nleref, "GetArray" , None , None , [vara], ([[mkArrayType 1 varaTy]; [v_int_ty]], varaTy)) @@ -1690,6 +1702,18 @@ type TcGlobals( member val range_op_vref = ValRefForIntrinsic v_range_op_info member val range_step_op_vref = ValRefForIntrinsic v_range_step_op_info member val range_int32_op_vref = ValRefForIntrinsic v_range_int32_op_info + member val range_int64_op_vref = ValRefForIntrinsic v_range_int64_op_info + member val range_uint64_op_vref = ValRefForIntrinsic v_range_uint64_op_info + member val range_uint32_op_vref = ValRefForIntrinsic v_range_uint32_op_info + member val range_nativeint_op_vref = ValRefForIntrinsic v_range_nativeint_op_info + member val range_unativeint_op_vref = ValRefForIntrinsic v_range_unativeint_op_info + member val range_int16_op_vref = ValRefForIntrinsic v_range_int16_op_info + member val range_uint16_op_vref = ValRefForIntrinsic v_range_uint16_op_info + member val range_sbyte_op_vref = ValRefForIntrinsic v_range_sbyte_op_info + member val range_byte_op_vref = ValRefForIntrinsic v_range_byte_op_info + member val range_char_op_vref = ValRefForIntrinsic v_range_char_op_info + member val range_generic_op_vref = ValRefForIntrinsic v_range_generic_op_info + member val range_step_generic_op_vref = ValRefForIntrinsic v_range_step_generic_op_info member val array_get_vref = ValRefForIntrinsic v_array_get_info member val array2D_get_vref = ValRefForIntrinsic v_array2D_get_info member val array3D_get_vref = ValRefForIntrinsic v_array3D_get_info diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index 68b924df6a2..8001c049ece 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -7416,6 +7416,42 @@ let mkTwo g m = mkInt g m 2 let mkMinusOne g m = mkInt g m -1 +let mkTypedZero g m ty = + let underlyingTy = stripMeasuresFromTy g ty + if typeEquiv g underlyingTy g.int32_ty then Expr.Const (Const.Int32 0, m, ty) + elif typeEquiv g underlyingTy g.int64_ty then Expr.Const (Const.Int64 0L, m, ty) + elif typeEquiv g underlyingTy g.uint64_ty then Expr.Const (Const.UInt64 0UL, m, ty) + elif typeEquiv g underlyingTy g.uint32_ty then Expr.Const (Const.UInt32 0u, m, ty) + elif typeEquiv g underlyingTy g.nativeint_ty then Expr.Const (Const.IntPtr 0L, m, ty) + elif typeEquiv g underlyingTy g.unativeint_ty then Expr.Const (Const.UIntPtr 0UL, m, ty) + elif typeEquiv g underlyingTy g.int16_ty then Expr.Const (Const.Int16 0s, m, ty) + elif typeEquiv g underlyingTy g.uint16_ty then Expr.Const (Const.UInt16 0us, m, ty) + elif typeEquiv g underlyingTy g.sbyte_ty then Expr.Const (Const.SByte 0y, m, ty) + elif typeEquiv g underlyingTy g.byte_ty then Expr.Const (Const.Byte 0uy, m, ty) + elif typeEquiv g underlyingTy g.char_ty then Expr.Const (Const.Char '\000', m, ty) + elif typeEquiv g underlyingTy g.float32_ty then Expr.Const (Const.Single 0.0f, m, ty) + elif typeEquiv g underlyingTy g.float_ty then Expr.Const (Const.Double 0.0, m, ty) + elif typeEquiv g underlyingTy g.decimal_ty then Expr.Const (Const.Decimal 0m, m, ty) + else error (InternalError ($"Unrecognized numeric type '{ty}'.", m)) + +let mkTypedOne g m ty = + let underlyingTy = stripMeasuresFromTy g ty + if typeEquiv g underlyingTy g.int32_ty then Expr.Const (Const.Int32 1, m, ty) + elif typeEquiv g underlyingTy g.int64_ty then Expr.Const (Const.Int64 1L, m, ty) + elif typeEquiv g underlyingTy g.uint64_ty then Expr.Const (Const.UInt64 1UL, m, ty) + elif typeEquiv g underlyingTy g.uint32_ty then Expr.Const (Const.UInt32 1u, m, ty) + elif typeEquiv g underlyingTy g.nativeint_ty then Expr.Const (Const.IntPtr 1L, m, ty) + elif typeEquiv g underlyingTy g.unativeint_ty then Expr.Const (Const.UIntPtr 1UL, m, ty) + elif typeEquiv g underlyingTy g.int16_ty then Expr.Const (Const.Int16 1s, m, ty) + elif typeEquiv g underlyingTy g.uint16_ty then Expr.Const (Const.UInt16 1us, m, ty) + elif typeEquiv g underlyingTy g.sbyte_ty then Expr.Const (Const.SByte 1y, m, ty) + elif typeEquiv g underlyingTy g.byte_ty then Expr.Const (Const.Byte 1uy, m, ty) + elif typeEquiv g underlyingTy g.char_ty then Expr.Const (Const.Char '\001', m, ty) + elif typeEquiv g underlyingTy g.float32_ty then Expr.Const (Const.Single 1.0f, m, ty) + elif typeEquiv g underlyingTy g.float_ty then Expr.Const (Const.Double 1.0, m, ty) + elif typeEquiv g underlyingTy g.decimal_ty then Expr.Const (Const.Decimal 1m, m, ty) + else error (InternalError ($"Unrecognized numeric type '{ty}'.", m)) + let destInt32 = function Expr.Const (Const.Int32 n, _, _) -> Some n | _ -> None let isIDelegateEventType g ty = @@ -8339,6 +8375,10 @@ let mkCompGenLetIn m nm ty e f = let v, ve = mkCompGenLocal m nm ty mkCompGenLet m v e (f (v, ve)) +let mkCompGenLetMutableIn m nm ty e f = + let v, ve = mkMutableCompGenLocal m nm ty + mkCompGenLet m v e (f (v, ve)) + /// Take a node representing a coercion from one function type to another, e.g. /// A -> A * A -> int /// to @@ -10108,7 +10148,7 @@ let (|CompiledForEachExpr|_|) g expr = Some (enumerableTy, enumerableExpr, elemVar, bodyExpr, (mBody, spFor, spIn, mFor, mIn, spInWhile, mWholeExpr)) | _ -> None - + let (|CompiledInt32RangeForEachExpr|_|) g expr = match expr with @@ -10116,6 +10156,724 @@ let (|CompiledInt32RangeForEachExpr|_|) g expr = Some (startExpr, step, finishExpr, elemVar, bodyExpr, ranges) | _ -> None +let (|ValApp|_|) g vref expr = + match expr with + | Expr.App (Expr.Val (vref2, _, _), _f0ty, tyargs, args, m) when valRefEq g vref vref2 -> Some (tyargs, args, m) + | _ -> None + +[] +module IntegralConst = + /// Constant 0. + [] + let (|Zero|_|) c = + match c with + | Const.Zero + | Const.Int32 0 + | Const.Int64 0L + | Const.UInt64 0UL + | Const.UInt32 0u + | Const.IntPtr 0L + | Const.UIntPtr 0UL + | Const.Int16 0s + | Const.UInt16 0us + | Const.SByte 0y + | Const.Byte 0uy + | Const.Char '\000' -> ValueSome Zero + | _ -> ValueNone + + /// Constant 1. + [] + let (|One|_|) expr = + match expr with + | Const.Int32 1 + | Const.Int64 1L + | Const.UInt64 1UL + | Const.UInt32 1u + | Const.IntPtr 1L + | Const.UIntPtr 1UL + | Const.Int16 1s + | Const.UInt16 1us + | Const.SByte 1y + | Const.Byte 1uy + | Const.Char '\001' -> ValueSome One + | _ -> ValueNone + + /// Constant -1. + [] + let (|MinusOne|_|) c = + match c with + | Const.Int32 -1 + | Const.Int64 -1L + | Const.IntPtr -1L + | Const.Int16 -1s + | Const.SByte -1y -> ValueSome MinusOne + | _ -> ValueNone + + /// Positive constant. + [] + let (|Positive|_|) c = + match c with + | Const.Int32 v when v > 0 -> ValueSome Positive + | Const.Int64 v when v > 0L -> ValueSome Positive + // sizeof is not constant, so |𝑐| ≥ 0x80000000n cannot be treated as a constant. + | Const.IntPtr v when v > 0L && uint64 v < 0x80000000UL -> ValueSome Positive + | Const.Int16 v when v > 0s -> ValueSome Positive + | Const.SByte v when v > 0y -> ValueSome Positive + | Const.UInt64 v when v > 0UL -> ValueSome Positive + | Const.UInt32 v when v > 0u -> ValueSome Positive + // sizeof is not constant, so |𝑐| > 0xffffffffun cannot be treated as a constant. + | Const.UIntPtr v when v > 0UL && v <= 0xffffffffUL -> ValueSome Positive + | Const.UInt16 v when v > 0us -> ValueSome Positive + | Const.Byte v when v > 0uy -> ValueSome Positive + | Const.Char v when v > '\000' -> ValueSome Positive + | _ -> ValueNone + + /// Negative constant. + [] + let (|Negative|_|) c = + match c with + | Const.Int32 v when v < 0 -> ValueSome Negative + | Const.Int64 v when v < 0L -> ValueSome Negative + // sizeof is not constant, so |𝑐| ≥ 0x80000000n cannot be treated as a constant. + | Const.IntPtr v when v < 0L && uint64 v < 0x80000000UL -> ValueSome Negative + | Const.Int16 v when v < 0s -> ValueSome Negative + | Const.SByte v when v < 0y -> ValueSome Negative + | _ -> ValueNone + + /// Returns the absolute value of the given integral constant. + let abs c = + match c with + | Const.Int32 Int32.MinValue -> Const.UInt32 (uint Int32.MaxValue + 1u) + | Const.Int64 Int64.MinValue -> Const.UInt64 (uint64 Int64.MaxValue + 1UL) + | Const.IntPtr Int64.MinValue -> Const.UIntPtr (uint64 Int64.MaxValue + 1UL) + | Const.Int16 Int16.MinValue -> Const.UInt16 (uint16 Int16.MaxValue + 1us) + | Const.SByte SByte.MinValue -> Const.Byte (byte SByte.MaxValue + 1uy) + | Const.Int32 v -> Const.Int32 (abs v) + | Const.Int64 v -> Const.Int64 (abs v) + | Const.IntPtr v -> Const.IntPtr (abs v) + | Const.Int16 v -> Const.Int16 (abs v) + | Const.SByte v -> Const.SByte (abs v) + | _ -> c + +/// start..finish +/// start..step..finish +[] +let (|IntegralRange|_|) g expr = + match expr with + | ValApp g g.range_int32_op_vref ([], [start; step; finish], _) -> ValueSome (g.int32_ty, (start, step, finish)) + | ValApp g g.range_int64_op_vref ([], [start; step; finish], _) -> ValueSome (g.int64_ty, (start, step, finish)) + | ValApp g g.range_uint64_op_vref ([], [start; step; finish], _) -> ValueSome (g.uint64_ty, (start, step, finish)) + | ValApp g g.range_uint32_op_vref ([], [start; step; finish], _) -> ValueSome (g.uint32_ty, (start, step, finish)) + | ValApp g g.range_nativeint_op_vref ([], [start; step; finish], _) -> ValueSome (g.nativeint_ty, (start, step, finish)) + | ValApp g g.range_unativeint_op_vref ([], [start; step; finish], _) -> ValueSome (g.unativeint_ty, (start, step, finish)) + | ValApp g g.range_int16_op_vref ([], [start; step; finish], _) -> ValueSome (g.int16_ty, (start, step, finish)) + | ValApp g g.range_uint16_op_vref ([], [start; step; finish], _) -> ValueSome (g.uint16_ty, (start, step, finish)) + | ValApp g g.range_sbyte_op_vref ([], [start; step; finish], _) -> ValueSome (g.sbyte_ty, (start, step, finish)) + | ValApp g g.range_byte_op_vref ([], [start; step; finish], _) -> ValueSome (g.byte_ty, (start, step, finish)) + | ValApp g g.range_char_op_vref ([], [start; finish], _) -> ValueSome (g.char_ty, (start, Expr.Const (Const.Char '\001', Text.Range.range0, g.char_ty), finish)) + | ValApp g g.range_op_vref (ty :: _, [start; finish], _) when isIntegerTy g ty || typeEquivAux EraseMeasures g ty g.char_ty -> ValueSome (ty, (start, mkTypedOne g Text.Range.range0 ty, finish)) + | ValApp g g.range_step_op_vref ([ty; ty2], [start; step; finish], _) when typeEquiv g ty ty2 && (isIntegerTy g ty || typeEquivAux EraseMeasures g ty g.char_ty) -> ValueSome (ty, (start, step, finish)) + | ValApp g g.range_generic_op_vref ([ty; ty2], [_one; _add; start; finish], _) when typeEquiv g ty ty2 && (isIntegerTy g ty || typeEquivAux EraseMeasures g ty g.char_ty) -> ValueSome (ty, (start, mkTypedOne g Text.Range.range0 ty, finish)) + | ValApp g g.range_step_generic_op_vref ([ty; ty2], [_zero; _add; start; step; finish], _) when typeEquiv g ty ty2 && (isIntegerTy g ty || typeEquivAux EraseMeasures g ty g.char_ty) -> ValueSome (ty, (start, step, finish)) + | _ -> ValueNone + +/// 5..1 +/// 1..-5 +/// 1..-1..5 +/// -5..-1..-1 +/// 5..2..1 +[] +let (|EmptyRange|_|) (start, step, finish) = + match start, step, finish with + | Expr.Const (value = Const.Int32 start), Expr.Const (value = Const.Int32 step), Expr.Const (value = Const.Int32 finish) when finish < start && step > 0 || finish > start && step < 0 -> ValueSome EmptyRange + | Expr.Const (value = Const.Int64 start), Expr.Const (value = Const.Int64 step), Expr.Const (value = Const.Int64 finish) when finish < start && step > 0L || finish > start && step < 0L -> ValueSome EmptyRange + | Expr.Const (value = Const.UInt64 start), Expr.Const (value = Const.UInt64 _), Expr.Const (value = Const.UInt64 finish) when finish < start -> ValueSome EmptyRange + | Expr.Const (value = Const.UInt32 start), Expr.Const (value = Const.UInt32 _), Expr.Const (value = Const.UInt32 finish) when finish < start -> ValueSome EmptyRange + + // sizeof is not constant, so |𝑐| ≥ 0x80000000n cannot be treated as a constant. + | Expr.Const (value = Const.IntPtr start), Expr.Const (value = Const.IntPtr step), Expr.Const (value = Const.IntPtr finish) when + uint64 start < 0x80000000UL + && uint64 step < 0x80000000UL + && uint64 finish < 0x80000000UL + && (finish < start && step > 0L || finish > start && step < 0L) + -> + ValueSome EmptyRange + + // sizeof is not constant, so |𝑐| > 0xffffffffun cannot be treated as a constant. + | Expr.Const (value = Const.UIntPtr start), Expr.Const (value = Const.UIntPtr step), Expr.Const (value = Const.UIntPtr finish) when + start <= 0xffffffffUL + && step <= 0xffffffffUL + && finish <= 0xffffffffUL + && finish <= start + -> + ValueSome EmptyRange + + | Expr.Const (value = Const.Int16 start), Expr.Const (value = Const.Int16 step), Expr.Const (value = Const.Int16 finish) when finish < start && step > 0s || finish > start && step < 0s -> ValueSome EmptyRange + | Expr.Const (value = Const.UInt16 start), Expr.Const (value = Const.UInt16 _), Expr.Const (value = Const.UInt16 finish) when finish < start -> ValueSome EmptyRange + | Expr.Const (value = Const.SByte start), Expr.Const (value = Const.SByte step), Expr.Const (value = Const.SByte finish) when finish < start && step > 0y || finish > start && step < 0y -> ValueSome EmptyRange + | Expr.Const (value = Const.Byte start), Expr.Const (value = Const.Byte _), Expr.Const (value = Const.Byte finish) when finish < start -> ValueSome EmptyRange + | Expr.Const (value = Const.Char start), Expr.Const (value = Const.Char _), Expr.Const (value = Const.Char finish) when finish < start -> ValueSome EmptyRange + | _ -> ValueNone + +/// Note: this assumes that an empty range has already been checked for +/// (otherwise the conversion operations here might overflow). +[] +let (|ConstCount|_|) (start, step, finish) = + match start, step, finish with + // The count for these ranges is 2⁶⁴ + 1. We must handle such ranges at runtime. + | Expr.Const (value = Const.Int64 Int64.MinValue), Expr.Const (value = Const.Int64 1L), Expr.Const (value = Const.Int64 Int64.MaxValue) + | Expr.Const (value = Const.Int64 Int64.MaxValue), Expr.Const (value = Const.Int64 -1L), Expr.Const (value = Const.Int64 Int64.MinValue) + | Expr.Const (value = Const.UInt64 UInt64.MinValue), Expr.Const (value = Const.UInt64 1UL), Expr.Const (value = Const.UInt64 UInt64.MaxValue) + | Expr.Const (value = Const.IntPtr Int64.MinValue), Expr.Const (value = Const.IntPtr 1L), Expr.Const (value = Const.IntPtr Int64.MaxValue) + | Expr.Const (value = Const.IntPtr Int64.MaxValue), Expr.Const (value = Const.IntPtr -1L), Expr.Const (value = Const.IntPtr Int64.MinValue) + | Expr.Const (value = Const.UIntPtr UInt64.MinValue), Expr.Const (value = Const.UIntPtr 1UL), Expr.Const (value = Const.UIntPtr UInt64.MaxValue) -> ValueNone + + // We must special-case a step of Int64.MinValue, since we cannot call abs on it. + | Expr.Const (value = Const.Int64 start), Expr.Const (value = Const.Int64 Int64.MinValue), Expr.Const (value = Const.Int64 finish) when start <= finish -> ValueSome (Const.UInt64 ((uint64 finish - uint64 start) / (uint64 Int64.MaxValue + 1UL) + 1UL)) + | Expr.Const (value = Const.Int64 start), Expr.Const (value = Const.Int64 Int64.MinValue), Expr.Const (value = Const.Int64 finish) -> ValueSome (Const.UInt64 ((uint64 start - uint64 finish) / (uint64 Int64.MaxValue + 1UL) + 1UL)) + | Expr.Const (value = Const.IntPtr start), Expr.Const (value = Const.IntPtr Int64.MinValue), Expr.Const (value = Const.IntPtr finish) when start <= finish -> ValueSome (Const.UIntPtr ((uint64 start - uint64 finish) / (uint64 Int64.MaxValue + 1UL) + 1UL)) + | Expr.Const (value = Const.IntPtr start), Expr.Const (value = Const.IntPtr Int64.MinValue), Expr.Const (value = Const.IntPtr finish) -> ValueSome (Const.UIntPtr ((uint64 start - uint64 finish) / (uint64 Int64.MaxValue + 1UL) + 1UL)) + + | Expr.Const (value = Const.Int64 start), Expr.Const (value = Const.Int64 step), Expr.Const (value = Const.Int64 finish) when start <= finish -> ValueSome (Const.UInt64 ((uint64 finish - uint64 start) / uint64 (abs step) + 1UL)) + | Expr.Const (value = Const.Int64 start), Expr.Const (value = Const.Int64 step), Expr.Const (value = Const.Int64 finish) -> ValueSome (Const.UInt64 ((uint64 start - uint64 finish) / uint64 (abs step) + 1UL)) + + // sizeof is not constant, so |𝑐| ≥ 0x80000000n cannot be treated as a constant. + | Expr.Const (value = Const.IntPtr start), Expr.Const (value = Const.IntPtr step), Expr.Const (value = Const.IntPtr finish) when + uint64 start < 0x80000000UL + && uint64 step < 0x80000000UL + && uint64 finish < 0x80000000UL + && start <= finish + -> + ValueSome (Const.UIntPtr ((uint64 finish - uint64 start) / uint64 (abs step) + 1UL)) + + | Expr.Const (value = Const.IntPtr start), Expr.Const (value = Const.IntPtr step), Expr.Const (value = Const.IntPtr finish) when + uint64 start < 0x80000000UL + && uint64 step < 0x80000000UL + && uint64 finish < 0x80000000UL + -> + ValueSome (Const.UIntPtr ((uint64 start - uint64 finish) / uint64 (abs step) + 1UL)) + + | Expr.Const (value = Const.Int32 start), Expr.Const (value = Const.Int32 step), Expr.Const (value = Const.Int32 finish) when start <= finish -> ValueSome (Const.UInt64 ((uint64 finish - uint64 start) / uint64 (abs (int64 step)) + 1UL)) + | Expr.Const (value = Const.Int32 start), Expr.Const (value = Const.Int32 step), Expr.Const (value = Const.Int32 finish) -> ValueSome (Const.UInt64 ((uint64 start - uint64 finish) / uint64 (abs (int64 step)) + 1UL)) + + | Expr.Const (value = Const.Int16 start), Expr.Const (value = Const.Int16 step), Expr.Const (value = Const.Int16 finish) when start <= finish -> ValueSome (Const.UInt32 ((uint finish - uint start) / uint (abs (int step)) + 1u)) + | Expr.Const (value = Const.Int16 start), Expr.Const (value = Const.Int16 step), Expr.Const (value = Const.Int16 finish) -> ValueSome (Const.UInt32 ((uint start - uint finish) / uint (abs (int step)) + 1u)) + + | Expr.Const (value = Const.SByte start), Expr.Const (value = Const.SByte step), Expr.Const (value = Const.SByte finish) when start <= finish -> ValueSome (Const.UInt16 ((uint16 finish - uint16 start) / uint16 (abs (int16 step)) + 1us)) + | Expr.Const (value = Const.SByte start), Expr.Const (value = Const.SByte step), Expr.Const (value = Const.SByte finish) -> ValueSome (Const.UInt16 ((uint16 start - uint16 finish) / uint16 (abs (int16 step)) + 1us)) + + // sizeof is not constant, so |𝑐| > 0xffffffffun cannot be treated as a constant. + | Expr.Const (value = Const.UIntPtr start), Expr.Const (value = Const.UIntPtr step), Expr.Const (value = Const.UIntPtr finish) when + start <= 0xffffffffUL + && step <= 0xffffffffUL + && finish <= 0xffffffffUL + -> + ValueSome (Const.UIntPtr ((finish - start) / step + 1UL)) + + | Expr.Const (value = Const.UInt64 start), Expr.Const (value = Const.UInt64 step), Expr.Const (value = Const.UInt64 finish) when start <= finish -> ValueSome (Const.UInt64 ((finish - start) / step + 1UL)) + | Expr.Const (value = Const.UInt64 start), Expr.Const (value = Const.UInt64 step), Expr.Const (value = Const.UInt64 finish) -> ValueSome (Const.UInt64 ((start - finish) / step + 1UL)) + | Expr.Const (value = Const.UInt32 start), Expr.Const (value = Const.UInt32 step), Expr.Const (value = Const.UInt32 finish) when start <= finish -> ValueSome (Const.UInt64 (uint64 (finish - start) / uint64 step + 1UL)) + | Expr.Const (value = Const.UInt32 start), Expr.Const (value = Const.UInt32 step), Expr.Const (value = Const.UInt32 finish) -> ValueSome (Const.UInt64 (uint64 (start - finish) / uint64 step + 1UL)) + | Expr.Const (value = Const.UInt16 start), Expr.Const (value = Const.UInt16 step), Expr.Const (value = Const.UInt16 finish) when start <= finish -> ValueSome (Const.UInt32 (uint (finish - start) / uint step + 1u)) + | Expr.Const (value = Const.UInt16 start), Expr.Const (value = Const.UInt16 step), Expr.Const (value = Const.UInt16 finish) -> ValueSome (Const.UInt32 (uint (start - finish) / uint step + 1u)) + | Expr.Const (value = Const.Byte start), Expr.Const (value = Const.Byte step), Expr.Const (value = Const.Byte finish) when start <= finish -> ValueSome (Const.UInt16 (uint16 (finish - start) / uint16 step + 1us)) + | Expr.Const (value = Const.Byte start), Expr.Const (value = Const.Byte step), Expr.Const (value = Const.Byte finish) -> ValueSome (Const.UInt16 (uint16 (start - finish) / uint16 step + 1us)) + | Expr.Const (value = Const.Char start), Expr.Const (value = Const.Char step), Expr.Const (value = Const.Char finish) when start <= finish -> ValueSome (Const.UInt32 (uint (finish - start) / uint step + 1u)) + | Expr.Const (value = Const.Char start), Expr.Const (value = Const.Char step), Expr.Const (value = Const.Char finish) -> ValueSome (Const.UInt32 (uint (start - finish) / uint step + 1u)) + + | _ -> ValueNone + +type Count = Expr +type Idx = Expr +type Elem = Expr +type Body = Expr +type Loop = Expr +type WouldOvf = Expr + +[] +type RangeCount = + /// An expression representing a count known at compile time. + | Constant of Count + + /// An expression representing a "count" whose step is known to be zero at compile time. + /// Evaluating this expression at runtime will raise an exception. + | ConstantZeroStep of Expr + + /// An expression to compute a count at runtime that will definitely fit in 64 bits without overflow. + | Safe of Count + + /// A function for building a loop given an expression that may produce a count that + /// would not fit in 64 bits without overflow, and an expression indicating whether + /// evaluating the first expression directly would in fact overflow. + | PossiblyOversize of ((Count -> WouldOvf -> Expr) -> Expr) + +/// Makes an expression to compute the iteration count for the given integral range. +let mkRangeCount g m rangeTy rangeExpr start step finish = + /// This will raise an exception at runtime if step is zero. + let mkCallAndIgnoreRangeExpr start step finish = + // Use the potentially-evaluated-and-bound start, step, and finish. + let rangeExpr = + match rangeExpr with + // Type-specific range op (RangeInt32, etc.). + | Expr.App (funcExpr, formalType, tyargs, [_start; _step; _finish], m) -> Expr.App (funcExpr, formalType, tyargs, [start; step; finish], m) + // Generic range–step op (RangeStepGeneric). + | Expr.App (funcExpr, formalType, tyargs, [zero; add; _start; _step; _finish], m) -> Expr.App (funcExpr, formalType, tyargs, [zero; add; start; step; finish], m) + | _ -> error (InternalError ($"Unrecognized range function application '{rangeExpr}'.", m)) + + mkSequential + m + rangeExpr + (mkUnit g m) + + let mkSignednessAppropriateClt ty e1 e2 = + if isSignedIntegerTy g ty then + mkILAsmClt g m e1 e2 + else + mkAsmExpr ([AI_clt_un], [], [e1; e2], [g.bool_ty], m) + + let unsignedEquivalent ty = + if typeEquiv g ty g.int64_ty then g.uint64_ty + elif typeEquiv g ty g.int32_ty then g.uint32_ty + elif typeEquiv g ty g.int16_ty then g.uint16_ty + elif typeEquiv g ty g.sbyte_ty then g.byte_ty + else ty + + /// Find the unsigned type with twice the width of the given type, if available. + let nextWidestUnsignedTy ty = + let ty = stripMeasuresFromTy g ty + + if typeEquiv g ty g.int64_ty || typeEquiv g ty g.int32_ty || typeEquiv g ty g.uint32_ty then + g.uint64_ty + elif typeEquiv g ty g.int16_ty || typeEquiv g ty g.uint16_ty || typeEquiv g ty g.char_ty then + g.uint32_ty + elif typeEquiv g ty g.sbyte_ty || typeEquiv g ty g.byte_ty then + g.uint16_ty + else + ty + + /// Convert the value to the next-widest unsigned type. + /// We do this so that adding one won't result in overflow. + let mkWiden e = + let ty = stripMeasuresFromTy g rangeTy + + if typeEquiv g ty g.int32_ty then + mkAsmExpr ([AI_conv DT_I8], [], [e], [g.uint64_ty], m) + elif typeEquiv g ty g.uint32_ty then + mkAsmExpr ([AI_conv DT_U8], [], [e], [g.uint64_ty], m) + elif typeEquiv g ty g.int16_ty then + mkAsmExpr ([AI_conv DT_I4], [], [e], [g.uint32_ty], m) + elif typeEquiv g ty g.uint16_ty || typeEquiv g ty g.char_ty then + mkAsmExpr ([AI_conv DT_U4], [], [e], [g.uint32_ty], m) + elif typeEquiv g ty g.sbyte_ty then + mkAsmExpr ([AI_conv DT_I2], [], [e], [g.uint16_ty], m) + elif typeEquiv g ty g.byte_ty then + mkAsmExpr ([AI_conv DT_U2], [], [e], [g.uint16_ty], m) + else + e + + /// Expects that |e1| ≥ |e2|. + let mkDiff e1 e2 = mkAsmExpr ([AI_sub], [], [e1; e2], [unsignedEquivalent (tyOfExpr g e1)], m) + + /// diff / step + let mkQuotient diff step = mkAsmExpr ([AI_div_un], [], [diff; step], [tyOfExpr g diff], m) + + /// Whether the total count might not fit in 64 bits. + let couldBeTooBig ty = + let underlying = stripMeasuresFromTy g ty + + typeEquiv g underlying g.int64_ty + || typeEquiv g underlying g.uint64_ty + || typeEquiv g underlying g.nativeint_ty + || typeEquiv g underlying g.unativeint_ty + + /// pseudoCount + 1 + let mkAddOne pseudoCount = + let pseudoCount = mkWiden pseudoCount + let ty = tyOfExpr g pseudoCount + + if couldBeTooBig rangeTy then + mkAsmExpr ([AI_add_ovf_un], [], [pseudoCount; mkTypedOne g m ty], [ty], m) + else + mkAsmExpr ([AI_add], [], [pseudoCount; mkTypedOne g m ty], [ty], m) + + let mkRuntimeCalc mkThrowIfStepIsZero pseudoCount count = + let underlying = stripMeasuresFromTy g rangeTy + + if typeEquiv g underlying g.int64_ty || typeEquiv g underlying g.uint64_ty then + RangeCount.PossiblyOversize (fun mkLoopExpr -> + mkThrowIfStepIsZero + (mkCompGenLetIn m (nameof pseudoCount) (tyOfExpr g pseudoCount) pseudoCount (fun (_, pseudoCount) -> + let wouldOvf = mkILAsmCeq g m pseudoCount (Expr.Const (Const.UInt64 UInt64.MaxValue, m, g.uint64_ty)) + mkCompGenLetIn m (nameof wouldOvf) g.bool_ty wouldOvf (fun (_, wouldOvf) -> + mkLoopExpr count wouldOvf)))) + elif typeEquiv g underlying g.nativeint_ty || typeEquiv g underlying g.unativeint_ty then // We have a nativeint ty whose size we won't know till runtime. + RangeCount.PossiblyOversize (fun mkLoopExpr -> + mkThrowIfStepIsZero + (mkCompGenLetIn m (nameof pseudoCount) (tyOfExpr g pseudoCount) pseudoCount (fun (_, pseudoCount) -> + let wouldOvf = + mkCond + DebugPointAtBinding.NoneAtInvisible + m + g.bool_ty + (mkILAsmCeq g m (mkAsmExpr ([I_sizeof g.ilg.typ_IntPtr], [], [], [g.uint32_ty], m)) (Expr.Const (Const.UInt32 4u, m, g.uint32_ty))) + (mkILAsmCeq g m pseudoCount (Expr.Const (Const.UIntPtr (uint64 UInt32.MaxValue), m, g.unativeint_ty))) + (mkILAsmCeq g m pseudoCount (Expr.Const (Const.UIntPtr UInt64.MaxValue, m, g.unativeint_ty))) + + mkCompGenLetIn m (nameof wouldOvf) g.bool_ty wouldOvf (fun (_, wouldOvf) -> + mkLoopExpr count wouldOvf)))) + else + RangeCount.Safe (mkThrowIfStepIsZero count) + + match start, step, finish with + // start..0..finish + | _, Expr.Const (value = IntegralConst.Zero), _ -> RangeCount.ConstantZeroStep (mkSequential m (mkCallAndIgnoreRangeExpr start step finish) (mkTypedZero g m rangeTy)) + + // 5..1 + // 1..-1..5 + | EmptyRange -> RangeCount.Constant (mkTypedZero g m rangeTy) + + // 1..5 + // 1..2..5 + // 5..-1..1 + | ConstCount count -> RangeCount.Constant (Expr.Const (count, m, nextWidestUnsignedTy rangeTy)) + + // start..finish + // start..1..finish + // + // if finish < start then 0 else finish - start + 1 + | _, Expr.Const (value = IntegralConst.One), _ -> + let mkCount mkAddOne = + let count = mkAddOne (mkDiff finish start) + let countTy = tyOfExpr g count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + countTy + (mkSignednessAppropriateClt rangeTy finish start) + (mkTypedZero g m countTy) + count + + match start, finish with + // The total count could exceed 2⁶⁴. + | Expr.Const (value = Const.Int64 Int64.MinValue), _ | _, Expr.Const (value = Const.Int64 Int64.MaxValue) + | Expr.Const (value = Const.UInt64 UInt64.MinValue), _ | _, Expr.Const (value = Const.UInt64 UInt64.MaxValue) -> + mkRuntimeCalc id (mkCount id) (mkCount mkAddOne) + + // The total count could not exceed 2⁶⁴. + | Expr.Const (value = Const.Int64 _), _ | _, Expr.Const (value = Const.Int64 _) + | Expr.Const (value = Const.UInt64 _), _ | _, Expr.Const (value = Const.UInt64 _) -> + RangeCount.Safe (mkCount mkAddOne) + + | _ -> mkRuntimeCalc id (mkCount id) (mkCount mkAddOne) + + // (Only possible for signed types.) + // + // start..-1..finish + // + // if start < finish then 0 else start - finish + 1 + | _, Expr.Const (value = IntegralConst.MinusOne), _ -> + let mkCount mkAddOne = + let count = mkAddOne (mkDiff start finish) + let countTy = tyOfExpr g count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + countTy + (mkSignednessAppropriateClt rangeTy start finish) + (mkTypedZero g m countTy) + count + + match start, finish with + // The total count could exceed 2⁶⁴. + | Expr.Const (value = Const.Int64 Int64.MaxValue), _ | _, Expr.Const (value = Const.Int64 Int64.MinValue) -> + mkRuntimeCalc id (mkCount id) (mkCount mkAddOne) + + // The total count could not exceed 2⁶⁴. + | Expr.Const (value = Const.Int64 _), _ | _, Expr.Const (value = Const.Int64 _) -> + RangeCount.Safe (mkCount mkAddOne) + + | _ -> mkRuntimeCalc id (mkCount id) (mkCount mkAddOne) + + // start..2..finish + // + // if finish < start then 0 else (finish - start) / step + 1 + | _, Expr.Const (value = IntegralConst.Positive), _ -> + let count = + let count = mkAddOne (mkQuotient (mkDiff finish start) step) + let countTy = tyOfExpr g count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + countTy + (mkSignednessAppropriateClt rangeTy finish start) + (mkTypedZero g m countTy) + count + + // We know that the magnitude of step is greater than one, + // so we know that the total count won't overflow. + RangeCount.Safe count + + // (Only possible for signed types.) + // + // start..-2..finish + // + // if start < finish then 0 else (start - finish) / abs step + 1 + | _, Expr.Const (value = IntegralConst.Negative as negativeStep), _ -> + let count = + let count = mkAddOne (mkQuotient (mkDiff start finish) (Expr.Const (IntegralConst.abs negativeStep, m, unsignedEquivalent rangeTy))) + let countTy = tyOfExpr g count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + countTy + (mkSignednessAppropriateClt rangeTy start finish) + (mkTypedZero g m countTy) + count + + // We know that the magnitude of step is greater than one, + // so we know that the total count won't overflow. + RangeCount.Safe count + + // start..step..finish + // + // if step = 0 then + // ignore ((.. ..) start step finish) // Throws. + // if 0 < step then + // if finish < start then 0 else unsigned (finish - start) / unsigned step + 1 + // else // step < 0 + // if start < finish then 0 else unsigned (start - finish) / unsigned (abs step) + 1 + | _, _, _ -> + // Let the range call throw the appropriate localized + // exception at runtime if step is zero: + // + // if step = 0 then ignore ((.. ..) start step finish) + let mkThrowIfStepIsZero count = + let throwIfStepIsZero = + mkCond + DebugPointAtBinding.NoneAtInvisible + m + g.unit_ty + (mkILAsmCeq g m step (mkTypedZero g m rangeTy)) + (mkCallAndIgnoreRangeExpr start step finish) + (mkUnit g m) + + mkSequential m throwIfStepIsZero count + + let mkCount mkAddOne = + if isSignedIntegerTy g rangeTy then + let positiveStep = + let count = mkAddOne (mkQuotient (mkDiff finish start) step) + let countTy = tyOfExpr g count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + countTy + (mkSignednessAppropriateClt rangeTy finish start) + (mkTypedZero g m countTy) + count + + let negativeStep = + let absStep = mkAsmExpr ([AI_add], [], [mkAsmExpr ([AI_not], [], [step], [rangeTy], m); mkTypedOne g m rangeTy], [rangeTy], m) + let count = mkAddOne (mkQuotient (mkDiff start finish) absStep) + let countTy = tyOfExpr g count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + countTy + (mkSignednessAppropriateClt rangeTy start finish) + (mkTypedZero g m countTy) + count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + (tyOfExpr g positiveStep) + (mkSignednessAppropriateClt rangeTy (mkTypedZero g m rangeTy) step) + positiveStep + negativeStep + else // Unsigned. + let count = mkAddOne (mkQuotient (mkDiff finish start) step) + let countTy = tyOfExpr g count + + mkCond + DebugPointAtBinding.NoneAtInvisible + m + countTy + (mkSignednessAppropriateClt rangeTy finish start) + (mkTypedZero g m countTy) + count + + match start, finish with + // The total count could exceed 2⁶⁴. + | Expr.Const (value = Const.Int64 Int64.MinValue), _ | _, Expr.Const (value = Const.Int64 Int64.MaxValue) + | Expr.Const (value = Const.Int64 Int64.MaxValue), _ | _, Expr.Const (value = Const.Int64 Int64.MinValue) + | Expr.Const (value = Const.UInt64 UInt64.MinValue), _ | _, Expr.Const (value = Const.UInt64 UInt64.MaxValue) -> + mkRuntimeCalc mkThrowIfStepIsZero (mkCount id) (mkCount mkAddOne) + + // The total count could not exceed 2⁶⁴. + | Expr.Const (value = Const.Int64 _), _ | _, Expr.Const (value = Const.Int64 _) + | Expr.Const (value = Const.UInt64 _), _ | _, Expr.Const (value = Const.UInt64 _) -> + RangeCount.Safe (mkThrowIfStepIsZero (mkCount mkAddOne)) + + | _ -> mkRuntimeCalc mkThrowIfStepIsZero (mkCount id) (mkCount mkAddOne) + +let mkOptimizedRangeLoop (g: TcGlobals) (mBody, mFor, mIn, spInWhile) (rangeTy, rangeExpr) (start, step, finish) (buildLoop: (Count -> ((Idx -> Elem -> Body) -> Loop) -> Expr)) = + let inline mkLetBindingsIfNeeded f = + match start, step, finish with + | (Expr.Const _ | Expr.Val _), (Expr.Const _ | Expr.Val _), (Expr.Const _ | Expr.Val _) -> + f start step finish + + | (Expr.Const _ | Expr.Val _), (Expr.Const _ | Expr.Val _), _ -> + mkCompGenLetIn finish.Range (nameof finish) rangeTy finish (fun (_, finish) -> + f start step finish) + + | _, (Expr.Const _ | Expr.Val _), (Expr.Const _ | Expr.Val _) -> + mkCompGenLetIn start.Range (nameof start) rangeTy start (fun (_, start) -> + f start step finish) + + | (Expr.Const _ | Expr.Val _), _, (Expr.Const _ | Expr.Val _) -> + mkCompGenLetIn step.Range (nameof step) rangeTy step (fun (_, step) -> + f start step finish) + + | _, (Expr.Const _ | Expr.Val _), _ -> + mkCompGenLetIn start.Range (nameof start) rangeTy start (fun (_, start) -> + mkCompGenLetIn finish.Range (nameof finish) rangeTy finish (fun (_, finish) -> + f start step finish)) + + | (Expr.Const _ | Expr.Val _), _, _ -> + mkCompGenLetIn step.Range (nameof step) rangeTy step (fun (_, step) -> + mkCompGenLetIn finish.Range (nameof finish) rangeTy finish (fun (_, finish) -> + f start step finish)) + + | _, _, (Expr.Const _ | Expr.Val _) -> + mkCompGenLetIn start.Range (nameof start) rangeTy start (fun (_, start) -> + mkCompGenLetIn step.Range (nameof step) rangeTy step (fun (_, step) -> + f start step finish)) + + | _, _, _ -> + mkCompGenLetIn start.Range (nameof start) rangeTy start (fun (_, start) -> + mkCompGenLetIn step.Range (nameof step) rangeTy step (fun (_, step) -> + mkCompGenLetIn finish.Range (nameof finish) rangeTy finish (fun (_, finish) -> + f start step finish))) + + mkLetBindingsIfNeeded (fun start step finish -> + /// Start at 0 and count up through count - 1. + /// + /// while i < count do + /// + /// i <- i + 1 + let mkCountUpExclusive mkBody count = + let countTy = tyOfExpr g count + + mkCompGenLetMutableIn mIn "i" countTy (mkTypedZero g mIn countTy) (fun (idxVal, idxVar) -> + mkCompGenLetMutableIn mIn "loopVar" rangeTy start (fun (loopVal, loopVar) -> + // loopVar <- loopVar + step + let incrV = mkValSet mIn (mkLocalValRef loopVal) (mkAsmExpr ([AI_add], [], [loopVar; step], [rangeTy], mIn)) + + // i <- i + 1 + let incrI = mkValSet mIn (mkLocalValRef idxVal) (mkAsmExpr ([AI_add], [], [idxVar; mkTypedOne g mIn countTy], [rangeTy], mIn)) + + // + // loopVar <- loopVar + step + // i <- i + 1 + let body = mkSequentials g mBody [mkBody idxVar loopVar; incrV; incrI] + + // i < count + let guard = mkAsmExpr ([AI_clt_un], [], [idxVar; count], [g.bool_ty], mFor) + + // while i < count do + // + // loopVar <- loopVar + step + // i <- i + 1 + mkWhile + g + ( + spInWhile, + WhileLoopForCompiledForEachExprMarker, + guard, + body, + mBody + ) + ) + ) + + /// Start at 0 and count up till we have wrapped around. + /// We only emit this if the type is or may be 64-bit and step is not constant, + /// and we only execute it if step = 1 and |finish - step| = 2⁶⁴ + 1. + /// + /// Logically equivalent to (pseudo-code): + /// + /// while true do + /// + /// loopVar <- loopVar + step + /// i <- i + 1 + /// if i = 0 then break + let mkCountUpInclusive mkBody countTy = + mkCompGenLetMutableIn mFor "guard" g.bool_ty (mkTrue g mFor) (fun (guardVal, guardVar) -> + mkCompGenLetMutableIn mIn "i" countTy (mkTypedZero g mIn countTy) (fun (idxVal, idxVar) -> + mkCompGenLetMutableIn mIn "loopVar" rangeTy start (fun (loopVal, loopVar) -> + // loopVar <- loopVar + step + let incrV = mkValSet mIn (mkLocalValRef loopVal) (mkAsmExpr ([AI_add], [], [loopVar; step], [rangeTy], mIn)) + + // i <- i + 1 + let incrI = mkValSet mIn (mkLocalValRef idxVal) (mkAsmExpr ([AI_add], [], [idxVar; mkTypedOne g mIn countTy], [rangeTy], mIn)) + + // guard <- i <> 0 + let breakIfZero = mkValSet mFor (mkLocalValRef guardVal) (mkAsmExpr ([ILInstr.AI_cgt_un], [], [idxVar; mkTypedZero g mFor countTy], [g.bool_ty], mFor)) + + // + // loopVar <- loopVar + step + // i <- i + 1 + // guard <- i <> 0 + let body = mkSequentials g mBody [mkBody idxVar loopVar; incrV; incrI; breakIfZero] + + // while guard do + // + // loopVar <- loopVar + step + // i <- i + 1 + // guard <- i <> 0 + mkWhile + g + ( + spInWhile, + WhileLoopForCompiledForEachExprMarker, + guardVar, + body, + mBody + ) + ) + ) + ) + + match mkRangeCount g mIn rangeTy rangeExpr start step finish with + | RangeCount.Constant count -> + buildLoop count (fun mkBody -> mkCountUpExclusive mkBody count) + + | RangeCount.ConstantZeroStep count -> + mkCompGenLetIn mIn (nameof count) (tyOfExpr g count) count (fun (_, count) -> + buildLoop count (fun mkBody -> mkCountUpExclusive mkBody count)) + + | RangeCount.Safe count -> + mkCompGenLetIn mIn (nameof count) (tyOfExpr g count) count (fun (_, count) -> + buildLoop count (fun mkBody -> mkCountUpExclusive mkBody count)) + + | RangeCount.PossiblyOversize calc -> + calc (fun count wouldOvf -> + buildLoop count (fun mkBody -> + mkCond + DebugPointAtBinding.NoneAtInvisible + mIn + g.unit_ty + wouldOvf + (mkCountUpInclusive mkBody (tyOfExpr g count)) + (mkCompGenLetIn mIn (nameof count) (tyOfExpr g count) count (fun (_, count) -> mkCountUpExclusive mkBody count)))) + ) let mkDebugPoint m expr = Expr.DebugPoint(DebugPointAtLeafExpr.Yes m, expr) @@ -10132,6 +10890,18 @@ let DetectAndOptimizeForEachExpression g option expr = let spFor = match spFor with DebugPointAtBinding.Yes mFor -> DebugPointAtFor.Yes mFor | _ -> DebugPointAtFor.No mkFastForLoop g (spFor, spIn, mWholeExpr, elemVar, startExpr, (step = 1), finishExpr, bodyExpr) + | OptimizeAllForExpressions, CompiledForEachExpr g (_enumTy, rangeExpr & IntegralRange g (rangeTy, (start, step, finish)), elemVar, bodyExpr, ranges) when + g.langVersion.SupportsFeature LanguageFeature.LowerIntegralRangesToFastLoops + -> + let mBody, _spFor, _spIn, mFor, mIn, spInWhile, _mWhole = ranges + + mkOptimizedRangeLoop + g + (mBody, mFor, mIn, spInWhile) + (rangeTy, rangeExpr) + (start, step, finish) + (fun _count mkLoop -> mkLoop (fun _idxVar loopVar -> mkInvisibleLet elemVar.Range elemVar loopVar bodyExpr)) + | OptimizeAllForExpressions, CompiledForEachExpr g (enumerableTy, enumerableExpr, elemVar, bodyExpr, ranges) -> let mBody, spFor, spIn, mFor, mIn, spInWhile, mWholeExpr = ranges @@ -10225,12 +10995,6 @@ let mkUnitDelayLambda (g: TcGlobals) m e = let uv, _ = mkCompGenLocal m "unitVar" g.unit_ty mkLambda m uv (e, tyOfExpr g e) - -let (|ValApp|_|) g vref expr = - match expr with - | Expr.App (Expr.Val (vref2, _, _), _f0ty, tyargs, args, m) when valRefEq g vref vref2 -> Some (tyargs, args, m) - | _ -> None - let (|UseResumableStateMachinesExpr|_|) g expr = match expr with | ValApp g g.cgh__useResumableCode_vref (_, _, _m) -> Some () diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 534eefc7762..1154b7e8a01 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -218,6 +218,10 @@ val mkCompGenLet: range -> Val -> Expr -> Expr -> Expr /// is returned by the given continuation. Compiler-generated bindings do not give rise to a sequence point in debugging. val mkCompGenLetIn: range -> string -> TType -> Expr -> (Val * Expr -> Expr) -> Expr +/// Make a mutable let-expression that locally binds a compiler-generated value to an expression, where the expression +/// is returned by the given continuation. Compiler-generated bindings do not give rise to a sequence point in debugging. +val mkCompGenLetMutableIn: range -> string -> TType -> Expr -> (Val * Expr -> Expr) -> Expr + /// Make a let-expression that locally binds a value to an expression in an "invisible" way. /// Invisible bindings are not given a sequence point and should not have side effects. val mkInvisibleLet: range -> Val -> Expr -> Expr -> Expr @@ -1960,6 +1964,12 @@ val mkTwo: TcGlobals -> range -> Expr val mkMinusOne: TcGlobals -> range -> Expr +/// Makes an expression holding a constant 0 value of the given numeric type. +val mkTypedZero: g: TcGlobals -> m: range -> ty: TType -> Expr + +/// Makes an expression holding a constant 1 value of the given numeric type. +val mkTypedOne: g: TcGlobals -> m: range -> ty: TType -> Expr + val destInt32: Expr -> int32 option //------------------------------------------------------------------------- @@ -2546,6 +2556,50 @@ val (|SpecialEquatableHeadType|_|): TcGlobals -> TType -> TType list option val (|SpecialNotEquatableHeadType|_|): TcGlobals -> TType -> unit option +/// Matches if the given expression is an application +/// of the range or range-step operator on an integral type +/// and returns the type, start, step, and finish if so. +/// +/// start..finish +/// +/// start..step..finish +[] +val (|IntegralRange|_|): g: TcGlobals -> expr: Expr -> (TType * (Expr * Expr * Expr)) voption + +[] +module IntegralConst = + /// Constant 0. + [] + val (|Zero|_|): c: Const -> unit voption + +/// An expression holding the loop's iteration count. +type Count = Expr + +/// An expression representing the loop's current iteration index. +type Idx = Expr + +/// An expression representing the current loop element. +type Elem = Expr + +/// An expression representing the loop body. +type Body = Expr + +/// An expression representing the overall loop. +type Loop = Expr + +/// Makes an optimized while-loop for a range expression with the given integral start, step, and finish: +/// +/// start..step..finish +/// +/// The buildLoop function enables using the precomputed iteration count in an optional initialization step before the loop is executed. +val mkOptimizedRangeLoop: + g: TcGlobals -> + mBody: range * mFor: range * mIn: range * spInWhile: DebugPointAtWhile -> + rangeTy: TType * rangeExpr: Expr -> + start: Expr * step: Expr * finish: Expr -> + buildLoop: (Count -> ((Idx -> Elem -> Body) -> Loop) -> Expr) -> + Expr + type OptimizeForExpressionOptions = | OptimizeIntRangesOnly | OptimizeAllForExpressions diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index c46e652979d..66205091123 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute Povolit duplikát malými písmeny při atributu RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 56f7493d1d1..f72b6948a76 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute DU in Kleinbuchstaben zulassen, wenn requireQualifiedAccess-Attribut diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index a35a6bce598..12f4457f73e 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute Permitir DU en minúsculas con el atributo RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index aeeb53ac93d..9477b8b7680 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute Autoriser les DU en minuscules pour l'attribut RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 390160ee95e..b17ab37848d 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute Consentire l’unione discriminata minuscola quando l'attributo RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index e57dac6f312..fa6fb18bda6 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute RequireQualifiedAccess 属性の場合に小文字 DU を許可する diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index 2d6a4e5e22b..1cf38ecd52e 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute RequireQualifiedAccess 특성이 있는 경우 소문자 DU 허용 diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index db56cd3ba49..a36f1d7cb51 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute Zezwalaj na małą literę DU, gdy występuje RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 7566fb49ae1..129e7cb792e 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute Permitir DU em minúsculas quando o atributo RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 90c39f565ee..d0acf9ef585 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute Разрешить du в нижнем регистре, если атрибут RequireQualifiedAccess diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 496bc35ef95..555f737153e 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute RequireQualifiedAccess özniteliğinde küçük harf DU'ya izin ver diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 94bd2ea062c..72e2ea8f447 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute 当 RequireQualifiedAccess 属性时允许小写 DU diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 9334199ba0f..817e803623b 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -387,6 +387,11 @@ Optimizes interpolated strings in certain cases, by lowering to concatenation + + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + Optimizes certain uses of the integral range (..) and range-step (.. ..) operators to fast while-loops. + + Allow lowercase DU when RequireQualifiedAccess attribute RequireQualifiedAccess 屬性時允許小寫 DU diff --git a/src/FSharp.Build/Microsoft.FSharp.Targets b/src/FSharp.Build/Microsoft.FSharp.Targets index ed5111f5edb..3e5e347d12f 100644 --- a/src/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/FSharp.Build/Microsoft.FSharp.Targets @@ -275,7 +275,8 @@ this file. $(VersionFile); $(KeyOriginatorFile); $(UseSource); - $(LoadSource)" + $(LoadSource); + $(SourceLink)" Outputs="@(DocFileItem); @(IntermediateAssembly); @(IntermediateRefAssembly); diff --git a/src/FSharp.Core/FSharp.Core.fsproj b/src/FSharp.Core/FSharp.Core.fsproj index c2ad1d456a3..0f9fe0fb624 100644 --- a/src/FSharp.Core/FSharp.Core.fsproj +++ b/src/FSharp.Core/FSharp.Core.fsproj @@ -26,7 +26,7 @@ $(OtherFlags) --nowarn:3513 $(OtherFlags) --compiling-fslib --compiling-fslib-40 --maxerrors:100 --extraoptimizationloops:1 - $(OtherFlags) --realsig- + $(OtherFlags) --realsig- true true diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsProperty.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsProperty.fs new file mode 100644 index 00000000000..42c94f1e474 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeTargetsIsProperty.fs @@ -0,0 +1,10 @@ + +open System + +[] +type PropertyLevelAttribute() = + inherit Attribute() + +type U = + | [] A + | [] B diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs index 5d930ea1e14..0bdc9306cb7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -71,6 +71,21 @@ module CustomAttributes_AttributeUsage = |> withLangVersionPreview |> verifyCompileAndRun |> shouldSucceed + + // SOURCE=AttributeTargetsIsProperty.fs # AttributeTargetsIsProperty.fs + [] + let ``AttributeTargetsIsProperty_fs`` compilation = + compilation + |> verifyCompile + |> shouldSucceed + + // SOURCE=AttributeTargetsIsProperty.fs # AttributeTargetsIsProperty.fs + [] + let ``AttributeTargetsIsProperty_fs preview`` compilation = + compilation + |> withLangVersionPreview + |> verifyCompile + |> shouldSucceed // SOURCE=ConditionalAttribute.fs # ConditionalAttribute.fs [] diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/ImportDeclarations.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/ImportDeclarations.fs index 1f93d4b3bab..851746df35c 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/ImportDeclarations.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ImportDeclarations/ImportDeclarations.fs @@ -107,4 +107,75 @@ module ImportDeclarations = |> verifyCompileAndRun |> shouldSucceed + [] + let ImplementImportedAbstractBaseMethodsFailsIfUsed ()= + FSharp """ +module Testing +open System.Text.Json +open System.Text.Json.Serialization + +type StringTrimJsonSerializer(o: JsonSerializerOptions) = + inherit JsonConverter() + + override this.Read(reader, _, _) = + match reader.TokenType with + | JsonTokenType.String -> reader.GetString().Trim() + | _ -> JsonException("Type is not a string") |> raise + + override this.Write(writer, objectToWrite, options) = base.Write(writer, objectToWrite, options) + +type SomeType = { AField: string } + +let serialize item = + let options = JsonSerializerOptions() + StringTrimJsonSerializer options |> options.Converters.Add + JsonSerializer.Serialize(item, options) + +[] +let main _ = + { AField = "a" } + |> serialize + |> ignore + 0""" + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 1201, Line 15, Col 59, Line 15, Col 101, "Cannot call an abstract base member: 'Write'") + ] + + + [] + let ImplementImportedAbstractBaseMethodsFailsIfNotUsed ()= + FSharp """ +module Testing + +open System.Text.Json +open System.Text.Json.Serialization + +type StringTrimJsonSerializer(o: JsonSerializerOptions) = + inherit JsonConverter() + override this.Read(reader, _, _) = + match reader.TokenType with + | JsonTokenType.String -> reader.GetString().Trim() + | _ -> JsonException("Type is not a string") |> raise + override this.Write(writer, objectToWrite, options) = base.Write(writer, objectToWrite, options) + +type SomeType = { AField: int } + +let serialize item = + let options = JsonSerializerOptions() + StringTrimJsonSerializer options |> options.Converters.Add + JsonSerializer.Serialize(item, options) + +[] +let main _ = + { AField = 1 } + |> serialize + |>ignore + 0""" + |> verifyCompile + |> shouldFail + |> withDiagnostics [ + (Error 1201, Line 13, Col 59, Line 13, Col 101, "Cannot call an abstract base member: 'Write'") + ] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl index ddc2e25a3e9..1af6d7ef89d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpr07.fs.RealInternalSignatureOff.il.bsl @@ -166,7 +166,10 @@ { .maxstack 9 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0) + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) IL_0000: ldc.i4.1 IL_0001: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1::.ctor(!0) IL_0006: stloc.0 @@ -175,32 +178,52 @@ IL_000d: ldarg.0 IL_000e: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ IL_0013: ldc.i4.0 - IL_0014: ldc.i4.1 - IL_0015: ldc.i4.3 - IL_0016: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_001b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0020: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0025: ldarg.0 - IL_0026: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_002b: ldloc.0 - IL_002c: newobj instance void Program/'res7@10-1'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: ldc.i4.0 + IL_0017: stloc.3 + IL_0018: ldloc.2 + IL_0019: ldc.i4.4 + IL_001a: conv.i8 + IL_001b: bge.un.s IL_0032 + + IL_001d: ldloca.s V_1 + IL_001f: ldloc.3 + IL_0020: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0025: nop + IL_0026: ldloc.3 + IL_0027: ldc.i4.1 + IL_0028: add + IL_0029: stloc.3 + IL_002a: ldloc.2 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.2 + IL_002f: nop + IL_0030: br.s IL_0018 + + IL_0032: ldloca.s V_1 + IL_0034: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0039: ldarg.0 + IL_003a: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_003f: ldloc.0 + IL_0040: newobj instance void Program/'res7@10-1'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0031: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, + IL_0045: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::For(class [runtime]System.Collections.Generic.IEnumerable`1, class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_0036: ldarg.0 - IL_0037: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_003c: ldarg.0 - IL_003d: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ - IL_0042: ldloc.0 - IL_0043: newobj instance void Program/'res7@12-2'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, + IL_004a: ldarg.0 + IL_004b: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_0050: ldarg.0 + IL_0051: ldfld class [ComputationExprLibrary]Library.EventuallyBuilder Program/res7@9::builder@ + IL_0056: ldloc.0 + IL_0057: newobj instance void Program/'res7@12-2'::.ctor(class [ComputationExprLibrary]Library.EventuallyBuilder, class [FSharp.Core]Microsoft.FSharp.Core.FSharpRef`1) - IL_0048: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) - IL_004d: tail. - IL_004f: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Combine(class [ComputationExprLibrary]Library.Eventually`1, + IL_005c: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Delay(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>) + IL_0061: tail. + IL_0063: callvirt instance class [ComputationExprLibrary]Library.Eventually`1 [ComputationExprLibrary]Library.EventuallyBuilder::Combine(class [ComputationExprLibrary]Library.Eventually`1, class [ComputationExprLibrary]Library.Eventually`1) - IL_0054: ret + IL_0068: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs index b1e8ca4f4c8..14a4a7e4270 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputationExpressions/ComputationExpressions.fs @@ -114,4 +114,5 @@ module ComputationExpressions = let ``ComputationExpr07_realsig=false`` compilation = compilation |> withoutRealInternalSignature + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs new file mode 100644 index 00000000000..b97d6e164fb --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs @@ -0,0 +1,36 @@ +namespace EmittedIL + +open FSharp.Test +open FSharp.Test.Compiler +open Xunit + +module ComputedCollections = + let verifyCompilation compilation = + compilation + |> asExe + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> withOptimize + |> withEmbeddedPdb + |> withEmbedAllSource + |> ignoreWarnings + |> verifyILBaseline + + [] + let ``Int32RangeArrays_fs`` compilation = + compilation + |> verifyCompilation + + [] + let ``Int32RangeLists_fs`` compilation = + compilation + |> verifyCompilation + + [] + let ``UInt64RangeArrays_fs`` compilation = + compilation + |> verifyCompilation + + [] + let ``UInt64RangeLists_fs`` compilation = + compilation + |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs new file mode 100644 index 00000000000..6d51226e87d --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs @@ -0,0 +1,25 @@ +let f1 () = [|1..10|] +let f2 () = [|10..1|] +let f3 () = [|1..1..10|] +let f4 () = [|1..2..10|] +let f5 () = [|10..1..1|] +let f6 () = [|1..-1..10|] +let f7 () = [|10..-1..1|] +let f8 () = [|10..-2..1|] +let f9 start = [|start..10|] +let f10 finish = [|1..finish|] +let f11 start finish = [|start..finish|] +let f12 start = [|start..1..10|] +let f13 step = [|1..step..10|] +let f14 finish = [|1..1..finish|] +let f15 start step = [|start..step..10|] +let f16 start finish = [|start..1..finish|] +let f17 step finish = [|1..step..finish|] +let f18 start step finish = [|start..step..finish|] +let f19 f = [|f ()..10|] +let f20 f = [|1..f ()|] +let f21 f g = [|f ()..g()|] +let f22 f = [|f ()..1..10|] +let f23 f = [|1..f ()..10|] +let f24 f = [|1..1..f ()|] +let f25 f g h = [|f ()..g ()..h ()|] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs.il.bsl new file mode 100644 index 00000000000..36ec223fd78 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeArrays.fs.il.bsl @@ -0,0 +1,1831 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static int32[] f1() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stelem.i4 + IL_0016: ldloc.2 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.2 + IL_001a: ldloc.1 + IL_001b: ldc.i4.1 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldc.i4.s 10 + IL_0022: conv.i8 + IL_0023: blt.un.s IL_0011 + + IL_0025: ldloc.0 + IL_0026: ret + } + + .method public static int32[] f2() cil managed + { + + .maxstack 8 + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: ret + } + + .method public static int32[] f3() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stelem.i4 + IL_0016: ldloc.2 + IL_0017: ldc.i4.1 + IL_0018: add + IL_0019: stloc.2 + IL_001a: ldloc.1 + IL_001b: ldc.i4.1 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldc.i4.s 10 + IL_0022: conv.i8 + IL_0023: blt.un.s IL_0011 + + IL_0025: ldloc.0 + IL_0026: ret + } + + .method public static int32[] f4() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.5 + IL_0001: conv.i8 + IL_0002: conv.ovf.i.un + IL_0003: newarr [runtime]System.Int32 + IL_0008: stloc.0 + IL_0009: ldc.i4.0 + IL_000a: conv.i8 + IL_000b: stloc.1 + IL_000c: ldc.i4.1 + IL_000d: stloc.2 + IL_000e: br.s IL_001e + + IL_0010: ldloc.0 + IL_0011: ldloc.1 + IL_0012: conv.i + IL_0013: ldloc.2 + IL_0014: stelem.i4 + IL_0015: ldloc.2 + IL_0016: ldc.i4.2 + IL_0017: add + IL_0018: stloc.2 + IL_0019: ldloc.1 + IL_001a: ldc.i4.1 + IL_001b: conv.i8 + IL_001c: add + IL_001d: stloc.1 + IL_001e: ldloc.1 + IL_001f: ldc.i4.5 + IL_0020: conv.i8 + IL_0021: blt.un.s IL_0010 + + IL_0023: ldloc.0 + IL_0024: ret + } + + .method public static int32[] f5() cil managed + { + + .maxstack 8 + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: ret + } + + .method public static int32[] f6() cil managed + { + + .maxstack 8 + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: ret + } + + .method public static int32[] f7() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.Int32 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.s 10 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.0 + IL_0013: ldloc.1 + IL_0014: conv.i + IL_0015: ldloc.2 + IL_0016: stelem.i4 + IL_0017: ldloc.2 + IL_0018: ldc.i4.m1 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: conv.i8 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldc.i4.s 10 + IL_0023: conv.i8 + IL_0024: blt.un.s IL_0012 + + IL_0026: ldloc.0 + IL_0027: ret + } + + .method public static int32[] f8() cil managed + { + + .maxstack 5 + .locals init (int32[] V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.5 + IL_0001: conv.i8 + IL_0002: conv.ovf.i.un + IL_0003: newarr [runtime]System.Int32 + IL_0008: stloc.0 + IL_0009: ldc.i4.0 + IL_000a: conv.i8 + IL_000b: stloc.1 + IL_000c: ldc.i4.s 10 + IL_000e: stloc.2 + IL_000f: br.s IL_0020 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stelem.i4 + IL_0016: ldloc.2 + IL_0017: ldc.i4.s -2 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: conv.i8 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldc.i4.5 + IL_0022: conv.i8 + IL_0023: blt.un.s IL_0011 + + IL_0025: ldloc.0 + IL_0026: ret + } + + .method public static int32[] f9(int32 start) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: ldarg.0 + IL_000e: sub + IL_000f: conv.i8 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: stloc.1 + IL_0017: ldloc.1 + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: bge.un.s IL_0022 + + IL_001c: call !!0[] [runtime]System.Array::Empty() + IL_0021: ret + + IL_0022: ldloc.1 + IL_0023: conv.ovf.i.un + IL_0024: newarr [runtime]System.Int32 + IL_0029: stloc.2 + IL_002a: ldc.i4.0 + IL_002b: conv.i8 + IL_002c: stloc.3 + IL_002d: ldarg.0 + IL_002e: stloc.s V_4 + IL_0030: br.s IL_0043 + + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i + IL_0035: ldloc.s V_4 + IL_0037: stelem.i4 + IL_0038: ldloc.s V_4 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: stloc.s V_4 + IL_003e: ldloc.3 + IL_003f: ldc.i4.1 + IL_0040: conv.i8 + IL_0041: add + IL_0042: stloc.3 + IL_0043: ldloc.3 + IL_0044: ldloc.0 + IL_0045: blt.un.s IL_0032 + + IL_0047: ldloc.2 + IL_0048: ret + } + + .method public static int32[] f10(int32 finish) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldloc.0 + IL_0014: stloc.1 + IL_0015: ldloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: bge.un.s IL_0020 + + IL_001a: call !!0[] [runtime]System.Array::Empty() + IL_001f: ret + + IL_0020: ldloc.1 + IL_0021: conv.ovf.i.un + IL_0022: newarr [runtime]System.Int32 + IL_0027: stloc.2 + IL_0028: ldc.i4.0 + IL_0029: conv.i8 + IL_002a: stloc.3 + IL_002b: ldc.i4.1 + IL_002c: stloc.s V_4 + IL_002e: br.s IL_0041 + + IL_0030: ldloc.2 + IL_0031: ldloc.3 + IL_0032: conv.i + IL_0033: ldloc.s V_4 + IL_0035: stelem.i4 + IL_0036: ldloc.s V_4 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: stloc.s V_4 + IL_003c: ldloc.3 + IL_003d: ldc.i4.1 + IL_003e: conv.i8 + IL_003f: add + IL_0040: stloc.3 + IL_0041: ldloc.3 + IL_0042: ldloc.0 + IL_0043: blt.un.s IL_0030 + + IL_0045: ldloc.2 + IL_0046: ret + } + + .method public static int32[] f11(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldloc.0 + IL_0014: stloc.1 + IL_0015: ldloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: bge.un.s IL_0020 + + IL_001a: call !!0[] [runtime]System.Array::Empty() + IL_001f: ret + + IL_0020: ldloc.1 + IL_0021: conv.ovf.i.un + IL_0022: newarr [runtime]System.Int32 + IL_0027: stloc.2 + IL_0028: ldc.i4.0 + IL_0029: conv.i8 + IL_002a: stloc.3 + IL_002b: ldarg.0 + IL_002c: stloc.s V_4 + IL_002e: br.s IL_0041 + + IL_0030: ldloc.2 + IL_0031: ldloc.3 + IL_0032: conv.i + IL_0033: ldloc.s V_4 + IL_0035: stelem.i4 + IL_0036: ldloc.s V_4 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: stloc.s V_4 + IL_003c: ldloc.3 + IL_003d: ldc.i4.1 + IL_003e: conv.i8 + IL_003f: add + IL_0040: stloc.3 + IL_0041: ldloc.3 + IL_0042: ldloc.0 + IL_0043: blt.un.s IL_0030 + + IL_0045: ldloc.2 + IL_0046: ret + } + + .method public static int32[] f12(int32 start) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: ldarg.0 + IL_000e: sub + IL_000f: conv.i8 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: stloc.1 + IL_0017: ldloc.1 + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: bge.un.s IL_0022 + + IL_001c: call !!0[] [runtime]System.Array::Empty() + IL_0021: ret + + IL_0022: ldloc.1 + IL_0023: conv.ovf.i.un + IL_0024: newarr [runtime]System.Int32 + IL_0029: stloc.2 + IL_002a: ldc.i4.0 + IL_002b: conv.i8 + IL_002c: stloc.3 + IL_002d: ldarg.0 + IL_002e: stloc.s V_4 + IL_0030: br.s IL_0043 + + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i + IL_0035: ldloc.s V_4 + IL_0037: stelem.i4 + IL_0038: ldloc.s V_4 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: stloc.s V_4 + IL_003e: ldloc.3 + IL_003f: ldc.i4.1 + IL_0040: conv.i8 + IL_0041: add + IL_0042: stloc.3 + IL_0043: ldloc.3 + IL_0044: ldloc.0 + IL_0045: blt.un.s IL_0032 + + IL_0047: ldloc.2 + IL_0048: ret + } + + .method public static int32[] f13(int32 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0011 + + IL_0004: ldc.i4.1 + IL_0005: ldarg.0 + IL_0006: ldc.i4.s 10 + IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000d: pop + IL_000e: nop + IL_000f: br.s IL_0012 + + IL_0011: nop + IL_0012: ldc.i4.0 + IL_0013: ldarg.0 + IL_0014: bge.s IL_002d + + IL_0016: ldc.i4.s 10 + IL_0018: ldc.i4.1 + IL_0019: bge.s IL_0020 + + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: nop + IL_001e: br.s IL_0045 + + IL_0020: ldc.i4.s 10 + IL_0022: ldc.i4.1 + IL_0023: sub + IL_0024: ldarg.0 + IL_0025: div.un + IL_0026: conv.i8 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: nop + IL_002b: br.s IL_0045 + + IL_002d: ldc.i4.1 + IL_002e: ldc.i4.s 10 + IL_0030: bge.s IL_0037 + + IL_0032: ldc.i4.0 + IL_0033: conv.i8 + IL_0034: nop + IL_0035: br.s IL_0045 + + IL_0037: ldc.i4.1 + IL_0038: ldc.i4.s 10 + IL_003a: sub + IL_003b: ldarg.0 + IL_003c: not + IL_003d: ldc.i4.1 + IL_003e: add + IL_003f: div.un + IL_0040: conv.i8 + IL_0041: ldc.i4.1 + IL_0042: conv.i8 + IL_0043: add + IL_0044: nop + IL_0045: stloc.0 + IL_0046: ldloc.0 + IL_0047: stloc.1 + IL_0048: ldloc.1 + IL_0049: ldc.i4.1 + IL_004a: conv.i8 + IL_004b: bge.un.s IL_0053 + + IL_004d: call !!0[] [runtime]System.Array::Empty() + IL_0052: ret + + IL_0053: ldloc.1 + IL_0054: conv.ovf.i.un + IL_0055: newarr [runtime]System.Int32 + IL_005a: stloc.2 + IL_005b: ldc.i4.0 + IL_005c: conv.i8 + IL_005d: stloc.3 + IL_005e: ldc.i4.1 + IL_005f: stloc.s V_4 + IL_0061: br.s IL_0074 + + IL_0063: ldloc.2 + IL_0064: ldloc.3 + IL_0065: conv.i + IL_0066: ldloc.s V_4 + IL_0068: stelem.i4 + IL_0069: ldloc.s V_4 + IL_006b: ldarg.0 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.3 + IL_0070: ldc.i4.1 + IL_0071: conv.i8 + IL_0072: add + IL_0073: stloc.3 + IL_0074: ldloc.3 + IL_0075: ldloc.0 + IL_0076: blt.un.s IL_0063 + + IL_0078: ldloc.2 + IL_0079: ret + } + + .method public static int32[] f14(int32 finish) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldloc.0 + IL_0014: stloc.1 + IL_0015: ldloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: bge.un.s IL_0020 + + IL_001a: call !!0[] [runtime]System.Array::Empty() + IL_001f: ret + + IL_0020: ldloc.1 + IL_0021: conv.ovf.i.un + IL_0022: newarr [runtime]System.Int32 + IL_0027: stloc.2 + IL_0028: ldc.i4.0 + IL_0029: conv.i8 + IL_002a: stloc.3 + IL_002b: ldc.i4.1 + IL_002c: stloc.s V_4 + IL_002e: br.s IL_0041 + + IL_0030: ldloc.2 + IL_0031: ldloc.3 + IL_0032: conv.i + IL_0033: ldloc.s V_4 + IL_0035: stelem.i4 + IL_0036: ldloc.s V_4 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: stloc.s V_4 + IL_003c: ldloc.3 + IL_003d: ldc.i4.1 + IL_003e: conv.i8 + IL_003f: add + IL_0040: stloc.3 + IL_0041: ldloc.3 + IL_0042: ldloc.0 + IL_0043: blt.un.s IL_0030 + + IL_0045: ldloc.2 + IL_0046: ret + } + + .method public static int32[] f15(int32 start, + int32 step) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0011 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldc.i4.s 10 + IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000d: pop + IL_000e: nop + IL_000f: br.s IL_0012 + + IL_0011: nop + IL_0012: ldc.i4.0 + IL_0013: ldarg.1 + IL_0014: bge.s IL_002d + + IL_0016: ldc.i4.s 10 + IL_0018: ldarg.0 + IL_0019: bge.s IL_0020 + + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: nop + IL_001e: br.s IL_0045 + + IL_0020: ldc.i4.s 10 + IL_0022: ldarg.0 + IL_0023: sub + IL_0024: ldarg.1 + IL_0025: div.un + IL_0026: conv.i8 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: nop + IL_002b: br.s IL_0045 + + IL_002d: ldarg.0 + IL_002e: ldc.i4.s 10 + IL_0030: bge.s IL_0037 + + IL_0032: ldc.i4.0 + IL_0033: conv.i8 + IL_0034: nop + IL_0035: br.s IL_0045 + + IL_0037: ldarg.0 + IL_0038: ldc.i4.s 10 + IL_003a: sub + IL_003b: ldarg.1 + IL_003c: not + IL_003d: ldc.i4.1 + IL_003e: add + IL_003f: div.un + IL_0040: conv.i8 + IL_0041: ldc.i4.1 + IL_0042: conv.i8 + IL_0043: add + IL_0044: nop + IL_0045: stloc.0 + IL_0046: ldloc.0 + IL_0047: stloc.1 + IL_0048: ldloc.1 + IL_0049: ldc.i4.1 + IL_004a: conv.i8 + IL_004b: bge.un.s IL_0053 + + IL_004d: call !!0[] [runtime]System.Array::Empty() + IL_0052: ret + + IL_0053: ldloc.1 + IL_0054: conv.ovf.i.un + IL_0055: newarr [runtime]System.Int32 + IL_005a: stloc.2 + IL_005b: ldc.i4.0 + IL_005c: conv.i8 + IL_005d: stloc.3 + IL_005e: ldarg.0 + IL_005f: stloc.s V_4 + IL_0061: br.s IL_0074 + + IL_0063: ldloc.2 + IL_0064: ldloc.3 + IL_0065: conv.i + IL_0066: ldloc.s V_4 + IL_0068: stelem.i4 + IL_0069: ldloc.s V_4 + IL_006b: ldarg.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.3 + IL_0070: ldc.i4.1 + IL_0071: conv.i8 + IL_0072: add + IL_0073: stloc.3 + IL_0074: ldloc.3 + IL_0075: ldloc.0 + IL_0076: blt.un.s IL_0063 + + IL_0078: ldloc.2 + IL_0079: ret + } + + .method public static int32[] f16(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldloc.0 + IL_0014: stloc.1 + IL_0015: ldloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: bge.un.s IL_0020 + + IL_001a: call !!0[] [runtime]System.Array::Empty() + IL_001f: ret + + IL_0020: ldloc.1 + IL_0021: conv.ovf.i.un + IL_0022: newarr [runtime]System.Int32 + IL_0027: stloc.2 + IL_0028: ldc.i4.0 + IL_0029: conv.i8 + IL_002a: stloc.3 + IL_002b: ldarg.0 + IL_002c: stloc.s V_4 + IL_002e: br.s IL_0041 + + IL_0030: ldloc.2 + IL_0031: ldloc.3 + IL_0032: conv.i + IL_0033: ldloc.s V_4 + IL_0035: stelem.i4 + IL_0036: ldloc.s V_4 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: stloc.s V_4 + IL_003c: ldloc.3 + IL_003d: ldc.i4.1 + IL_003e: conv.i8 + IL_003f: add + IL_0040: stloc.3 + IL_0041: ldloc.3 + IL_0042: ldloc.0 + IL_0043: blt.un.s IL_0030 + + IL_0045: ldloc.2 + IL_0046: ret + } + + .method public static int32[] f17(int32 step, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0010 + + IL_0004: ldc.i4.1 + IL_0005: ldarg.0 + IL_0006: ldarg.1 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_002a + + IL_0015: ldarg.1 + IL_0016: ldc.i4.1 + IL_0017: bge.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0040 + + IL_001e: ldarg.1 + IL_001f: ldc.i4.1 + IL_0020: sub + IL_0021: ldarg.0 + IL_0022: div.un + IL_0023: conv.i8 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: nop + IL_0028: br.s IL_0040 + + IL_002a: ldc.i4.1 + IL_002b: ldarg.1 + IL_002c: bge.s IL_0033 + + IL_002e: ldc.i4.0 + IL_002f: conv.i8 + IL_0030: nop + IL_0031: br.s IL_0040 + + IL_0033: ldc.i4.1 + IL_0034: ldarg.1 + IL_0035: sub + IL_0036: ldarg.0 + IL_0037: not + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: div.un + IL_003b: conv.i8 + IL_003c: ldc.i4.1 + IL_003d: conv.i8 + IL_003e: add + IL_003f: nop + IL_0040: stloc.0 + IL_0041: ldloc.0 + IL_0042: stloc.1 + IL_0043: ldloc.1 + IL_0044: ldc.i4.1 + IL_0045: conv.i8 + IL_0046: bge.un.s IL_004e + + IL_0048: call !!0[] [runtime]System.Array::Empty() + IL_004d: ret + + IL_004e: ldloc.1 + IL_004f: conv.ovf.i.un + IL_0050: newarr [runtime]System.Int32 + IL_0055: stloc.2 + IL_0056: ldc.i4.0 + IL_0057: conv.i8 + IL_0058: stloc.3 + IL_0059: ldc.i4.1 + IL_005a: stloc.s V_4 + IL_005c: br.s IL_006f + + IL_005e: ldloc.2 + IL_005f: ldloc.3 + IL_0060: conv.i + IL_0061: ldloc.s V_4 + IL_0063: stelem.i4 + IL_0064: ldloc.s V_4 + IL_0066: ldarg.0 + IL_0067: add + IL_0068: stloc.s V_4 + IL_006a: ldloc.3 + IL_006b: ldc.i4.1 + IL_006c: conv.i8 + IL_006d: add + IL_006e: stloc.3 + IL_006f: ldloc.3 + IL_0070: ldloc.0 + IL_0071: blt.un.s IL_005e + + IL_0073: ldloc.2 + IL_0074: ret + } + + .method public static int32[] f18(int32 start, + int32 step, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32[] V_2, + uint64 V_3, + int32 V_4) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0010 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldarg.2 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.1 + IL_0013: bge.s IL_002a + + IL_0015: ldarg.2 + IL_0016: ldarg.0 + IL_0017: bge.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0040 + + IL_001e: ldarg.2 + IL_001f: ldarg.0 + IL_0020: sub + IL_0021: ldarg.1 + IL_0022: div.un + IL_0023: conv.i8 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: nop + IL_0028: br.s IL_0040 + + IL_002a: ldarg.0 + IL_002b: ldarg.2 + IL_002c: bge.s IL_0033 + + IL_002e: ldc.i4.0 + IL_002f: conv.i8 + IL_0030: nop + IL_0031: br.s IL_0040 + + IL_0033: ldarg.0 + IL_0034: ldarg.2 + IL_0035: sub + IL_0036: ldarg.1 + IL_0037: not + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: div.un + IL_003b: conv.i8 + IL_003c: ldc.i4.1 + IL_003d: conv.i8 + IL_003e: add + IL_003f: nop + IL_0040: stloc.0 + IL_0041: ldloc.0 + IL_0042: stloc.1 + IL_0043: ldloc.1 + IL_0044: ldc.i4.1 + IL_0045: conv.i8 + IL_0046: bge.un.s IL_004e + + IL_0048: call !!0[] [runtime]System.Array::Empty() + IL_004d: ret + + IL_004e: ldloc.1 + IL_004f: conv.ovf.i.un + IL_0050: newarr [runtime]System.Int32 + IL_0055: stloc.2 + IL_0056: ldc.i4.0 + IL_0057: conv.i8 + IL_0058: stloc.3 + IL_0059: ldarg.0 + IL_005a: stloc.s V_4 + IL_005c: br.s IL_006f + + IL_005e: ldloc.2 + IL_005f: ldloc.3 + IL_0060: conv.i + IL_0061: ldloc.s V_4 + IL_0063: stelem.i4 + IL_0064: ldloc.s V_4 + IL_0066: ldarg.1 + IL_0067: add + IL_0068: stloc.s V_4 + IL_006a: ldloc.3 + IL_006b: ldc.i4.1 + IL_006c: conv.i8 + IL_006d: add + IL_006e: stloc.3 + IL_006f: ldloc.3 + IL_0070: ldloc.0 + IL_0071: blt.un.s IL_005e + + IL_0073: ldloc.2 + IL_0074: ret + } + + .method public static int32[] f19(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + uint64 V_1, + uint64 V_2, + int32[] V_3, + uint64 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: ldloc.0 + IL_000b: bge.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001b + + IL_0012: ldc.i4.s 10 + IL_0014: ldloc.0 + IL_0015: sub + IL_0016: conv.i8 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: nop + IL_001b: stloc.1 + IL_001c: ldloc.1 + IL_001d: stloc.2 + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: conv.i8 + IL_0021: bge.un.s IL_0029 + + IL_0023: call !!0[] [runtime]System.Array::Empty() + IL_0028: ret + + IL_0029: ldloc.2 + IL_002a: conv.ovf.i.un + IL_002b: newarr [runtime]System.Int32 + IL_0030: stloc.3 + IL_0031: ldc.i4.0 + IL_0032: conv.i8 + IL_0033: stloc.s V_4 + IL_0035: ldloc.0 + IL_0036: stloc.s V_5 + IL_0038: br.s IL_004e + + IL_003a: ldloc.3 + IL_003b: ldloc.s V_4 + IL_003d: conv.i + IL_003e: ldloc.s V_5 + IL_0040: stelem.i4 + IL_0041: ldloc.s V_5 + IL_0043: ldc.i4.1 + IL_0044: add + IL_0045: stloc.s V_5 + IL_0047: ldloc.s V_4 + IL_0049: ldc.i4.1 + IL_004a: conv.i8 + IL_004b: add + IL_004c: stloc.s V_4 + IL_004e: ldloc.s V_4 + IL_0050: ldloc.1 + IL_0051: blt.un.s IL_003a + + IL_0053: ldloc.3 + IL_0054: ret + } + + .method public static int32[] f20(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + uint64 V_1, + uint64 V_2, + int32[] V_3, + uint64 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: bge.s IL_0011 + + IL_000c: ldc.i4.0 + IL_000d: conv.i8 + IL_000e: nop + IL_000f: br.s IL_0019 + + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: sub + IL_0014: conv.i8 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: nop + IL_0019: stloc.1 + IL_001a: ldloc.1 + IL_001b: stloc.2 + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: bge.un.s IL_0027 + + IL_0021: call !!0[] [runtime]System.Array::Empty() + IL_0026: ret + + IL_0027: ldloc.2 + IL_0028: conv.ovf.i.un + IL_0029: newarr [runtime]System.Int32 + IL_002e: stloc.3 + IL_002f: ldc.i4.0 + IL_0030: conv.i8 + IL_0031: stloc.s V_4 + IL_0033: ldc.i4.1 + IL_0034: stloc.s V_5 + IL_0036: br.s IL_004c + + IL_0038: ldloc.3 + IL_0039: ldloc.s V_4 + IL_003b: conv.i + IL_003c: ldloc.s V_5 + IL_003e: stelem.i4 + IL_003f: ldloc.s V_5 + IL_0041: ldc.i4.1 + IL_0042: add + IL_0043: stloc.s V_5 + IL_0045: ldloc.s V_4 + IL_0047: ldc.i4.1 + IL_0048: conv.i8 + IL_0049: add + IL_004a: stloc.s V_4 + IL_004c: ldloc.s V_4 + IL_004e: ldloc.1 + IL_004f: blt.un.s IL_0038 + + IL_0051: ldloc.3 + IL_0052: ret + } + + .method public static int32[] f21(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + uint64 V_2, + uint64 V_3, + int32[] V_4, + uint64 V_5, + int32 V_6) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldloc.1 + IL_0011: ldloc.0 + IL_0012: bge.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_0021 + + IL_0019: ldloc.1 + IL_001a: ldloc.0 + IL_001b: sub + IL_001c: conv.i8 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: add + IL_0020: nop + IL_0021: stloc.2 + IL_0022: ldloc.2 + IL_0023: stloc.3 + IL_0024: ldloc.3 + IL_0025: ldc.i4.1 + IL_0026: conv.i8 + IL_0027: bge.un.s IL_002f + + IL_0029: call !!0[] [runtime]System.Array::Empty() + IL_002e: ret + + IL_002f: ldloc.3 + IL_0030: conv.ovf.i.un + IL_0031: newarr [runtime]System.Int32 + IL_0036: stloc.s V_4 + IL_0038: ldc.i4.0 + IL_0039: conv.i8 + IL_003a: stloc.s V_5 + IL_003c: ldloc.0 + IL_003d: stloc.s V_6 + IL_003f: br.s IL_0056 + + IL_0041: ldloc.s V_4 + IL_0043: ldloc.s V_5 + IL_0045: conv.i + IL_0046: ldloc.s V_6 + IL_0048: stelem.i4 + IL_0049: ldloc.s V_6 + IL_004b: ldc.i4.1 + IL_004c: add + IL_004d: stloc.s V_6 + IL_004f: ldloc.s V_5 + IL_0051: ldc.i4.1 + IL_0052: conv.i8 + IL_0053: add + IL_0054: stloc.s V_5 + IL_0056: ldloc.s V_5 + IL_0058: ldloc.2 + IL_0059: blt.un.s IL_0041 + + IL_005b: ldloc.s V_4 + IL_005d: ret + } + + .method public static int32[] f22(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + uint64 V_1, + uint64 V_2, + int32[] V_3, + uint64 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: ldloc.0 + IL_000b: bge.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001b + + IL_0012: ldc.i4.s 10 + IL_0014: ldloc.0 + IL_0015: sub + IL_0016: conv.i8 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: nop + IL_001b: stloc.1 + IL_001c: ldloc.1 + IL_001d: stloc.2 + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: conv.i8 + IL_0021: bge.un.s IL_0029 + + IL_0023: call !!0[] [runtime]System.Array::Empty() + IL_0028: ret + + IL_0029: ldloc.2 + IL_002a: conv.ovf.i.un + IL_002b: newarr [runtime]System.Int32 + IL_0030: stloc.3 + IL_0031: ldc.i4.0 + IL_0032: conv.i8 + IL_0033: stloc.s V_4 + IL_0035: ldloc.0 + IL_0036: stloc.s V_5 + IL_0038: br.s IL_004e + + IL_003a: ldloc.3 + IL_003b: ldloc.s V_4 + IL_003d: conv.i + IL_003e: ldloc.s V_5 + IL_0040: stelem.i4 + IL_0041: ldloc.s V_5 + IL_0043: ldc.i4.1 + IL_0044: add + IL_0045: stloc.s V_5 + IL_0047: ldloc.s V_4 + IL_0049: ldc.i4.1 + IL_004a: conv.i8 + IL_004b: add + IL_004c: stloc.s V_4 + IL_004e: ldloc.s V_4 + IL_0050: ldloc.1 + IL_0051: blt.un.s IL_003a + + IL_0053: ldloc.3 + IL_0054: ret + } + + .method public static int32[] f23(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + uint64 V_1, + uint64 V_2, + int32[] V_3, + uint64 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: brtrue.s IL_0018 + + IL_000b: ldc.i4.1 + IL_000c: ldloc.0 + IL_000d: ldc.i4.s 10 + IL_000f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0014: pop + IL_0015: nop + IL_0016: br.s IL_0019 + + IL_0018: nop + IL_0019: ldc.i4.0 + IL_001a: ldloc.0 + IL_001b: bge.s IL_0034 + + IL_001d: ldc.i4.s 10 + IL_001f: ldc.i4.1 + IL_0020: bge.s IL_0027 + + IL_0022: ldc.i4.0 + IL_0023: conv.i8 + IL_0024: nop + IL_0025: br.s IL_004c + + IL_0027: ldc.i4.s 10 + IL_0029: ldc.i4.1 + IL_002a: sub + IL_002b: ldloc.0 + IL_002c: div.un + IL_002d: conv.i8 + IL_002e: ldc.i4.1 + IL_002f: conv.i8 + IL_0030: add + IL_0031: nop + IL_0032: br.s IL_004c + + IL_0034: ldc.i4.1 + IL_0035: ldc.i4.s 10 + IL_0037: bge.s IL_003e + + IL_0039: ldc.i4.0 + IL_003a: conv.i8 + IL_003b: nop + IL_003c: br.s IL_004c + + IL_003e: ldc.i4.1 + IL_003f: ldc.i4.s 10 + IL_0041: sub + IL_0042: ldloc.0 + IL_0043: not + IL_0044: ldc.i4.1 + IL_0045: add + IL_0046: div.un + IL_0047: conv.i8 + IL_0048: ldc.i4.1 + IL_0049: conv.i8 + IL_004a: add + IL_004b: nop + IL_004c: stloc.1 + IL_004d: ldloc.1 + IL_004e: stloc.2 + IL_004f: ldloc.2 + IL_0050: ldc.i4.1 + IL_0051: conv.i8 + IL_0052: bge.un.s IL_005a + + IL_0054: call !!0[] [runtime]System.Array::Empty() + IL_0059: ret + + IL_005a: ldloc.2 + IL_005b: conv.ovf.i.un + IL_005c: newarr [runtime]System.Int32 + IL_0061: stloc.3 + IL_0062: ldc.i4.0 + IL_0063: conv.i8 + IL_0064: stloc.s V_4 + IL_0066: ldc.i4.1 + IL_0067: stloc.s V_5 + IL_0069: br.s IL_007f + + IL_006b: ldloc.3 + IL_006c: ldloc.s V_4 + IL_006e: conv.i + IL_006f: ldloc.s V_5 + IL_0071: stelem.i4 + IL_0072: ldloc.s V_5 + IL_0074: ldloc.0 + IL_0075: add + IL_0076: stloc.s V_5 + IL_0078: ldloc.s V_4 + IL_007a: ldc.i4.1 + IL_007b: conv.i8 + IL_007c: add + IL_007d: stloc.s V_4 + IL_007f: ldloc.s V_4 + IL_0081: ldloc.1 + IL_0082: blt.un.s IL_006b + + IL_0084: ldloc.3 + IL_0085: ret + } + + .method public static int32[] f24(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + uint64 V_1, + uint64 V_2, + int32[] V_3, + uint64 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: bge.s IL_0011 + + IL_000c: ldc.i4.0 + IL_000d: conv.i8 + IL_000e: nop + IL_000f: br.s IL_0019 + + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: sub + IL_0014: conv.i8 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: nop + IL_0019: stloc.1 + IL_001a: ldloc.1 + IL_001b: stloc.2 + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: bge.un.s IL_0027 + + IL_0021: call !!0[] [runtime]System.Array::Empty() + IL_0026: ret + + IL_0027: ldloc.2 + IL_0028: conv.ovf.i.un + IL_0029: newarr [runtime]System.Int32 + IL_002e: stloc.3 + IL_002f: ldc.i4.0 + IL_0030: conv.i8 + IL_0031: stloc.s V_4 + IL_0033: ldc.i4.1 + IL_0034: stloc.s V_5 + IL_0036: br.s IL_004c + + IL_0038: ldloc.3 + IL_0039: ldloc.s V_4 + IL_003b: conv.i + IL_003c: ldloc.s V_5 + IL_003e: stelem.i4 + IL_003f: ldloc.s V_5 + IL_0041: ldc.i4.1 + IL_0042: add + IL_0043: stloc.s V_5 + IL_0045: ldloc.s V_4 + IL_0047: ldc.i4.1 + IL_0048: conv.i8 + IL_0049: add + IL_004a: stloc.s V_4 + IL_004c: ldloc.s V_4 + IL_004e: ldloc.1 + IL_004f: blt.un.s IL_0038 + + IL_0051: ldloc.3 + IL_0052: ret + } + + .method public static int32[] f25(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 h) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + int32 V_2, + uint64 V_3, + uint64 V_4, + int32[] V_5, + uint64 V_6, + int32 V_7) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldarg.2 + IL_0011: ldnull + IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0017: stloc.2 + IL_0018: ldloc.1 + IL_0019: brtrue.s IL_0027 + + IL_001b: ldloc.0 + IL_001c: ldloc.1 + IL_001d: ldloc.2 + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0023: pop + IL_0024: nop + IL_0025: br.s IL_0028 + + IL_0027: nop + IL_0028: ldc.i4.0 + IL_0029: ldloc.1 + IL_002a: bge.s IL_0041 + + IL_002c: ldloc.2 + IL_002d: ldloc.0 + IL_002e: bge.s IL_0035 + + IL_0030: ldc.i4.0 + IL_0031: conv.i8 + IL_0032: nop + IL_0033: br.s IL_0057 + + IL_0035: ldloc.2 + IL_0036: ldloc.0 + IL_0037: sub + IL_0038: ldloc.1 + IL_0039: div.un + IL_003a: conv.i8 + IL_003b: ldc.i4.1 + IL_003c: conv.i8 + IL_003d: add + IL_003e: nop + IL_003f: br.s IL_0057 + + IL_0041: ldloc.0 + IL_0042: ldloc.2 + IL_0043: bge.s IL_004a + + IL_0045: ldc.i4.0 + IL_0046: conv.i8 + IL_0047: nop + IL_0048: br.s IL_0057 + + IL_004a: ldloc.0 + IL_004b: ldloc.2 + IL_004c: sub + IL_004d: ldloc.1 + IL_004e: not + IL_004f: ldc.i4.1 + IL_0050: add + IL_0051: div.un + IL_0052: conv.i8 + IL_0053: ldc.i4.1 + IL_0054: conv.i8 + IL_0055: add + IL_0056: nop + IL_0057: stloc.3 + IL_0058: ldloc.3 + IL_0059: stloc.s V_4 + IL_005b: ldloc.s V_4 + IL_005d: ldc.i4.1 + IL_005e: conv.i8 + IL_005f: bge.un.s IL_0067 + + IL_0061: call !!0[] [runtime]System.Array::Empty() + IL_0066: ret + + IL_0067: ldloc.s V_4 + IL_0069: conv.ovf.i.un + IL_006a: newarr [runtime]System.Int32 + IL_006f: stloc.s V_5 + IL_0071: ldc.i4.0 + IL_0072: conv.i8 + IL_0073: stloc.s V_6 + IL_0075: ldloc.0 + IL_0076: stloc.s V_7 + IL_0078: br.s IL_008f + + IL_007a: ldloc.s V_5 + IL_007c: ldloc.s V_6 + IL_007e: conv.i + IL_007f: ldloc.s V_7 + IL_0081: stelem.i4 + IL_0082: ldloc.s V_7 + IL_0084: ldloc.1 + IL_0085: add + IL_0086: stloc.s V_7 + IL_0088: ldloc.s V_6 + IL_008a: ldc.i4.1 + IL_008b: conv.i8 + IL_008c: add + IL_008d: stloc.s V_6 + IL_008f: ldloc.s V_6 + IL_0091: ldloc.3 + IL_0092: blt.un.s IL_007a + + IL_0094: ldloc.s V_5 + IL_0096: ret + } + +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs new file mode 100644 index 00000000000..8e67d795f65 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs @@ -0,0 +1,25 @@ +let f1 () = [1..10] +let f2 () = [10..1] +let f3 () = [1..1..10] +let f4 () = [1..2..10] +let f5 () = [10..1..1] +let f6 () = [1..-1..10] +let f7 () = [10..-1..1] +let f8 () = [10..-2..1] +let f9 start = [start..10] +let f10 finish = [1..finish] +let f11 start finish = [start..finish] +let f12 start = [start..1..10] +let f13 step = [1..step..10] +let f14 finish = [1..1..finish] +let f15 start step = [start..step..10] +let f16 start finish = [start..1..finish] +let f17 step finish = [1..step..finish] +let f18 start step finish = [start..step..finish] +let f19 f = [f ()..10] +let f20 f = [1..f ()] +let f21 f g = [f ()..g()] +let f22 f = [f ()..1..10] +let f23 f = [1..f ()..10] +let f24 f = [1..1..f ()] +let f25 f g h = [f ()..g ()..h ()] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs.il.bsl new file mode 100644 index 00000000000..104102225b1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/Int32RangeLists.fs.il.bsl @@ -0,0 +1,1558 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f1() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_0019 + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_000f: nop + IL_0010: ldloc.2 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.2 + IL_0014: ldloc.1 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.1 + IL_0019: ldloc.1 + IL_001a: ldc.i4.s 10 + IL_001c: conv.i8 + IL_001d: blt.un.s IL_0007 + + IL_001f: ldloca.s V_0 + IL_0021: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0026: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f2() cil managed + { + + .maxstack 8 + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0005: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f3() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_0019 + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_000f: nop + IL_0010: ldloc.2 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.2 + IL_0014: ldloc.1 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.1 + IL_0019: ldloc.1 + IL_001a: ldc.i4.s 10 + IL_001c: conv.i8 + IL_001d: blt.un.s IL_0007 + + IL_001f: ldloca.s V_0 + IL_0021: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0026: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f4() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_0019 + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_000f: nop + IL_0010: ldloc.2 + IL_0011: ldc.i4.2 + IL_0012: add + IL_0013: stloc.2 + IL_0014: ldloc.1 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.1 + IL_0019: ldloc.1 + IL_001a: ldc.i4.5 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0007 + + IL_001e: ldloca.s V_0 + IL_0020: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0025: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f5() cil managed + { + + .maxstack 8 + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0005: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f6() cil managed + { + + .maxstack 8 + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0005: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f7() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.s 10 + IL_0005: stloc.2 + IL_0006: br.s IL_001a + + IL_0008: ldloca.s V_0 + IL_000a: ldloc.2 + IL_000b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0010: nop + IL_0011: ldloc.2 + IL_0012: ldc.i4.m1 + IL_0013: add + IL_0014: stloc.2 + IL_0015: ldloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add + IL_0019: stloc.1 + IL_001a: ldloc.1 + IL_001b: ldc.i4.s 10 + IL_001d: conv.i8 + IL_001e: blt.un.s IL_0008 + + IL_0020: ldloca.s V_0 + IL_0022: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0027: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f8() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.s 10 + IL_0005: stloc.2 + IL_0006: br.s IL_001b + + IL_0008: ldloca.s V_0 + IL_000a: ldloc.2 + IL_000b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0010: nop + IL_0011: ldloc.2 + IL_0012: ldc.i4.s -2 + IL_0014: add + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: stloc.1 + IL_001b: ldloc.1 + IL_001c: ldc.i4.5 + IL_001d: conv.i8 + IL_001e: blt.un.s IL_0008 + + IL_0020: ldloca.s V_0 + IL_0022: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0027: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f9(int32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: ldarg.0 + IL_000e: sub + IL_000f: conv.i8 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.2 + IL_0018: ldarg.0 + IL_0019: stloc.3 + IL_001a: br.s IL_002e + + IL_001c: ldloca.s V_1 + IL_001e: ldloc.3 + IL_001f: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0024: nop + IL_0025: ldloc.3 + IL_0026: ldc.i4.1 + IL_0027: add + IL_0028: stloc.3 + IL_0029: ldloc.2 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: add + IL_002d: stloc.2 + IL_002e: ldloc.2 + IL_002f: ldloc.0 + IL_0030: blt.un.s IL_001c + + IL_0032: ldloca.s V_1 + IL_0034: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0039: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f10(int32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: ldc.i4.1 + IL_0017: stloc.3 + IL_0018: br.s IL_002c + + IL_001a: ldloca.s V_1 + IL_001c: ldloc.3 + IL_001d: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0022: nop + IL_0023: ldloc.3 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001a + + IL_0030: ldloca.s V_1 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f11(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: ldarg.0 + IL_0017: stloc.3 + IL_0018: br.s IL_002c + + IL_001a: ldloca.s V_1 + IL_001c: ldloc.3 + IL_001d: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0022: nop + IL_0023: ldloc.3 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001a + + IL_0030: ldloca.s V_1 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f12(int32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: ldarg.0 + IL_000e: sub + IL_000f: conv.i8 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.2 + IL_0018: ldarg.0 + IL_0019: stloc.3 + IL_001a: br.s IL_002e + + IL_001c: ldloca.s V_1 + IL_001e: ldloc.3 + IL_001f: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0024: nop + IL_0025: ldloc.3 + IL_0026: ldc.i4.1 + IL_0027: add + IL_0028: stloc.3 + IL_0029: ldloc.2 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: add + IL_002d: stloc.2 + IL_002e: ldloc.2 + IL_002f: ldloc.0 + IL_0030: blt.un.s IL_001c + + IL_0032: ldloca.s V_1 + IL_0034: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0039: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f13(int32 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0011 + + IL_0004: ldc.i4.1 + IL_0005: ldarg.0 + IL_0006: ldc.i4.s 10 + IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000d: pop + IL_000e: nop + IL_000f: br.s IL_0012 + + IL_0011: nop + IL_0012: ldc.i4.0 + IL_0013: ldarg.0 + IL_0014: bge.s IL_002d + + IL_0016: ldc.i4.s 10 + IL_0018: ldc.i4.1 + IL_0019: bge.s IL_0020 + + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: nop + IL_001e: br.s IL_0045 + + IL_0020: ldc.i4.s 10 + IL_0022: ldc.i4.1 + IL_0023: sub + IL_0024: ldarg.0 + IL_0025: div.un + IL_0026: conv.i8 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: nop + IL_002b: br.s IL_0045 + + IL_002d: ldc.i4.1 + IL_002e: ldc.i4.s 10 + IL_0030: bge.s IL_0037 + + IL_0032: ldc.i4.0 + IL_0033: conv.i8 + IL_0034: nop + IL_0035: br.s IL_0045 + + IL_0037: ldc.i4.1 + IL_0038: ldc.i4.s 10 + IL_003a: sub + IL_003b: ldarg.0 + IL_003c: not + IL_003d: ldc.i4.1 + IL_003e: add + IL_003f: div.un + IL_0040: conv.i8 + IL_0041: ldc.i4.1 + IL_0042: conv.i8 + IL_0043: add + IL_0044: nop + IL_0045: stloc.0 + IL_0046: ldc.i4.0 + IL_0047: conv.i8 + IL_0048: stloc.2 + IL_0049: ldc.i4.1 + IL_004a: stloc.3 + IL_004b: br.s IL_005f + + IL_004d: ldloca.s V_1 + IL_004f: ldloc.3 + IL_0050: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0055: nop + IL_0056: ldloc.3 + IL_0057: ldarg.0 + IL_0058: add + IL_0059: stloc.3 + IL_005a: ldloc.2 + IL_005b: ldc.i4.1 + IL_005c: conv.i8 + IL_005d: add + IL_005e: stloc.2 + IL_005f: ldloc.2 + IL_0060: ldloc.0 + IL_0061: blt.un.s IL_004d + + IL_0063: ldloca.s V_1 + IL_0065: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_006a: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f14(int32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: ldc.i4.1 + IL_0017: stloc.3 + IL_0018: br.s IL_002c + + IL_001a: ldloca.s V_1 + IL_001c: ldloc.3 + IL_001d: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0022: nop + IL_0023: ldloc.3 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001a + + IL_0030: ldloca.s V_1 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f15(int32 start, + int32 step) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0011 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldc.i4.s 10 + IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000d: pop + IL_000e: nop + IL_000f: br.s IL_0012 + + IL_0011: nop + IL_0012: ldc.i4.0 + IL_0013: ldarg.1 + IL_0014: bge.s IL_002d + + IL_0016: ldc.i4.s 10 + IL_0018: ldarg.0 + IL_0019: bge.s IL_0020 + + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: nop + IL_001e: br.s IL_0045 + + IL_0020: ldc.i4.s 10 + IL_0022: ldarg.0 + IL_0023: sub + IL_0024: ldarg.1 + IL_0025: div.un + IL_0026: conv.i8 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: nop + IL_002b: br.s IL_0045 + + IL_002d: ldarg.0 + IL_002e: ldc.i4.s 10 + IL_0030: bge.s IL_0037 + + IL_0032: ldc.i4.0 + IL_0033: conv.i8 + IL_0034: nop + IL_0035: br.s IL_0045 + + IL_0037: ldarg.0 + IL_0038: ldc.i4.s 10 + IL_003a: sub + IL_003b: ldarg.1 + IL_003c: not + IL_003d: ldc.i4.1 + IL_003e: add + IL_003f: div.un + IL_0040: conv.i8 + IL_0041: ldc.i4.1 + IL_0042: conv.i8 + IL_0043: add + IL_0044: nop + IL_0045: stloc.0 + IL_0046: ldc.i4.0 + IL_0047: conv.i8 + IL_0048: stloc.2 + IL_0049: ldarg.0 + IL_004a: stloc.3 + IL_004b: br.s IL_005f + + IL_004d: ldloca.s V_1 + IL_004f: ldloc.3 + IL_0050: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0055: nop + IL_0056: ldloc.3 + IL_0057: ldarg.1 + IL_0058: add + IL_0059: stloc.3 + IL_005a: ldloc.2 + IL_005b: ldc.i4.1 + IL_005c: conv.i8 + IL_005d: add + IL_005e: stloc.2 + IL_005f: ldloc.2 + IL_0060: ldloc.0 + IL_0061: blt.un.s IL_004d + + IL_0063: ldloca.s V_1 + IL_0065: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_006a: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f16(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i8 + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: ldarg.0 + IL_0017: stloc.3 + IL_0018: br.s IL_002c + + IL_001a: ldloca.s V_1 + IL_001c: ldloc.3 + IL_001d: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0022: nop + IL_0023: ldloc.3 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001a + + IL_0030: ldloca.s V_1 + IL_0032: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0037: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f17(int32 step, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0010 + + IL_0004: ldc.i4.1 + IL_0005: ldarg.0 + IL_0006: ldarg.1 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_002a + + IL_0015: ldarg.1 + IL_0016: ldc.i4.1 + IL_0017: bge.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0040 + + IL_001e: ldarg.1 + IL_001f: ldc.i4.1 + IL_0020: sub + IL_0021: ldarg.0 + IL_0022: div.un + IL_0023: conv.i8 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: nop + IL_0028: br.s IL_0040 + + IL_002a: ldc.i4.1 + IL_002b: ldarg.1 + IL_002c: bge.s IL_0033 + + IL_002e: ldc.i4.0 + IL_002f: conv.i8 + IL_0030: nop + IL_0031: br.s IL_0040 + + IL_0033: ldc.i4.1 + IL_0034: ldarg.1 + IL_0035: sub + IL_0036: ldarg.0 + IL_0037: not + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: div.un + IL_003b: conv.i8 + IL_003c: ldc.i4.1 + IL_003d: conv.i8 + IL_003e: add + IL_003f: nop + IL_0040: stloc.0 + IL_0041: ldc.i4.0 + IL_0042: conv.i8 + IL_0043: stloc.2 + IL_0044: ldc.i4.1 + IL_0045: stloc.3 + IL_0046: br.s IL_005a + + IL_0048: ldloca.s V_1 + IL_004a: ldloc.3 + IL_004b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0050: nop + IL_0051: ldloc.3 + IL_0052: ldarg.0 + IL_0053: add + IL_0054: stloc.3 + IL_0055: ldloc.2 + IL_0056: ldc.i4.1 + IL_0057: conv.i8 + IL_0058: add + IL_0059: stloc.2 + IL_005a: ldloc.2 + IL_005b: ldloc.0 + IL_005c: blt.un.s IL_0048 + + IL_005e: ldloca.s V_1 + IL_0060: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0065: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f18(int32 start, + int32 step, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0010 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldarg.2 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.1 + IL_0013: bge.s IL_002a + + IL_0015: ldarg.2 + IL_0016: ldarg.0 + IL_0017: bge.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0040 + + IL_001e: ldarg.2 + IL_001f: ldarg.0 + IL_0020: sub + IL_0021: ldarg.1 + IL_0022: div.un + IL_0023: conv.i8 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: nop + IL_0028: br.s IL_0040 + + IL_002a: ldarg.0 + IL_002b: ldarg.2 + IL_002c: bge.s IL_0033 + + IL_002e: ldc.i4.0 + IL_002f: conv.i8 + IL_0030: nop + IL_0031: br.s IL_0040 + + IL_0033: ldarg.0 + IL_0034: ldarg.2 + IL_0035: sub + IL_0036: ldarg.1 + IL_0037: not + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: div.un + IL_003b: conv.i8 + IL_003c: ldc.i4.1 + IL_003d: conv.i8 + IL_003e: add + IL_003f: nop + IL_0040: stloc.0 + IL_0041: ldc.i4.0 + IL_0042: conv.i8 + IL_0043: stloc.2 + IL_0044: ldarg.0 + IL_0045: stloc.3 + IL_0046: br.s IL_005a + + IL_0048: ldloca.s V_1 + IL_004a: ldloc.3 + IL_004b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0050: nop + IL_0051: ldloc.3 + IL_0052: ldarg.1 + IL_0053: add + IL_0054: stloc.3 + IL_0055: ldloc.2 + IL_0056: ldc.i4.1 + IL_0057: conv.i8 + IL_0058: add + IL_0059: stloc.2 + IL_005a: ldloc.2 + IL_005b: ldloc.0 + IL_005c: blt.un.s IL_0048 + + IL_005e: ldloca.s V_1 + IL_0060: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0065: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f19(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: ldloc.0 + IL_000b: bge.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001b + + IL_0012: ldc.i4.s 10 + IL_0014: ldloc.0 + IL_0015: sub + IL_0016: conv.i8 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: nop + IL_001b: stloc.1 + IL_001c: ldc.i4.0 + IL_001d: conv.i8 + IL_001e: stloc.3 + IL_001f: ldloc.0 + IL_0020: stloc.s V_4 + IL_0022: br.s IL_0039 + + IL_0024: ldloca.s V_2 + IL_0026: ldloc.s V_4 + IL_0028: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002d: nop + IL_002e: ldloc.s V_4 + IL_0030: ldc.i4.1 + IL_0031: add + IL_0032: stloc.s V_4 + IL_0034: ldloc.3 + IL_0035: ldc.i4.1 + IL_0036: conv.i8 + IL_0037: add + IL_0038: stloc.3 + IL_0039: ldloc.3 + IL_003a: ldloc.1 + IL_003b: blt.un.s IL_0024 + + IL_003d: ldloca.s V_2 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f20(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: bge.s IL_0011 + + IL_000c: ldc.i4.0 + IL_000d: conv.i8 + IL_000e: nop + IL_000f: br.s IL_0019 + + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: sub + IL_0014: conv.i8 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: nop + IL_0019: stloc.1 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: stloc.3 + IL_001d: ldc.i4.1 + IL_001e: stloc.s V_4 + IL_0020: br.s IL_0037 + + IL_0022: ldloca.s V_2 + IL_0024: ldloc.s V_4 + IL_0026: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002b: nop + IL_002c: ldloc.s V_4 + IL_002e: ldc.i4.1 + IL_002f: add + IL_0030: stloc.s V_4 + IL_0032: ldloc.3 + IL_0033: ldc.i4.1 + IL_0034: conv.i8 + IL_0035: add + IL_0036: stloc.3 + IL_0037: ldloc.3 + IL_0038: ldloc.1 + IL_0039: blt.un.s IL_0022 + + IL_003b: ldloca.s V_2 + IL_003d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0042: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f21(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + uint64 V_2, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_3, + uint64 V_4, + int32 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldloc.1 + IL_0011: ldloc.0 + IL_0012: bge.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_0021 + + IL_0019: ldloc.1 + IL_001a: ldloc.0 + IL_001b: sub + IL_001c: conv.i8 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: add + IL_0020: nop + IL_0021: stloc.2 + IL_0022: ldc.i4.0 + IL_0023: conv.i8 + IL_0024: stloc.s V_4 + IL_0026: ldloc.0 + IL_0027: stloc.s V_5 + IL_0029: br.s IL_0042 + + IL_002b: ldloca.s V_3 + IL_002d: ldloc.s V_5 + IL_002f: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0034: nop + IL_0035: ldloc.s V_5 + IL_0037: ldc.i4.1 + IL_0038: add + IL_0039: stloc.s V_5 + IL_003b: ldloc.s V_4 + IL_003d: ldc.i4.1 + IL_003e: conv.i8 + IL_003f: add + IL_0040: stloc.s V_4 + IL_0042: ldloc.s V_4 + IL_0044: ldloc.2 + IL_0045: blt.un.s IL_002b + + IL_0047: ldloca.s V_3 + IL_0049: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_004e: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f22(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: ldloc.0 + IL_000b: bge.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001b + + IL_0012: ldc.i4.s 10 + IL_0014: ldloc.0 + IL_0015: sub + IL_0016: conv.i8 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: nop + IL_001b: stloc.1 + IL_001c: ldc.i4.0 + IL_001d: conv.i8 + IL_001e: stloc.3 + IL_001f: ldloc.0 + IL_0020: stloc.s V_4 + IL_0022: br.s IL_0039 + + IL_0024: ldloca.s V_2 + IL_0026: ldloc.s V_4 + IL_0028: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002d: nop + IL_002e: ldloc.s V_4 + IL_0030: ldc.i4.1 + IL_0031: add + IL_0032: stloc.s V_4 + IL_0034: ldloc.3 + IL_0035: ldc.i4.1 + IL_0036: conv.i8 + IL_0037: add + IL_0038: stloc.3 + IL_0039: ldloc.3 + IL_003a: ldloc.1 + IL_003b: blt.un.s IL_0024 + + IL_003d: ldloca.s V_2 + IL_003f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0044: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f23(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: brtrue.s IL_0018 + + IL_000b: ldc.i4.1 + IL_000c: ldloc.0 + IL_000d: ldc.i4.s 10 + IL_000f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0014: pop + IL_0015: nop + IL_0016: br.s IL_0019 + + IL_0018: nop + IL_0019: ldc.i4.0 + IL_001a: ldloc.0 + IL_001b: bge.s IL_0034 + + IL_001d: ldc.i4.s 10 + IL_001f: ldc.i4.1 + IL_0020: bge.s IL_0027 + + IL_0022: ldc.i4.0 + IL_0023: conv.i8 + IL_0024: nop + IL_0025: br.s IL_004c + + IL_0027: ldc.i4.s 10 + IL_0029: ldc.i4.1 + IL_002a: sub + IL_002b: ldloc.0 + IL_002c: div.un + IL_002d: conv.i8 + IL_002e: ldc.i4.1 + IL_002f: conv.i8 + IL_0030: add + IL_0031: nop + IL_0032: br.s IL_004c + + IL_0034: ldc.i4.1 + IL_0035: ldc.i4.s 10 + IL_0037: bge.s IL_003e + + IL_0039: ldc.i4.0 + IL_003a: conv.i8 + IL_003b: nop + IL_003c: br.s IL_004c + + IL_003e: ldc.i4.1 + IL_003f: ldc.i4.s 10 + IL_0041: sub + IL_0042: ldloc.0 + IL_0043: not + IL_0044: ldc.i4.1 + IL_0045: add + IL_0046: div.un + IL_0047: conv.i8 + IL_0048: ldc.i4.1 + IL_0049: conv.i8 + IL_004a: add + IL_004b: nop + IL_004c: stloc.1 + IL_004d: ldc.i4.0 + IL_004e: conv.i8 + IL_004f: stloc.3 + IL_0050: ldc.i4.1 + IL_0051: stloc.s V_4 + IL_0053: br.s IL_006a + + IL_0055: ldloca.s V_2 + IL_0057: ldloc.s V_4 + IL_0059: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_005e: nop + IL_005f: ldloc.s V_4 + IL_0061: ldloc.0 + IL_0062: add + IL_0063: stloc.s V_4 + IL_0065: ldloc.3 + IL_0066: ldc.i4.1 + IL_0067: conv.i8 + IL_0068: add + IL_0069: stloc.3 + IL_006a: ldloc.3 + IL_006b: ldloc.1 + IL_006c: blt.un.s IL_0055 + + IL_006e: ldloca.s V_2 + IL_0070: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0075: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f24(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: bge.s IL_0011 + + IL_000c: ldc.i4.0 + IL_000d: conv.i8 + IL_000e: nop + IL_000f: br.s IL_0019 + + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: sub + IL_0014: conv.i8 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: nop + IL_0019: stloc.1 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: stloc.3 + IL_001d: ldc.i4.1 + IL_001e: stloc.s V_4 + IL_0020: br.s IL_0037 + + IL_0022: ldloca.s V_2 + IL_0024: ldloc.s V_4 + IL_0026: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002b: nop + IL_002c: ldloc.s V_4 + IL_002e: ldc.i4.1 + IL_002f: add + IL_0030: stloc.s V_4 + IL_0032: ldloc.3 + IL_0033: ldc.i4.1 + IL_0034: conv.i8 + IL_0035: add + IL_0036: stloc.3 + IL_0037: ldloc.3 + IL_0038: ldloc.1 + IL_0039: blt.un.s IL_0022 + + IL_003b: ldloca.s V_2 + IL_003d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0042: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f25(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 h) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + int32 V_2, + uint64 V_3, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_4, + uint64 V_5, + int32 V_6) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldarg.2 + IL_0011: ldnull + IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0017: stloc.2 + IL_0018: ldloc.1 + IL_0019: brtrue.s IL_0027 + + IL_001b: ldloc.0 + IL_001c: ldloc.1 + IL_001d: ldloc.2 + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0023: pop + IL_0024: nop + IL_0025: br.s IL_0028 + + IL_0027: nop + IL_0028: ldc.i4.0 + IL_0029: ldloc.1 + IL_002a: bge.s IL_0041 + + IL_002c: ldloc.2 + IL_002d: ldloc.0 + IL_002e: bge.s IL_0035 + + IL_0030: ldc.i4.0 + IL_0031: conv.i8 + IL_0032: nop + IL_0033: br.s IL_0057 + + IL_0035: ldloc.2 + IL_0036: ldloc.0 + IL_0037: sub + IL_0038: ldloc.1 + IL_0039: div.un + IL_003a: conv.i8 + IL_003b: ldc.i4.1 + IL_003c: conv.i8 + IL_003d: add + IL_003e: nop + IL_003f: br.s IL_0057 + + IL_0041: ldloc.0 + IL_0042: ldloc.2 + IL_0043: bge.s IL_004a + + IL_0045: ldc.i4.0 + IL_0046: conv.i8 + IL_0047: nop + IL_0048: br.s IL_0057 + + IL_004a: ldloc.0 + IL_004b: ldloc.2 + IL_004c: sub + IL_004d: ldloc.1 + IL_004e: not + IL_004f: ldc.i4.1 + IL_0050: add + IL_0051: div.un + IL_0052: conv.i8 + IL_0053: ldc.i4.1 + IL_0054: conv.i8 + IL_0055: add + IL_0056: nop + IL_0057: stloc.3 + IL_0058: ldc.i4.0 + IL_0059: conv.i8 + IL_005a: stloc.s V_5 + IL_005c: ldloc.0 + IL_005d: stloc.s V_6 + IL_005f: br.s IL_0078 + + IL_0061: ldloca.s V_4 + IL_0063: ldloc.s V_6 + IL_0065: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_006a: nop + IL_006b: ldloc.s V_6 + IL_006d: ldloc.1 + IL_006e: add + IL_006f: stloc.s V_6 + IL_0071: ldloc.s V_5 + IL_0073: ldc.i4.1 + IL_0074: conv.i8 + IL_0075: add + IL_0076: stloc.s V_5 + IL_0078: ldloc.s V_5 + IL_007a: ldloc.3 + IL_007b: blt.un.s IL_0061 + + IL_007d: ldloca.s V_4 + IL_007f: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0084: ret + } + +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs new file mode 100644 index 00000000000..21fa8db2428 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs @@ -0,0 +1,22 @@ +let f1 () = [|1UL..10UL|] +let f2 () = [|10UL..1UL|] +let f3 () = [|1UL..1UL..10UL|] +let f4 () = [|1UL..2UL..10UL|] +let f5 () = [|10UL..1UL..1UL|] +let f6 start = [|start..10UL|] +let f7 finish = [|1UL..finish|] +let f8 (start: uint64) finish = [|start..finish|] +let f9 start = [|start..1UL..10UL|] +let f10 step = [|1UL..step..10UL|] +let f11 finish = [|1UL..1UL..finish|] +let f12 start step = [|start..step..10UL|] +let f13 start finish = [|start..1UL..finish|] +let f14 step finish = [|1UL..step..finish|] +let f15 (start: uint64) step finish = [|start..step..finish|] +let f16 f = [|f ()..10UL|] +let f17 f = [|1UL..f ()|] +let f18 (f: unit -> uint64) g = [|f ()..g()|] +let f19 f = [|f ()..1UL..10UL|] +let f20 f = [|1UL..f ()..10UL|] +let f21 f = [|1UL..1UL..f ()|] +let f22 (f: unit -> uint64) g h = [|f ()..g ()..h ()|] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs.il.bsl new file mode 100644 index 00000000000..d35ebad1148 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeArrays.fs.il.bsl @@ -0,0 +1,1998 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static uint64[] f1() cil managed + { + + .maxstack 5 + .locals init (uint64[] V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.UInt64 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: stloc.2 + IL_0010: br.s IL_0021 + + IL_0012: ldloc.0 + IL_0013: ldloc.1 + IL_0014: conv.i + IL_0015: ldloc.2 + IL_0016: stelem.i8 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: add + IL_0020: stloc.1 + IL_0021: ldloc.1 + IL_0022: ldc.i4.s 10 + IL_0024: conv.i8 + IL_0025: blt.un.s IL_0012 + + IL_0027: ldloc.0 + IL_0028: ret + } + + .method public static uint64[] f2() cil managed + { + + .maxstack 8 + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: ret + } + + .method public static uint64[] f3() cil managed + { + + .maxstack 5 + .locals init (uint64[] V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: conv.ovf.i.un + IL_0004: newarr [runtime]System.UInt64 + IL_0009: stloc.0 + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.1 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: stloc.2 + IL_0010: br.s IL_0021 + + IL_0012: ldloc.0 + IL_0013: ldloc.1 + IL_0014: conv.i + IL_0015: ldloc.2 + IL_0016: stelem.i8 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: add + IL_0020: stloc.1 + IL_0021: ldloc.1 + IL_0022: ldc.i4.s 10 + IL_0024: conv.i8 + IL_0025: blt.un.s IL_0012 + + IL_0027: ldloc.0 + IL_0028: ret + } + + .method public static uint64[] f4() cil managed + { + + .maxstack 5 + .locals init (uint64[] V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.5 + IL_0001: conv.i8 + IL_0002: conv.ovf.i.un + IL_0003: newarr [runtime]System.UInt64 + IL_0008: stloc.0 + IL_0009: ldc.i4.0 + IL_000a: conv.i8 + IL_000b: stloc.1 + IL_000c: ldc.i4.1 + IL_000d: conv.i8 + IL_000e: stloc.2 + IL_000f: br.s IL_0020 + + IL_0011: ldloc.0 + IL_0012: ldloc.1 + IL_0013: conv.i + IL_0014: ldloc.2 + IL_0015: stelem.i8 + IL_0016: ldloc.2 + IL_0017: ldc.i4.2 + IL_0018: conv.i8 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: conv.i8 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldc.i4.5 + IL_0022: conv.i8 + IL_0023: blt.un.s IL_0011 + + IL_0025: ldloc.0 + IL_0026: ret + } + + .method public static uint64[] f5() cil managed + { + + .maxstack 8 + IL_0000: call !!0[] [runtime]System.Array::Empty() + IL_0005: ret + } + + .method public static uint64[] f6(uint64 start) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64[] V_2, + uint64 V_3, + uint64 V_4) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: conv.i8 + IL_0004: ldarg.0 + IL_0005: bge.un.s IL_000c + + IL_0007: ldc.i4.0 + IL_0008: conv.i8 + IL_0009: nop + IL_000a: br.s IL_0015 + + IL_000c: ldc.i4.s 10 + IL_000e: conv.i8 + IL_000f: ldarg.0 + IL_0010: sub + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: stloc.1 + IL_0018: ldloc.1 + IL_0019: ldc.i4.1 + IL_001a: conv.i8 + IL_001b: bge.un.s IL_0023 + + IL_001d: call !!0[] [runtime]System.Array::Empty() + IL_0022: ret + + IL_0023: ldloc.1 + IL_0024: conv.ovf.i.un + IL_0025: newarr [runtime]System.UInt64 + IL_002a: stloc.2 + IL_002b: ldc.i4.0 + IL_002c: conv.i8 + IL_002d: stloc.3 + IL_002e: ldarg.0 + IL_002f: stloc.s V_4 + IL_0031: br.s IL_0045 + + IL_0033: ldloc.2 + IL_0034: ldloc.3 + IL_0035: conv.i + IL_0036: ldloc.s V_4 + IL_0038: stelem.i8 + IL_0039: ldloc.s V_4 + IL_003b: ldc.i4.1 + IL_003c: conv.i8 + IL_003d: add + IL_003e: stloc.s V_4 + IL_0040: ldloc.3 + IL_0041: ldc.i4.1 + IL_0042: conv.i8 + IL_0043: add + IL_0044: stloc.3 + IL_0045: ldloc.3 + IL_0046: ldloc.0 + IL_0047: blt.un.s IL_0033 + + IL_0049: ldloc.2 + IL_004a: ret + } + + .method public static uint64[] f7(uint64 finish) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64[] V_2, + uint64 V_3, + uint64 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0013 + + IL_000b: ldarg.0 + IL_000c: ldc.i4.1 + IL_000d: conv.i8 + IL_000e: sub + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add.ovf.un + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: stloc.1 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: bge.un.s IL_0021 + + IL_001b: call !!0[] [runtime]System.Array::Empty() + IL_0020: ret + + IL_0021: ldloc.1 + IL_0022: conv.ovf.i.un + IL_0023: newarr [runtime]System.UInt64 + IL_0028: stloc.2 + IL_0029: ldc.i4.0 + IL_002a: conv.i8 + IL_002b: stloc.3 + IL_002c: ldc.i4.1 + IL_002d: conv.i8 + IL_002e: stloc.s V_4 + IL_0030: br.s IL_0044 + + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i + IL_0035: ldloc.s V_4 + IL_0037: stelem.i8 + IL_0038: ldloc.s V_4 + IL_003a: ldc.i4.1 + IL_003b: conv.i8 + IL_003c: add + IL_003d: stloc.s V_4 + IL_003f: ldloc.3 + IL_0040: ldc.i4.1 + IL_0041: conv.i8 + IL_0042: add + IL_0043: stloc.3 + IL_0044: ldloc.3 + IL_0045: ldloc.0 + IL_0046: blt.un.s IL_0032 + + IL_0048: ldloc.2 + IL_0049: ret + } + + .method public static uint64[] f8(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + uint64[] V_3, + bool V_4, + uint64 V_5, + uint64 V_6, + uint64 V_7) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_000e + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: nop + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: ldc.i4.m1 + IL_0011: conv.i8 + IL_0012: ceq + IL_0014: stloc.1 + IL_0015: ldarg.1 + IL_0016: ldarg.0 + IL_0017: bge.un.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0025 + + IL_001e: ldarg.1 + IL_001f: ldarg.0 + IL_0020: sub + IL_0021: ldc.i4.1 + IL_0022: conv.i8 + IL_0023: add.ovf.un + IL_0024: nop + IL_0025: stloc.2 + IL_0026: ldloc.2 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: bge.un.s IL_0031 + + IL_002b: call !!0[] [runtime]System.Array::Empty() + IL_0030: ret + + IL_0031: ldloc.2 + IL_0032: conv.ovf.i.un + IL_0033: newarr [runtime]System.UInt64 + IL_0038: stloc.3 + IL_0039: ldloc.1 + IL_003a: brfalse.s IL_006c + + IL_003c: ldc.i4.1 + IL_003d: stloc.s V_4 + IL_003f: ldc.i4.0 + IL_0040: conv.i8 + IL_0041: stloc.s V_5 + IL_0043: ldarg.0 + IL_0044: stloc.s V_6 + IL_0046: br.s IL_0065 + + IL_0048: ldloc.3 + IL_0049: ldloc.s V_5 + IL_004b: conv.i + IL_004c: ldloc.s V_6 + IL_004e: stelem.i8 + IL_004f: ldloc.s V_6 + IL_0051: ldc.i4.1 + IL_0052: conv.i8 + IL_0053: add + IL_0054: stloc.s V_6 + IL_0056: ldloc.s V_5 + IL_0058: ldc.i4.1 + IL_0059: conv.i8 + IL_005a: add + IL_005b: stloc.s V_5 + IL_005d: ldloc.s V_5 + IL_005f: ldc.i4.0 + IL_0060: conv.i8 + IL_0061: cgt.un + IL_0063: stloc.s V_4 + IL_0065: ldloc.s V_4 + IL_0067: brtrue.s IL_0048 + + IL_0069: nop + IL_006a: br.s IL_00a3 + + IL_006c: ldarg.1 + IL_006d: ldarg.0 + IL_006e: bge.un.s IL_0075 + + IL_0070: ldc.i4.0 + IL_0071: conv.i8 + IL_0072: nop + IL_0073: br.s IL_007c + + IL_0075: ldarg.1 + IL_0076: ldarg.0 + IL_0077: sub + IL_0078: ldc.i4.1 + IL_0079: conv.i8 + IL_007a: add.ovf.un + IL_007b: nop + IL_007c: stloc.s V_5 + IL_007e: ldc.i4.0 + IL_007f: conv.i8 + IL_0080: stloc.s V_6 + IL_0082: ldarg.0 + IL_0083: stloc.s V_7 + IL_0085: br.s IL_009c + + IL_0087: ldloc.3 + IL_0088: ldloc.s V_6 + IL_008a: conv.i + IL_008b: ldloc.s V_7 + IL_008d: stelem.i8 + IL_008e: ldloc.s V_7 + IL_0090: ldc.i4.1 + IL_0091: conv.i8 + IL_0092: add + IL_0093: stloc.s V_7 + IL_0095: ldloc.s V_6 + IL_0097: ldc.i4.1 + IL_0098: conv.i8 + IL_0099: add + IL_009a: stloc.s V_6 + IL_009c: ldloc.s V_6 + IL_009e: ldloc.s V_5 + IL_00a0: blt.un.s IL_0087 + + IL_00a2: nop + IL_00a3: ldloc.3 + IL_00a4: ret + } + + .method public static uint64[] f9(uint64 start) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64[] V_2, + uint64 V_3, + uint64 V_4) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: conv.i8 + IL_0004: ldarg.0 + IL_0005: bge.un.s IL_000c + + IL_0007: ldc.i4.0 + IL_0008: conv.i8 + IL_0009: nop + IL_000a: br.s IL_0015 + + IL_000c: ldc.i4.s 10 + IL_000e: conv.i8 + IL_000f: ldarg.0 + IL_0010: sub + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: stloc.1 + IL_0018: ldloc.1 + IL_0019: ldc.i4.1 + IL_001a: conv.i8 + IL_001b: bge.un.s IL_0023 + + IL_001d: call !!0[] [runtime]System.Array::Empty() + IL_0022: ret + + IL_0023: ldloc.1 + IL_0024: conv.ovf.i.un + IL_0025: newarr [runtime]System.UInt64 + IL_002a: stloc.2 + IL_002b: ldc.i4.0 + IL_002c: conv.i8 + IL_002d: stloc.3 + IL_002e: ldarg.0 + IL_002f: stloc.s V_4 + IL_0031: br.s IL_0045 + + IL_0033: ldloc.2 + IL_0034: ldloc.3 + IL_0035: conv.i + IL_0036: ldloc.s V_4 + IL_0038: stelem.i8 + IL_0039: ldloc.s V_4 + IL_003b: ldc.i4.1 + IL_003c: conv.i8 + IL_003d: add + IL_003e: stloc.s V_4 + IL_0040: ldloc.3 + IL_0041: ldc.i4.1 + IL_0042: conv.i8 + IL_0043: add + IL_0044: stloc.3 + IL_0045: ldloc.3 + IL_0046: ldloc.0 + IL_0047: blt.un.s IL_0033 + + IL_0049: ldloc.2 + IL_004a: ret + } + + .method public static uint64[] f10(uint64 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64[] V_2, + uint64 V_3, + uint64 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0013 + + IL_0004: ldc.i4.1 + IL_0005: conv.i8 + IL_0006: ldarg.0 + IL_0007: ldc.i4.s 10 + IL_0009: conv.i8 + IL_000a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000f: pop + IL_0010: nop + IL_0011: br.s IL_0014 + + IL_0013: nop + IL_0014: ldc.i4.s 10 + IL_0016: conv.i8 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: bge.un.s IL_0020 + + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: nop + IL_001e: br.s IL_002c + + IL_0020: ldc.i4.s 10 + IL_0022: conv.i8 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: sub + IL_0026: ldarg.0 + IL_0027: div.un + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add.ovf.un + IL_002b: nop + IL_002c: stloc.0 + IL_002d: ldloc.0 + IL_002e: stloc.1 + IL_002f: ldloc.1 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: bge.un.s IL_003a + + IL_0034: call !!0[] [runtime]System.Array::Empty() + IL_0039: ret + + IL_003a: ldloc.1 + IL_003b: conv.ovf.i.un + IL_003c: newarr [runtime]System.UInt64 + IL_0041: stloc.2 + IL_0042: ldc.i4.0 + IL_0043: conv.i8 + IL_0044: stloc.3 + IL_0045: ldc.i4.1 + IL_0046: conv.i8 + IL_0047: stloc.s V_4 + IL_0049: br.s IL_005c + + IL_004b: ldloc.2 + IL_004c: ldloc.3 + IL_004d: conv.i + IL_004e: ldloc.s V_4 + IL_0050: stelem.i8 + IL_0051: ldloc.s V_4 + IL_0053: ldarg.0 + IL_0054: add + IL_0055: stloc.s V_4 + IL_0057: ldloc.3 + IL_0058: ldc.i4.1 + IL_0059: conv.i8 + IL_005a: add + IL_005b: stloc.3 + IL_005c: ldloc.3 + IL_005d: ldloc.0 + IL_005e: blt.un.s IL_004b + + IL_0060: ldloc.2 + IL_0061: ret + } + + .method public static uint64[] f11(uint64 finish) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64[] V_2, + uint64 V_3, + uint64 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0013 + + IL_000b: ldarg.0 + IL_000c: ldc.i4.1 + IL_000d: conv.i8 + IL_000e: sub + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add.ovf.un + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: stloc.1 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: bge.un.s IL_0021 + + IL_001b: call !!0[] [runtime]System.Array::Empty() + IL_0020: ret + + IL_0021: ldloc.1 + IL_0022: conv.ovf.i.un + IL_0023: newarr [runtime]System.UInt64 + IL_0028: stloc.2 + IL_0029: ldc.i4.0 + IL_002a: conv.i8 + IL_002b: stloc.3 + IL_002c: ldc.i4.1 + IL_002d: conv.i8 + IL_002e: stloc.s V_4 + IL_0030: br.s IL_0044 + + IL_0032: ldloc.2 + IL_0033: ldloc.3 + IL_0034: conv.i + IL_0035: ldloc.s V_4 + IL_0037: stelem.i8 + IL_0038: ldloc.s V_4 + IL_003a: ldc.i4.1 + IL_003b: conv.i8 + IL_003c: add + IL_003d: stloc.s V_4 + IL_003f: ldloc.3 + IL_0040: ldc.i4.1 + IL_0041: conv.i8 + IL_0042: add + IL_0043: stloc.3 + IL_0044: ldloc.3 + IL_0045: ldloc.0 + IL_0046: blt.un.s IL_0032 + + IL_0048: ldloc.2 + IL_0049: ret + } + + .method public static uint64[] f12(uint64 start, + uint64 step) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64[] V_2, + uint64 V_3, + uint64 V_4) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0012 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldc.i4.s 10 + IL_0008: conv.i8 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000e: pop + IL_000f: nop + IL_0010: br.s IL_0013 + + IL_0012: nop + IL_0013: ldc.i4.s 10 + IL_0015: conv.i8 + IL_0016: ldarg.0 + IL_0017: bge.un.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0029 + + IL_001e: ldc.i4.s 10 + IL_0020: conv.i8 + IL_0021: ldarg.0 + IL_0022: sub + IL_0023: ldarg.1 + IL_0024: div.un + IL_0025: ldc.i4.1 + IL_0026: conv.i8 + IL_0027: add.ovf.un + IL_0028: nop + IL_0029: stloc.0 + IL_002a: ldloc.0 + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldc.i4.1 + IL_002e: conv.i8 + IL_002f: bge.un.s IL_0037 + + IL_0031: call !!0[] [runtime]System.Array::Empty() + IL_0036: ret + + IL_0037: ldloc.1 + IL_0038: conv.ovf.i.un + IL_0039: newarr [runtime]System.UInt64 + IL_003e: stloc.2 + IL_003f: ldc.i4.0 + IL_0040: conv.i8 + IL_0041: stloc.3 + IL_0042: ldarg.0 + IL_0043: stloc.s V_4 + IL_0045: br.s IL_0058 + + IL_0047: ldloc.2 + IL_0048: ldloc.3 + IL_0049: conv.i + IL_004a: ldloc.s V_4 + IL_004c: stelem.i8 + IL_004d: ldloc.s V_4 + IL_004f: ldarg.1 + IL_0050: add + IL_0051: stloc.s V_4 + IL_0053: ldloc.3 + IL_0054: ldc.i4.1 + IL_0055: conv.i8 + IL_0056: add + IL_0057: stloc.3 + IL_0058: ldloc.3 + IL_0059: ldloc.0 + IL_005a: blt.un.s IL_0047 + + IL_005c: ldloc.2 + IL_005d: ret + } + + .method public static uint64[] f13(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + uint64[] V_3, + bool V_4, + uint64 V_5, + uint64 V_6, + uint64 V_7) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_000e + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: nop + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: ldc.i4.m1 + IL_0011: conv.i8 + IL_0012: ceq + IL_0014: stloc.1 + IL_0015: ldarg.1 + IL_0016: ldarg.0 + IL_0017: bge.un.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0025 + + IL_001e: ldarg.1 + IL_001f: ldarg.0 + IL_0020: sub + IL_0021: ldc.i4.1 + IL_0022: conv.i8 + IL_0023: add.ovf.un + IL_0024: nop + IL_0025: stloc.2 + IL_0026: ldloc.2 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: bge.un.s IL_0031 + + IL_002b: call !!0[] [runtime]System.Array::Empty() + IL_0030: ret + + IL_0031: ldloc.2 + IL_0032: conv.ovf.i.un + IL_0033: newarr [runtime]System.UInt64 + IL_0038: stloc.3 + IL_0039: ldloc.1 + IL_003a: brfalse.s IL_006c + + IL_003c: ldc.i4.1 + IL_003d: stloc.s V_4 + IL_003f: ldc.i4.0 + IL_0040: conv.i8 + IL_0041: stloc.s V_5 + IL_0043: ldarg.0 + IL_0044: stloc.s V_6 + IL_0046: br.s IL_0065 + + IL_0048: ldloc.3 + IL_0049: ldloc.s V_5 + IL_004b: conv.i + IL_004c: ldloc.s V_6 + IL_004e: stelem.i8 + IL_004f: ldloc.s V_6 + IL_0051: ldc.i4.1 + IL_0052: conv.i8 + IL_0053: add + IL_0054: stloc.s V_6 + IL_0056: ldloc.s V_5 + IL_0058: ldc.i4.1 + IL_0059: conv.i8 + IL_005a: add + IL_005b: stloc.s V_5 + IL_005d: ldloc.s V_5 + IL_005f: ldc.i4.0 + IL_0060: conv.i8 + IL_0061: cgt.un + IL_0063: stloc.s V_4 + IL_0065: ldloc.s V_4 + IL_0067: brtrue.s IL_0048 + + IL_0069: nop + IL_006a: br.s IL_00a3 + + IL_006c: ldarg.1 + IL_006d: ldarg.0 + IL_006e: bge.un.s IL_0075 + + IL_0070: ldc.i4.0 + IL_0071: conv.i8 + IL_0072: nop + IL_0073: br.s IL_007c + + IL_0075: ldarg.1 + IL_0076: ldarg.0 + IL_0077: sub + IL_0078: ldc.i4.1 + IL_0079: conv.i8 + IL_007a: add.ovf.un + IL_007b: nop + IL_007c: stloc.s V_5 + IL_007e: ldc.i4.0 + IL_007f: conv.i8 + IL_0080: stloc.s V_6 + IL_0082: ldarg.0 + IL_0083: stloc.s V_7 + IL_0085: br.s IL_009c + + IL_0087: ldloc.3 + IL_0088: ldloc.s V_6 + IL_008a: conv.i + IL_008b: ldloc.s V_7 + IL_008d: stelem.i8 + IL_008e: ldloc.s V_7 + IL_0090: ldc.i4.1 + IL_0091: conv.i8 + IL_0092: add + IL_0093: stloc.s V_7 + IL_0095: ldloc.s V_6 + IL_0097: ldc.i4.1 + IL_0098: conv.i8 + IL_0099: add + IL_009a: stloc.s V_6 + IL_009c: ldloc.s V_6 + IL_009e: ldloc.s V_5 + IL_00a0: blt.un.s IL_0087 + + IL_00a2: nop + IL_00a3: ldloc.3 + IL_00a4: ret + } + + .method public static uint64[] f14(uint64 step, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64[] V_2, + uint64 V_3, + uint64 V_4) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0011 + + IL_0004: ldc.i4.1 + IL_0005: conv.i8 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000d: pop + IL_000e: nop + IL_000f: br.s IL_0012 + + IL_0011: nop + IL_0012: ldarg.1 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: bge.un.s IL_001c + + IL_0017: ldc.i4.0 + IL_0018: conv.i8 + IL_0019: nop + IL_001a: br.s IL_0026 + + IL_001c: ldarg.1 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: sub + IL_0020: ldarg.0 + IL_0021: div.un + IL_0022: ldc.i4.1 + IL_0023: conv.i8 + IL_0024: add.ovf.un + IL_0025: nop + IL_0026: stloc.0 + IL_0027: ldloc.0 + IL_0028: stloc.1 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: bge.un.s IL_0034 + + IL_002e: call !!0[] [runtime]System.Array::Empty() + IL_0033: ret + + IL_0034: ldloc.1 + IL_0035: conv.ovf.i.un + IL_0036: newarr [runtime]System.UInt64 + IL_003b: stloc.2 + IL_003c: ldc.i4.0 + IL_003d: conv.i8 + IL_003e: stloc.3 + IL_003f: ldc.i4.1 + IL_0040: conv.i8 + IL_0041: stloc.s V_4 + IL_0043: br.s IL_0056 + + IL_0045: ldloc.2 + IL_0046: ldloc.3 + IL_0047: conv.i + IL_0048: ldloc.s V_4 + IL_004a: stelem.i8 + IL_004b: ldloc.s V_4 + IL_004d: ldarg.0 + IL_004e: add + IL_004f: stloc.s V_4 + IL_0051: ldloc.3 + IL_0052: ldc.i4.1 + IL_0053: conv.i8 + IL_0054: add + IL_0055: stloc.3 + IL_0056: ldloc.3 + IL_0057: ldloc.0 + IL_0058: blt.un.s IL_0045 + + IL_005a: ldloc.2 + IL_005b: ret + } + + .method public static uint64[] f15(uint64 start, + uint64 step, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + uint64[] V_3, + bool V_4, + uint64 V_5, + uint64 V_6, + uint64 V_7) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0010 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldarg.2 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldarg.2 + IL_0012: ldarg.0 + IL_0013: bge.un.s IL_001a + + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: nop + IL_0018: br.s IL_0020 + + IL_001a: ldarg.2 + IL_001b: ldarg.0 + IL_001c: sub + IL_001d: ldarg.1 + IL_001e: div.un + IL_001f: nop + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: ldc.i4.m1 + IL_0023: conv.i8 + IL_0024: ceq + IL_0026: stloc.1 + IL_0027: ldarg.2 + IL_0028: ldarg.0 + IL_0029: bge.un.s IL_0030 + + IL_002b: ldc.i4.0 + IL_002c: conv.i8 + IL_002d: nop + IL_002e: br.s IL_0039 + + IL_0030: ldarg.2 + IL_0031: ldarg.0 + IL_0032: sub + IL_0033: ldarg.1 + IL_0034: div.un + IL_0035: ldc.i4.1 + IL_0036: conv.i8 + IL_0037: add.ovf.un + IL_0038: nop + IL_0039: stloc.2 + IL_003a: ldloc.2 + IL_003b: ldc.i4.1 + IL_003c: conv.i8 + IL_003d: bge.un.s IL_0045 + + IL_003f: call !!0[] [runtime]System.Array::Empty() + IL_0044: ret + + IL_0045: ldloc.2 + IL_0046: conv.ovf.i.un + IL_0047: newarr [runtime]System.UInt64 + IL_004c: stloc.3 + IL_004d: ldloc.1 + IL_004e: brfalse.s IL_007f + + IL_0050: ldc.i4.1 + IL_0051: stloc.s V_4 + IL_0053: ldc.i4.0 + IL_0054: conv.i8 + IL_0055: stloc.s V_5 + IL_0057: ldarg.0 + IL_0058: stloc.s V_6 + IL_005a: br.s IL_0078 + + IL_005c: ldloc.3 + IL_005d: ldloc.s V_5 + IL_005f: conv.i + IL_0060: ldloc.s V_6 + IL_0062: stelem.i8 + IL_0063: ldloc.s V_6 + IL_0065: ldarg.1 + IL_0066: add + IL_0067: stloc.s V_6 + IL_0069: ldloc.s V_5 + IL_006b: ldc.i4.1 + IL_006c: conv.i8 + IL_006d: add + IL_006e: stloc.s V_5 + IL_0070: ldloc.s V_5 + IL_0072: ldc.i4.0 + IL_0073: conv.i8 + IL_0074: cgt.un + IL_0076: stloc.s V_4 + IL_0078: ldloc.s V_4 + IL_007a: brtrue.s IL_005c + + IL_007c: nop + IL_007d: br.s IL_00b7 + + IL_007f: ldarg.2 + IL_0080: ldarg.0 + IL_0081: bge.un.s IL_0088 + + IL_0083: ldc.i4.0 + IL_0084: conv.i8 + IL_0085: nop + IL_0086: br.s IL_0091 + + IL_0088: ldarg.2 + IL_0089: ldarg.0 + IL_008a: sub + IL_008b: ldarg.1 + IL_008c: div.un + IL_008d: ldc.i4.1 + IL_008e: conv.i8 + IL_008f: add.ovf.un + IL_0090: nop + IL_0091: stloc.s V_5 + IL_0093: ldc.i4.0 + IL_0094: conv.i8 + IL_0095: stloc.s V_6 + IL_0097: ldarg.0 + IL_0098: stloc.s V_7 + IL_009a: br.s IL_00b0 + + IL_009c: ldloc.3 + IL_009d: ldloc.s V_6 + IL_009f: conv.i + IL_00a0: ldloc.s V_7 + IL_00a2: stelem.i8 + IL_00a3: ldloc.s V_7 + IL_00a5: ldarg.1 + IL_00a6: add + IL_00a7: stloc.s V_7 + IL_00a9: ldloc.s V_6 + IL_00ab: ldc.i4.1 + IL_00ac: conv.i8 + IL_00ad: add + IL_00ae: stloc.s V_6 + IL_00b0: ldloc.s V_6 + IL_00b2: ldloc.s V_5 + IL_00b4: blt.un.s IL_009c + + IL_00b6: nop + IL_00b7: ldloc.3 + IL_00b8: ret + } + + .method public static uint64[] f16(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + uint64[] V_3, + uint64 V_4, + uint64 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: conv.i8 + IL_000b: ldloc.0 + IL_000c: bge.un.s IL_0013 + + IL_000e: ldc.i4.0 + IL_000f: conv.i8 + IL_0010: nop + IL_0011: br.s IL_001c + + IL_0013: ldc.i4.s 10 + IL_0015: conv.i8 + IL_0016: ldloc.0 + IL_0017: sub + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add.ovf.un + IL_001b: nop + IL_001c: stloc.1 + IL_001d: ldloc.1 + IL_001e: stloc.2 + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: conv.i8 + IL_0022: bge.un.s IL_002a + + IL_0024: call !!0[] [runtime]System.Array::Empty() + IL_0029: ret + + IL_002a: ldloc.2 + IL_002b: conv.ovf.i.un + IL_002c: newarr [runtime]System.UInt64 + IL_0031: stloc.3 + IL_0032: ldc.i4.0 + IL_0033: conv.i8 + IL_0034: stloc.s V_4 + IL_0036: ldloc.0 + IL_0037: stloc.s V_5 + IL_0039: br.s IL_0050 + + IL_003b: ldloc.3 + IL_003c: ldloc.s V_4 + IL_003e: conv.i + IL_003f: ldloc.s V_5 + IL_0041: stelem.i8 + IL_0042: ldloc.s V_5 + IL_0044: ldc.i4.1 + IL_0045: conv.i8 + IL_0046: add + IL_0047: stloc.s V_5 + IL_0049: ldloc.s V_4 + IL_004b: ldc.i4.1 + IL_004c: conv.i8 + IL_004d: add + IL_004e: stloc.s V_4 + IL_0050: ldloc.s V_4 + IL_0052: ldloc.1 + IL_0053: blt.un.s IL_003b + + IL_0055: ldloc.3 + IL_0056: ret + } + + .method public static uint64[] f17(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + uint64[] V_3, + uint64 V_4, + uint64 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: conv.i8 + IL_000b: bge.un.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001a + + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: sub + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add.ovf.un + IL_0019: nop + IL_001a: stloc.1 + IL_001b: ldloc.1 + IL_001c: stloc.2 + IL_001d: ldloc.2 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: bge.un.s IL_0028 + + IL_0022: call !!0[] [runtime]System.Array::Empty() + IL_0027: ret + + IL_0028: ldloc.2 + IL_0029: conv.ovf.i.un + IL_002a: newarr [runtime]System.UInt64 + IL_002f: stloc.3 + IL_0030: ldc.i4.0 + IL_0031: conv.i8 + IL_0032: stloc.s V_4 + IL_0034: ldc.i4.1 + IL_0035: conv.i8 + IL_0036: stloc.s V_5 + IL_0038: br.s IL_004f + + IL_003a: ldloc.3 + IL_003b: ldloc.s V_4 + IL_003d: conv.i + IL_003e: ldloc.s V_5 + IL_0040: stelem.i8 + IL_0041: ldloc.s V_5 + IL_0043: ldc.i4.1 + IL_0044: conv.i8 + IL_0045: add + IL_0046: stloc.s V_5 + IL_0048: ldloc.s V_4 + IL_004a: ldc.i4.1 + IL_004b: conv.i8 + IL_004c: add + IL_004d: stloc.s V_4 + IL_004f: ldloc.s V_4 + IL_0051: ldloc.1 + IL_0052: blt.un.s IL_003a + + IL_0054: ldloc.3 + IL_0055: ret + } + + .method public static uint64[] f18(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + bool V_3, + uint64 V_4, + uint64[] V_5, + bool V_6, + uint64 V_7, + uint64 V_8, + uint64 V_9) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldloc.1 + IL_0011: ldloc.0 + IL_0012: bge.un.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_001d + + IL_0019: ldloc.1 + IL_001a: ldloc.0 + IL_001b: sub + IL_001c: nop + IL_001d: stloc.2 + IL_001e: ldloc.2 + IL_001f: ldc.i4.m1 + IL_0020: conv.i8 + IL_0021: ceq + IL_0023: stloc.3 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: bge.un.s IL_002d + + IL_0028: ldc.i4.0 + IL_0029: conv.i8 + IL_002a: nop + IL_002b: br.s IL_0034 + + IL_002d: ldloc.1 + IL_002e: ldloc.0 + IL_002f: sub + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: add.ovf.un + IL_0033: nop + IL_0034: stloc.s V_4 + IL_0036: ldloc.s V_4 + IL_0038: ldc.i4.1 + IL_0039: conv.i8 + IL_003a: bge.un.s IL_0042 + + IL_003c: call !!0[] [runtime]System.Array::Empty() + IL_0041: ret + + IL_0042: ldloc.s V_4 + IL_0044: conv.ovf.i.un + IL_0045: newarr [runtime]System.UInt64 + IL_004a: stloc.s V_5 + IL_004c: ldloc.3 + IL_004d: brfalse.s IL_0080 + + IL_004f: ldc.i4.1 + IL_0050: stloc.s V_6 + IL_0052: ldc.i4.0 + IL_0053: conv.i8 + IL_0054: stloc.s V_7 + IL_0056: ldloc.0 + IL_0057: stloc.s V_8 + IL_0059: br.s IL_0079 + + IL_005b: ldloc.s V_5 + IL_005d: ldloc.s V_7 + IL_005f: conv.i + IL_0060: ldloc.s V_8 + IL_0062: stelem.i8 + IL_0063: ldloc.s V_8 + IL_0065: ldc.i4.1 + IL_0066: conv.i8 + IL_0067: add + IL_0068: stloc.s V_8 + IL_006a: ldloc.s V_7 + IL_006c: ldc.i4.1 + IL_006d: conv.i8 + IL_006e: add + IL_006f: stloc.s V_7 + IL_0071: ldloc.s V_7 + IL_0073: ldc.i4.0 + IL_0074: conv.i8 + IL_0075: cgt.un + IL_0077: stloc.s V_6 + IL_0079: ldloc.s V_6 + IL_007b: brtrue.s IL_005b + + IL_007d: nop + IL_007e: br.s IL_00b8 + + IL_0080: ldloc.1 + IL_0081: ldloc.0 + IL_0082: bge.un.s IL_0089 + + IL_0084: ldc.i4.0 + IL_0085: conv.i8 + IL_0086: nop + IL_0087: br.s IL_0090 + + IL_0089: ldloc.1 + IL_008a: ldloc.0 + IL_008b: sub + IL_008c: ldc.i4.1 + IL_008d: conv.i8 + IL_008e: add.ovf.un + IL_008f: nop + IL_0090: stloc.s V_7 + IL_0092: ldc.i4.0 + IL_0093: conv.i8 + IL_0094: stloc.s V_8 + IL_0096: ldloc.0 + IL_0097: stloc.s V_9 + IL_0099: br.s IL_00b1 + + IL_009b: ldloc.s V_5 + IL_009d: ldloc.s V_8 + IL_009f: conv.i + IL_00a0: ldloc.s V_9 + IL_00a2: stelem.i8 + IL_00a3: ldloc.s V_9 + IL_00a5: ldc.i4.1 + IL_00a6: conv.i8 + IL_00a7: add + IL_00a8: stloc.s V_9 + IL_00aa: ldloc.s V_8 + IL_00ac: ldc.i4.1 + IL_00ad: conv.i8 + IL_00ae: add + IL_00af: stloc.s V_8 + IL_00b1: ldloc.s V_8 + IL_00b3: ldloc.s V_7 + IL_00b5: blt.un.s IL_009b + + IL_00b7: nop + IL_00b8: ldloc.s V_5 + IL_00ba: ret + } + + .method public static uint64[] f19(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + uint64[] V_3, + uint64 V_4, + uint64 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: conv.i8 + IL_000b: ldloc.0 + IL_000c: bge.un.s IL_0013 + + IL_000e: ldc.i4.0 + IL_000f: conv.i8 + IL_0010: nop + IL_0011: br.s IL_001c + + IL_0013: ldc.i4.s 10 + IL_0015: conv.i8 + IL_0016: ldloc.0 + IL_0017: sub + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add.ovf.un + IL_001b: nop + IL_001c: stloc.1 + IL_001d: ldloc.1 + IL_001e: stloc.2 + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: conv.i8 + IL_0022: bge.un.s IL_002a + + IL_0024: call !!0[] [runtime]System.Array::Empty() + IL_0029: ret + + IL_002a: ldloc.2 + IL_002b: conv.ovf.i.un + IL_002c: newarr [runtime]System.UInt64 + IL_0031: stloc.3 + IL_0032: ldc.i4.0 + IL_0033: conv.i8 + IL_0034: stloc.s V_4 + IL_0036: ldloc.0 + IL_0037: stloc.s V_5 + IL_0039: br.s IL_0050 + + IL_003b: ldloc.3 + IL_003c: ldloc.s V_4 + IL_003e: conv.i + IL_003f: ldloc.s V_5 + IL_0041: stelem.i8 + IL_0042: ldloc.s V_5 + IL_0044: ldc.i4.1 + IL_0045: conv.i8 + IL_0046: add + IL_0047: stloc.s V_5 + IL_0049: ldloc.s V_4 + IL_004b: ldc.i4.1 + IL_004c: conv.i8 + IL_004d: add + IL_004e: stloc.s V_4 + IL_0050: ldloc.s V_4 + IL_0052: ldloc.1 + IL_0053: blt.un.s IL_003b + + IL_0055: ldloc.3 + IL_0056: ret + } + + .method public static uint64[] f20(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + uint64[] V_3, + uint64 V_4, + uint64 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: brtrue.s IL_001a + + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: ldloc.0 + IL_000e: ldc.i4.s 10 + IL_0010: conv.i8 + IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_0016: pop + IL_0017: nop + IL_0018: br.s IL_001b + + IL_001a: nop + IL_001b: ldc.i4.s 10 + IL_001d: conv.i8 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: bge.un.s IL_0027 + + IL_0022: ldc.i4.0 + IL_0023: conv.i8 + IL_0024: nop + IL_0025: br.s IL_0033 + + IL_0027: ldc.i4.s 10 + IL_0029: conv.i8 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: sub + IL_002d: ldloc.0 + IL_002e: div.un + IL_002f: ldc.i4.1 + IL_0030: conv.i8 + IL_0031: add.ovf.un + IL_0032: nop + IL_0033: stloc.1 + IL_0034: ldloc.1 + IL_0035: stloc.2 + IL_0036: ldloc.2 + IL_0037: ldc.i4.1 + IL_0038: conv.i8 + IL_0039: bge.un.s IL_0041 + + IL_003b: call !!0[] [runtime]System.Array::Empty() + IL_0040: ret + + IL_0041: ldloc.2 + IL_0042: conv.ovf.i.un + IL_0043: newarr [runtime]System.UInt64 + IL_0048: stloc.3 + IL_0049: ldc.i4.0 + IL_004a: conv.i8 + IL_004b: stloc.s V_4 + IL_004d: ldc.i4.1 + IL_004e: conv.i8 + IL_004f: stloc.s V_5 + IL_0051: br.s IL_0067 + + IL_0053: ldloc.3 + IL_0054: ldloc.s V_4 + IL_0056: conv.i + IL_0057: ldloc.s V_5 + IL_0059: stelem.i8 + IL_005a: ldloc.s V_5 + IL_005c: ldloc.0 + IL_005d: add + IL_005e: stloc.s V_5 + IL_0060: ldloc.s V_4 + IL_0062: ldc.i4.1 + IL_0063: conv.i8 + IL_0064: add + IL_0065: stloc.s V_4 + IL_0067: ldloc.s V_4 + IL_0069: ldloc.1 + IL_006a: blt.un.s IL_0053 + + IL_006c: ldloc.3 + IL_006d: ret + } + + .method public static uint64[] f21(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + uint64[] V_3, + uint64 V_4, + uint64 V_5) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: conv.i8 + IL_000b: bge.un.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001a + + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: sub + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add.ovf.un + IL_0019: nop + IL_001a: stloc.1 + IL_001b: ldloc.1 + IL_001c: stloc.2 + IL_001d: ldloc.2 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: bge.un.s IL_0028 + + IL_0022: call !!0[] [runtime]System.Array::Empty() + IL_0027: ret + + IL_0028: ldloc.2 + IL_0029: conv.ovf.i.un + IL_002a: newarr [runtime]System.UInt64 + IL_002f: stloc.3 + IL_0030: ldc.i4.0 + IL_0031: conv.i8 + IL_0032: stloc.s V_4 + IL_0034: ldc.i4.1 + IL_0035: conv.i8 + IL_0036: stloc.s V_5 + IL_0038: br.s IL_004f + + IL_003a: ldloc.3 + IL_003b: ldloc.s V_4 + IL_003d: conv.i + IL_003e: ldloc.s V_5 + IL_0040: stelem.i8 + IL_0041: ldloc.s V_5 + IL_0043: ldc.i4.1 + IL_0044: conv.i8 + IL_0045: add + IL_0046: stloc.s V_5 + IL_0048: ldloc.s V_4 + IL_004a: ldc.i4.1 + IL_004b: conv.i8 + IL_004c: add + IL_004d: stloc.s V_4 + IL_004f: ldloc.s V_4 + IL_0051: ldloc.1 + IL_0052: blt.un.s IL_003a + + IL_0054: ldloc.3 + IL_0055: ret + } + + .method public static uint64[] f22(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 h) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + uint64 V_3, + bool V_4, + uint64 V_5, + uint64[] V_6, + bool V_7, + uint64 V_8, + uint64 V_9, + uint64 V_10) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldarg.2 + IL_0011: ldnull + IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0017: stloc.2 + IL_0018: ldloc.1 + IL_0019: brtrue.s IL_0027 + + IL_001b: ldloc.0 + IL_001c: ldloc.1 + IL_001d: ldloc.2 + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_0023: pop + IL_0024: nop + IL_0025: br.s IL_0028 + + IL_0027: nop + IL_0028: ldloc.2 + IL_0029: ldloc.0 + IL_002a: bge.un.s IL_0031 + + IL_002c: ldc.i4.0 + IL_002d: conv.i8 + IL_002e: nop + IL_002f: br.s IL_0037 + + IL_0031: ldloc.2 + IL_0032: ldloc.0 + IL_0033: sub + IL_0034: ldloc.1 + IL_0035: div.un + IL_0036: nop + IL_0037: stloc.3 + IL_0038: ldloc.3 + IL_0039: ldc.i4.m1 + IL_003a: conv.i8 + IL_003b: ceq + IL_003d: stloc.s V_4 + IL_003f: ldloc.2 + IL_0040: ldloc.0 + IL_0041: bge.un.s IL_0048 + + IL_0043: ldc.i4.0 + IL_0044: conv.i8 + IL_0045: nop + IL_0046: br.s IL_0051 + + IL_0048: ldloc.2 + IL_0049: ldloc.0 + IL_004a: sub + IL_004b: ldloc.1 + IL_004c: div.un + IL_004d: ldc.i4.1 + IL_004e: conv.i8 + IL_004f: add.ovf.un + IL_0050: nop + IL_0051: stloc.s V_5 + IL_0053: ldloc.s V_5 + IL_0055: ldc.i4.1 + IL_0056: conv.i8 + IL_0057: bge.un.s IL_005f + + IL_0059: call !!0[] [runtime]System.Array::Empty() + IL_005e: ret + + IL_005f: ldloc.s V_5 + IL_0061: conv.ovf.i.un + IL_0062: newarr [runtime]System.UInt64 + IL_0067: stloc.s V_6 + IL_0069: ldloc.s V_4 + IL_006b: brfalse.s IL_009d + + IL_006d: ldc.i4.1 + IL_006e: stloc.s V_7 + IL_0070: ldc.i4.0 + IL_0071: conv.i8 + IL_0072: stloc.s V_8 + IL_0074: ldloc.0 + IL_0075: stloc.s V_9 + IL_0077: br.s IL_0096 + + IL_0079: ldloc.s V_6 + IL_007b: ldloc.s V_8 + IL_007d: conv.i + IL_007e: ldloc.s V_9 + IL_0080: stelem.i8 + IL_0081: ldloc.s V_9 + IL_0083: ldloc.1 + IL_0084: add + IL_0085: stloc.s V_9 + IL_0087: ldloc.s V_8 + IL_0089: ldc.i4.1 + IL_008a: conv.i8 + IL_008b: add + IL_008c: stloc.s V_8 + IL_008e: ldloc.s V_8 + IL_0090: ldc.i4.0 + IL_0091: conv.i8 + IL_0092: cgt.un + IL_0094: stloc.s V_7 + IL_0096: ldloc.s V_7 + IL_0098: brtrue.s IL_0079 + + IL_009a: nop + IL_009b: br.s IL_00d6 + + IL_009d: ldloc.2 + IL_009e: ldloc.0 + IL_009f: bge.un.s IL_00a6 + + IL_00a1: ldc.i4.0 + IL_00a2: conv.i8 + IL_00a3: nop + IL_00a4: br.s IL_00af + + IL_00a6: ldloc.2 + IL_00a7: ldloc.0 + IL_00a8: sub + IL_00a9: ldloc.1 + IL_00aa: div.un + IL_00ab: ldc.i4.1 + IL_00ac: conv.i8 + IL_00ad: add.ovf.un + IL_00ae: nop + IL_00af: stloc.s V_8 + IL_00b1: ldc.i4.0 + IL_00b2: conv.i8 + IL_00b3: stloc.s V_9 + IL_00b5: ldloc.0 + IL_00b6: stloc.s V_10 + IL_00b8: br.s IL_00cf + + IL_00ba: ldloc.s V_6 + IL_00bc: ldloc.s V_9 + IL_00be: conv.i + IL_00bf: ldloc.s V_10 + IL_00c1: stelem.i8 + IL_00c2: ldloc.s V_10 + IL_00c4: ldloc.1 + IL_00c5: add + IL_00c6: stloc.s V_10 + IL_00c8: ldloc.s V_9 + IL_00ca: ldc.i4.1 + IL_00cb: conv.i8 + IL_00cc: add + IL_00cd: stloc.s V_9 + IL_00cf: ldloc.s V_9 + IL_00d1: ldloc.s V_8 + IL_00d3: blt.un.s IL_00ba + + IL_00d5: nop + IL_00d6: ldloc.s V_6 + IL_00d8: ret + } + +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs new file mode 100644 index 00000000000..b1236c04160 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs @@ -0,0 +1,22 @@ +let f1 () = [1UL..10UL] +let f2 () = [10UL..1UL] +let f3 () = [1UL..1UL..10UL] +let f4 () = [1UL..2UL..10UL] +let f5 () = [10UL..1UL..1UL] +let f6 start = [start..10UL] +let f7 finish = [1UL..finish] +let f8 (start: uint64) finish = [start..finish] +let f9 start = [start..1UL..10UL] +let f10 step = [1UL..step..10UL] +let f11 finish = [1UL..1UL..finish] +let f12 start step = [start..step..10UL] +let f13 start finish = [start..1UL..finish] +let f14 step finish = [1UL..step..finish] +let f15 (start: uint64) step finish = [start..step..finish] +let f16 f = [f ()..10UL] +let f17 f = [1UL..f ()] +let f18 (f: unit -> uint64) g = [f ()..g()] +let f19 f = [f ()..1UL..10UL] +let f20 f = [1UL..f ()..10UL] +let f21 f = [1UL..1UL..f ()] +let f22 (f: unit -> uint64) g h = [f ()..g ()..h ()] diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs.il.bsl new file mode 100644 index 00000000000..acf670b4144 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/UInt64RangeLists.fs.il.bsl @@ -0,0 +1,1651 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f1() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.2 + IL_0006: br.s IL_001b + + IL_0008: ldloca.s V_0 + IL_000a: ldloc.2 + IL_000b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0010: nop + IL_0011: ldloc.2 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: stloc.1 + IL_001b: ldloc.1 + IL_001c: ldc.i4.s 10 + IL_001e: conv.i8 + IL_001f: blt.un.s IL_0008 + + IL_0021: ldloca.s V_0 + IL_0023: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0028: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f2() cil managed + { + + .maxstack 8 + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0005: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f3() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.2 + IL_0006: br.s IL_001b + + IL_0008: ldloca.s V_0 + IL_000a: ldloc.2 + IL_000b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0010: nop + IL_0011: ldloc.2 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: stloc.1 + IL_001b: ldloc.1 + IL_001c: ldc.i4.s 10 + IL_001e: conv.i8 + IL_001f: blt.un.s IL_0008 + + IL_0021: ldloca.s V_0 + IL_0023: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0028: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f4() cil managed + { + + .maxstack 4 + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.2 + IL_0006: br.s IL_001b + + IL_0008: ldloca.s V_0 + IL_000a: ldloc.2 + IL_000b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0010: nop + IL_0011: ldloc.2 + IL_0012: ldc.i4.2 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.2 + IL_0016: ldloc.1 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: add + IL_001a: stloc.1 + IL_001b: ldloc.1 + IL_001c: ldc.i4.5 + IL_001d: conv.i8 + IL_001e: blt.un.s IL_0008 + + IL_0020: ldloca.s V_0 + IL_0022: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0027: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f5() cil managed + { + + .maxstack 8 + IL_0000: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0005: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f6(uint64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + uint64 V_3) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: conv.i8 + IL_0004: ldarg.0 + IL_0005: bge.un.s IL_000c + + IL_0007: ldc.i4.0 + IL_0008: conv.i8 + IL_0009: nop + IL_000a: br.s IL_0015 + + IL_000c: ldc.i4.s 10 + IL_000e: conv.i8 + IL_000f: ldarg.0 + IL_0010: sub + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.2 + IL_0019: ldarg.0 + IL_001a: stloc.3 + IL_001b: br.s IL_0030 + + IL_001d: ldloca.s V_1 + IL_001f: ldloc.3 + IL_0020: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0025: nop + IL_0026: ldloc.3 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.3 + IL_002b: ldloc.2 + IL_002c: ldc.i4.1 + IL_002d: conv.i8 + IL_002e: add + IL_002f: stloc.2 + IL_0030: ldloc.2 + IL_0031: ldloc.0 + IL_0032: blt.un.s IL_001d + + IL_0034: ldloca.s V_1 + IL_0036: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003b: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f7(uint64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + uint64 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0013 + + IL_000b: ldarg.0 + IL_000c: ldc.i4.1 + IL_000d: conv.i8 + IL_000e: sub + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add.ovf.un + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.2 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: stloc.3 + IL_001a: br.s IL_002f + + IL_001c: ldloca.s V_1 + IL_001e: ldloc.3 + IL_001f: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0024: nop + IL_0025: ldloc.3 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.3 + IL_002a: ldloc.2 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.2 + IL_002f: ldloc.2 + IL_0030: ldloc.0 + IL_0031: blt.un.s IL_001c + + IL_0033: ldloca.s V_1 + IL_0035: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003a: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f8(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + bool V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + bool V_3, + uint64 V_4, + uint64 V_5, + uint64 V_6) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_000e + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: nop + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: ldc.i4.m1 + IL_0011: conv.i8 + IL_0012: ceq + IL_0014: stloc.1 + IL_0015: ldloc.1 + IL_0016: brfalse.s IL_0048 + + IL_0018: ldc.i4.1 + IL_0019: stloc.3 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: stloc.s V_4 + IL_001e: ldarg.0 + IL_001f: stloc.s V_5 + IL_0021: br.s IL_0042 + + IL_0023: ldloca.s V_2 + IL_0025: ldloc.s V_5 + IL_0027: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002c: nop + IL_002d: ldloc.s V_5 + IL_002f: ldc.i4.1 + IL_0030: conv.i8 + IL_0031: add + IL_0032: stloc.s V_5 + IL_0034: ldloc.s V_4 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.s V_4 + IL_003b: ldloc.s V_4 + IL_003d: ldc.i4.0 + IL_003e: conv.i8 + IL_003f: cgt.un + IL_0041: stloc.3 + IL_0042: ldloc.3 + IL_0043: brtrue.s IL_0023 + + IL_0045: nop + IL_0046: br.s IL_0082 + + IL_0048: ldarg.1 + IL_0049: ldarg.0 + IL_004a: bge.un.s IL_0051 + + IL_004c: ldc.i4.0 + IL_004d: conv.i8 + IL_004e: nop + IL_004f: br.s IL_0058 + + IL_0051: ldarg.1 + IL_0052: ldarg.0 + IL_0053: sub + IL_0054: ldc.i4.1 + IL_0055: conv.i8 + IL_0056: add.ovf.un + IL_0057: nop + IL_0058: stloc.s V_4 + IL_005a: ldc.i4.0 + IL_005b: conv.i8 + IL_005c: stloc.s V_5 + IL_005e: ldarg.0 + IL_005f: stloc.s V_6 + IL_0061: br.s IL_007b + + IL_0063: ldloca.s V_2 + IL_0065: ldloc.s V_6 + IL_0067: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_006c: nop + IL_006d: ldloc.s V_6 + IL_006f: ldc.i4.1 + IL_0070: conv.i8 + IL_0071: add + IL_0072: stloc.s V_6 + IL_0074: ldloc.s V_5 + IL_0076: ldc.i4.1 + IL_0077: conv.i8 + IL_0078: add + IL_0079: stloc.s V_5 + IL_007b: ldloc.s V_5 + IL_007d: ldloc.s V_4 + IL_007f: blt.un.s IL_0063 + + IL_0081: nop + IL_0082: ldloca.s V_2 + IL_0084: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0089: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f9(uint64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + uint64 V_3) + IL_0000: nop + IL_0001: ldc.i4.s 10 + IL_0003: conv.i8 + IL_0004: ldarg.0 + IL_0005: bge.un.s IL_000c + + IL_0007: ldc.i4.0 + IL_0008: conv.i8 + IL_0009: nop + IL_000a: br.s IL_0015 + + IL_000c: ldc.i4.s 10 + IL_000e: conv.i8 + IL_000f: ldarg.0 + IL_0010: sub + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.2 + IL_0019: ldarg.0 + IL_001a: stloc.3 + IL_001b: br.s IL_0030 + + IL_001d: ldloca.s V_1 + IL_001f: ldloc.3 + IL_0020: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0025: nop + IL_0026: ldloc.3 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.3 + IL_002b: ldloc.2 + IL_002c: ldc.i4.1 + IL_002d: conv.i8 + IL_002e: add + IL_002f: stloc.2 + IL_0030: ldloc.2 + IL_0031: ldloc.0 + IL_0032: blt.un.s IL_001d + + IL_0034: ldloca.s V_1 + IL_0036: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003b: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f10(uint64 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + uint64 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0013 + + IL_0004: ldc.i4.1 + IL_0005: conv.i8 + IL_0006: ldarg.0 + IL_0007: ldc.i4.s 10 + IL_0009: conv.i8 + IL_000a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000f: pop + IL_0010: nop + IL_0011: br.s IL_0014 + + IL_0013: nop + IL_0014: ldc.i4.s 10 + IL_0016: conv.i8 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: bge.un.s IL_0020 + + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: nop + IL_001e: br.s IL_002c + + IL_0020: ldc.i4.s 10 + IL_0022: conv.i8 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: sub + IL_0026: ldarg.0 + IL_0027: div.un + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add.ovf.un + IL_002b: nop + IL_002c: stloc.0 + IL_002d: ldc.i4.0 + IL_002e: conv.i8 + IL_002f: stloc.2 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: stloc.3 + IL_0033: br.s IL_0047 + + IL_0035: ldloca.s V_1 + IL_0037: ldloc.3 + IL_0038: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_003d: nop + IL_003e: ldloc.3 + IL_003f: ldarg.0 + IL_0040: add + IL_0041: stloc.3 + IL_0042: ldloc.2 + IL_0043: ldc.i4.1 + IL_0044: conv.i8 + IL_0045: add + IL_0046: stloc.2 + IL_0047: ldloc.2 + IL_0048: ldloc.0 + IL_0049: blt.un.s IL_0035 + + IL_004b: ldloca.s V_1 + IL_004d: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0052: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f11(uint64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + uint64 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldc.i4.1 + IL_0003: conv.i8 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0013 + + IL_000b: ldarg.0 + IL_000c: ldc.i4.1 + IL_000d: conv.i8 + IL_000e: sub + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add.ovf.un + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.2 + IL_0017: ldc.i4.1 + IL_0018: conv.i8 + IL_0019: stloc.3 + IL_001a: br.s IL_002f + + IL_001c: ldloca.s V_1 + IL_001e: ldloc.3 + IL_001f: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0024: nop + IL_0025: ldloc.3 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.3 + IL_002a: ldloc.2 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.2 + IL_002f: ldloc.2 + IL_0030: ldloc.0 + IL_0031: blt.un.s IL_001c + + IL_0033: ldloca.s V_1 + IL_0035: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_003a: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f12(uint64 start, + uint64 step) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + uint64 V_3) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0012 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldc.i4.s 10 + IL_0008: conv.i8 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000e: pop + IL_000f: nop + IL_0010: br.s IL_0013 + + IL_0012: nop + IL_0013: ldc.i4.s 10 + IL_0015: conv.i8 + IL_0016: ldarg.0 + IL_0017: bge.un.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0029 + + IL_001e: ldc.i4.s 10 + IL_0020: conv.i8 + IL_0021: ldarg.0 + IL_0022: sub + IL_0023: ldarg.1 + IL_0024: div.un + IL_0025: ldc.i4.1 + IL_0026: conv.i8 + IL_0027: add.ovf.un + IL_0028: nop + IL_0029: stloc.0 + IL_002a: ldc.i4.0 + IL_002b: conv.i8 + IL_002c: stloc.2 + IL_002d: ldarg.0 + IL_002e: stloc.3 + IL_002f: br.s IL_0043 + + IL_0031: ldloca.s V_1 + IL_0033: ldloc.3 + IL_0034: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0039: nop + IL_003a: ldloc.3 + IL_003b: ldarg.1 + IL_003c: add + IL_003d: stloc.3 + IL_003e: ldloc.2 + IL_003f: ldc.i4.1 + IL_0040: conv.i8 + IL_0041: add + IL_0042: stloc.2 + IL_0043: ldloc.2 + IL_0044: ldloc.0 + IL_0045: blt.un.s IL_0031 + + IL_0047: ldloca.s V_1 + IL_0049: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_004e: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f13(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + bool V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + bool V_3, + uint64 V_4, + uint64 V_5, + uint64 V_6) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_000e + + IL_000a: ldarg.1 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: nop + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: ldc.i4.m1 + IL_0011: conv.i8 + IL_0012: ceq + IL_0014: stloc.1 + IL_0015: ldloc.1 + IL_0016: brfalse.s IL_0048 + + IL_0018: ldc.i4.1 + IL_0019: stloc.3 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: stloc.s V_4 + IL_001e: ldarg.0 + IL_001f: stloc.s V_5 + IL_0021: br.s IL_0042 + + IL_0023: ldloca.s V_2 + IL_0025: ldloc.s V_5 + IL_0027: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002c: nop + IL_002d: ldloc.s V_5 + IL_002f: ldc.i4.1 + IL_0030: conv.i8 + IL_0031: add + IL_0032: stloc.s V_5 + IL_0034: ldloc.s V_4 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.s V_4 + IL_003b: ldloc.s V_4 + IL_003d: ldc.i4.0 + IL_003e: conv.i8 + IL_003f: cgt.un + IL_0041: stloc.3 + IL_0042: ldloc.3 + IL_0043: brtrue.s IL_0023 + + IL_0045: nop + IL_0046: br.s IL_0082 + + IL_0048: ldarg.1 + IL_0049: ldarg.0 + IL_004a: bge.un.s IL_0051 + + IL_004c: ldc.i4.0 + IL_004d: conv.i8 + IL_004e: nop + IL_004f: br.s IL_0058 + + IL_0051: ldarg.1 + IL_0052: ldarg.0 + IL_0053: sub + IL_0054: ldc.i4.1 + IL_0055: conv.i8 + IL_0056: add.ovf.un + IL_0057: nop + IL_0058: stloc.s V_4 + IL_005a: ldc.i4.0 + IL_005b: conv.i8 + IL_005c: stloc.s V_5 + IL_005e: ldarg.0 + IL_005f: stloc.s V_6 + IL_0061: br.s IL_007b + + IL_0063: ldloca.s V_2 + IL_0065: ldloc.s V_6 + IL_0067: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_006c: nop + IL_006d: ldloc.s V_6 + IL_006f: ldc.i4.1 + IL_0070: conv.i8 + IL_0071: add + IL_0072: stloc.s V_6 + IL_0074: ldloc.s V_5 + IL_0076: ldc.i4.1 + IL_0077: conv.i8 + IL_0078: add + IL_0079: stloc.s V_5 + IL_007b: ldloc.s V_5 + IL_007d: ldloc.s V_4 + IL_007f: blt.un.s IL_0063 + + IL_0081: nop + IL_0082: ldloca.s V_2 + IL_0084: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0089: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f14(uint64 step, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + uint64 V_3) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: brtrue.s IL_0011 + + IL_0004: ldc.i4.1 + IL_0005: conv.i8 + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000d: pop + IL_000e: nop + IL_000f: br.s IL_0012 + + IL_0011: nop + IL_0012: ldarg.1 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: bge.un.s IL_001c + + IL_0017: ldc.i4.0 + IL_0018: conv.i8 + IL_0019: nop + IL_001a: br.s IL_0026 + + IL_001c: ldarg.1 + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: sub + IL_0020: ldarg.0 + IL_0021: div.un + IL_0022: ldc.i4.1 + IL_0023: conv.i8 + IL_0024: add.ovf.un + IL_0025: nop + IL_0026: stloc.0 + IL_0027: ldc.i4.0 + IL_0028: conv.i8 + IL_0029: stloc.2 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: stloc.3 + IL_002d: br.s IL_0041 + + IL_002f: ldloca.s V_1 + IL_0031: ldloc.3 + IL_0032: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0037: nop + IL_0038: ldloc.3 + IL_0039: ldarg.0 + IL_003a: add + IL_003b: stloc.3 + IL_003c: ldloc.2 + IL_003d: ldc.i4.1 + IL_003e: conv.i8 + IL_003f: add + IL_0040: stloc.2 + IL_0041: ldloc.2 + IL_0042: ldloc.0 + IL_0043: blt.un.s IL_002f + + IL_0045: ldloca.s V_1 + IL_0047: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_004c: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f15(uint64 start, + uint64 step, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + bool V_3, + uint64 V_4, + uint64 V_5, + uint64 V_6) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: brtrue.s IL_0010 + + IL_0004: ldarg.0 + IL_0005: ldarg.1 + IL_0006: ldarg.2 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldarg.2 + IL_0012: ldarg.0 + IL_0013: bge.un.s IL_001a + + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: nop + IL_0018: br.s IL_0020 + + IL_001a: ldarg.2 + IL_001b: ldarg.0 + IL_001c: sub + IL_001d: ldarg.1 + IL_001e: div.un + IL_001f: nop + IL_0020: stloc.0 + IL_0021: ldloc.0 + IL_0022: ldc.i4.m1 + IL_0023: conv.i8 + IL_0024: ceq + IL_0026: stloc.1 + IL_0027: ldloc.1 + IL_0028: brfalse.s IL_0059 + + IL_002a: ldc.i4.1 + IL_002b: stloc.3 + IL_002c: ldc.i4.0 + IL_002d: conv.i8 + IL_002e: stloc.s V_4 + IL_0030: ldarg.0 + IL_0031: stloc.s V_5 + IL_0033: br.s IL_0053 + + IL_0035: ldloca.s V_2 + IL_0037: ldloc.s V_5 + IL_0039: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_003e: nop + IL_003f: ldloc.s V_5 + IL_0041: ldarg.1 + IL_0042: add + IL_0043: stloc.s V_5 + IL_0045: ldloc.s V_4 + IL_0047: ldc.i4.1 + IL_0048: conv.i8 + IL_0049: add + IL_004a: stloc.s V_4 + IL_004c: ldloc.s V_4 + IL_004e: ldc.i4.0 + IL_004f: conv.i8 + IL_0050: cgt.un + IL_0052: stloc.3 + IL_0053: ldloc.3 + IL_0054: brtrue.s IL_0035 + + IL_0056: nop + IL_0057: br.s IL_0094 + + IL_0059: ldarg.2 + IL_005a: ldarg.0 + IL_005b: bge.un.s IL_0062 + + IL_005d: ldc.i4.0 + IL_005e: conv.i8 + IL_005f: nop + IL_0060: br.s IL_006b + + IL_0062: ldarg.2 + IL_0063: ldarg.0 + IL_0064: sub + IL_0065: ldarg.1 + IL_0066: div.un + IL_0067: ldc.i4.1 + IL_0068: conv.i8 + IL_0069: add.ovf.un + IL_006a: nop + IL_006b: stloc.s V_4 + IL_006d: ldc.i4.0 + IL_006e: conv.i8 + IL_006f: stloc.s V_5 + IL_0071: ldarg.0 + IL_0072: stloc.s V_6 + IL_0074: br.s IL_008d + + IL_0076: ldloca.s V_2 + IL_0078: ldloc.s V_6 + IL_007a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_007f: nop + IL_0080: ldloc.s V_6 + IL_0082: ldarg.1 + IL_0083: add + IL_0084: stloc.s V_6 + IL_0086: ldloc.s V_5 + IL_0088: ldc.i4.1 + IL_0089: conv.i8 + IL_008a: add + IL_008b: stloc.s V_5 + IL_008d: ldloc.s V_5 + IL_008f: ldloc.s V_4 + IL_0091: blt.un.s IL_0076 + + IL_0093: nop + IL_0094: ldloca.s V_2 + IL_0096: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_009b: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f16(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: conv.i8 + IL_000b: ldloc.0 + IL_000c: bge.un.s IL_0013 + + IL_000e: ldc.i4.0 + IL_000f: conv.i8 + IL_0010: nop + IL_0011: br.s IL_001c + + IL_0013: ldc.i4.s 10 + IL_0015: conv.i8 + IL_0016: ldloc.0 + IL_0017: sub + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add.ovf.un + IL_001b: nop + IL_001c: stloc.1 + IL_001d: ldc.i4.0 + IL_001e: conv.i8 + IL_001f: stloc.3 + IL_0020: ldloc.0 + IL_0021: stloc.s V_4 + IL_0023: br.s IL_003b + + IL_0025: ldloca.s V_2 + IL_0027: ldloc.s V_4 + IL_0029: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002e: nop + IL_002f: ldloc.s V_4 + IL_0031: ldc.i4.1 + IL_0032: conv.i8 + IL_0033: add + IL_0034: stloc.s V_4 + IL_0036: ldloc.3 + IL_0037: ldc.i4.1 + IL_0038: conv.i8 + IL_0039: add + IL_003a: stloc.3 + IL_003b: ldloc.3 + IL_003c: ldloc.1 + IL_003d: blt.un.s IL_0025 + + IL_003f: ldloca.s V_2 + IL_0041: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0046: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f17(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: conv.i8 + IL_000b: bge.un.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001a + + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: sub + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add.ovf.un + IL_0019: nop + IL_001a: stloc.1 + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: stloc.3 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: stloc.s V_4 + IL_0022: br.s IL_003a + + IL_0024: ldloca.s V_2 + IL_0026: ldloc.s V_4 + IL_0028: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002d: nop + IL_002e: ldloc.s V_4 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: add + IL_0033: stloc.s V_4 + IL_0035: ldloc.3 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.3 + IL_003a: ldloc.3 + IL_003b: ldloc.1 + IL_003c: blt.un.s IL_0024 + + IL_003e: ldloca.s V_2 + IL_0040: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0045: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f18(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + bool V_3, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_4, + bool V_5, + uint64 V_6, + uint64 V_7, + uint64 V_8) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldloc.1 + IL_0011: ldloc.0 + IL_0012: bge.un.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_001d + + IL_0019: ldloc.1 + IL_001a: ldloc.0 + IL_001b: sub + IL_001c: nop + IL_001d: stloc.2 + IL_001e: ldloc.2 + IL_001f: ldc.i4.m1 + IL_0020: conv.i8 + IL_0021: ceq + IL_0023: stloc.3 + IL_0024: ldloc.3 + IL_0025: brfalse.s IL_005a + + IL_0027: ldc.i4.1 + IL_0028: stloc.s V_5 + IL_002a: ldc.i4.0 + IL_002b: conv.i8 + IL_002c: stloc.s V_6 + IL_002e: ldloc.0 + IL_002f: stloc.s V_7 + IL_0031: br.s IL_0053 + + IL_0033: ldloca.s V_4 + IL_0035: ldloc.s V_7 + IL_0037: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_003c: nop + IL_003d: ldloc.s V_7 + IL_003f: ldc.i4.1 + IL_0040: conv.i8 + IL_0041: add + IL_0042: stloc.s V_7 + IL_0044: ldloc.s V_6 + IL_0046: ldc.i4.1 + IL_0047: conv.i8 + IL_0048: add + IL_0049: stloc.s V_6 + IL_004b: ldloc.s V_6 + IL_004d: ldc.i4.0 + IL_004e: conv.i8 + IL_004f: cgt.un + IL_0051: stloc.s V_5 + IL_0053: ldloc.s V_5 + IL_0055: brtrue.s IL_0033 + + IL_0057: nop + IL_0058: br.s IL_0094 + + IL_005a: ldloc.1 + IL_005b: ldloc.0 + IL_005c: bge.un.s IL_0063 + + IL_005e: ldc.i4.0 + IL_005f: conv.i8 + IL_0060: nop + IL_0061: br.s IL_006a + + IL_0063: ldloc.1 + IL_0064: ldloc.0 + IL_0065: sub + IL_0066: ldc.i4.1 + IL_0067: conv.i8 + IL_0068: add.ovf.un + IL_0069: nop + IL_006a: stloc.s V_6 + IL_006c: ldc.i4.0 + IL_006d: conv.i8 + IL_006e: stloc.s V_7 + IL_0070: ldloc.0 + IL_0071: stloc.s V_8 + IL_0073: br.s IL_008d + + IL_0075: ldloca.s V_4 + IL_0077: ldloc.s V_8 + IL_0079: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_007e: nop + IL_007f: ldloc.s V_8 + IL_0081: ldc.i4.1 + IL_0082: conv.i8 + IL_0083: add + IL_0084: stloc.s V_8 + IL_0086: ldloc.s V_7 + IL_0088: ldc.i4.1 + IL_0089: conv.i8 + IL_008a: add + IL_008b: stloc.s V_7 + IL_008d: ldloc.s V_7 + IL_008f: ldloc.s V_6 + IL_0091: blt.un.s IL_0075 + + IL_0093: nop + IL_0094: ldloca.s V_4 + IL_0096: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_009b: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f19(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldc.i4.s 10 + IL_000a: conv.i8 + IL_000b: ldloc.0 + IL_000c: bge.un.s IL_0013 + + IL_000e: ldc.i4.0 + IL_000f: conv.i8 + IL_0010: nop + IL_0011: br.s IL_001c + + IL_0013: ldc.i4.s 10 + IL_0015: conv.i8 + IL_0016: ldloc.0 + IL_0017: sub + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add.ovf.un + IL_001b: nop + IL_001c: stloc.1 + IL_001d: ldc.i4.0 + IL_001e: conv.i8 + IL_001f: stloc.3 + IL_0020: ldloc.0 + IL_0021: stloc.s V_4 + IL_0023: br.s IL_003b + + IL_0025: ldloca.s V_2 + IL_0027: ldloc.s V_4 + IL_0029: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002e: nop + IL_002f: ldloc.s V_4 + IL_0031: ldc.i4.1 + IL_0032: conv.i8 + IL_0033: add + IL_0034: stloc.s V_4 + IL_0036: ldloc.3 + IL_0037: ldc.i4.1 + IL_0038: conv.i8 + IL_0039: add + IL_003a: stloc.3 + IL_003b: ldloc.3 + IL_003c: ldloc.1 + IL_003d: blt.un.s IL_0025 + + IL_003f: ldloca.s V_2 + IL_0041: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0046: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f20(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: brtrue.s IL_001a + + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: ldloc.0 + IL_000e: ldc.i4.s 10 + IL_0010: conv.i8 + IL_0011: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_0016: pop + IL_0017: nop + IL_0018: br.s IL_001b + + IL_001a: nop + IL_001b: ldc.i4.s 10 + IL_001d: conv.i8 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: bge.un.s IL_0027 + + IL_0022: ldc.i4.0 + IL_0023: conv.i8 + IL_0024: nop + IL_0025: br.s IL_0033 + + IL_0027: ldc.i4.s 10 + IL_0029: conv.i8 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: sub + IL_002d: ldloc.0 + IL_002e: div.un + IL_002f: ldc.i4.1 + IL_0030: conv.i8 + IL_0031: add.ovf.un + IL_0032: nop + IL_0033: stloc.1 + IL_0034: ldc.i4.0 + IL_0035: conv.i8 + IL_0036: stloc.3 + IL_0037: ldc.i4.1 + IL_0038: conv.i8 + IL_0039: stloc.s V_4 + IL_003b: br.s IL_0052 + + IL_003d: ldloca.s V_2 + IL_003f: ldloc.s V_4 + IL_0041: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0046: nop + IL_0047: ldloc.s V_4 + IL_0049: ldloc.0 + IL_004a: add + IL_004b: stloc.s V_4 + IL_004d: ldloc.3 + IL_004e: ldc.i4.1 + IL_004f: conv.i8 + IL_0050: add + IL_0051: stloc.3 + IL_0052: ldloc.3 + IL_0053: ldloc.1 + IL_0054: blt.un.s IL_003d + + IL_0056: ldloca.s V_2 + IL_0058: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_005d: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f21(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: conv.i8 + IL_000b: bge.un.s IL_0012 + + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: nop + IL_0010: br.s IL_001a + + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: sub + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add.ovf.un + IL_0019: nop + IL_001a: stloc.1 + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: stloc.3 + IL_001e: ldc.i4.1 + IL_001f: conv.i8 + IL_0020: stloc.s V_4 + IL_0022: br.s IL_003a + + IL_0024: ldloca.s V_2 + IL_0026: ldloc.s V_4 + IL_0028: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002d: nop + IL_002e: ldloc.s V_4 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: add + IL_0033: stloc.s V_4 + IL_0035: ldloc.3 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.3 + IL_003a: ldloc.3 + IL_003b: ldloc.1 + IL_003c: blt.un.s IL_0024 + + IL_003e: ldloca.s V_2 + IL_0040: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0045: ret + } + + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 + f22(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 f, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 g, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 h) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2, + uint64 V_3, + bool V_4, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_5, + bool V_6, + uint64 V_7, + uint64 V_8, + uint64 V_9) + IL_0000: ldarg.0 + IL_0001: ldnull + IL_0002: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0007: stloc.0 + IL_0008: ldarg.1 + IL_0009: ldnull + IL_000a: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_000f: stloc.1 + IL_0010: ldarg.2 + IL_0011: ldnull + IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0017: stloc.2 + IL_0018: ldloc.1 + IL_0019: brtrue.s IL_0027 + + IL_001b: ldloc.0 + IL_001c: ldloc.1 + IL_001d: ldloc.2 + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_0023: pop + IL_0024: nop + IL_0025: br.s IL_0028 + + IL_0027: nop + IL_0028: ldloc.2 + IL_0029: ldloc.0 + IL_002a: bge.un.s IL_0031 + + IL_002c: ldc.i4.0 + IL_002d: conv.i8 + IL_002e: nop + IL_002f: br.s IL_0037 + + IL_0031: ldloc.2 + IL_0032: ldloc.0 + IL_0033: sub + IL_0034: ldloc.1 + IL_0035: div.un + IL_0036: nop + IL_0037: stloc.3 + IL_0038: ldloc.3 + IL_0039: ldc.i4.m1 + IL_003a: conv.i8 + IL_003b: ceq + IL_003d: stloc.s V_4 + IL_003f: ldloc.s V_4 + IL_0041: brfalse.s IL_0075 + + IL_0043: ldc.i4.1 + IL_0044: stloc.s V_6 + IL_0046: ldc.i4.0 + IL_0047: conv.i8 + IL_0048: stloc.s V_7 + IL_004a: ldloc.0 + IL_004b: stloc.s V_8 + IL_004d: br.s IL_006e + + IL_004f: ldloca.s V_5 + IL_0051: ldloc.s V_8 + IL_0053: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0058: nop + IL_0059: ldloc.s V_8 + IL_005b: ldloc.1 + IL_005c: add + IL_005d: stloc.s V_8 + IL_005f: ldloc.s V_7 + IL_0061: ldc.i4.1 + IL_0062: conv.i8 + IL_0063: add + IL_0064: stloc.s V_7 + IL_0066: ldloc.s V_7 + IL_0068: ldc.i4.0 + IL_0069: conv.i8 + IL_006a: cgt.un + IL_006c: stloc.s V_6 + IL_006e: ldloc.s V_6 + IL_0070: brtrue.s IL_004f + + IL_0072: nop + IL_0073: br.s IL_00b0 + + IL_0075: ldloc.2 + IL_0076: ldloc.0 + IL_0077: bge.un.s IL_007e + + IL_0079: ldc.i4.0 + IL_007a: conv.i8 + IL_007b: nop + IL_007c: br.s IL_0087 + + IL_007e: ldloc.2 + IL_007f: ldloc.0 + IL_0080: sub + IL_0081: ldloc.1 + IL_0082: div.un + IL_0083: ldc.i4.1 + IL_0084: conv.i8 + IL_0085: add.ovf.un + IL_0086: nop + IL_0087: stloc.s V_7 + IL_0089: ldc.i4.0 + IL_008a: conv.i8 + IL_008b: stloc.s V_8 + IL_008d: ldloc.0 + IL_008e: stloc.s V_9 + IL_0090: br.s IL_00a9 + + IL_0092: ldloca.s V_5 + IL_0094: ldloc.s V_9 + IL_0096: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_009b: nop + IL_009c: ldloc.s V_9 + IL_009e: ldloc.1 + IL_009f: add + IL_00a0: stloc.s V_9 + IL_00a2: ldloc.s V_8 + IL_00a4: ldc.i4.1 + IL_00a5: conv.i8 + IL_00a6: add + IL_00a7: stloc.s V_8 + IL_00a9: ldloc.s V_8 + IL_00ab: ldloc.s V_7 + IL_00ad: blt.un.s IL_0092 + + IL_00af: nop + IL_00b0: ldloca.s V_5 + IL_00b2: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_00b7: ret + } + +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepByte.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepByte.fs new file mode 100644 index 00000000000..f4e047fb3d5 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepByte.fs @@ -0,0 +1,57 @@ +let mutable c = 0uy + +let f0 () = + for n in 10uy..1uy do + c <- n + +let f00 () = + for n in 10uy..1uy..1uy do + c <- n + +let f1 () = + for n in 1uy..10uy do + c <- n + +let f2 start = + for n in start..10uy do + c <- n + +let f3 finish = + for n in 1uy..finish do + c <- n + +let f4 (start: byte) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1uy..1uy..10uy do + c <- n + +let f6 () = + for n in 1uy..2uy..10uy do + c <- n + +let f7uy start = + for n in start..2uy..10uy do + c <- n + +let f8 step = + for n in 1uy..step..10uy do + c <- n + +let f9 finish = + for n in 1uy..2uy..finish do + c <- n + +let f10 (start: byte) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0uy..finish do + c <- n + +let f12 () = + for n in 1uy..0uy..10uy do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepByte.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepByte.fs.opt.il.bsl new file mode 100644 index 00000000000..681c6e38186 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepByte.fs.opt.il.bsl @@ -0,0 +1,674 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static uint8 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint8 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint8 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint8 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint8 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint8 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(uint8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.u2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(uint8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.u2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(uint8 start, + uint8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.u2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7uy(uint8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u2 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(uint8) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(uint8 step) cil managed + { + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.s 9 + IL_0013: ldarg.0 + IL_0014: div.un + IL_0015: conv.u2 + IL_0016: ldc.i4.1 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldc.i4.0 + IL_001a: stloc.1 + IL_001b: ldc.i4.1 + IL_001c: stloc.2 + IL_001d: br.s IL_002d + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(uint8) + IL_0025: ldloc.2 + IL_0026: ldarg.0 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: add + IL_002c: stloc.1 + IL_002d: ldloc.1 + IL_002e: ldloc.0 + IL_002f: blt.un.s IL_001f + + IL_0031: ret + } + + .method public static void f9(uint8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.u2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(uint8 start, + uint8 step, + uint8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0018 + + IL_0014: ldc.i4.0 + IL_0015: nop + IL_0016: br.s IL_0021 + + IL_0018: ldarg.2 + IL_0019: ldarg.2 + IL_001a: sub + IL_001b: ldarg.1 + IL_001c: div.un + IL_001d: conv.u2 + IL_001e: ldc.i4.1 + IL_001f: add + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldarg.2 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(uint8) + IL_002e: ldloc.2 + IL_002f: ldarg.1 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f11(uint8 start, + uint8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint8 V_0, + uint8 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(uint8) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint8 V_0, + uint8 V_1, + uint8 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(uint8) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .property uint8 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint8) + .get uint8 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly uint8 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld uint8 ''.$assembly::c@1 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepChar.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepChar.fs new file mode 100644 index 00000000000..137044d13b9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepChar.fs @@ -0,0 +1,57 @@ +let mutable c = '\000' + +let f0 () = + for n in 'z'..'a' do + c <- n + +let f00 () = + for n in 'z'..'\001'..'a' do + c <- n + +let f1 () = + for n in 'a'..'z' do + c <- n + +let f2 start = + for n in start..'z' do + c <- n + +let f3 finish = + for n in 'a'..finish do + c <- n + +let f4 (start: char) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 'a'..'\001'..'z' do + c <- n + +let f6 () = + for n in 'a'..'\002'..'z' do + c <- n + +let f7 start = + for n in start..'\002'..'z' do + c <- n + +let f8 step = + for n in 'a'..step..'z' do + c <- n + +let f9 finish = + for n in 'a'..'\002'..finish do + c <- n + +let f10 (start: char) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..'\000'..finish do + c <- n + +let f12 () = + for n in 'a'..'\000'..'z' do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepChar.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepChar.fs.opt.il.bsl new file mode 100644 index 00000000000..bb440972d85 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepChar.fs.opt.il.bsl @@ -0,0 +1,850 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit f8@40 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f8@40 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f8@40::.ctor() + IL_0005: stsfld class assembly/f8@40 assembly/f8@40::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit f10@48 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f10@48 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f10@48::.ctor() + IL_0005: stsfld class assembly/f10@48 assembly/f10@48::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit f11@52 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f11@52 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f11@52::.ctor() + IL_0005: stsfld class assembly/f11@52 assembly/f11@52::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit f12@56 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f12@56 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f12@56::.ctor() + IL_0005: stsfld class assembly/f12@56 assembly/f12@56::@_instance + IL_000a: ret + } + + } + + .method public specialname static char get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld char ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(char 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld char ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (char V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 122 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (char V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 122 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 97 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 26 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f2(char start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldc.i4.s 122 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 122 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(char) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(char finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 97 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.s 97 + IL_000c: sub + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.s 97 + IL_0016: stloc.2 + IL_0017: br.s IL_0027 + + IL_0019: ldloc.2 + IL_001a: call void assembly::set_c(char) + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.1 + IL_0027: ldloc.1 + IL_0028: ldloc.0 + IL_0029: blt.un.s IL_0019 + + IL_002b: ret + } + + .method public static void f4(char start, + char finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.u4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(char) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 97 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 26 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 97 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.2 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 13 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f7(char start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldc.i4.s 122 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 122 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(char) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(char step) cil managed + { + + .maxstack 7 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: bne.un.s IL_0018 + + IL_0004: ldc.i4.0 + IL_0005: ldsfld class assembly/f8@40 assembly/f8@40::@_instance + IL_000a: ldc.i4.s 97 + IL_000c: ldarg.0 + IL_000d: ldc.i4.s 122 + IL_000f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_0014: pop + IL_0015: nop + IL_0016: br.s IL_0019 + + IL_0018: nop + IL_0019: ldc.i4.s 122 + IL_001b: ldc.i4.s 97 + IL_001d: sub + IL_001e: ldarg.0 + IL_001f: div.un + IL_0020: conv.u4 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldc.i4.0 + IL_0025: stloc.1 + IL_0026: ldc.i4.s 97 + IL_0028: stloc.2 + IL_0029: br.s IL_0039 + + IL_002b: ldloc.2 + IL_002c: call void assembly::set_c(char) + IL_0031: ldloc.2 + IL_0032: ldarg.0 + IL_0033: add + IL_0034: stloc.2 + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: add + IL_0038: stloc.1 + IL_0039: ldloc.1 + IL_003a: ldloc.0 + IL_003b: blt.un.s IL_002b + + IL_003d: ret + } + + .method public static void f9(char finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 97 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.s 97 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldc.i4.s 97 + IL_0018: stloc.2 + IL_0019: br.s IL_0029 + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(char) + IL_0021: ldloc.2 + IL_0022: ldc.i4.2 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: add + IL_0028: stloc.1 + IL_0029: ldloc.1 + IL_002a: ldloc.0 + IL_002b: blt.un.s IL_001b + + IL_002d: ret + } + + .method public static void f10(char start, + char step, + char finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 7 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.1 + IL_0001: ldc.i4.0 + IL_0002: bne.un.s IL_0016 + + IL_0004: ldc.i4.0 + IL_0005: ldsfld class assembly/f10@48 assembly/f10@48::@_instance + IL_000a: ldarg.2 + IL_000b: ldarg.1 + IL_000c: ldarg.2 + IL_000d: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_0012: pop + IL_0013: nop + IL_0014: br.s IL_0017 + + IL_0016: nop + IL_0017: ldarg.2 + IL_0018: ldarg.2 + IL_0019: bge.un.s IL_001f + + IL_001b: ldc.i4.0 + IL_001c: nop + IL_001d: br.s IL_0028 + + IL_001f: ldarg.2 + IL_0020: ldarg.2 + IL_0021: sub + IL_0022: ldarg.1 + IL_0023: div.un + IL_0024: conv.u4 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: nop + IL_0028: stloc.0 + IL_0029: ldc.i4.0 + IL_002a: stloc.1 + IL_002b: ldarg.2 + IL_002c: stloc.2 + IL_002d: br.s IL_003d + + IL_002f: ldloc.2 + IL_0030: call void assembly::set_c(char) + IL_0035: ldloc.2 + IL_0036: ldarg.1 + IL_0037: add + IL_0038: stloc.2 + IL_0039: ldloc.1 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: stloc.1 + IL_003d: ldloc.1 + IL_003e: ldloc.0 + IL_003f: blt.un.s IL_002f + + IL_0041: ret + } + + .method public static void f11(char start, + char finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (char V_0, + char V_1, + char V_2) + IL_0000: ldc.i4.0 + IL_0001: ldsfld class assembly/f11@52 assembly/f11@52::@_instance + IL_0006: ldarg.0 + IL_0007: ldc.i4.0 + IL_0008: ldarg.1 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_000e: pop + IL_000f: ldc.i4.0 + IL_0010: stloc.0 + IL_0011: ldc.i4.0 + IL_0012: stloc.1 + IL_0013: ldarg.0 + IL_0014: stloc.2 + IL_0015: br.s IL_0025 + + IL_0017: ldloc.2 + IL_0018: call void assembly::set_c(char) + IL_001d: ldloc.2 + IL_001e: ldc.i4.0 + IL_001f: add + IL_0020: stloc.2 + IL_0021: ldloc.1 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.1 + IL_0025: ldloc.1 + IL_0026: ldloc.0 + IL_0027: blt.un.s IL_0017 + + IL_0029: ret + } + + .method public static void f12() cil managed + { + + .maxstack 7 + .locals init (char V_0, + char V_1, + char V_2) + IL_0000: ldc.i4.0 + IL_0001: ldsfld class assembly/f12@56 assembly/f12@56::@_instance + IL_0006: ldc.i4.s 97 + IL_0008: ldc.i4.0 + IL_0009: ldc.i4.s 122 + IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_0010: pop + IL_0011: ldc.i4.0 + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: stloc.1 + IL_0015: ldc.i4.s 97 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(char) + IL_0020: ldloc.2 + IL_0021: ldc.i4.0 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .property char c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(char) + .get char assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly char c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld char ''.$assembly::c@1 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt16.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt16.fs new file mode 100644 index 00000000000..f664f0ad2de --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt16.fs @@ -0,0 +1,65 @@ +let mutable c = 0s + +let f0 () = + for n in 10s..1s do + c <- n + +let f00 () = + for n in 10s..1s..1s do + c <- n + +let f1 () = + for n in 1s..10s do + c <- n + +let f2 start = + for n in start..10s do + c <- n + +let f3 finish = + for n in 1s..finish do + c <- n + +let f4 (start: int16) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1s..1s..10s do + c <- n + +let f6 () = + for n in 1s..2s..10s do + c <- n + +let f7 start = + for n in start..2s..10s do + c <- n + +let f8 step = + for n in 1s..step..10s do + c <- n + +let f9 finish = + for n in 1s..2s..finish do + c <- n + +let f10 (start: int16) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0s..finish do + c <- n + +let f12 () = + for n in 1s..0s..10s do + c <- n + +let f13 () = + for n in 10s .. -1s .. 1s do + c <- n + +let f14 () = + for n in 10s .. -2s .. 1s do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt16.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt16.fs.opt.il.bsl new file mode 100644 index 00000000000..79646c5f401 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt16.fs.opt.il.bsl @@ -0,0 +1,767 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static int16 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int16 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int16 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int16 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int16 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int16 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(int16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(int16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.i4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(int16 start, + int16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.i4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7(int16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.i4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(int16) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(int16 step) cil managed + { + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_001f + + IL_0015: ldc.i4.s 9 + IL_0017: ldarg.0 + IL_0018: div.un + IL_0019: conv.i4 + IL_001a: ldc.i4.1 + IL_001b: add + IL_001c: nop + IL_001d: br.s IL_0021 + + IL_001f: ldc.i4.0 + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldc.i4.1 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(int16) + IL_002e: ldloc.2 + IL_002f: ldarg.0 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f9(int16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.i4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(int16 start, + int16 step, + int16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: ldarg.1 + IL_0012: bge.s IL_0027 + + IL_0014: ldarg.2 + IL_0015: ldarg.2 + IL_0016: bge.s IL_001c + + IL_0018: ldc.i4.0 + IL_0019: nop + IL_001a: br.s IL_003b + + IL_001c: ldarg.2 + IL_001d: ldarg.2 + IL_001e: sub + IL_001f: ldarg.1 + IL_0020: div.un + IL_0021: conv.i4 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: nop + IL_0025: br.s IL_003b + + IL_0027: ldarg.2 + IL_0028: ldarg.2 + IL_0029: bge.s IL_002f + + IL_002b: ldc.i4.0 + IL_002c: nop + IL_002d: br.s IL_003b + + IL_002f: ldarg.2 + IL_0030: ldarg.2 + IL_0031: sub + IL_0032: ldarg.1 + IL_0033: not + IL_0034: ldc.i4.1 + IL_0035: add + IL_0036: div.un + IL_0037: conv.i4 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: nop + IL_003b: stloc.0 + IL_003c: ldc.i4.0 + IL_003d: stloc.1 + IL_003e: ldarg.2 + IL_003f: stloc.2 + IL_0040: br.s IL_0050 + + IL_0042: ldloc.2 + IL_0043: call void assembly::set_c(int16) + IL_0048: ldloc.2 + IL_0049: ldarg.1 + IL_004a: add + IL_004b: stloc.2 + IL_004c: ldloc.1 + IL_004d: ldc.i4.1 + IL_004e: add + IL_004f: stloc.1 + IL_0050: ldloc.1 + IL_0051: ldloc.0 + IL_0052: blt.un.s IL_0042 + + IL_0054: ret + } + + .method public static void f11(int16 start, + int16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int16 V_0, + int16 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(int16) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int16 V_0, + int16 V_1, + int16 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(int16) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.m1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 10 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.s -2 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .property int16 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int16) + .get int16 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int16 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int16 ''.$assembly::c@1 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt32.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt32.fs new file mode 100644 index 00000000000..32bca951da3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt32.fs @@ -0,0 +1,65 @@ +let mutable c = 0 + +let f0 () = + for n in 10..1 do + c <- n + +let f00 () = + for n in 10..1..1 do + c <- n + +let f1 () = + for n in 1..10 do + c <- n + +let f2 start = + for n in start..10 do + c <- n + +let f3 finish = + for n in 1..finish do + c <- n + +let f4 start finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1..1..10 do + c <- n + +let f6 () = + for n in 1..2..10 do + c <- n + +let f7 start = + for n in start..2..10 do + c <- n + +let f8 step = + for n in 1..step..10 do + c <- n + +let f9 finish = + for n in 1..2..finish do + c <- n + +let f10 start step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0..finish do + c <- n + +let f12 () = + for n in 1..0..10 do + c <- n + +let f13 () = + for n in 10..-1..1 do + c <- n + +let f14 () = + for n in 10..-2..1 do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt32.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt32.fs.opt.il.bsl new file mode 100644 index 00000000000..e511f90098b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt32.fs.opt.il.bsl @@ -0,0 +1,725 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static int32 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int32 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.s 10 + IL_0002: stloc.0 + IL_0003: br.s IL_000f + + IL_0005: ldloc.0 + IL_0006: call void assembly::set_c(int32) + IL_000b: ldloc.0 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: ldc.i4.2 + IL_0011: blt.s IL_0005 + + IL_0013: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.1 + IL_0001: stloc.0 + IL_0002: br.s IL_000e + + IL_0004: ldloc.0 + IL_0005: call void assembly::set_c(int32) + IL_000a: ldloc.0 + IL_000b: ldc.i4.1 + IL_000c: add + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.s 11 + IL_0011: blt.s IL_0004 + + IL_0013: ret + } + + .method public static void f2(int32 start) cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: br.s IL_000e + + IL_0004: ldloc.0 + IL_0005: call void assembly::set_c(int32) + IL_000a: ldloc.0 + IL_000b: ldc.i4.1 + IL_000c: add + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.s 11 + IL_0011: blt.s IL_0004 + + IL_0013: ret + } + + .method public static void f3(int32 finish) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.1 + IL_0001: stloc.1 + IL_0002: ldarg.0 + IL_0003: stloc.0 + IL_0004: ldloc.0 + IL_0005: ldloc.1 + IL_0006: blt.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: bne.un.s IL_0008 + + IL_0018: ret + } + + .method public static void f4(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: stloc.1 + IL_0002: ldarg.1 + IL_0003: stloc.0 + IL_0004: ldloc.0 + IL_0005: ldloc.1 + IL_0006: blt.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: bne.un.s IL_0008 + + IL_0018: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.s 10 + IL_0019: conv.i8 + IL_001a: blt.un.s IL_0007 + + IL_001c: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.2 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: conv.i8 + IL_0019: blt.un.s IL_0007 + + IL_001b: ret + } + + .method public static void f7(int32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldc.i4.s 10 + IL_000c: ldarg.0 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: div.un + IL_0010: conv.i8 + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldarg.0 + IL_001a: stloc.2 + IL_001b: br.s IL_002c + + IL_001d: ldloc.2 + IL_001e: call void assembly::set_c(int32) + IL_0023: ldloc.2 + IL_0024: ldc.i4.2 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001d + + IL_0030: ret + } + + .method public static void f8(int32 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_0020 + + IL_0015: ldc.i4.s 9 + IL_0017: ldarg.0 + IL_0018: div.un + IL_0019: conv.i8 + IL_001a: ldc.i4.1 + IL_001b: conv.i8 + IL_001c: add + IL_001d: nop + IL_001e: br.s IL_0023 + + IL_0020: ldc.i4.0 + IL_0021: conv.i8 + IL_0022: nop + IL_0023: stloc.0 + IL_0024: ldc.i4.0 + IL_0025: conv.i8 + IL_0026: stloc.1 + IL_0027: ldc.i4.1 + IL_0028: stloc.2 + IL_0029: br.s IL_003a + + IL_002b: ldloc.2 + IL_002c: call void assembly::set_c(int32) + IL_0031: ldloc.2 + IL_0032: ldarg.0 + IL_0033: add + IL_0034: stloc.2 + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.1 + IL_003a: ldloc.1 + IL_003b: ldloc.0 + IL_003c: blt.un.s IL_002b + + IL_003e: ret + } + + .method public static void f9(int32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.1 + IL_000b: sub + IL_000c: ldc.i4.2 + IL_000d: div.un + IL_000e: conv.i8 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.1 + IL_0017: ldc.i4.1 + IL_0018: stloc.2 + IL_0019: br.s IL_002a + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(int32) + IL_0021: ldloc.2 + IL_0022: ldc.i4.2 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldloc.0 + IL_002c: blt.un.s IL_001b + + IL_002e: ret + } + + .method public static void f10(!!a start, + int32 step, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: ldarg.1 + IL_0012: bge.s IL_0029 + + IL_0014: ldarg.2 + IL_0015: ldarg.2 + IL_0016: bge.s IL_001d + + IL_0018: ldc.i4.0 + IL_0019: conv.i8 + IL_001a: nop + IL_001b: br.s IL_003f + + IL_001d: ldarg.2 + IL_001e: ldarg.2 + IL_001f: sub + IL_0020: ldarg.1 + IL_0021: div.un + IL_0022: conv.i8 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: nop + IL_0027: br.s IL_003f + + IL_0029: ldarg.2 + IL_002a: ldarg.2 + IL_002b: bge.s IL_0032 + + IL_002d: ldc.i4.0 + IL_002e: conv.i8 + IL_002f: nop + IL_0030: br.s IL_003f + + IL_0032: ldarg.2 + IL_0033: ldarg.2 + IL_0034: sub + IL_0035: ldarg.1 + IL_0036: not + IL_0037: ldc.i4.1 + IL_0038: add + IL_0039: div.un + IL_003a: conv.i8 + IL_003b: ldc.i4.1 + IL_003c: conv.i8 + IL_003d: add + IL_003e: nop + IL_003f: stloc.0 + IL_0040: ldc.i4.0 + IL_0041: conv.i8 + IL_0042: stloc.1 + IL_0043: ldarg.2 + IL_0044: stloc.2 + IL_0045: br.s IL_0056 + + IL_0047: ldloc.2 + IL_0048: call void assembly::set_c(int32) + IL_004d: ldloc.2 + IL_004e: ldarg.1 + IL_004f: add + IL_0050: stloc.2 + IL_0051: ldloc.1 + IL_0052: ldc.i4.1 + IL_0053: conv.i8 + IL_0054: add + IL_0055: stloc.1 + IL_0056: ldloc.1 + IL_0057: ldloc.0 + IL_0058: blt.un.s IL_0047 + + IL_005a: ret + } + + .method public static void f11(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(int32) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(int32) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: stloc.1 + IL_0006: br.s IL_0017 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.m1 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: add + IL_0016: stloc.0 + IL_0017: ldloc.0 + IL_0018: ldc.i4.s 10 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.s -2 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.5 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .property int32 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int32) + .get int32 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::c@1 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt64.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt64.fs new file mode 100644 index 00000000000..9e272eb300a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt64.fs @@ -0,0 +1,65 @@ +let mutable c = 0L + +let f0 () = + for n in 10L..1L do + c <- n + +let f00 () = + for n in 10L..1L..1L do + c <- n + +let f1 () = + for n in 1L..10L do + c <- n + +let f2 start = + for n in start..10L do + c <- n + +let f3 finish = + for n in 1L..finish do + c <- n + +let f4 (start: int64) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1L..1L..10L do + c <- n + +let f6 () = + for n in 1L..2L..10L do + c <- n + +let f7 start = + for n in start..2L..10L do + c <- n + +let f8 step = + for n in 1L..step..10L do + c <- n + +let f9 finish = + for n in 1L..2L..finish do + c <- n + +let f10 (start: int64) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0L..finish do + c <- n + +let f12 () = + for n in 1L..0L..10L do + c <- n + +let f13 () = + for n in 10L.. -1L ..1L do + c <- n + +let f14 () = + for n in 10L.. -2L ..1L do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt64.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt64.fs.opt.il.bsl new file mode 100644 index 00000000000..0f20def3e61 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepInt64.fs.opt.il.bsl @@ -0,0 +1,993 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static int64 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int64 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int64 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int64 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f2(int64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add.ovf.un + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.1 + IL_0018: ldarg.0 + IL_0019: stloc.2 + IL_001a: br.s IL_002c + + IL_001c: ldloc.2 + IL_001d: call void assembly::set_c(int64) + IL_0022: ldloc.2 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001c + + IL_0030: ret + } + + .method public static void f3(int64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add.ovf.un + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: stloc.2 + IL_0019: br.s IL_002b + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(int64) + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: conv.i8 + IL_0024: add + IL_0025: stloc.2 + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.1 + IL_002c: ldloc.0 + IL_002d: blt.un.s IL_001b + + IL_002f: ret + } + + .method public static void f4(int64 start, + int64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + int64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_000d + + IL_0009: ldarg.1 + IL_000a: ldarg.0 + IL_000b: sub + IL_000c: nop + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.m1 + IL_0010: conv.i8 + IL_0011: bne.un.s IL_0036 + + IL_0013: ldc.i4.1 + IL_0014: stloc.1 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.2 + IL_0018: ldarg.0 + IL_0019: stloc.3 + IL_001a: br.s IL_0032 + + IL_001c: ldloc.3 + IL_001d: call void assembly::set_c(int64) + IL_0022: ldloc.3 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldc.i4.0 + IL_002e: conv.i8 + IL_002f: cgt.un + IL_0031: stloc.1 + IL_0032: ldloc.1 + IL_0033: brtrue.s IL_001c + + IL_0035: ret + + IL_0036: ldarg.1 + IL_0037: ldarg.0 + IL_0038: bge.s IL_003f + + IL_003a: ldc.i4.0 + IL_003b: conv.i8 + IL_003c: nop + IL_003d: br.s IL_0046 + + IL_003f: ldarg.1 + IL_0040: ldarg.0 + IL_0041: sub + IL_0042: ldc.i4.1 + IL_0043: conv.i8 + IL_0044: add.ovf.un + IL_0045: nop + IL_0046: stloc.2 + IL_0047: ldc.i4.0 + IL_0048: conv.i8 + IL_0049: stloc.s V_4 + IL_004b: ldarg.0 + IL_004c: stloc.3 + IL_004d: br.s IL_0061 + + IL_004f: ldloc.3 + IL_0050: call void assembly::set_c(int64) + IL_0055: ldloc.3 + IL_0056: ldc.i4.1 + IL_0057: conv.i8 + IL_0058: add + IL_0059: stloc.3 + IL_005a: ldloc.s V_4 + IL_005c: ldc.i4.1 + IL_005d: conv.i8 + IL_005e: add + IL_005f: stloc.s V_4 + IL_0061: ldloc.s V_4 + IL_0063: ldloc.2 + IL_0064: blt.un.s IL_004f + + IL_0066: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.2 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.5 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .method public static void f7(int64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0017 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.2 + IL_0011: conv.i8 + IL_0012: div.un + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: add.ovf.un + IL_0016: nop + IL_0017: stloc.0 + IL_0018: ldc.i4.0 + IL_0019: conv.i8 + IL_001a: stloc.1 + IL_001b: ldarg.0 + IL_001c: stloc.2 + IL_001d: br.s IL_002f + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(int64) + IL_0025: ldloc.2 + IL_0026: ldc.i4.2 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.2 + IL_002a: ldloc.1 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.1 + IL_002f: ldloc.1 + IL_0030: ldloc.0 + IL_0031: blt.un.s IL_001f + + IL_0033: ret + } + + .method public static void f8(int64 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0012 + + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: ldarg.0 + IL_0006: ldc.i4.s 10 + IL_0008: conv.i8 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000e: pop + IL_000f: nop + IL_0010: br.s IL_0013 + + IL_0012: nop + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: ldarg.0 + IL_0016: bge.s IL_0023 + + IL_0018: ldc.i4.s 9 + IL_001a: conv.i8 + IL_001b: ldarg.0 + IL_001c: div.un + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: add.ovf.un + IL_0020: nop + IL_0021: br.s IL_0026 + + IL_0023: ldc.i4.0 + IL_0024: conv.i8 + IL_0025: nop + IL_0026: stloc.0 + IL_0027: ldc.i4.0 + IL_0028: conv.i8 + IL_0029: stloc.1 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: stloc.2 + IL_002d: br.s IL_003e + + IL_002f: ldloc.2 + IL_0030: call void assembly::set_c(int64) + IL_0035: ldloc.2 + IL_0036: ldarg.0 + IL_0037: add + IL_0038: stloc.2 + IL_0039: ldloc.1 + IL_003a: ldc.i4.1 + IL_003b: conv.i8 + IL_003c: add + IL_003d: stloc.1 + IL_003e: ldloc.1 + IL_003f: ldloc.0 + IL_0040: blt.un.s IL_002f + + IL_0042: ret + } + + .method public static void f9(int64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: conv.i8 + IL_0010: div.un + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldc.i4.1 + IL_001a: conv.i8 + IL_001b: stloc.2 + IL_001c: br.s IL_002e + + IL_001e: ldloc.2 + IL_001f: call void assembly::set_c(int64) + IL_0024: ldloc.2 + IL_0025: ldc.i4.2 + IL_0026: conv.i8 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: add + IL_002d: stloc.1 + IL_002e: ldloc.1 + IL_002f: ldloc.0 + IL_0030: blt.un.s IL_001e + + IL_0032: ret + } + + .method public static void f10(int64 start, + int64 step, + int64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + int64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: conv.i8 + IL_0012: ldarg.1 + IL_0013: bge.s IL_0026 + + IL_0015: ldarg.2 + IL_0016: ldarg.2 + IL_0017: bge.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0039 + + IL_001e: ldarg.2 + IL_001f: ldarg.2 + IL_0020: sub + IL_0021: ldarg.1 + IL_0022: div.un + IL_0023: nop + IL_0024: br.s IL_0039 + + IL_0026: ldarg.2 + IL_0027: ldarg.2 + IL_0028: bge.s IL_002f + + IL_002a: ldc.i4.0 + IL_002b: conv.i8 + IL_002c: nop + IL_002d: br.s IL_0039 + + IL_002f: ldarg.2 + IL_0030: ldarg.2 + IL_0031: sub + IL_0032: ldarg.1 + IL_0033: not + IL_0034: ldc.i4.1 + IL_0035: conv.i8 + IL_0036: add + IL_0037: div.un + IL_0038: nop + IL_0039: stloc.0 + IL_003a: ldloc.0 + IL_003b: ldc.i4.m1 + IL_003c: conv.i8 + IL_003d: bne.un.s IL_0061 + + IL_003f: ldc.i4.1 + IL_0040: stloc.1 + IL_0041: ldc.i4.0 + IL_0042: conv.i8 + IL_0043: stloc.2 + IL_0044: ldarg.2 + IL_0045: stloc.3 + IL_0046: br.s IL_005d + + IL_0048: ldloc.3 + IL_0049: call void assembly::set_c(int64) + IL_004e: ldloc.3 + IL_004f: ldarg.1 + IL_0050: add + IL_0051: stloc.3 + IL_0052: ldloc.2 + IL_0053: ldc.i4.1 + IL_0054: conv.i8 + IL_0055: add + IL_0056: stloc.2 + IL_0057: ldloc.2 + IL_0058: ldc.i4.0 + IL_0059: conv.i8 + IL_005a: cgt.un + IL_005c: stloc.1 + IL_005d: ldloc.1 + IL_005e: brtrue.s IL_0048 + + IL_0060: ret + + IL_0061: ldc.i4.0 + IL_0062: conv.i8 + IL_0063: ldarg.1 + IL_0064: bge.s IL_007a + + IL_0066: ldarg.2 + IL_0067: ldarg.2 + IL_0068: bge.s IL_006f + + IL_006a: ldc.i4.0 + IL_006b: conv.i8 + IL_006c: nop + IL_006d: br.s IL_0090 + + IL_006f: ldarg.2 + IL_0070: ldarg.2 + IL_0071: sub + IL_0072: ldarg.1 + IL_0073: div.un + IL_0074: ldc.i4.1 + IL_0075: conv.i8 + IL_0076: add.ovf.un + IL_0077: nop + IL_0078: br.s IL_0090 + + IL_007a: ldarg.2 + IL_007b: ldarg.2 + IL_007c: bge.s IL_0083 + + IL_007e: ldc.i4.0 + IL_007f: conv.i8 + IL_0080: nop + IL_0081: br.s IL_0090 + + IL_0083: ldarg.2 + IL_0084: ldarg.2 + IL_0085: sub + IL_0086: ldarg.1 + IL_0087: not + IL_0088: ldc.i4.1 + IL_0089: conv.i8 + IL_008a: add + IL_008b: div.un + IL_008c: ldc.i4.1 + IL_008d: conv.i8 + IL_008e: add.ovf.un + IL_008f: nop + IL_0090: stloc.2 + IL_0091: ldc.i4.0 + IL_0092: conv.i8 + IL_0093: stloc.s V_4 + IL_0095: ldarg.2 + IL_0096: stloc.3 + IL_0097: br.s IL_00aa + + IL_0099: ldloc.3 + IL_009a: call void assembly::set_c(int64) + IL_009f: ldloc.3 + IL_00a0: ldarg.1 + IL_00a1: add + IL_00a2: stloc.3 + IL_00a3: ldloc.s V_4 + IL_00a5: ldc.i4.1 + IL_00a6: conv.i8 + IL_00a7: add + IL_00a8: stloc.s V_4 + IL_00aa: ldloc.s V_4 + IL_00ac: ldloc.2 + IL_00ad: blt.un.s IL_0099 + + IL_00af: ret + } + + .method public static void f11(int64 start, + int64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int64 V_0, + int64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: conv.i8 + IL_0003: ldarg.1 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.0 + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.1 + IL_0010: ldarg.0 + IL_0011: stloc.2 + IL_0012: br.s IL_0024 + + IL_0014: ldloc.2 + IL_0015: call void assembly::set_c(int64) + IL_001a: ldloc.2 + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.2 + IL_001f: ldloc.1 + IL_0020: ldc.i4.1 + IL_0021: conv.i8 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0014 + + IL_0028: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int64 V_0, + int64 V_1, + int64 V_2) + IL_0000: ldc.i4.1 + IL_0001: conv.i8 + IL_0002: ldc.i4.0 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 10 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000c: pop + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: conv.i8 + IL_0012: stloc.1 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: br.s IL_0028 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int64) + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: conv.i8 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0018 + + IL_002c: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.m1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.s 10 + IL_001c: conv.i8 + IL_001d: blt.un.s IL_0009 + + IL_001f: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_001a + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.s -2 + IL_0012: conv.i8 + IL_0013: add + IL_0014: stloc.1 + IL_0015: ldloc.0 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add + IL_0019: stloc.0 + IL_001a: ldloc.0 + IL_001b: ldc.i4.5 + IL_001c: conv.i8 + IL_001d: blt.un.s IL_0009 + + IL_001f: ret + } + + .property int64 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int64) + .get int64 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int64 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stsfld int64 ''.$assembly::c@1 + IL_0007: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepIntPtr.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepIntPtr.fs new file mode 100644 index 00000000000..31464a36932 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepIntPtr.fs @@ -0,0 +1,65 @@ +let mutable c = 0n + +let f0 () = + for n in 10n..1n do + c <- n + +let f00 () = + for n in 10n..1n..1n do + c <- n + +let f1 () = + for n in 1n..10n do + c <- n + +let f2 start = + for n in start..10n do + c <- n + +let f3 finish = + for n in 1n..finish do + c <- n + +let f4 (start: nativeint) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1n..1n..10n do + c <- n + +let f6 () = + for n in 1n..2n..10n do + c <- n + +let f7 start = + for n in start..2n..10n do + c <- n + +let f8 step = + for n in 1n..step..10n do + c <- n + +let f9 finish = + for n in 1n..2n..finish do + c <- n + +let f10 (start: nativeint) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0n..finish do + c <- n + +let f12 () = + for n in 1n..0n..10n do + c <- n + +let f13 () = + for n in 10n.. -1n ..1n do + c <- n + +let f14 () = + for n in 10n.. -2n ..1n do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepIntPtr.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepIntPtr.fs.opt.il.bsl new file mode 100644 index 00000000000..330c21deb58 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepIntPtr.fs.opt.il.bsl @@ -0,0 +1,1571 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static native int get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld native int ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(native int 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld native int ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.i + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.i + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f2(native int start) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldc.i8 0xa + IL_0009: conv.i + IL_000a: ldarg.0 + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldc.i8 0xa + IL_0023: conv.i + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_0094 + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.i + IL_005d: stloc.2 + IL_005e: ldarg.0 + IL_005f: stloc.3 + IL_0060: br.s IL_0090 + + IL_0062: ldloc.3 + IL_0063: call void assembly::set_c(native int) + IL_0068: ldloc.3 + IL_0069: ldc.i8 0x1 + IL_0072: conv.i + IL_0073: add + IL_0074: stloc.3 + IL_0075: ldloc.2 + IL_0076: ldc.i8 0x1 + IL_007f: conv.i + IL_0080: add + IL_0081: stloc.2 + IL_0082: ldloc.2 + IL_0083: ldc.i8 0x0 + IL_008c: conv.i + IL_008d: cgt.un + IL_008f: stloc.1 + IL_0090: ldloc.1 + IL_0091: brtrue.s IL_0062 + + IL_0093: ret + + IL_0094: ldc.i8 0xa + IL_009d: conv.i + IL_009e: ldarg.0 + IL_009f: bge.s IL_00ae + + IL_00a1: ldc.i8 0x0 + IL_00aa: conv.i + IL_00ab: nop + IL_00ac: br.s IL_00c6 + + IL_00ae: ldc.i8 0xa + IL_00b7: conv.i + IL_00b8: ldarg.0 + IL_00b9: sub + IL_00ba: ldc.i8 0x1 + IL_00c3: conv.i + IL_00c4: add.ovf.un + IL_00c5: nop + IL_00c6: stloc.2 + IL_00c7: ldc.i8 0x0 + IL_00d0: conv.i + IL_00d1: stloc.3 + IL_00d2: ldarg.0 + IL_00d3: stloc.s V_4 + IL_00d5: br.s IL_00fa + + IL_00d7: ldloc.s V_4 + IL_00d9: call void assembly::set_c(native int) + IL_00de: ldloc.s V_4 + IL_00e0: ldc.i8 0x1 + IL_00e9: conv.i + IL_00ea: add + IL_00eb: stloc.s V_4 + IL_00ed: ldloc.3 + IL_00ee: ldc.i8 0x1 + IL_00f7: conv.i + IL_00f8: add + IL_00f9: stloc.3 + IL_00fa: ldloc.3 + IL_00fb: ldloc.2 + IL_00fc: blt.un.s IL_00d7 + + IL_00fe: ret + } + + .method public static void f3(native int finish) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.i + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.i + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_009d + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.i + IL_005d: stloc.2 + IL_005e: ldc.i8 0x1 + IL_0067: conv.i + IL_0068: stloc.3 + IL_0069: br.s IL_0099 + + IL_006b: ldloc.3 + IL_006c: call void assembly::set_c(native int) + IL_0071: ldloc.3 + IL_0072: ldc.i8 0x1 + IL_007b: conv.i + IL_007c: add + IL_007d: stloc.3 + IL_007e: ldloc.2 + IL_007f: ldc.i8 0x1 + IL_0088: conv.i + IL_0089: add + IL_008a: stloc.2 + IL_008b: ldloc.2 + IL_008c: ldc.i8 0x0 + IL_0095: conv.i + IL_0096: cgt.un + IL_0098: stloc.1 + IL_0099: ldloc.1 + IL_009a: brtrue.s IL_006b + + IL_009c: ret + + IL_009d: ldarg.0 + IL_009e: ldc.i8 0x1 + IL_00a7: conv.i + IL_00a8: bge.s IL_00b7 + + IL_00aa: ldc.i8 0x0 + IL_00b3: conv.i + IL_00b4: nop + IL_00b5: br.s IL_00cf + + IL_00b7: ldarg.0 + IL_00b8: ldc.i8 0x1 + IL_00c1: conv.i + IL_00c2: sub + IL_00c3: ldc.i8 0x1 + IL_00cc: conv.i + IL_00cd: add.ovf.un + IL_00ce: nop + IL_00cf: stloc.2 + IL_00d0: ldc.i8 0x0 + IL_00d9: conv.i + IL_00da: stloc.3 + IL_00db: ldc.i8 0x1 + IL_00e4: conv.i + IL_00e5: stloc.s V_4 + IL_00e7: br.s IL_010c + + IL_00e9: ldloc.s V_4 + IL_00eb: call void assembly::set_c(native int) + IL_00f0: ldloc.s V_4 + IL_00f2: ldc.i8 0x1 + IL_00fb: conv.i + IL_00fc: add + IL_00fd: stloc.s V_4 + IL_00ff: ldloc.3 + IL_0100: ldc.i8 0x1 + IL_0109: conv.i + IL_010a: add + IL_010b: stloc.3 + IL_010c: ldloc.3 + IL_010d: ldloc.2 + IL_010e: blt.un.s IL_00e9 + + IL_0110: ret + } + + .method public static void f4(native int start, + native int finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0011 + + IL_0004: ldc.i8 0x0 + IL_000d: conv.i + IL_000e: nop + IL_000f: br.s IL_0015 + + IL_0011: ldarg.1 + IL_0012: ldarg.0 + IL_0013: sub + IL_0014: nop + IL_0015: stloc.0 + IL_0016: sizeof [runtime]System.IntPtr + IL_001c: ldc.i4.4 + IL_001d: bne.un.s IL_002f + + IL_001f: ldloc.0 + IL_0020: ldc.i8 0xffffffff + IL_0029: conv.u + IL_002a: ceq + IL_002c: nop + IL_002d: br.s IL_003d + + IL_002f: ldloc.0 + IL_0030: ldc.i8 0xffffffffffffffff + IL_0039: conv.u + IL_003a: ceq + IL_003c: nop + IL_003d: brfalse.s IL_0082 + + IL_003f: ldc.i4.1 + IL_0040: stloc.1 + IL_0041: ldc.i8 0x0 + IL_004a: conv.i + IL_004b: stloc.2 + IL_004c: ldarg.0 + IL_004d: stloc.3 + IL_004e: br.s IL_007e + + IL_0050: ldloc.3 + IL_0051: call void assembly::set_c(native int) + IL_0056: ldloc.3 + IL_0057: ldc.i8 0x1 + IL_0060: conv.i + IL_0061: add + IL_0062: stloc.3 + IL_0063: ldloc.2 + IL_0064: ldc.i8 0x1 + IL_006d: conv.i + IL_006e: add + IL_006f: stloc.2 + IL_0070: ldloc.2 + IL_0071: ldc.i8 0x0 + IL_007a: conv.i + IL_007b: cgt.un + IL_007d: stloc.1 + IL_007e: ldloc.1 + IL_007f: brtrue.s IL_0050 + + IL_0081: ret + + IL_0082: ldarg.1 + IL_0083: ldarg.0 + IL_0084: bge.s IL_0093 + + IL_0086: ldc.i8 0x0 + IL_008f: conv.i + IL_0090: nop + IL_0091: br.s IL_00a2 + + IL_0093: ldarg.1 + IL_0094: ldarg.0 + IL_0095: sub + IL_0096: ldc.i8 0x1 + IL_009f: conv.i + IL_00a0: add.ovf.un + IL_00a1: nop + IL_00a2: stloc.2 + IL_00a3: ldc.i8 0x0 + IL_00ac: conv.i + IL_00ad: stloc.3 + IL_00ae: ldarg.0 + IL_00af: stloc.s V_4 + IL_00b1: br.s IL_00d6 + + IL_00b3: ldloc.s V_4 + IL_00b5: call void assembly::set_c(native int) + IL_00ba: ldloc.s V_4 + IL_00bc: ldc.i8 0x1 + IL_00c5: conv.i + IL_00c6: add + IL_00c7: stloc.s V_4 + IL_00c9: ldloc.3 + IL_00ca: ldc.i8 0x1 + IL_00d3: conv.i + IL_00d4: add + IL_00d5: stloc.3 + IL_00d6: ldloc.3 + IL_00d7: ldloc.2 + IL_00d8: blt.un.s IL_00b3 + + IL_00da: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x2 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x5 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f7(native int start) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldc.i8 0xa + IL_0009: conv.i + IL_000a: ldarg.0 + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldc.i8 0xa + IL_0023: conv.i + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.i + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.i + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.i + IL_0048: stloc.1 + IL_0049: ldarg.0 + IL_004a: stloc.2 + IL_004b: br.s IL_006d + + IL_004d: ldloc.2 + IL_004e: call void assembly::set_c(native int) + IL_0053: ldloc.2 + IL_0054: ldc.i8 0x2 + IL_005d: conv.i + IL_005e: add + IL_005f: stloc.2 + IL_0060: ldloc.1 + IL_0061: ldc.i8 0x1 + IL_006a: conv.i + IL_006b: add + IL_006c: stloc.1 + IL_006d: ldloc.1 + IL_006e: ldloc.0 + IL_006f: blt.un.s IL_004d + + IL_0071: ret + } + + .method public static void f8(native int step) cil managed + { + + .maxstack 5 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.i + IL_000b: bne.un.s IL_002b + + IL_000d: ldc.i8 0x1 + IL_0016: conv.i + IL_0017: ldarg.0 + IL_0018: ldc.i8 0xa + IL_0021: conv.i + IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0027: pop + IL_0028: nop + IL_0029: br.s IL_002c + + IL_002b: nop + IL_002c: ldc.i8 0x0 + IL_0035: conv.i + IL_0036: ldarg.0 + IL_0037: bge.s IL_0076 + + IL_0039: ldc.i8 0xa + IL_0042: conv.i + IL_0043: ldc.i8 0x1 + IL_004c: conv.i + IL_004d: bge.s IL_005c + + IL_004f: ldc.i8 0x0 + IL_0058: conv.i + IL_0059: nop + IL_005a: br.s IL_00bd + + IL_005c: ldc.i8 0xa + IL_0065: conv.i + IL_0066: ldc.i8 0x1 + IL_006f: conv.i + IL_0070: sub + IL_0071: ldarg.0 + IL_0072: div.un + IL_0073: nop + IL_0074: br.s IL_00bd + + IL_0076: ldc.i8 0x1 + IL_007f: conv.i + IL_0080: ldc.i8 0xa + IL_0089: conv.i + IL_008a: bge.s IL_0099 + + IL_008c: ldc.i8 0x0 + IL_0095: conv.i + IL_0096: nop + IL_0097: br.s IL_00bd + + IL_0099: ldc.i8 0x1 + IL_00a2: conv.i + IL_00a3: ldc.i8 0xa + IL_00ac: conv.i + IL_00ad: sub + IL_00ae: ldarg.0 + IL_00af: not + IL_00b0: ldc.i8 0x1 + IL_00b9: conv.i + IL_00ba: add + IL_00bb: div.un + IL_00bc: nop + IL_00bd: stloc.0 + IL_00be: sizeof [runtime]System.IntPtr + IL_00c4: ldc.i4.4 + IL_00c5: bne.un.s IL_00d7 + + IL_00c7: ldloc.0 + IL_00c8: ldc.i8 0xffffffff + IL_00d1: conv.u + IL_00d2: ceq + IL_00d4: nop + IL_00d5: br.s IL_00e5 + + IL_00d7: ldloc.0 + IL_00d8: ldc.i8 0xffffffffffffffff + IL_00e1: conv.u + IL_00e2: ceq + IL_00e4: nop + IL_00e5: brfalse.s IL_012a + + IL_00e7: ldc.i4.1 + IL_00e8: stloc.1 + IL_00e9: ldc.i8 0x0 + IL_00f2: conv.i + IL_00f3: stloc.2 + IL_00f4: ldc.i8 0x1 + IL_00fd: conv.i + IL_00fe: stloc.3 + IL_00ff: br.s IL_0126 + + IL_0101: ldloc.3 + IL_0102: call void assembly::set_c(native int) + IL_0107: ldloc.3 + IL_0108: ldarg.0 + IL_0109: add + IL_010a: stloc.3 + IL_010b: ldloc.2 + IL_010c: ldc.i8 0x1 + IL_0115: conv.i + IL_0116: add + IL_0117: stloc.2 + IL_0118: ldloc.2 + IL_0119: ldc.i8 0x0 + IL_0122: conv.i + IL_0123: cgt.un + IL_0125: stloc.1 + IL_0126: ldloc.1 + IL_0127: brtrue.s IL_0101 + + IL_0129: ret + + IL_012a: ldc.i8 0x0 + IL_0133: conv.i + IL_0134: ldarg.0 + IL_0135: bge.s IL_0182 + + IL_0137: ldc.i8 0xa + IL_0140: conv.i + IL_0141: ldc.i8 0x1 + IL_014a: conv.i + IL_014b: bge.s IL_015d + + IL_014d: ldc.i8 0x0 + IL_0156: conv.i + IL_0157: nop + IL_0158: br IL_01d4 + + IL_015d: ldc.i8 0xa + IL_0166: conv.i + IL_0167: ldc.i8 0x1 + IL_0170: conv.i + IL_0171: sub + IL_0172: ldarg.0 + IL_0173: div.un + IL_0174: ldc.i8 0x1 + IL_017d: conv.i + IL_017e: add.ovf.un + IL_017f: nop + IL_0180: br.s IL_01d4 + + IL_0182: ldc.i8 0x1 + IL_018b: conv.i + IL_018c: ldc.i8 0xa + IL_0195: conv.i + IL_0196: bge.s IL_01a5 + + IL_0198: ldc.i8 0x0 + IL_01a1: conv.i + IL_01a2: nop + IL_01a3: br.s IL_01d4 + + IL_01a5: ldc.i8 0x1 + IL_01ae: conv.i + IL_01af: ldc.i8 0xa + IL_01b8: conv.i + IL_01b9: sub + IL_01ba: ldarg.0 + IL_01bb: not + IL_01bc: ldc.i8 0x1 + IL_01c5: conv.i + IL_01c6: add + IL_01c7: div.un + IL_01c8: ldc.i8 0x1 + IL_01d1: conv.i + IL_01d2: add.ovf.un + IL_01d3: nop + IL_01d4: stloc.2 + IL_01d5: ldc.i8 0x0 + IL_01de: conv.i + IL_01df: stloc.3 + IL_01e0: ldc.i8 0x1 + IL_01e9: conv.i + IL_01ea: stloc.s V_4 + IL_01ec: br.s IL_0208 + + IL_01ee: ldloc.s V_4 + IL_01f0: call void assembly::set_c(native int) + IL_01f5: ldloc.s V_4 + IL_01f7: ldarg.0 + IL_01f8: add + IL_01f9: stloc.s V_4 + IL_01fb: ldloc.3 + IL_01fc: ldc.i8 0x1 + IL_0205: conv.i + IL_0206: add + IL_0207: stloc.3 + IL_0208: ldloc.3 + IL_0209: ldloc.2 + IL_020a: blt.un.s IL_01ee + + IL_020c: ret + } + + .method public static void f9(native int finish) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.i + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.i + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.i + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.i + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.i + IL_0048: stloc.1 + IL_0049: ldc.i8 0x1 + IL_0052: conv.i + IL_0053: stloc.2 + IL_0054: br.s IL_0076 + + IL_0056: ldloc.2 + IL_0057: call void assembly::set_c(native int) + IL_005c: ldloc.2 + IL_005d: ldc.i8 0x2 + IL_0066: conv.i + IL_0067: add + IL_0068: stloc.2 + IL_0069: ldloc.1 + IL_006a: ldc.i8 0x1 + IL_0073: conv.i + IL_0074: add + IL_0075: stloc.1 + IL_0076: ldloc.1 + IL_0077: ldloc.0 + IL_0078: blt.un.s IL_0056 + + IL_007a: ret + } + + .method public static void f10(native int start, + native int step, + native int finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.1 + IL_0001: ldc.i8 0x0 + IL_000a: conv.i + IL_000b: bne.un.s IL_0019 + + IL_000d: ldarg.2 + IL_000e: ldarg.1 + IL_000f: ldarg.2 + IL_0010: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0015: pop + IL_0016: nop + IL_0017: br.s IL_001a + + IL_0019: nop + IL_001a: ldc.i8 0x0 + IL_0023: conv.i + IL_0024: ldarg.1 + IL_0025: bge.s IL_0040 + + IL_0027: ldarg.2 + IL_0028: ldarg.2 + IL_0029: bge.s IL_0038 + + IL_002b: ldc.i8 0x0 + IL_0034: conv.i + IL_0035: nop + IL_0036: br.s IL_0063 + + IL_0038: ldarg.2 + IL_0039: ldarg.2 + IL_003a: sub + IL_003b: ldarg.1 + IL_003c: div.un + IL_003d: nop + IL_003e: br.s IL_0063 + + IL_0040: ldarg.2 + IL_0041: ldarg.2 + IL_0042: bge.s IL_0051 + + IL_0044: ldc.i8 0x0 + IL_004d: conv.i + IL_004e: nop + IL_004f: br.s IL_0063 + + IL_0051: ldarg.2 + IL_0052: ldarg.2 + IL_0053: sub + IL_0054: ldarg.1 + IL_0055: not + IL_0056: ldc.i8 0x1 + IL_005f: conv.i + IL_0060: add + IL_0061: div.un + IL_0062: nop + IL_0063: stloc.0 + IL_0064: sizeof [runtime]System.IntPtr + IL_006a: ldc.i4.4 + IL_006b: bne.un.s IL_007d + + IL_006d: ldloc.0 + IL_006e: ldc.i8 0xffffffff + IL_0077: conv.u + IL_0078: ceq + IL_007a: nop + IL_007b: br.s IL_008b + + IL_007d: ldloc.0 + IL_007e: ldc.i8 0xffffffffffffffff + IL_0087: conv.u + IL_0088: ceq + IL_008a: nop + IL_008b: brfalse.s IL_00c7 + + IL_008d: ldc.i4.1 + IL_008e: stloc.1 + IL_008f: ldc.i8 0x0 + IL_0098: conv.i + IL_0099: stloc.2 + IL_009a: ldarg.2 + IL_009b: stloc.3 + IL_009c: br.s IL_00c3 + + IL_009e: ldloc.3 + IL_009f: call void assembly::set_c(native int) + IL_00a4: ldloc.3 + IL_00a5: ldarg.1 + IL_00a6: add + IL_00a7: stloc.3 + IL_00a8: ldloc.2 + IL_00a9: ldc.i8 0x1 + IL_00b2: conv.i + IL_00b3: add + IL_00b4: stloc.2 + IL_00b5: ldloc.2 + IL_00b6: ldc.i8 0x0 + IL_00bf: conv.i + IL_00c0: cgt.un + IL_00c2: stloc.1 + IL_00c3: ldloc.1 + IL_00c4: brtrue.s IL_009e + + IL_00c6: ret + + IL_00c7: ldc.i8 0x0 + IL_00d0: conv.i + IL_00d1: ldarg.1 + IL_00d2: bge.s IL_00f8 + + IL_00d4: ldarg.2 + IL_00d5: ldarg.2 + IL_00d6: bge.s IL_00e5 + + IL_00d8: ldc.i8 0x0 + IL_00e1: conv.i + IL_00e2: nop + IL_00e3: br.s IL_0126 + + IL_00e5: ldarg.2 + IL_00e6: ldarg.2 + IL_00e7: sub + IL_00e8: ldarg.1 + IL_00e9: div.un + IL_00ea: ldc.i8 0x1 + IL_00f3: conv.i + IL_00f4: add.ovf.un + IL_00f5: nop + IL_00f6: br.s IL_0126 + + IL_00f8: ldarg.2 + IL_00f9: ldarg.2 + IL_00fa: bge.s IL_0109 + + IL_00fc: ldc.i8 0x0 + IL_0105: conv.i + IL_0106: nop + IL_0107: br.s IL_0126 + + IL_0109: ldarg.2 + IL_010a: ldarg.2 + IL_010b: sub + IL_010c: ldarg.1 + IL_010d: not + IL_010e: ldc.i8 0x1 + IL_0117: conv.i + IL_0118: add + IL_0119: div.un + IL_011a: ldc.i8 0x1 + IL_0123: conv.i + IL_0124: add.ovf.un + IL_0125: nop + IL_0126: stloc.2 + IL_0127: ldc.i8 0x0 + IL_0130: conv.i + IL_0131: stloc.3 + IL_0132: ldarg.2 + IL_0133: stloc.s V_4 + IL_0135: br.s IL_0151 + + IL_0137: ldloc.s V_4 + IL_0139: call void assembly::set_c(native int) + IL_013e: ldloc.s V_4 + IL_0140: ldarg.1 + IL_0141: add + IL_0142: stloc.s V_4 + IL_0144: ldloc.3 + IL_0145: ldc.i8 0x1 + IL_014e: conv.i + IL_014f: add + IL_0150: stloc.3 + IL_0151: ldloc.3 + IL_0152: ldloc.2 + IL_0153: blt.un.s IL_0137 + + IL_0155: ret + } + + .method public static void f11(native int start, + native int finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.i + IL_000b: ldarg.1 + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0011: pop + IL_0012: ldc.i8 0x0 + IL_001b: conv.i + IL_001c: stloc.0 + IL_001d: ldc.i8 0x0 + IL_0026: conv.i + IL_0027: stloc.1 + IL_0028: ldarg.0 + IL_0029: stloc.2 + IL_002a: br.s IL_004c + + IL_002c: ldloc.2 + IL_002d: call void assembly::set_c(native int) + IL_0032: ldloc.2 + IL_0033: ldc.i8 0x0 + IL_003c: conv.i + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i8 0x1 + IL_0049: conv.i + IL_004a: add + IL_004b: stloc.1 + IL_004c: ldloc.1 + IL_004d: ldloc.0 + IL_004e: blt.un.s IL_002c + + IL_0050: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldc.i8 0x1 + IL_0009: conv.i + IL_000a: ldc.i8 0x0 + IL_0013: conv.i + IL_0014: ldc.i8 0xa + IL_001d: conv.i + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0023: pop + IL_0024: ldc.i8 0x0 + IL_002d: conv.i + IL_002e: stloc.0 + IL_002f: ldc.i8 0x0 + IL_0038: conv.i + IL_0039: stloc.1 + IL_003a: ldc.i8 0x1 + IL_0043: conv.i + IL_0044: stloc.2 + IL_0045: br.s IL_0067 + + IL_0047: ldloc.2 + IL_0048: call void assembly::set_c(native int) + IL_004d: ldloc.2 + IL_004e: ldc.i8 0x0 + IL_0057: conv.i + IL_0058: add + IL_0059: stloc.2 + IL_005a: ldloc.1 + IL_005b: ldc.i8 0x1 + IL_0064: conv.i + IL_0065: add + IL_0066: stloc.1 + IL_0067: ldloc.1 + IL_0068: ldloc.0 + IL_0069: blt.un.s IL_0047 + + IL_006b: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldc.i8 0xa + IL_0009: conv.i + IL_000a: ldc.i8 0x1 + IL_0013: conv.i + IL_0014: bge.s IL_0023 + + IL_0016: ldc.i8 0x0 + IL_001f: conv.i + IL_0020: nop + IL_0021: br.s IL_0039 + + IL_0023: ldc.i8 0xa + IL_002c: conv.i + IL_002d: ldc.i8 0x1 + IL_0036: conv.i + IL_0037: sub + IL_0038: nop + IL_0039: stloc.0 + IL_003a: sizeof [runtime]System.IntPtr + IL_0040: ldc.i4.4 + IL_0041: bne.un.s IL_0053 + + IL_0043: ldloc.0 + IL_0044: ldc.i8 0xffffffff + IL_004d: conv.u + IL_004e: ceq + IL_0050: nop + IL_0051: br.s IL_0061 + + IL_0053: ldloc.0 + IL_0054: ldc.i8 0xffffffffffffffff + IL_005d: conv.u + IL_005e: ceq + IL_0060: nop + IL_0061: brfalse.s IL_00af + + IL_0063: ldc.i4.1 + IL_0064: stloc.1 + IL_0065: ldc.i8 0x0 + IL_006e: conv.i + IL_006f: stloc.2 + IL_0070: ldc.i8 0xa + IL_0079: conv.i + IL_007a: stloc.3 + IL_007b: br.s IL_00ab + + IL_007d: ldloc.3 + IL_007e: call void assembly::set_c(native int) + IL_0083: ldloc.3 + IL_0084: ldc.i8 0xffffffffffffffff + IL_008d: conv.i + IL_008e: add + IL_008f: stloc.3 + IL_0090: ldloc.2 + IL_0091: ldc.i8 0x1 + IL_009a: conv.i + IL_009b: add + IL_009c: stloc.2 + IL_009d: ldloc.2 + IL_009e: ldc.i8 0x0 + IL_00a7: conv.i + IL_00a8: cgt.un + IL_00aa: stloc.1 + IL_00ab: ldloc.1 + IL_00ac: brtrue.s IL_007d + + IL_00ae: ret + + IL_00af: ldc.i8 0xa + IL_00b8: conv.i + IL_00b9: ldc.i8 0x1 + IL_00c2: conv.i + IL_00c3: bge.s IL_00d2 + + IL_00c5: ldc.i8 0x0 + IL_00ce: conv.i + IL_00cf: nop + IL_00d0: br.s IL_00f3 + + IL_00d2: ldc.i8 0xa + IL_00db: conv.i + IL_00dc: ldc.i8 0x1 + IL_00e5: conv.i + IL_00e6: sub + IL_00e7: ldc.i8 0x1 + IL_00f0: conv.i + IL_00f1: add.ovf.un + IL_00f2: nop + IL_00f3: stloc.2 + IL_00f4: ldc.i8 0x0 + IL_00fd: conv.i + IL_00fe: stloc.3 + IL_00ff: ldc.i8 0xa + IL_0108: conv.i + IL_0109: stloc.s V_4 + IL_010b: br.s IL_0130 + + IL_010d: ldloc.s V_4 + IL_010f: call void assembly::set_c(native int) + IL_0114: ldloc.s V_4 + IL_0116: ldc.i8 0xffffffffffffffff + IL_011f: conv.i + IL_0120: add + IL_0121: stloc.s V_4 + IL_0123: ldloc.3 + IL_0124: ldc.i8 0x1 + IL_012d: conv.i + IL_012e: add + IL_012f: stloc.3 + IL_0130: ldloc.3 + IL_0131: ldloc.2 + IL_0132: blt.un.s IL_010d + + IL_0134: ret + } + + .method public static void f14() cil managed + { + + .maxstack 5 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldc.i8 0xfffffffffffffffe + IL_0009: conv.i + IL_000a: ldc.i8 0x0 + IL_0013: conv.i + IL_0014: bne.un.s IL_003d + + IL_0016: ldc.i8 0xa + IL_001f: conv.i + IL_0020: ldc.i8 0xfffffffffffffffe + IL_0029: conv.i + IL_002a: ldc.i8 0x1 + IL_0033: conv.i + IL_0034: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0039: pop + IL_003a: nop + IL_003b: br.s IL_003e + + IL_003d: nop + IL_003e: ldc.i8 0x0 + IL_0047: conv.i + IL_0048: ldc.i8 0xfffffffffffffffe + IL_0051: conv.i + IL_0052: bge.s IL_009a + + IL_0054: ldc.i8 0x1 + IL_005d: conv.i + IL_005e: ldc.i8 0xa + IL_0067: conv.i + IL_0068: bge.s IL_0077 + + IL_006a: ldc.i8 0x0 + IL_0073: conv.i + IL_0074: nop + IL_0075: br.s IL_00ea + + IL_0077: ldc.i8 0x1 + IL_0080: conv.i + IL_0081: ldc.i8 0xa + IL_008a: conv.i + IL_008b: sub + IL_008c: ldc.i8 0xfffffffffffffffe + IL_0095: conv.i + IL_0096: div.un + IL_0097: nop + IL_0098: br.s IL_00ea + + IL_009a: ldc.i8 0xa + IL_00a3: conv.i + IL_00a4: ldc.i8 0x1 + IL_00ad: conv.i + IL_00ae: bge.s IL_00bd + + IL_00b0: ldc.i8 0x0 + IL_00b9: conv.i + IL_00ba: nop + IL_00bb: br.s IL_00ea + + IL_00bd: ldc.i8 0xa + IL_00c6: conv.i + IL_00c7: ldc.i8 0x1 + IL_00d0: conv.i + IL_00d1: sub + IL_00d2: ldc.i8 0xfffffffffffffffe + IL_00db: conv.i + IL_00dc: not + IL_00dd: ldc.i8 0x1 + IL_00e6: conv.i + IL_00e7: add + IL_00e8: div.un + IL_00e9: nop + IL_00ea: stloc.0 + IL_00eb: sizeof [runtime]System.IntPtr + IL_00f1: ldc.i4.4 + IL_00f2: bne.un.s IL_0104 + + IL_00f4: ldloc.0 + IL_00f5: ldc.i8 0xffffffff + IL_00fe: conv.u + IL_00ff: ceq + IL_0101: nop + IL_0102: br.s IL_0112 + + IL_0104: ldloc.0 + IL_0105: ldc.i8 0xffffffffffffffff + IL_010e: conv.u + IL_010f: ceq + IL_0111: nop + IL_0112: brfalse.s IL_0160 + + IL_0114: ldc.i4.1 + IL_0115: stloc.1 + IL_0116: ldc.i8 0x0 + IL_011f: conv.i + IL_0120: stloc.2 + IL_0121: ldc.i8 0xa + IL_012a: conv.i + IL_012b: stloc.3 + IL_012c: br.s IL_015c + + IL_012e: ldloc.3 + IL_012f: call void assembly::set_c(native int) + IL_0134: ldloc.3 + IL_0135: ldc.i8 0xfffffffffffffffe + IL_013e: conv.i + IL_013f: add + IL_0140: stloc.3 + IL_0141: ldloc.2 + IL_0142: ldc.i8 0x1 + IL_014b: conv.i + IL_014c: add + IL_014d: stloc.2 + IL_014e: ldloc.2 + IL_014f: ldc.i8 0x0 + IL_0158: conv.i + IL_0159: cgt.un + IL_015b: stloc.1 + IL_015c: ldloc.1 + IL_015d: brtrue.s IL_012e + + IL_015f: ret + + IL_0160: ldc.i8 0x0 + IL_0169: conv.i + IL_016a: ldc.i8 0xfffffffffffffffe + IL_0173: conv.i + IL_0174: bge.s IL_01ca + + IL_0176: ldc.i8 0x1 + IL_017f: conv.i + IL_0180: ldc.i8 0xa + IL_0189: conv.i + IL_018a: bge.s IL_019c + + IL_018c: ldc.i8 0x0 + IL_0195: conv.i + IL_0196: nop + IL_0197: br IL_0225 + + IL_019c: ldc.i8 0x1 + IL_01a5: conv.i + IL_01a6: ldc.i8 0xa + IL_01af: conv.i + IL_01b0: sub + IL_01b1: ldc.i8 0xfffffffffffffffe + IL_01ba: conv.i + IL_01bb: div.un + IL_01bc: ldc.i8 0x1 + IL_01c5: conv.i + IL_01c6: add.ovf.un + IL_01c7: nop + IL_01c8: br.s IL_0225 + + IL_01ca: ldc.i8 0xa + IL_01d3: conv.i + IL_01d4: ldc.i8 0x1 + IL_01dd: conv.i + IL_01de: bge.s IL_01ed + + IL_01e0: ldc.i8 0x0 + IL_01e9: conv.i + IL_01ea: nop + IL_01eb: br.s IL_0225 + + IL_01ed: ldc.i8 0xa + IL_01f6: conv.i + IL_01f7: ldc.i8 0x1 + IL_0200: conv.i + IL_0201: sub + IL_0202: ldc.i8 0xfffffffffffffffe + IL_020b: conv.i + IL_020c: not + IL_020d: ldc.i8 0x1 + IL_0216: conv.i + IL_0217: add + IL_0218: div.un + IL_0219: ldc.i8 0x1 + IL_0222: conv.i + IL_0223: add.ovf.un + IL_0224: nop + IL_0225: stloc.2 + IL_0226: ldc.i8 0x0 + IL_022f: conv.i + IL_0230: stloc.3 + IL_0231: ldc.i8 0xa + IL_023a: conv.i + IL_023b: stloc.s V_4 + IL_023d: br.s IL_0262 + + IL_023f: ldloc.s V_4 + IL_0241: call void assembly::set_c(native int) + IL_0246: ldloc.s V_4 + IL_0248: ldc.i8 0xfffffffffffffffe + IL_0251: conv.i + IL_0252: add + IL_0253: stloc.s V_4 + IL_0255: ldloc.3 + IL_0256: ldc.i8 0x1 + IL_025f: conv.i + IL_0260: add + IL_0261: stloc.3 + IL_0262: ldloc.3 + IL_0263: ldloc.2 + IL_0264: blt.un.s IL_023f + + IL_0266: ret + } + + .property native int c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(native int) + .get native int assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly native int c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stsfld native int ''.$assembly::c@1 + IL_000f: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepSByte.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepSByte.fs new file mode 100644 index 00000000000..ee96ee45237 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepSByte.fs @@ -0,0 +1,65 @@ +let mutable c = 0y + +let f0 () = + for n in 10y..1y do + c <- n + +let f00 () = + for n in 10y..1y..1y do + c <- n + +let f1 () = + for n in 1y..10y do + c <- n + +let f2 start = + for n in start..10y do + c <- n + +let f3 finish = + for n in 1y..finish do + c <- n + +let f4 (start: sbyte) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1y..1y..10y do + c <- n + +let f6 () = + for n in 1y..2y..10y do + c <- n + +let f7 start = + for n in start..2y..10y do + c <- n + +let f8 step = + for n in 1y..step..10y do + c <- n + +let f9 finish = + for n in 1y..2y..finish do + c <- n + +let f10 (start: sbyte) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0y..finish do + c <- n + +let f12 () = + for n in 1y..0y..10y do + c <- n + +let f13 () = + for n in 10y .. -1y .. 1y do + c <- n + +let f14 () = + for n in 10y .. -2y .. 1y do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepSByte.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepSByte.fs.opt.il.bsl new file mode 100644 index 00000000000..f49d7ac9c52 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepSByte.fs.opt.il.bsl @@ -0,0 +1,767 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static int8 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int8 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int8 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int8 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int8 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int8 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(int8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(int8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.i2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(int8 start, + int8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.i2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7(int8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.i2 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(int8) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(int8 step) cil managed + { + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_001f + + IL_0015: ldc.i4.s 9 + IL_0017: ldarg.0 + IL_0018: div.un + IL_0019: conv.i2 + IL_001a: ldc.i4.1 + IL_001b: add + IL_001c: nop + IL_001d: br.s IL_0021 + + IL_001f: ldc.i4.0 + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldc.i4.1 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(int8) + IL_002e: ldloc.2 + IL_002f: ldarg.0 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f9(int8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.i2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(int8 start, + int8 step, + int8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: ldarg.1 + IL_0012: bge.s IL_0027 + + IL_0014: ldarg.2 + IL_0015: ldarg.2 + IL_0016: bge.s IL_001c + + IL_0018: ldc.i4.0 + IL_0019: nop + IL_001a: br.s IL_003b + + IL_001c: ldarg.2 + IL_001d: ldarg.2 + IL_001e: sub + IL_001f: ldarg.1 + IL_0020: div.un + IL_0021: conv.i2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: nop + IL_0025: br.s IL_003b + + IL_0027: ldarg.2 + IL_0028: ldarg.2 + IL_0029: bge.s IL_002f + + IL_002b: ldc.i4.0 + IL_002c: nop + IL_002d: br.s IL_003b + + IL_002f: ldarg.2 + IL_0030: ldarg.2 + IL_0031: sub + IL_0032: ldarg.1 + IL_0033: not + IL_0034: ldc.i4.1 + IL_0035: add + IL_0036: div.un + IL_0037: conv.i2 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: nop + IL_003b: stloc.0 + IL_003c: ldc.i4.0 + IL_003d: stloc.1 + IL_003e: ldarg.2 + IL_003f: stloc.2 + IL_0040: br.s IL_0050 + + IL_0042: ldloc.2 + IL_0043: call void assembly::set_c(int8) + IL_0048: ldloc.2 + IL_0049: ldarg.1 + IL_004a: add + IL_004b: stloc.2 + IL_004c: ldloc.1 + IL_004d: ldc.i4.1 + IL_004e: add + IL_004f: stloc.1 + IL_0050: ldloc.1 + IL_0051: ldloc.0 + IL_0052: blt.un.s IL_0042 + + IL_0054: ret + } + + .method public static void f11(int8 start, + int8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int8 V_0, + int8 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(int8) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int8 V_0, + int8 V_1, + int8 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(int8) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.m1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 10 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.s -2 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .property int8 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int8) + .get int8 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int8 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int8 ''.$assembly::c@1 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt16.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt16.fs new file mode 100644 index 00000000000..64028b65394 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt16.fs @@ -0,0 +1,57 @@ +let mutable c = 0us + +let f0 () = + for n in 10us..1us do + c <- n + +let f00 () = + for n in 10us..1us..1us do + c <- n + +let f1 () = + for n in 1us..10us do + c <- n + +let f2 start = + for n in start..10us do + c <- n + +let f3 finish = + for n in 1us..finish do + c <- n + +let f4 (start: uint16) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1us..1us..10us do + c <- n + +let f6 () = + for n in 1us..2us..10us do + c <- n + +let f7 start = + for n in start..2us..10us do + c <- n + +let f8 step = + for n in 1us..step..10us do + c <- n + +let f9 finish = + for n in 1us..2us..finish do + c <- n + +let f10 (start: uint16) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0us..finish do + c <- n + +let f12 () = + for n in 1us..0us..10us do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt16.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt16.fs.opt.il.bsl new file mode 100644 index 00000000000..2b059e5df41 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt16.fs.opt.il.bsl @@ -0,0 +1,674 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static uint16 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint16 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint16 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint16 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(uint16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(uint16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.u4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(uint16 start, + uint16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.u4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7(uint16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(uint16) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(uint16 step) cil managed + { + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.s 9 + IL_0013: ldarg.0 + IL_0014: div.un + IL_0015: conv.u4 + IL_0016: ldc.i4.1 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldc.i4.0 + IL_001a: stloc.1 + IL_001b: ldc.i4.1 + IL_001c: stloc.2 + IL_001d: br.s IL_002d + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(uint16) + IL_0025: ldloc.2 + IL_0026: ldarg.0 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: add + IL_002c: stloc.1 + IL_002d: ldloc.1 + IL_002e: ldloc.0 + IL_002f: blt.un.s IL_001f + + IL_0031: ret + } + + .method public static void f9(uint16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(uint16 start, + uint16 step, + uint16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0018 + + IL_0014: ldc.i4.0 + IL_0015: nop + IL_0016: br.s IL_0021 + + IL_0018: ldarg.2 + IL_0019: ldarg.2 + IL_001a: sub + IL_001b: ldarg.1 + IL_001c: div.un + IL_001d: conv.u4 + IL_001e: ldc.i4.1 + IL_001f: add + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldarg.2 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(uint16) + IL_002e: ldloc.2 + IL_002f: ldarg.1 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f11(uint16 start, + uint16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(uint16) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint16 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(uint16) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .property uint16 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint16) + .get uint16 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly uint16 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld uint16 ''.$assembly::c@1 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt32.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt32.fs new file mode 100644 index 00000000000..d689d8d393a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt32.fs @@ -0,0 +1,57 @@ +let mutable c = 0u + +let f0 () = + for n in 10u..1u do + c <- n + +let f00 () = + for n in 10u..1u..1u do + c <- n + +let f1 () = + for n in 1u..10u do + c <- n + +let f2 start = + for n in start..10u do + c <- n + +let f3 finish = + for n in 1u..finish do + c <- n + +let f4 (start: uint32) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1u..1u..10u do + c <- n + +let f6 () = + for n in 1u..2u..10u do + c <- n + +let f7 start = + for n in start..2u..10u do + c <- n + +let f8 step = + for n in 1u..step..10u do + c <- n + +let f9 finish = + for n in 1u..2u..finish do + c <- n + +let f10 (start: uint32) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0u..finish do + c <- n + +let f12 () = + for n in 1u..0u..10u do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt32.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt32.fs.opt.il.bsl new file mode 100644 index 00000000000..8bf808cab23 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt32.fs.opt.il.bsl @@ -0,0 +1,710 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static uint32 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint32 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint32 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.s 10 + IL_0019: conv.i8 + IL_001a: blt.un.s IL_0007 + + IL_001c: ret + } + + .method public static void f2(uint32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0013 + + IL_000a: ldc.i4.s 10 + IL_000c: ldarg.0 + IL_000d: sub + IL_000e: conv.u8 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.1 + IL_0017: ldarg.0 + IL_0018: stloc.2 + IL_0019: br.s IL_002a + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(uint32) + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldloc.0 + IL_002c: blt.un.s IL_001b + + IL_002e: ret + } + + .method public static void f3(uint32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.1 + IL_000b: sub + IL_000c: conv.u8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldc.i4.1 + IL_0016: stloc.2 + IL_0017: br.s IL_0028 + + IL_0019: ldloc.2 + IL_001a: call void assembly::set_c(uint32) + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0019 + + IL_002c: ret + } + + .method public static void f4(uint32 start, + uint32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.1 + IL_000a: ldarg.0 + IL_000b: sub + IL_000c: conv.u8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0028 + + IL_0019: ldloc.2 + IL_001a: call void assembly::set_c(uint32) + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0019 + + IL_002c: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.s 10 + IL_0019: conv.i8 + IL_001a: blt.un.s IL_0007 + + IL_001c: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.2 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: conv.i8 + IL_0019: blt.un.s IL_0007 + + IL_001b: ret + } + + .method public static void f7(uint32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldc.i4.s 10 + IL_000c: ldarg.0 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: div.un + IL_0010: conv.u8 + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldarg.0 + IL_001a: stloc.2 + IL_001b: br.s IL_002c + + IL_001d: ldloc.2 + IL_001e: call void assembly::set_c(uint32) + IL_0023: ldloc.2 + IL_0024: ldc.i4.2 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001d + + IL_0030: ret + } + + .method public static void f8(uint32 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.s 9 + IL_0013: ldarg.0 + IL_0014: div.un + IL_0015: conv.u8 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add + IL_0019: stloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: stloc.1 + IL_001d: ldc.i4.1 + IL_001e: stloc.2 + IL_001f: br.s IL_0030 + + IL_0021: ldloc.2 + IL_0022: call void assembly::set_c(uint32) + IL_0027: ldloc.2 + IL_0028: ldarg.0 + IL_0029: add + IL_002a: stloc.2 + IL_002b: ldloc.1 + IL_002c: ldc.i4.1 + IL_002d: conv.i8 + IL_002e: add + IL_002f: stloc.1 + IL_0030: ldloc.1 + IL_0031: ldloc.0 + IL_0032: blt.un.s IL_0021 + + IL_0034: ret + } + + .method public static void f9(uint32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.1 + IL_000b: sub + IL_000c: ldc.i4.2 + IL_000d: div.un + IL_000e: conv.u8 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.1 + IL_0017: ldc.i4.1 + IL_0018: stloc.2 + IL_0019: br.s IL_002a + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(uint32) + IL_0021: ldloc.2 + IL_0022: ldc.i4.2 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldloc.0 + IL_002c: blt.un.s IL_001b + + IL_002e: ret + } + + .method public static void f10(uint32 start, + uint32 step, + uint32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_0023 + + IL_0019: ldarg.2 + IL_001a: ldarg.2 + IL_001b: sub + IL_001c: ldarg.1 + IL_001d: div.un + IL_001e: conv.u8 + IL_001f: ldc.i4.1 + IL_0020: conv.i8 + IL_0021: add + IL_0022: nop + IL_0023: stloc.0 + IL_0024: ldc.i4.0 + IL_0025: conv.i8 + IL_0026: stloc.1 + IL_0027: ldarg.2 + IL_0028: stloc.2 + IL_0029: br.s IL_003a + + IL_002b: ldloc.2 + IL_002c: call void assembly::set_c(uint32) + IL_0031: ldloc.2 + IL_0032: ldarg.1 + IL_0033: add + IL_0034: stloc.2 + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.1 + IL_003a: ldloc.1 + IL_003b: ldloc.0 + IL_003c: blt.un.s IL_002b + + IL_003e: ret + } + + .method public static void f11(uint32 start, + uint32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(uint32) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint32 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(uint32) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .property uint32 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint32) + .get uint32 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly uint32 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld uint32 ''.$assembly::c@1 + IL_0006: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt64.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt64.fs new file mode 100644 index 00000000000..2a9b1627344 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt64.fs @@ -0,0 +1,57 @@ +let mutable c = 0UL + +let f0 () = + for n in 10UL..1UL do + c <- n + +let f00 () = + for n in 10UL..1UL..1UL do + c <- n + +let f1 () = + for n in 1UL..10UL do + c <- n + +let f2 start = + for n in start..10UL do + c <- n + +let f3 finish = + for n in 1UL..finish do + c <- n + +let f4 (start: uint64) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1UL..1UL..10UL do + c <- n + +let f6 () = + for n in 1UL..2UL..10UL do + c <- n + +let f7 start = + for n in start..2UL..10UL do + c <- n + +let f8 step = + for n in 1UL..step..10UL do + c <- n + +let f9 finish = + for n in 1UL..2UL..finish do + c <- n + +let f10 (start: uint64) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0UL..finish do + c <- n + +let f12 () = + for n in 1UL..0UL..10UL do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt64.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt64.fs.opt.il.bsl new file mode 100644 index 00000000000..8076772e763 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUInt64.fs.opt.il.bsl @@ -0,0 +1,859 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static uint64 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint64 ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint64 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint64 ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(uint64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(uint64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(uint64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f2(uint64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add.ovf.un + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.1 + IL_0018: ldarg.0 + IL_0019: stloc.2 + IL_001a: br.s IL_002c + + IL_001c: ldloc.2 + IL_001d: call void assembly::set_c(uint64) + IL_0022: ldloc.2 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001c + + IL_0030: ret + } + + .method public static void f3(uint64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add.ovf.un + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: stloc.2 + IL_0019: br.s IL_002b + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(uint64) + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: conv.i8 + IL_0024: add + IL_0025: stloc.2 + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.1 + IL_002c: ldloc.0 + IL_002d: blt.un.s IL_001b + + IL_002f: ret + } + + .method public static void f4(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_000d + + IL_0009: ldarg.1 + IL_000a: ldarg.0 + IL_000b: sub + IL_000c: nop + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.m1 + IL_0010: conv.i8 + IL_0011: bne.un.s IL_0036 + + IL_0013: ldc.i4.1 + IL_0014: stloc.1 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.2 + IL_0018: ldarg.0 + IL_0019: stloc.3 + IL_001a: br.s IL_0032 + + IL_001c: ldloc.3 + IL_001d: call void assembly::set_c(uint64) + IL_0022: ldloc.3 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldc.i4.0 + IL_002e: conv.i8 + IL_002f: cgt.un + IL_0031: stloc.1 + IL_0032: ldloc.1 + IL_0033: brtrue.s IL_001c + + IL_0035: ret + + IL_0036: ldarg.1 + IL_0037: ldarg.0 + IL_0038: bge.un.s IL_003f + + IL_003a: ldc.i4.0 + IL_003b: conv.i8 + IL_003c: nop + IL_003d: br.s IL_0046 + + IL_003f: ldarg.1 + IL_0040: ldarg.0 + IL_0041: sub + IL_0042: ldc.i4.1 + IL_0043: conv.i8 + IL_0044: add.ovf.un + IL_0045: nop + IL_0046: stloc.2 + IL_0047: ldc.i4.0 + IL_0048: conv.i8 + IL_0049: stloc.3 + IL_004a: ldarg.0 + IL_004b: stloc.s V_4 + IL_004d: br.s IL_0062 + + IL_004f: ldloc.s V_4 + IL_0051: call void assembly::set_c(uint64) + IL_0056: ldloc.s V_4 + IL_0058: ldc.i4.1 + IL_0059: conv.i8 + IL_005a: add + IL_005b: stloc.s V_4 + IL_005d: ldloc.3 + IL_005e: ldc.i4.1 + IL_005f: conv.i8 + IL_0060: add + IL_0061: stloc.3 + IL_0062: ldloc.3 + IL_0063: ldloc.2 + IL_0064: blt.un.s IL_004f + + IL_0066: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(uint64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(uint64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.2 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.5 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .method public static void f7(uint64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0017 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.2 + IL_0011: conv.i8 + IL_0012: div.un + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: add.ovf.un + IL_0016: nop + IL_0017: stloc.0 + IL_0018: ldc.i4.0 + IL_0019: conv.i8 + IL_001a: stloc.1 + IL_001b: ldarg.0 + IL_001c: stloc.2 + IL_001d: br.s IL_002f + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(uint64) + IL_0025: ldloc.2 + IL_0026: ldc.i4.2 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.2 + IL_002a: ldloc.1 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.1 + IL_002f: ldloc.1 + IL_0030: ldloc.0 + IL_0031: blt.un.s IL_001f + + IL_0033: ret + } + + .method public static void f8(uint64 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0012 + + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: ldarg.0 + IL_0006: ldc.i4.s 10 + IL_0008: conv.i8 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000e: pop + IL_000f: nop + IL_0010: br.s IL_0013 + + IL_0012: nop + IL_0013: ldc.i4.s 9 + IL_0015: conv.i8 + IL_0016: ldarg.0 + IL_0017: div.un + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add.ovf.un + IL_001b: stloc.0 + IL_001c: ldc.i4.0 + IL_001d: conv.i8 + IL_001e: stloc.1 + IL_001f: ldc.i4.1 + IL_0020: conv.i8 + IL_0021: stloc.2 + IL_0022: br.s IL_0033 + + IL_0024: ldloc.2 + IL_0025: call void assembly::set_c(uint64) + IL_002a: ldloc.2 + IL_002b: ldarg.0 + IL_002c: add + IL_002d: stloc.2 + IL_002e: ldloc.1 + IL_002f: ldc.i4.1 + IL_0030: conv.i8 + IL_0031: add + IL_0032: stloc.1 + IL_0033: ldloc.1 + IL_0034: ldloc.0 + IL_0035: blt.un.s IL_0024 + + IL_0037: ret + } + + .method public static void f9(uint64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: conv.i8 + IL_0010: div.un + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldc.i4.1 + IL_001a: conv.i8 + IL_001b: stloc.2 + IL_001c: br.s IL_002e + + IL_001e: ldloc.2 + IL_001f: call void assembly::set_c(uint64) + IL_0024: ldloc.2 + IL_0025: ldc.i4.2 + IL_0026: conv.i8 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: add + IL_002d: stloc.1 + IL_002e: ldloc.1 + IL_002f: ldloc.0 + IL_0030: blt.un.s IL_001e + + IL_0032: ret + } + + .method public static void f10(uint64 start, + uint64 step, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_001f + + IL_0019: ldarg.2 + IL_001a: ldarg.2 + IL_001b: sub + IL_001c: ldarg.1 + IL_001d: div.un + IL_001e: nop + IL_001f: stloc.0 + IL_0020: ldloc.0 + IL_0021: ldc.i4.m1 + IL_0022: conv.i8 + IL_0023: bne.un.s IL_0047 + + IL_0025: ldc.i4.1 + IL_0026: stloc.1 + IL_0027: ldc.i4.0 + IL_0028: conv.i8 + IL_0029: stloc.2 + IL_002a: ldarg.2 + IL_002b: stloc.3 + IL_002c: br.s IL_0043 + + IL_002e: ldloc.3 + IL_002f: call void assembly::set_c(uint64) + IL_0034: ldloc.3 + IL_0035: ldarg.1 + IL_0036: add + IL_0037: stloc.3 + IL_0038: ldloc.2 + IL_0039: ldc.i4.1 + IL_003a: conv.i8 + IL_003b: add + IL_003c: stloc.2 + IL_003d: ldloc.2 + IL_003e: ldc.i4.0 + IL_003f: conv.i8 + IL_0040: cgt.un + IL_0042: stloc.1 + IL_0043: ldloc.1 + IL_0044: brtrue.s IL_002e + + IL_0046: ret + + IL_0047: ldarg.2 + IL_0048: ldarg.2 + IL_0049: bge.un.s IL_0050 + + IL_004b: ldc.i4.0 + IL_004c: conv.i8 + IL_004d: nop + IL_004e: br.s IL_0059 + + IL_0050: ldarg.2 + IL_0051: ldarg.2 + IL_0052: sub + IL_0053: ldarg.1 + IL_0054: div.un + IL_0055: ldc.i4.1 + IL_0056: conv.i8 + IL_0057: add.ovf.un + IL_0058: nop + IL_0059: stloc.2 + IL_005a: ldc.i4.0 + IL_005b: conv.i8 + IL_005c: stloc.3 + IL_005d: ldarg.2 + IL_005e: stloc.s V_4 + IL_0060: br.s IL_0074 + + IL_0062: ldloc.s V_4 + IL_0064: call void assembly::set_c(uint64) + IL_0069: ldloc.s V_4 + IL_006b: ldarg.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.3 + IL_0070: ldc.i4.1 + IL_0071: conv.i8 + IL_0072: add + IL_0073: stloc.3 + IL_0074: ldloc.3 + IL_0075: ldloc.2 + IL_0076: blt.un.s IL_0062 + + IL_0078: ret + } + + .method public static void f11(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: conv.i8 + IL_0003: ldarg.1 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.0 + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.1 + IL_0010: ldarg.0 + IL_0011: stloc.2 + IL_0012: br.s IL_0024 + + IL_0014: ldloc.2 + IL_0015: call void assembly::set_c(uint64) + IL_001a: ldloc.2 + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.2 + IL_001f: ldloc.1 + IL_0020: ldc.i4.1 + IL_0021: conv.i8 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0014 + + IL_0028: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.1 + IL_0001: conv.i8 + IL_0002: ldc.i4.0 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 10 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000c: pop + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: conv.i8 + IL_0012: stloc.1 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: br.s IL_0028 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint64) + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: conv.i8 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0018 + + IL_002c: ret + } + + .property uint64 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint64) + .get uint64 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly uint64 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stsfld uint64 ''.$assembly::c@1 + IL_0007: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUIntPtr.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUIntPtr.fs new file mode 100644 index 00000000000..0ec7970c52a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUIntPtr.fs @@ -0,0 +1,57 @@ +let mutable c = 0un + +let f0 () = + for n in 10un..1un do + c <- n + +let f00 () = + for n in 10un..1un..1un do + c <- n + +let f1 () = + for n in 1un..10un do + c <- n + +let f2 start = + for n in start..10un do + c <- n + +let f3 finish = + for n in 1un..finish do + c <- n + +let f4 (start: unativeint) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1un..1un..10un do + c <- n + +let f6 () = + for n in 1un..2un..10un do + c <- n + +let f7 start = + for n in start..2un..10un do + c <- n + +let f8 step = + for n in 1un..step..10un do + c <- n + +let f9 finish = + for n in 1un..2un..finish do + c <- n + +let f10 (start: unativeint) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0un..finish do + c <- n + +let f12 () = + for n in 1un..0un..10un do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUIntPtr.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUIntPtr.fs.opt.il.bsl new file mode 100644 index 00000000000..9af9230923b --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForEachRangeStepUIntPtr.fs.opt.il.bsl @@ -0,0 +1,1110 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .method public specialname static native uint get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld native uint ''.$assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(native uint 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld native uint ''.$assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f2(native uint start) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldc.i8 0xa + IL_0009: conv.u + IL_000a: ldarg.0 + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldc.i8 0xa + IL_0023: conv.u + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_0094 + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.u + IL_005d: stloc.2 + IL_005e: ldarg.0 + IL_005f: stloc.3 + IL_0060: br.s IL_0090 + + IL_0062: ldloc.3 + IL_0063: call void assembly::set_c(native uint) + IL_0068: ldloc.3 + IL_0069: ldc.i8 0x1 + IL_0072: conv.u + IL_0073: add + IL_0074: stloc.3 + IL_0075: ldloc.2 + IL_0076: ldc.i8 0x1 + IL_007f: conv.u + IL_0080: add + IL_0081: stloc.2 + IL_0082: ldloc.2 + IL_0083: ldc.i8 0x0 + IL_008c: conv.u + IL_008d: cgt.un + IL_008f: stloc.1 + IL_0090: ldloc.1 + IL_0091: brtrue.s IL_0062 + + IL_0093: ret + + IL_0094: ldc.i8 0xa + IL_009d: conv.u + IL_009e: ldarg.0 + IL_009f: bge.un.s IL_00ae + + IL_00a1: ldc.i8 0x0 + IL_00aa: conv.u + IL_00ab: nop + IL_00ac: br.s IL_00c6 + + IL_00ae: ldc.i8 0xa + IL_00b7: conv.u + IL_00b8: ldarg.0 + IL_00b9: sub + IL_00ba: ldc.i8 0x1 + IL_00c3: conv.u + IL_00c4: add.ovf.un + IL_00c5: nop + IL_00c6: stloc.2 + IL_00c7: ldc.i8 0x0 + IL_00d0: conv.u + IL_00d1: stloc.3 + IL_00d2: ldarg.0 + IL_00d3: stloc.s V_4 + IL_00d5: br.s IL_00fa + + IL_00d7: ldloc.s V_4 + IL_00d9: call void assembly::set_c(native uint) + IL_00de: ldloc.s V_4 + IL_00e0: ldc.i8 0x1 + IL_00e9: conv.u + IL_00ea: add + IL_00eb: stloc.s V_4 + IL_00ed: ldloc.3 + IL_00ee: ldc.i8 0x1 + IL_00f7: conv.u + IL_00f8: add + IL_00f9: stloc.3 + IL_00fa: ldloc.3 + IL_00fb: ldloc.2 + IL_00fc: blt.un.s IL_00d7 + + IL_00fe: ret + } + + .method public static void f3(native uint finish) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.u + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.u + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_009d + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.u + IL_005d: stloc.2 + IL_005e: ldc.i8 0x1 + IL_0067: conv.u + IL_0068: stloc.3 + IL_0069: br.s IL_0099 + + IL_006b: ldloc.3 + IL_006c: call void assembly::set_c(native uint) + IL_0071: ldloc.3 + IL_0072: ldc.i8 0x1 + IL_007b: conv.u + IL_007c: add + IL_007d: stloc.3 + IL_007e: ldloc.2 + IL_007f: ldc.i8 0x1 + IL_0088: conv.u + IL_0089: add + IL_008a: stloc.2 + IL_008b: ldloc.2 + IL_008c: ldc.i8 0x0 + IL_0095: conv.u + IL_0096: cgt.un + IL_0098: stloc.1 + IL_0099: ldloc.1 + IL_009a: brtrue.s IL_006b + + IL_009c: ret + + IL_009d: ldarg.0 + IL_009e: ldc.i8 0x1 + IL_00a7: conv.u + IL_00a8: bge.un.s IL_00b7 + + IL_00aa: ldc.i8 0x0 + IL_00b3: conv.u + IL_00b4: nop + IL_00b5: br.s IL_00cf + + IL_00b7: ldarg.0 + IL_00b8: ldc.i8 0x1 + IL_00c1: conv.u + IL_00c2: sub + IL_00c3: ldc.i8 0x1 + IL_00cc: conv.u + IL_00cd: add.ovf.un + IL_00ce: nop + IL_00cf: stloc.2 + IL_00d0: ldc.i8 0x0 + IL_00d9: conv.u + IL_00da: stloc.3 + IL_00db: ldc.i8 0x1 + IL_00e4: conv.u + IL_00e5: stloc.s V_4 + IL_00e7: br.s IL_010c + + IL_00e9: ldloc.s V_4 + IL_00eb: call void assembly::set_c(native uint) + IL_00f0: ldloc.s V_4 + IL_00f2: ldc.i8 0x1 + IL_00fb: conv.u + IL_00fc: add + IL_00fd: stloc.s V_4 + IL_00ff: ldloc.3 + IL_0100: ldc.i8 0x1 + IL_0109: conv.u + IL_010a: add + IL_010b: stloc.3 + IL_010c: ldloc.3 + IL_010d: ldloc.2 + IL_010e: blt.un.s IL_00e9 + + IL_0110: ret + } + + .method public static void f4(native uint start, + native uint finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0011 + + IL_0004: ldc.i8 0x0 + IL_000d: conv.u + IL_000e: nop + IL_000f: br.s IL_0015 + + IL_0011: ldarg.1 + IL_0012: ldarg.0 + IL_0013: sub + IL_0014: nop + IL_0015: stloc.0 + IL_0016: sizeof [runtime]System.IntPtr + IL_001c: ldc.i4.4 + IL_001d: bne.un.s IL_002f + + IL_001f: ldloc.0 + IL_0020: ldc.i8 0xffffffff + IL_0029: conv.u + IL_002a: ceq + IL_002c: nop + IL_002d: br.s IL_003d + + IL_002f: ldloc.0 + IL_0030: ldc.i8 0xffffffffffffffff + IL_0039: conv.u + IL_003a: ceq + IL_003c: nop + IL_003d: brfalse.s IL_0082 + + IL_003f: ldc.i4.1 + IL_0040: stloc.1 + IL_0041: ldc.i8 0x0 + IL_004a: conv.u + IL_004b: stloc.2 + IL_004c: ldarg.0 + IL_004d: stloc.3 + IL_004e: br.s IL_007e + + IL_0050: ldloc.3 + IL_0051: call void assembly::set_c(native uint) + IL_0056: ldloc.3 + IL_0057: ldc.i8 0x1 + IL_0060: conv.u + IL_0061: add + IL_0062: stloc.3 + IL_0063: ldloc.2 + IL_0064: ldc.i8 0x1 + IL_006d: conv.u + IL_006e: add + IL_006f: stloc.2 + IL_0070: ldloc.2 + IL_0071: ldc.i8 0x0 + IL_007a: conv.u + IL_007b: cgt.un + IL_007d: stloc.1 + IL_007e: ldloc.1 + IL_007f: brtrue.s IL_0050 + + IL_0081: ret + + IL_0082: ldarg.1 + IL_0083: ldarg.0 + IL_0084: bge.un.s IL_0093 + + IL_0086: ldc.i8 0x0 + IL_008f: conv.u + IL_0090: nop + IL_0091: br.s IL_00a2 + + IL_0093: ldarg.1 + IL_0094: ldarg.0 + IL_0095: sub + IL_0096: ldc.i8 0x1 + IL_009f: conv.u + IL_00a0: add.ovf.un + IL_00a1: nop + IL_00a2: stloc.2 + IL_00a3: ldc.i8 0x0 + IL_00ac: conv.u + IL_00ad: stloc.3 + IL_00ae: ldarg.0 + IL_00af: stloc.s V_4 + IL_00b1: br.s IL_00d6 + + IL_00b3: ldloc.s V_4 + IL_00b5: call void assembly::set_c(native uint) + IL_00ba: ldloc.s V_4 + IL_00bc: ldc.i8 0x1 + IL_00c5: conv.u + IL_00c6: add + IL_00c7: stloc.s V_4 + IL_00c9: ldloc.3 + IL_00ca: ldc.i8 0x1 + IL_00d3: conv.u + IL_00d4: add + IL_00d5: stloc.3 + IL_00d6: ldloc.3 + IL_00d7: ldloc.2 + IL_00d8: blt.un.s IL_00b3 + + IL_00da: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x2 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x5 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f7(native uint start) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldc.i8 0xa + IL_0009: conv.u + IL_000a: ldarg.0 + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldc.i8 0xa + IL_0023: conv.u + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.u + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.u + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.u + IL_0048: stloc.1 + IL_0049: ldarg.0 + IL_004a: stloc.2 + IL_004b: br.s IL_006d + + IL_004d: ldloc.2 + IL_004e: call void assembly::set_c(native uint) + IL_0053: ldloc.2 + IL_0054: ldc.i8 0x2 + IL_005d: conv.u + IL_005e: add + IL_005f: stloc.2 + IL_0060: ldloc.1 + IL_0061: ldc.i8 0x1 + IL_006a: conv.u + IL_006b: add + IL_006c: stloc.1 + IL_006d: ldloc.1 + IL_006e: ldloc.0 + IL_006f: blt.un.s IL_004d + + IL_0071: ret + } + + .method public static void f8(native uint step) cil managed + { + + .maxstack 5 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.u + IL_000b: bne.un.s IL_002b + + IL_000d: ldc.i8 0x1 + IL_0016: conv.u + IL_0017: ldarg.0 + IL_0018: ldc.i8 0xa + IL_0021: conv.u + IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0027: pop + IL_0028: nop + IL_0029: br.s IL_002c + + IL_002b: nop + IL_002c: ldc.i8 0xa + IL_0035: conv.u + IL_0036: ldc.i8 0x1 + IL_003f: conv.u + IL_0040: bge.un.s IL_004f + + IL_0042: ldc.i8 0x0 + IL_004b: conv.u + IL_004c: nop + IL_004d: br.s IL_0067 + + IL_004f: ldc.i8 0xa + IL_0058: conv.u + IL_0059: ldc.i8 0x1 + IL_0062: conv.u + IL_0063: sub + IL_0064: ldarg.0 + IL_0065: div.un + IL_0066: nop + IL_0067: stloc.0 + IL_0068: sizeof [runtime]System.IntPtr + IL_006e: ldc.i4.4 + IL_006f: bne.un.s IL_0081 + + IL_0071: ldloc.0 + IL_0072: ldc.i8 0xffffffff + IL_007b: conv.u + IL_007c: ceq + IL_007e: nop + IL_007f: br.s IL_008f + + IL_0081: ldloc.0 + IL_0082: ldc.i8 0xffffffffffffffff + IL_008b: conv.u + IL_008c: ceq + IL_008e: nop + IL_008f: brfalse.s IL_00d4 + + IL_0091: ldc.i4.1 + IL_0092: stloc.1 + IL_0093: ldc.i8 0x0 + IL_009c: conv.u + IL_009d: stloc.2 + IL_009e: ldc.i8 0x1 + IL_00a7: conv.u + IL_00a8: stloc.3 + IL_00a9: br.s IL_00d0 + + IL_00ab: ldloc.3 + IL_00ac: call void assembly::set_c(native uint) + IL_00b1: ldloc.3 + IL_00b2: ldarg.0 + IL_00b3: add + IL_00b4: stloc.3 + IL_00b5: ldloc.2 + IL_00b6: ldc.i8 0x1 + IL_00bf: conv.u + IL_00c0: add + IL_00c1: stloc.2 + IL_00c2: ldloc.2 + IL_00c3: ldc.i8 0x0 + IL_00cc: conv.u + IL_00cd: cgt.un + IL_00cf: stloc.1 + IL_00d0: ldloc.1 + IL_00d1: brtrue.s IL_00ab + + IL_00d3: ret + + IL_00d4: ldc.i8 0xa + IL_00dd: conv.u + IL_00de: ldc.i8 0x1 + IL_00e7: conv.u + IL_00e8: bge.un.s IL_00f7 + + IL_00ea: ldc.i8 0x0 + IL_00f3: conv.u + IL_00f4: nop + IL_00f5: br.s IL_011a + + IL_00f7: ldc.i8 0xa + IL_0100: conv.u + IL_0101: ldc.i8 0x1 + IL_010a: conv.u + IL_010b: sub + IL_010c: ldarg.0 + IL_010d: div.un + IL_010e: ldc.i8 0x1 + IL_0117: conv.u + IL_0118: add.ovf.un + IL_0119: nop + IL_011a: stloc.2 + IL_011b: ldc.i8 0x0 + IL_0124: conv.u + IL_0125: stloc.3 + IL_0126: ldc.i8 0x1 + IL_012f: conv.u + IL_0130: stloc.s V_4 + IL_0132: br.s IL_014e + + IL_0134: ldloc.s V_4 + IL_0136: call void assembly::set_c(native uint) + IL_013b: ldloc.s V_4 + IL_013d: ldarg.0 + IL_013e: add + IL_013f: stloc.s V_4 + IL_0141: ldloc.3 + IL_0142: ldc.i8 0x1 + IL_014b: conv.u + IL_014c: add + IL_014d: stloc.3 + IL_014e: ldloc.3 + IL_014f: ldloc.2 + IL_0150: blt.un.s IL_0134 + + IL_0152: ret + } + + .method public static void f9(native uint finish) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.u + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.u + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.u + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.u + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.u + IL_0048: stloc.1 + IL_0049: ldc.i8 0x1 + IL_0052: conv.u + IL_0053: stloc.2 + IL_0054: br.s IL_0076 + + IL_0056: ldloc.2 + IL_0057: call void assembly::set_c(native uint) + IL_005c: ldloc.2 + IL_005d: ldc.i8 0x2 + IL_0066: conv.u + IL_0067: add + IL_0068: stloc.2 + IL_0069: ldloc.1 + IL_006a: ldc.i8 0x1 + IL_0073: conv.u + IL_0074: add + IL_0075: stloc.1 + IL_0076: ldloc.1 + IL_0077: ldloc.0 + IL_0078: blt.un.s IL_0056 + + IL_007a: ret + } + + .method public static void f10(native uint start, + native uint step, + native uint finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.1 + IL_0001: ldc.i8 0x0 + IL_000a: conv.u + IL_000b: bne.un.s IL_0019 + + IL_000d: ldarg.2 + IL_000e: ldarg.1 + IL_000f: ldarg.2 + IL_0010: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0015: pop + IL_0016: nop + IL_0017: br.s IL_001a + + IL_0019: nop + IL_001a: ldarg.2 + IL_001b: ldarg.2 + IL_001c: bge.un.s IL_002b + + IL_001e: ldc.i8 0x0 + IL_0027: conv.u + IL_0028: nop + IL_0029: br.s IL_0031 + + IL_002b: ldarg.2 + IL_002c: ldarg.2 + IL_002d: sub + IL_002e: ldarg.1 + IL_002f: div.un + IL_0030: nop + IL_0031: stloc.0 + IL_0032: sizeof [runtime]System.IntPtr + IL_0038: ldc.i4.4 + IL_0039: bne.un.s IL_004b + + IL_003b: ldloc.0 + IL_003c: ldc.i8 0xffffffff + IL_0045: conv.u + IL_0046: ceq + IL_0048: nop + IL_0049: br.s IL_0059 + + IL_004b: ldloc.0 + IL_004c: ldc.i8 0xffffffffffffffff + IL_0055: conv.u + IL_0056: ceq + IL_0058: nop + IL_0059: brfalse.s IL_0095 + + IL_005b: ldc.i4.1 + IL_005c: stloc.1 + IL_005d: ldc.i8 0x0 + IL_0066: conv.u + IL_0067: stloc.2 + IL_0068: ldarg.2 + IL_0069: stloc.3 + IL_006a: br.s IL_0091 + + IL_006c: ldloc.3 + IL_006d: call void assembly::set_c(native uint) + IL_0072: ldloc.3 + IL_0073: ldarg.1 + IL_0074: add + IL_0075: stloc.3 + IL_0076: ldloc.2 + IL_0077: ldc.i8 0x1 + IL_0080: conv.u + IL_0081: add + IL_0082: stloc.2 + IL_0083: ldloc.2 + IL_0084: ldc.i8 0x0 + IL_008d: conv.u + IL_008e: cgt.un + IL_0090: stloc.1 + IL_0091: ldloc.1 + IL_0092: brtrue.s IL_006c + + IL_0094: ret + + IL_0095: ldarg.2 + IL_0096: ldarg.2 + IL_0097: bge.un.s IL_00a6 + + IL_0099: ldc.i8 0x0 + IL_00a2: conv.u + IL_00a3: nop + IL_00a4: br.s IL_00b7 + + IL_00a6: ldarg.2 + IL_00a7: ldarg.2 + IL_00a8: sub + IL_00a9: ldarg.1 + IL_00aa: div.un + IL_00ab: ldc.i8 0x1 + IL_00b4: conv.u + IL_00b5: add.ovf.un + IL_00b6: nop + IL_00b7: stloc.2 + IL_00b8: ldc.i8 0x0 + IL_00c1: conv.u + IL_00c2: stloc.3 + IL_00c3: ldarg.2 + IL_00c4: stloc.s V_4 + IL_00c6: br.s IL_00e2 + + IL_00c8: ldloc.s V_4 + IL_00ca: call void assembly::set_c(native uint) + IL_00cf: ldloc.s V_4 + IL_00d1: ldarg.1 + IL_00d2: add + IL_00d3: stloc.s V_4 + IL_00d5: ldloc.3 + IL_00d6: ldc.i8 0x1 + IL_00df: conv.u + IL_00e0: add + IL_00e1: stloc.3 + IL_00e2: ldloc.3 + IL_00e3: ldloc.2 + IL_00e4: blt.un.s IL_00c8 + + IL_00e6: ret + } + + .method public static void f11(native uint start, + native uint finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.u + IL_000b: ldarg.1 + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0011: pop + IL_0012: ldc.i8 0x0 + IL_001b: conv.u + IL_001c: stloc.0 + IL_001d: ldc.i8 0x0 + IL_0026: conv.u + IL_0027: stloc.1 + IL_0028: ldarg.0 + IL_0029: stloc.2 + IL_002a: br.s IL_004c + + IL_002c: ldloc.2 + IL_002d: call void assembly::set_c(native uint) + IL_0032: ldloc.2 + IL_0033: ldc.i8 0x0 + IL_003c: conv.u + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i8 0x1 + IL_0049: conv.u + IL_004a: add + IL_004b: stloc.1 + IL_004c: ldloc.1 + IL_004d: ldloc.0 + IL_004e: blt.un.s IL_002c + + IL_0050: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldc.i8 0x1 + IL_0009: conv.u + IL_000a: ldc.i8 0x0 + IL_0013: conv.u + IL_0014: ldc.i8 0xa + IL_001d: conv.u + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0023: pop + IL_0024: ldc.i8 0x0 + IL_002d: conv.u + IL_002e: stloc.0 + IL_002f: ldc.i8 0x0 + IL_0038: conv.u + IL_0039: stloc.1 + IL_003a: ldc.i8 0x1 + IL_0043: conv.u + IL_0044: stloc.2 + IL_0045: br.s IL_0067 + + IL_0047: ldloc.2 + IL_0048: call void assembly::set_c(native uint) + IL_004d: ldloc.2 + IL_004e: ldc.i8 0x0 + IL_0057: conv.u + IL_0058: add + IL_0059: stloc.2 + IL_005a: ldloc.1 + IL_005b: ldc.i8 0x1 + IL_0064: conv.u + IL_0065: add + IL_0066: stloc.1 + IL_0067: ldloc.1 + IL_0068: ldloc.0 + IL_0069: blt.un.s IL_0047 + + IL_006b: ret + } + + .property native uint c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(native uint) + .get native uint assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly native uint c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stsfld native uint ''.$assembly::c@1 + IL_000f: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForLoop.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForLoop.fs index d670348ae71..58bd7c3bd2d 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForLoop.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/ForLoop.fs @@ -131,3 +131,79 @@ module ForLoopRealInternalSignatureOff = compilation |> verifyCompilation + // SOURCE=ForEachRangeStepSByte.fs SCFLAGS="--optimize+" # ForEachRangeStepSByte.fs --optimize+ + [] + let ``ForEachRangeStepSByte_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepByte.fs SCFLAGS="--optimize+" # ForEachRangeStepByte.fs --optimize+ + [] + let ``ForEachRangeStepByte_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepChar.fs SCFLAGS="--optimize+" # ForEachRangeStepChar.fs --optimize+ + [] + let ``ForEachRangeStepChar_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepInt16.fs SCFLAGS="--optimize+" # ForEachRangeStepInt16.fs --optimize+ + [] + let ``ForEachRangeStepInt16_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUInt16.fs SCFLAGS="--optimize+" # ForEachRangeStepUInt16.fs --optimize+ + [] + let ``ForEachRangeStepUInt16_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepInt32.fs SCFLAGS="--optimize+" # ForEachRangeStepInt32.fs --optimize+ + [] + let ``ForEachRangeStepInt32_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUInt32.fs SCFLAGS="--optimize+" # ForEachRangeStepUInt32.fs --optimize+ + [] + let ``ForEachRangeStepUInt32_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepInt64.fs SCFLAGS="--optimize+" # ForEachRangeStepInt64.fs --optimize+ + [] + let ``ForEachRangeStepInt64_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUInt64.fs SCFLAGS="--optimize+" # ForEachRangeStepUInt64.fs --optimize+ + [] + let ``ForEachRangeStepUInt64_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepIntPtr.fs SCFLAGS="--optimize+" # ForEachRangeStepIntPtr.fs --optimize+ + [] + let ``ForEachRangeStepIntPtr_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUIntPtr.fs SCFLAGS="--optimize+" # ForEachRangeStepUIntPtr.fs --optimize+ + [] + let ``ForEachRangeStepUIntPtr_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.il.bsl index f4f037c9936..fb5c2acf0b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.il.bsl @@ -43,8 +43,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public specialname static int32[] - get_r() cil managed + .method public specialname static int32[] get_r() cil managed { .maxstack 8 @@ -52,8 +51,7 @@ IL_0005: ret } - .method public specialname static int32[] - get_w() cil managed + .method public specialname static int32[] get_w() cil managed { .maxstack 8 @@ -61,8 +59,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_current@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed { .maxstack 8 @@ -70,8 +67,7 @@ IL_0005: ret } - .method assembly specialname static void - set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 @@ -80,8 +76,7 @@ IL_0006: ret } - .method assembly specialname static int32 - get_e1@1() cil managed + .method assembly specialname static int32 get_e1@1() cil managed { .maxstack 8 @@ -89,8 +84,7 @@ IL_0005: ret } - .method assembly specialname static int32 - get_e2@1() cil managed + .method assembly specialname static int32 get_e2@1() cil managed { .maxstack 8 @@ -98,8 +92,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_next@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_next@9() cil managed { .maxstack 8 @@ -107,8 +100,7 @@ IL_0005: ret } - .method assembly specialname static void - set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl index f4f037c9936..fb5c2acf0b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl @@ -43,8 +43,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public specialname static int32[] - get_r() cil managed + .method public specialname static int32[] get_r() cil managed { .maxstack 8 @@ -52,8 +51,7 @@ IL_0005: ret } - .method public specialname static int32[] - get_w() cil managed + .method public specialname static int32[] get_w() cil managed { .maxstack 8 @@ -61,8 +59,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_current@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed { .maxstack 8 @@ -70,8 +67,7 @@ IL_0005: ret } - .method assembly specialname static void - set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 @@ -80,8 +76,7 @@ IL_0006: ret } - .method assembly specialname static int32 - get_e1@1() cil managed + .method assembly specialname static int32 get_e1@1() cil managed { .maxstack 8 @@ -89,8 +84,7 @@ IL_0005: ret } - .method assembly specialname static int32 - get_e2@1() cil managed + .method assembly specialname static int32 get_e2@1() cil managed { .maxstack 8 @@ -98,8 +92,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_next@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_next@9() cil managed { .maxstack 8 @@ -107,8 +100,7 @@ IL_0005: ret } - .method assembly specialname static void - set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.il.bsl index 7229991ff4b..afcb05828cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.il.bsl @@ -43,8 +43,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public specialname static int32[] - get_r() cil managed + .method public specialname static int32[] get_r() cil managed { .maxstack 8 @@ -52,8 +51,7 @@ IL_0005: ret } - .method public specialname static int32[] - get_w() cil managed + .method public specialname static int32[] get_w() cil managed { .maxstack 8 @@ -61,8 +59,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_current@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed { .maxstack 8 @@ -70,8 +67,7 @@ IL_0005: ret } - .method assembly specialname static void - set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 @@ -80,8 +76,7 @@ IL_0006: ret } - .method assembly specialname static int32 - get_e1@1() cil managed + .method assembly specialname static int32 get_e1@1() cil managed { .maxstack 8 @@ -89,8 +84,7 @@ IL_0005: ret } - .method assembly specialname static int32 - get_e2@1() cil managed + .method assembly specialname static int32 get_e2@1() cil managed { .maxstack 8 @@ -98,8 +92,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_next@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_next@9() cil managed { .maxstack 8 @@ -107,8 +100,7 @@ IL_0005: ret } - .method assembly specialname static void - set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl index 7229991ff4b..afcb05828cd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOff/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl @@ -43,8 +43,7 @@ extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) - .method public specialname static int32[] - get_r() cil managed + .method public specialname static int32[] get_r() cil managed { .maxstack 8 @@ -52,8 +51,7 @@ IL_0005: ret } - .method public specialname static int32[] - get_w() cil managed + .method public specialname static int32[] get_w() cil managed { .maxstack 8 @@ -61,8 +59,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_current@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_current@9() cil managed { .maxstack 8 @@ -70,8 +67,7 @@ IL_0005: ret } - .method assembly specialname static void - set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 @@ -80,8 +76,7 @@ IL_0006: ret } - .method assembly specialname static int32 - get_e1@1() cil managed + .method assembly specialname static int32 get_e1@1() cil managed { .maxstack 8 @@ -89,8 +84,7 @@ IL_0005: ret } - .method assembly specialname static int32 - get_e2@1() cil managed + .method assembly specialname static int32 get_e2@1() cil managed { .maxstack 8 @@ -98,8 +92,7 @@ IL_0005: ret } - .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_next@9() cil managed + .method assembly specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_next@9() cil managed { .maxstack 8 @@ -107,8 +100,7 @@ IL_0005: ret } - .method assembly specialname static void - set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed + .method assembly specialname static void set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 'value') cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepByte.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepByte.fs new file mode 100644 index 00000000000..f4e047fb3d5 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepByte.fs @@ -0,0 +1,57 @@ +let mutable c = 0uy + +let f0 () = + for n in 10uy..1uy do + c <- n + +let f00 () = + for n in 10uy..1uy..1uy do + c <- n + +let f1 () = + for n in 1uy..10uy do + c <- n + +let f2 start = + for n in start..10uy do + c <- n + +let f3 finish = + for n in 1uy..finish do + c <- n + +let f4 (start: byte) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1uy..1uy..10uy do + c <- n + +let f6 () = + for n in 1uy..2uy..10uy do + c <- n + +let f7uy start = + for n in start..2uy..10uy do + c <- n + +let f8 step = + for n in 1uy..step..10uy do + c <- n + +let f9 finish = + for n in 1uy..2uy..finish do + c <- n + +let f10 (start: byte) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0uy..finish do + c <- n + +let f12 () = + for n in 1uy..0uy..10uy do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepByte.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepByte.fs.opt.il.bsl new file mode 100644 index 00000000000..83c83d6eac2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepByte.fs.opt.il.bsl @@ -0,0 +1,693 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly uint8 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static uint8 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint8 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint8 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint8 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint8 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint8 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(uint8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.u2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(uint8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.u2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(uint8 start, + uint8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.u2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7uy(uint8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u2 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(uint8) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(uint8 step) cil managed + { + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.s 9 + IL_0013: ldarg.0 + IL_0014: div.un + IL_0015: conv.u2 + IL_0016: ldc.i4.1 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldc.i4.0 + IL_001a: stloc.1 + IL_001b: ldc.i4.1 + IL_001c: stloc.2 + IL_001d: br.s IL_002d + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(uint8) + IL_0025: ldloc.2 + IL_0026: ldarg.0 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: add + IL_002c: stloc.1 + IL_002d: ldloc.1 + IL_002e: ldloc.0 + IL_002f: blt.un.s IL_001f + + IL_0031: ret + } + + .method public static void f9(uint8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.u2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(uint8 start, + uint8 step, + uint8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint8 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0018 + + IL_0014: ldc.i4.0 + IL_0015: nop + IL_0016: br.s IL_0021 + + IL_0018: ldarg.2 + IL_0019: ldarg.2 + IL_001a: sub + IL_001b: ldarg.1 + IL_001c: div.un + IL_001d: conv.u2 + IL_001e: ldc.i4.1 + IL_001f: add + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldarg.2 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(uint8) + IL_002e: ldloc.2 + IL_002f: ldarg.1 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f11(uint8 start, + uint8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint8 V_0, + uint8 V_1, + uint8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(uint8) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint8 V_0, + uint8 V_1, + uint8 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, + uint8, + uint8) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(uint8) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld uint8 assembly::c@1 + IL_0006: ret + } + + .property uint8 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint8) + .get uint8 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepChar.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepChar.fs new file mode 100644 index 00000000000..137044d13b9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepChar.fs @@ -0,0 +1,57 @@ +let mutable c = '\000' + +let f0 () = + for n in 'z'..'a' do + c <- n + +let f00 () = + for n in 'z'..'\001'..'a' do + c <- n + +let f1 () = + for n in 'a'..'z' do + c <- n + +let f2 start = + for n in start..'z' do + c <- n + +let f3 finish = + for n in 'a'..finish do + c <- n + +let f4 (start: char) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 'a'..'\001'..'z' do + c <- n + +let f6 () = + for n in 'a'..'\002'..'z' do + c <- n + +let f7 start = + for n in start..'\002'..'z' do + c <- n + +let f8 step = + for n in 'a'..step..'z' do + c <- n + +let f9 finish = + for n in 'a'..'\002'..finish do + c <- n + +let f10 (start: char) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..'\000'..finish do + c <- n + +let f12 () = + for n in 'a'..'\000'..'z' do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepChar.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepChar.fs.opt.il.bsl new file mode 100644 index 00000000000..f383fcd5612 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepChar.fs.opt.il.bsl @@ -0,0 +1,869 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class auto ansi serializable sealed nested assembly beforefieldinit f8@40 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f8@40 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f8@40::.ctor() + IL_0005: stsfld class assembly/f8@40 assembly/f8@40::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit f10@48 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f10@48 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f10@48::.ctor() + IL_0005: stsfld class assembly/f10@48 assembly/f10@48::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit f11@52 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f11@52 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f11@52::.ctor() + IL_0005: stsfld class assembly/f11@52 assembly/f11@52::@_instance + IL_000a: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit f12@56 + extends class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3 + { + .field static assembly initonly class assembly/f12@56 @_instance + .method assembly specialname rtspecialname instance void .ctor() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.OptimizedClosures/FSharpFunc`3::.ctor() + IL_0006: ret + } + + .method public strict virtual instance char + Invoke(char x, + char y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: add.ovf.un + IL_0003: conv.ovf.u2.un + IL_0004: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 10 + IL_0000: newobj instance void assembly/f12@56::.ctor() + IL_0005: stsfld class assembly/f12@56 assembly/f12@56::@_instance + IL_000a: ret + } + + } + + .field static assembly char c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static char get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld char assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(char 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld char assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (char V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 122 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (char V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 122 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 97 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 26 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f2(char start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldc.i4.s 122 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 122 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(char) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(char finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 97 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.s 97 + IL_000c: sub + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.s 97 + IL_0016: stloc.2 + IL_0017: br.s IL_0027 + + IL_0019: ldloc.2 + IL_001a: call void assembly::set_c(char) + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: add + IL_0026: stloc.1 + IL_0027: ldloc.1 + IL_0028: ldloc.0 + IL_0029: blt.un.s IL_0019 + + IL_002b: ret + } + + .method public static void f4(char start, + char finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.u4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(char) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 97 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 26 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + char V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 97 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(char) + IL_000d: ldloc.1 + IL_000e: ldc.i4.2 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 13 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f7(char start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldc.i4.s 122 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 122 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(char) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(char step) cil managed + { + + .maxstack 7 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: bne.un.s IL_0018 + + IL_0004: ldc.i4.0 + IL_0005: ldsfld class assembly/f8@40 assembly/f8@40::@_instance + IL_000a: ldc.i4.s 97 + IL_000c: ldarg.0 + IL_000d: ldc.i4.s 122 + IL_000f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_0014: pop + IL_0015: nop + IL_0016: br.s IL_0019 + + IL_0018: nop + IL_0019: ldc.i4.s 122 + IL_001b: ldc.i4.s 97 + IL_001d: sub + IL_001e: ldarg.0 + IL_001f: div.un + IL_0020: conv.u4 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.0 + IL_0024: ldc.i4.0 + IL_0025: stloc.1 + IL_0026: ldc.i4.s 97 + IL_0028: stloc.2 + IL_0029: br.s IL_0039 + + IL_002b: ldloc.2 + IL_002c: call void assembly::set_c(char) + IL_0031: ldloc.2 + IL_0032: ldarg.0 + IL_0033: add + IL_0034: stloc.2 + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: add + IL_0038: stloc.1 + IL_0039: ldloc.1 + IL_003a: ldloc.0 + IL_003b: blt.un.s IL_002b + + IL_003d: ret + } + + .method public static void f9(char finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.s 97 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.s 97 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldc.i4.s 97 + IL_0018: stloc.2 + IL_0019: br.s IL_0029 + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(char) + IL_0021: ldloc.2 + IL_0022: ldc.i4.2 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: add + IL_0028: stloc.1 + IL_0029: ldloc.1 + IL_002a: ldloc.0 + IL_002b: blt.un.s IL_001b + + IL_002d: ret + } + + .method public static void f10(char start, + char step, + char finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 7 + .locals init (uint32 V_0, + uint32 V_1, + char V_2) + IL_0000: ldarg.1 + IL_0001: ldc.i4.0 + IL_0002: bne.un.s IL_0016 + + IL_0004: ldc.i4.0 + IL_0005: ldsfld class assembly/f10@48 assembly/f10@48::@_instance + IL_000a: ldarg.2 + IL_000b: ldarg.1 + IL_000c: ldarg.2 + IL_000d: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_0012: pop + IL_0013: nop + IL_0014: br.s IL_0017 + + IL_0016: nop + IL_0017: ldarg.2 + IL_0018: ldarg.2 + IL_0019: bge.un.s IL_001f + + IL_001b: ldc.i4.0 + IL_001c: nop + IL_001d: br.s IL_0028 + + IL_001f: ldarg.2 + IL_0020: ldarg.2 + IL_0021: sub + IL_0022: ldarg.1 + IL_0023: div.un + IL_0024: conv.u4 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: nop + IL_0028: stloc.0 + IL_0029: ldc.i4.0 + IL_002a: stloc.1 + IL_002b: ldarg.2 + IL_002c: stloc.2 + IL_002d: br.s IL_003d + + IL_002f: ldloc.2 + IL_0030: call void assembly::set_c(char) + IL_0035: ldloc.2 + IL_0036: ldarg.1 + IL_0037: add + IL_0038: stloc.2 + IL_0039: ldloc.1 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: stloc.1 + IL_003d: ldloc.1 + IL_003e: ldloc.0 + IL_003f: blt.un.s IL_002f + + IL_0041: ret + } + + .method public static void f11(char start, + char finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 7 + .locals init (char V_0, + char V_1, + char V_2) + IL_0000: ldc.i4.0 + IL_0001: ldsfld class assembly/f11@52 assembly/f11@52::@_instance + IL_0006: ldarg.0 + IL_0007: ldc.i4.0 + IL_0008: ldarg.1 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_000e: pop + IL_000f: ldc.i4.0 + IL_0010: stloc.0 + IL_0011: ldc.i4.0 + IL_0012: stloc.1 + IL_0013: ldarg.0 + IL_0014: stloc.2 + IL_0015: br.s IL_0025 + + IL_0017: ldloc.2 + IL_0018: call void assembly::set_c(char) + IL_001d: ldloc.2 + IL_001e: ldc.i4.0 + IL_001f: add + IL_0020: stloc.2 + IL_0021: ldloc.1 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.1 + IL_0025: ldloc.1 + IL_0026: ldloc.0 + IL_0027: blt.un.s IL_0017 + + IL_0029: ret + } + + .method public static void f12() cil managed + { + + .maxstack 7 + .locals init (char V_0, + char V_1, + char V_2) + IL_0000: ldc.i4.0 + IL_0001: ldsfld class assembly/f12@56 assembly/f12@56::@_instance + IL_0006: ldc.i4.s 97 + IL_0008: ldc.i4.0 + IL_0009: ldc.i4.s 122 + IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeStepGeneric(!!0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2>, + !!1, + !!0, + !!1) + IL_0010: pop + IL_0011: ldc.i4.0 + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: stloc.1 + IL_0015: ldc.i4.s 97 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(char) + IL_0020: ldloc.2 + IL_0021: ldc.i4.0 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld char assembly::c@1 + IL_0006: ret + } + + .property char c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(char) + .get char assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt16.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt16.fs new file mode 100644 index 00000000000..f664f0ad2de --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt16.fs @@ -0,0 +1,65 @@ +let mutable c = 0s + +let f0 () = + for n in 10s..1s do + c <- n + +let f00 () = + for n in 10s..1s..1s do + c <- n + +let f1 () = + for n in 1s..10s do + c <- n + +let f2 start = + for n in start..10s do + c <- n + +let f3 finish = + for n in 1s..finish do + c <- n + +let f4 (start: int16) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1s..1s..10s do + c <- n + +let f6 () = + for n in 1s..2s..10s do + c <- n + +let f7 start = + for n in start..2s..10s do + c <- n + +let f8 step = + for n in 1s..step..10s do + c <- n + +let f9 finish = + for n in 1s..2s..finish do + c <- n + +let f10 (start: int16) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0s..finish do + c <- n + +let f12 () = + for n in 1s..0s..10s do + c <- n + +let f13 () = + for n in 10s .. -1s .. 1s do + c <- n + +let f14 () = + for n in 10s .. -2s .. 1s do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt16.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt16.fs.opt.il.bsl new file mode 100644 index 00000000000..b8f92098223 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt16.fs.opt.il.bsl @@ -0,0 +1,786 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly int16 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static int16 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int16 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int16 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int16 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int16 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int16 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(int16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(int16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.i4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(int16 start, + int16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.i4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7(int16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.i4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(int16) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(int16 step) cil managed + { + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_001f + + IL_0015: ldc.i4.s 9 + IL_0017: ldarg.0 + IL_0018: div.un + IL_0019: conv.i4 + IL_001a: ldc.i4.1 + IL_001b: add + IL_001c: nop + IL_001d: br.s IL_0021 + + IL_001f: ldc.i4.0 + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldc.i4.1 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(int16) + IL_002e: ldloc.2 + IL_002f: ldarg.0 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f9(int16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.i4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(int16 start, + int16 step, + int16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + int16 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: ldarg.1 + IL_0012: bge.s IL_0027 + + IL_0014: ldarg.2 + IL_0015: ldarg.2 + IL_0016: bge.s IL_001c + + IL_0018: ldc.i4.0 + IL_0019: nop + IL_001a: br.s IL_003b + + IL_001c: ldarg.2 + IL_001d: ldarg.2 + IL_001e: sub + IL_001f: ldarg.1 + IL_0020: div.un + IL_0021: conv.i4 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: nop + IL_0025: br.s IL_003b + + IL_0027: ldarg.2 + IL_0028: ldarg.2 + IL_0029: bge.s IL_002f + + IL_002b: ldc.i4.0 + IL_002c: nop + IL_002d: br.s IL_003b + + IL_002f: ldarg.2 + IL_0030: ldarg.2 + IL_0031: sub + IL_0032: ldarg.1 + IL_0033: not + IL_0034: ldc.i4.1 + IL_0035: add + IL_0036: div.un + IL_0037: conv.i4 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: nop + IL_003b: stloc.0 + IL_003c: ldc.i4.0 + IL_003d: stloc.1 + IL_003e: ldarg.2 + IL_003f: stloc.2 + IL_0040: br.s IL_0050 + + IL_0042: ldloc.2 + IL_0043: call void assembly::set_c(int16) + IL_0048: ldloc.2 + IL_0049: ldarg.1 + IL_004a: add + IL_004b: stloc.2 + IL_004c: ldloc.1 + IL_004d: ldc.i4.1 + IL_004e: add + IL_004f: stloc.1 + IL_0050: ldloc.1 + IL_0051: ldloc.0 + IL_0052: blt.un.s IL_0042 + + IL_0054: ret + } + + .method public static void f11(int16 start, + int16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int16 V_0, + int16 V_1, + int16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(int16) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int16 V_0, + int16 V_1, + int16 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt16(int16, + int16, + int16) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(int16) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.m1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 10 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + int16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.s -2 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int16 assembly::c@1 + IL_0006: ret + } + + .property int16 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int16) + .get int16 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt32.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt32.fs new file mode 100644 index 00000000000..32bca951da3 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt32.fs @@ -0,0 +1,65 @@ +let mutable c = 0 + +let f0 () = + for n in 10..1 do + c <- n + +let f00 () = + for n in 10..1..1 do + c <- n + +let f1 () = + for n in 1..10 do + c <- n + +let f2 start = + for n in start..10 do + c <- n + +let f3 finish = + for n in 1..finish do + c <- n + +let f4 start finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1..1..10 do + c <- n + +let f6 () = + for n in 1..2..10 do + c <- n + +let f7 start = + for n in start..2..10 do + c <- n + +let f8 step = + for n in 1..step..10 do + c <- n + +let f9 finish = + for n in 1..2..finish do + c <- n + +let f10 start step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0..finish do + c <- n + +let f12 () = + for n in 1..0..10 do + c <- n + +let f13 () = + for n in 10..-1..1 do + c <- n + +let f14 () = + for n in 10..-2..1 do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt32.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt32.fs.opt.il.bsl new file mode 100644 index 00000000000..ae30a8e844f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt32.fs.opt.il.bsl @@ -0,0 +1,744 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly int32 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static int32 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int32 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int32 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.s 10 + IL_0002: stloc.0 + IL_0003: br.s IL_000f + + IL_0005: ldloc.0 + IL_0006: call void assembly::set_c(int32) + IL_000b: ldloc.0 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: stloc.0 + IL_000f: ldloc.0 + IL_0010: ldc.i4.2 + IL_0011: blt.s IL_0005 + + IL_0013: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldc.i4.1 + IL_0001: stloc.0 + IL_0002: br.s IL_000e + + IL_0004: ldloc.0 + IL_0005: call void assembly::set_c(int32) + IL_000a: ldloc.0 + IL_000b: ldc.i4.1 + IL_000c: add + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.s 11 + IL_0011: blt.s IL_0004 + + IL_0013: ret + } + + .method public static void f2(int32 start) cil managed + { + + .maxstack 4 + .locals init (int32 V_0) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: br.s IL_000e + + IL_0004: ldloc.0 + IL_0005: call void assembly::set_c(int32) + IL_000a: ldloc.0 + IL_000b: ldc.i4.1 + IL_000c: add + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.s 11 + IL_0011: blt.s IL_0004 + + IL_0013: ret + } + + .method public static void f3(int32 finish) cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldc.i4.1 + IL_0001: stloc.1 + IL_0002: ldarg.0 + IL_0003: stloc.0 + IL_0004: ldloc.0 + IL_0005: ldloc.1 + IL_0006: blt.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: bne.un.s IL_0008 + + IL_0018: ret + } + + .method public static void f4(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1) + IL_0000: ldarg.0 + IL_0001: stloc.1 + IL_0002: ldarg.1 + IL_0003: stloc.0 + IL_0004: ldloc.0 + IL_0005: ldloc.1 + IL_0006: blt.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: bne.un.s IL_0008 + + IL_0018: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.s 10 + IL_0019: conv.i8 + IL_001a: blt.un.s IL_0007 + + IL_001c: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.2 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: conv.i8 + IL_0019: blt.un.s IL_0007 + + IL_001b: ret + } + + .method public static void f7(int32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldc.i4.s 10 + IL_000c: ldarg.0 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: div.un + IL_0010: conv.i8 + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldarg.0 + IL_001a: stloc.2 + IL_001b: br.s IL_002c + + IL_001d: ldloc.2 + IL_001e: call void assembly::set_c(int32) + IL_0023: ldloc.2 + IL_0024: ldc.i4.2 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001d + + IL_0030: ret + } + + .method public static void f8(int32 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_0020 + + IL_0015: ldc.i4.s 9 + IL_0017: ldarg.0 + IL_0018: div.un + IL_0019: conv.i8 + IL_001a: ldc.i4.1 + IL_001b: conv.i8 + IL_001c: add + IL_001d: nop + IL_001e: br.s IL_0023 + + IL_0020: ldc.i4.0 + IL_0021: conv.i8 + IL_0022: nop + IL_0023: stloc.0 + IL_0024: ldc.i4.0 + IL_0025: conv.i8 + IL_0026: stloc.1 + IL_0027: ldc.i4.1 + IL_0028: stloc.2 + IL_0029: br.s IL_003a + + IL_002b: ldloc.2 + IL_002c: call void assembly::set_c(int32) + IL_0031: ldloc.2 + IL_0032: ldarg.0 + IL_0033: add + IL_0034: stloc.2 + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.1 + IL_003a: ldloc.1 + IL_003b: ldloc.0 + IL_003c: blt.un.s IL_002b + + IL_003e: ret + } + + .method public static void f9(int32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.1 + IL_000b: sub + IL_000c: ldc.i4.2 + IL_000d: div.un + IL_000e: conv.i8 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.1 + IL_0017: ldc.i4.1 + IL_0018: stloc.2 + IL_0019: br.s IL_002a + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(int32) + IL_0021: ldloc.2 + IL_0022: ldc.i4.2 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldloc.0 + IL_002c: blt.un.s IL_001b + + IL_002e: ret + } + + .method public static void f10(!!a start, + int32 step, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int32 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: ldarg.1 + IL_0012: bge.s IL_0029 + + IL_0014: ldarg.2 + IL_0015: ldarg.2 + IL_0016: bge.s IL_001d + + IL_0018: ldc.i4.0 + IL_0019: conv.i8 + IL_001a: nop + IL_001b: br.s IL_003f + + IL_001d: ldarg.2 + IL_001e: ldarg.2 + IL_001f: sub + IL_0020: ldarg.1 + IL_0021: div.un + IL_0022: conv.i8 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: nop + IL_0027: br.s IL_003f + + IL_0029: ldarg.2 + IL_002a: ldarg.2 + IL_002b: bge.s IL_0032 + + IL_002d: ldc.i4.0 + IL_002e: conv.i8 + IL_002f: nop + IL_0030: br.s IL_003f + + IL_0032: ldarg.2 + IL_0033: ldarg.2 + IL_0034: sub + IL_0035: ldarg.1 + IL_0036: not + IL_0037: ldc.i4.1 + IL_0038: add + IL_0039: div.un + IL_003a: conv.i8 + IL_003b: ldc.i4.1 + IL_003c: conv.i8 + IL_003d: add + IL_003e: nop + IL_003f: stloc.0 + IL_0040: ldc.i4.0 + IL_0041: conv.i8 + IL_0042: stloc.1 + IL_0043: ldarg.2 + IL_0044: stloc.2 + IL_0045: br.s IL_0056 + + IL_0047: ldloc.2 + IL_0048: call void assembly::set_c(int32) + IL_004d: ldloc.2 + IL_004e: ldarg.1 + IL_004f: add + IL_0050: stloc.2 + IL_0051: ldloc.1 + IL_0052: ldc.i4.1 + IL_0053: conv.i8 + IL_0054: add + IL_0055: stloc.1 + IL_0056: ldloc.1 + IL_0057: ldloc.0 + IL_0058: blt.un.s IL_0047 + + IL_005a: ret + } + + .method public static void f11(int32 start, + int32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(int32) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + int32 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(int32) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: stloc.1 + IL_0006: br.s IL_0017 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.m1 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: add + IL_0016: stloc.0 + IL_0017: ldloc.0 + IL_0018: ldc.i4.s 10 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int32) + IL_000e: ldloc.1 + IL_000f: ldc.i4.s -2 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.5 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 assembly::c@1 + IL_0006: ret + } + + .property int32 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int32) + .get int32 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt64.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt64.fs new file mode 100644 index 00000000000..9e272eb300a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt64.fs @@ -0,0 +1,65 @@ +let mutable c = 0L + +let f0 () = + for n in 10L..1L do + c <- n + +let f00 () = + for n in 10L..1L..1L do + c <- n + +let f1 () = + for n in 1L..10L do + c <- n + +let f2 start = + for n in start..10L do + c <- n + +let f3 finish = + for n in 1L..finish do + c <- n + +let f4 (start: int64) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1L..1L..10L do + c <- n + +let f6 () = + for n in 1L..2L..10L do + c <- n + +let f7 start = + for n in start..2L..10L do + c <- n + +let f8 step = + for n in 1L..step..10L do + c <- n + +let f9 finish = + for n in 1L..2L..finish do + c <- n + +let f10 (start: int64) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0L..finish do + c <- n + +let f12 () = + for n in 1L..0L..10L do + c <- n + +let f13 () = + for n in 10L.. -1L ..1L do + c <- n + +let f14 () = + for n in 10L.. -2L ..1L do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt64.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt64.fs.opt.il.bsl new file mode 100644 index 00000000000..3c567634da6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepInt64.fs.opt.il.bsl @@ -0,0 +1,1012 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly int64 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static int64 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int64 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int64 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int64 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f2(int64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add.ovf.un + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.1 + IL_0018: ldarg.0 + IL_0019: stloc.2 + IL_001a: br.s IL_002c + + IL_001c: ldloc.2 + IL_001d: call void assembly::set_c(int64) + IL_0022: ldloc.2 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001c + + IL_0030: ret + } + + .method public static void f3(int64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add.ovf.un + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: stloc.2 + IL_0019: br.s IL_002b + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(int64) + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: conv.i8 + IL_0024: add + IL_0025: stloc.2 + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.1 + IL_002c: ldloc.0 + IL_002d: blt.un.s IL_001b + + IL_002f: ret + } + + .method public static void f4(int64 start, + int64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + int64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_000d + + IL_0009: ldarg.1 + IL_000a: ldarg.0 + IL_000b: sub + IL_000c: nop + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.m1 + IL_0010: conv.i8 + IL_0011: bne.un.s IL_0036 + + IL_0013: ldc.i4.1 + IL_0014: stloc.1 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.2 + IL_0018: ldarg.0 + IL_0019: stloc.3 + IL_001a: br.s IL_0032 + + IL_001c: ldloc.3 + IL_001d: call void assembly::set_c(int64) + IL_0022: ldloc.3 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldc.i4.0 + IL_002e: conv.i8 + IL_002f: cgt.un + IL_0031: stloc.1 + IL_0032: ldloc.1 + IL_0033: brtrue.s IL_001c + + IL_0035: ret + + IL_0036: ldarg.1 + IL_0037: ldarg.0 + IL_0038: bge.s IL_003f + + IL_003a: ldc.i4.0 + IL_003b: conv.i8 + IL_003c: nop + IL_003d: br.s IL_0046 + + IL_003f: ldarg.1 + IL_0040: ldarg.0 + IL_0041: sub + IL_0042: ldc.i4.1 + IL_0043: conv.i8 + IL_0044: add.ovf.un + IL_0045: nop + IL_0046: stloc.2 + IL_0047: ldc.i4.0 + IL_0048: conv.i8 + IL_0049: stloc.s V_4 + IL_004b: ldarg.0 + IL_004c: stloc.3 + IL_004d: br.s IL_0061 + + IL_004f: ldloc.3 + IL_0050: call void assembly::set_c(int64) + IL_0055: ldloc.3 + IL_0056: ldc.i4.1 + IL_0057: conv.i8 + IL_0058: add + IL_0059: stloc.3 + IL_005a: ldloc.s V_4 + IL_005c: ldc.i4.1 + IL_005d: conv.i8 + IL_005e: add + IL_005f: stloc.s V_4 + IL_0061: ldloc.s V_4 + IL_0063: ldloc.2 + IL_0064: blt.un.s IL_004f + + IL_0066: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(int64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.2 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.5 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .method public static void f7(int64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0017 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.2 + IL_0011: conv.i8 + IL_0012: div.un + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: add.ovf.un + IL_0016: nop + IL_0017: stloc.0 + IL_0018: ldc.i4.0 + IL_0019: conv.i8 + IL_001a: stloc.1 + IL_001b: ldarg.0 + IL_001c: stloc.2 + IL_001d: br.s IL_002f + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(int64) + IL_0025: ldloc.2 + IL_0026: ldc.i4.2 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.2 + IL_002a: ldloc.1 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.1 + IL_002f: ldloc.1 + IL_0030: ldloc.0 + IL_0031: blt.un.s IL_001f + + IL_0033: ret + } + + .method public static void f8(int64 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0012 + + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: ldarg.0 + IL_0006: ldc.i4.s 10 + IL_0008: conv.i8 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000e: pop + IL_000f: nop + IL_0010: br.s IL_0013 + + IL_0012: nop + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: ldarg.0 + IL_0016: bge.s IL_0023 + + IL_0018: ldc.i4.s 9 + IL_001a: conv.i8 + IL_001b: ldarg.0 + IL_001c: div.un + IL_001d: ldc.i4.1 + IL_001e: conv.i8 + IL_001f: add.ovf.un + IL_0020: nop + IL_0021: br.s IL_0026 + + IL_0023: ldc.i4.0 + IL_0024: conv.i8 + IL_0025: nop + IL_0026: stloc.0 + IL_0027: ldc.i4.0 + IL_0028: conv.i8 + IL_0029: stloc.1 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: stloc.2 + IL_002d: br.s IL_003e + + IL_002f: ldloc.2 + IL_0030: call void assembly::set_c(int64) + IL_0035: ldloc.2 + IL_0036: ldarg.0 + IL_0037: add + IL_0038: stloc.2 + IL_0039: ldloc.1 + IL_003a: ldc.i4.1 + IL_003b: conv.i8 + IL_003c: add + IL_003d: stloc.1 + IL_003e: ldloc.1 + IL_003f: ldloc.0 + IL_0040: blt.un.s IL_002f + + IL_0042: ret + } + + .method public static void f9(int64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: conv.i8 + IL_0010: div.un + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldc.i4.1 + IL_001a: conv.i8 + IL_001b: stloc.2 + IL_001c: br.s IL_002e + + IL_001e: ldloc.2 + IL_001f: call void assembly::set_c(int64) + IL_0024: ldloc.2 + IL_0025: ldc.i4.2 + IL_0026: conv.i8 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: add + IL_002d: stloc.1 + IL_002e: ldloc.1 + IL_002f: ldloc.0 + IL_0030: blt.un.s IL_001e + + IL_0032: ret + } + + .method public static void f10(int64 start, + int64 step, + int64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + int64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: conv.i8 + IL_0012: ldarg.1 + IL_0013: bge.s IL_0026 + + IL_0015: ldarg.2 + IL_0016: ldarg.2 + IL_0017: bge.s IL_001e + + IL_0019: ldc.i4.0 + IL_001a: conv.i8 + IL_001b: nop + IL_001c: br.s IL_0039 + + IL_001e: ldarg.2 + IL_001f: ldarg.2 + IL_0020: sub + IL_0021: ldarg.1 + IL_0022: div.un + IL_0023: nop + IL_0024: br.s IL_0039 + + IL_0026: ldarg.2 + IL_0027: ldarg.2 + IL_0028: bge.s IL_002f + + IL_002a: ldc.i4.0 + IL_002b: conv.i8 + IL_002c: nop + IL_002d: br.s IL_0039 + + IL_002f: ldarg.2 + IL_0030: ldarg.2 + IL_0031: sub + IL_0032: ldarg.1 + IL_0033: not + IL_0034: ldc.i4.1 + IL_0035: conv.i8 + IL_0036: add + IL_0037: div.un + IL_0038: nop + IL_0039: stloc.0 + IL_003a: ldloc.0 + IL_003b: ldc.i4.m1 + IL_003c: conv.i8 + IL_003d: bne.un.s IL_0061 + + IL_003f: ldc.i4.1 + IL_0040: stloc.1 + IL_0041: ldc.i4.0 + IL_0042: conv.i8 + IL_0043: stloc.2 + IL_0044: ldarg.2 + IL_0045: stloc.3 + IL_0046: br.s IL_005d + + IL_0048: ldloc.3 + IL_0049: call void assembly::set_c(int64) + IL_004e: ldloc.3 + IL_004f: ldarg.1 + IL_0050: add + IL_0051: stloc.3 + IL_0052: ldloc.2 + IL_0053: ldc.i4.1 + IL_0054: conv.i8 + IL_0055: add + IL_0056: stloc.2 + IL_0057: ldloc.2 + IL_0058: ldc.i4.0 + IL_0059: conv.i8 + IL_005a: cgt.un + IL_005c: stloc.1 + IL_005d: ldloc.1 + IL_005e: brtrue.s IL_0048 + + IL_0060: ret + + IL_0061: ldc.i4.0 + IL_0062: conv.i8 + IL_0063: ldarg.1 + IL_0064: bge.s IL_007a + + IL_0066: ldarg.2 + IL_0067: ldarg.2 + IL_0068: bge.s IL_006f + + IL_006a: ldc.i4.0 + IL_006b: conv.i8 + IL_006c: nop + IL_006d: br.s IL_0090 + + IL_006f: ldarg.2 + IL_0070: ldarg.2 + IL_0071: sub + IL_0072: ldarg.1 + IL_0073: div.un + IL_0074: ldc.i4.1 + IL_0075: conv.i8 + IL_0076: add.ovf.un + IL_0077: nop + IL_0078: br.s IL_0090 + + IL_007a: ldarg.2 + IL_007b: ldarg.2 + IL_007c: bge.s IL_0083 + + IL_007e: ldc.i4.0 + IL_007f: conv.i8 + IL_0080: nop + IL_0081: br.s IL_0090 + + IL_0083: ldarg.2 + IL_0084: ldarg.2 + IL_0085: sub + IL_0086: ldarg.1 + IL_0087: not + IL_0088: ldc.i4.1 + IL_0089: conv.i8 + IL_008a: add + IL_008b: div.un + IL_008c: ldc.i4.1 + IL_008d: conv.i8 + IL_008e: add.ovf.un + IL_008f: nop + IL_0090: stloc.2 + IL_0091: ldc.i4.0 + IL_0092: conv.i8 + IL_0093: stloc.s V_4 + IL_0095: ldarg.2 + IL_0096: stloc.3 + IL_0097: br.s IL_00aa + + IL_0099: ldloc.3 + IL_009a: call void assembly::set_c(int64) + IL_009f: ldloc.3 + IL_00a0: ldarg.1 + IL_00a1: add + IL_00a2: stloc.3 + IL_00a3: ldloc.s V_4 + IL_00a5: ldc.i4.1 + IL_00a6: conv.i8 + IL_00a7: add + IL_00a8: stloc.s V_4 + IL_00aa: ldloc.s V_4 + IL_00ac: ldloc.2 + IL_00ad: blt.un.s IL_0099 + + IL_00af: ret + } + + .method public static void f11(int64 start, + int64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int64 V_0, + int64 V_1, + int64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: conv.i8 + IL_0003: ldarg.1 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.0 + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.1 + IL_0010: ldarg.0 + IL_0011: stloc.2 + IL_0012: br.s IL_0024 + + IL_0014: ldloc.2 + IL_0015: call void assembly::set_c(int64) + IL_001a: ldloc.2 + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.2 + IL_001f: ldloc.1 + IL_0020: ldc.i4.1 + IL_0021: conv.i8 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0014 + + IL_0028: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int64 V_0, + int64 V_1, + int64 V_2) + IL_0000: ldc.i4.1 + IL_0001: conv.i8 + IL_0002: ldc.i4.0 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 10 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt64(int64, + int64, + int64) + IL_000c: pop + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: conv.i8 + IL_0012: stloc.1 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: br.s IL_0028 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int64) + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: conv.i8 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0018 + + IL_002c: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.m1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.s 10 + IL_001c: conv.i8 + IL_001d: blt.un.s IL_0009 + + IL_001f: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + int64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_001a + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(int64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.s -2 + IL_0012: conv.i8 + IL_0013: add + IL_0014: stloc.1 + IL_0015: ldloc.0 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add + IL_0019: stloc.0 + IL_001a: ldloc.0 + IL_001b: ldc.i4.5 + IL_001c: conv.i8 + IL_001d: blt.un.s IL_0009 + + IL_001f: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stsfld int64 assembly::c@1 + IL_0007: ret + } + + .property int64 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int64) + .get int64 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepIntPtr.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepIntPtr.fs new file mode 100644 index 00000000000..31464a36932 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepIntPtr.fs @@ -0,0 +1,65 @@ +let mutable c = 0n + +let f0 () = + for n in 10n..1n do + c <- n + +let f00 () = + for n in 10n..1n..1n do + c <- n + +let f1 () = + for n in 1n..10n do + c <- n + +let f2 start = + for n in start..10n do + c <- n + +let f3 finish = + for n in 1n..finish do + c <- n + +let f4 (start: nativeint) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1n..1n..10n do + c <- n + +let f6 () = + for n in 1n..2n..10n do + c <- n + +let f7 start = + for n in start..2n..10n do + c <- n + +let f8 step = + for n in 1n..step..10n do + c <- n + +let f9 finish = + for n in 1n..2n..finish do + c <- n + +let f10 (start: nativeint) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0n..finish do + c <- n + +let f12 () = + for n in 1n..0n..10n do + c <- n + +let f13 () = + for n in 10n.. -1n ..1n do + c <- n + +let f14 () = + for n in 10n.. -2n ..1n do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepIntPtr.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepIntPtr.fs.opt.il.bsl new file mode 100644 index 00000000000..ebfc4b43fb1 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepIntPtr.fs.opt.il.bsl @@ -0,0 +1,1590 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly native int c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static native int get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld native int assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(native int 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld native int assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.i + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.i + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f2(native int start) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldc.i8 0xa + IL_0009: conv.i + IL_000a: ldarg.0 + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldc.i8 0xa + IL_0023: conv.i + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_0094 + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.i + IL_005d: stloc.2 + IL_005e: ldarg.0 + IL_005f: stloc.3 + IL_0060: br.s IL_0090 + + IL_0062: ldloc.3 + IL_0063: call void assembly::set_c(native int) + IL_0068: ldloc.3 + IL_0069: ldc.i8 0x1 + IL_0072: conv.i + IL_0073: add + IL_0074: stloc.3 + IL_0075: ldloc.2 + IL_0076: ldc.i8 0x1 + IL_007f: conv.i + IL_0080: add + IL_0081: stloc.2 + IL_0082: ldloc.2 + IL_0083: ldc.i8 0x0 + IL_008c: conv.i + IL_008d: cgt.un + IL_008f: stloc.1 + IL_0090: ldloc.1 + IL_0091: brtrue.s IL_0062 + + IL_0093: ret + + IL_0094: ldc.i8 0xa + IL_009d: conv.i + IL_009e: ldarg.0 + IL_009f: bge.s IL_00ae + + IL_00a1: ldc.i8 0x0 + IL_00aa: conv.i + IL_00ab: nop + IL_00ac: br.s IL_00c6 + + IL_00ae: ldc.i8 0xa + IL_00b7: conv.i + IL_00b8: ldarg.0 + IL_00b9: sub + IL_00ba: ldc.i8 0x1 + IL_00c3: conv.i + IL_00c4: add.ovf.un + IL_00c5: nop + IL_00c6: stloc.2 + IL_00c7: ldc.i8 0x0 + IL_00d0: conv.i + IL_00d1: stloc.3 + IL_00d2: ldarg.0 + IL_00d3: stloc.s V_4 + IL_00d5: br.s IL_00fa + + IL_00d7: ldloc.s V_4 + IL_00d9: call void assembly::set_c(native int) + IL_00de: ldloc.s V_4 + IL_00e0: ldc.i8 0x1 + IL_00e9: conv.i + IL_00ea: add + IL_00eb: stloc.s V_4 + IL_00ed: ldloc.3 + IL_00ee: ldc.i8 0x1 + IL_00f7: conv.i + IL_00f8: add + IL_00f9: stloc.3 + IL_00fa: ldloc.3 + IL_00fb: ldloc.2 + IL_00fc: blt.un.s IL_00d7 + + IL_00fe: ret + } + + .method public static void f3(native int finish) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.i + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.i + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_009d + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.i + IL_005d: stloc.2 + IL_005e: ldc.i8 0x1 + IL_0067: conv.i + IL_0068: stloc.3 + IL_0069: br.s IL_0099 + + IL_006b: ldloc.3 + IL_006c: call void assembly::set_c(native int) + IL_0071: ldloc.3 + IL_0072: ldc.i8 0x1 + IL_007b: conv.i + IL_007c: add + IL_007d: stloc.3 + IL_007e: ldloc.2 + IL_007f: ldc.i8 0x1 + IL_0088: conv.i + IL_0089: add + IL_008a: stloc.2 + IL_008b: ldloc.2 + IL_008c: ldc.i8 0x0 + IL_0095: conv.i + IL_0096: cgt.un + IL_0098: stloc.1 + IL_0099: ldloc.1 + IL_009a: brtrue.s IL_006b + + IL_009c: ret + + IL_009d: ldarg.0 + IL_009e: ldc.i8 0x1 + IL_00a7: conv.i + IL_00a8: bge.s IL_00b7 + + IL_00aa: ldc.i8 0x0 + IL_00b3: conv.i + IL_00b4: nop + IL_00b5: br.s IL_00cf + + IL_00b7: ldarg.0 + IL_00b8: ldc.i8 0x1 + IL_00c1: conv.i + IL_00c2: sub + IL_00c3: ldc.i8 0x1 + IL_00cc: conv.i + IL_00cd: add.ovf.un + IL_00ce: nop + IL_00cf: stloc.2 + IL_00d0: ldc.i8 0x0 + IL_00d9: conv.i + IL_00da: stloc.3 + IL_00db: ldc.i8 0x1 + IL_00e4: conv.i + IL_00e5: stloc.s V_4 + IL_00e7: br.s IL_010c + + IL_00e9: ldloc.s V_4 + IL_00eb: call void assembly::set_c(native int) + IL_00f0: ldloc.s V_4 + IL_00f2: ldc.i8 0x1 + IL_00fb: conv.i + IL_00fc: add + IL_00fd: stloc.s V_4 + IL_00ff: ldloc.3 + IL_0100: ldc.i8 0x1 + IL_0109: conv.i + IL_010a: add + IL_010b: stloc.3 + IL_010c: ldloc.3 + IL_010d: ldloc.2 + IL_010e: blt.un.s IL_00e9 + + IL_0110: ret + } + + .method public static void f4(native int start, + native int finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0011 + + IL_0004: ldc.i8 0x0 + IL_000d: conv.i + IL_000e: nop + IL_000f: br.s IL_0015 + + IL_0011: ldarg.1 + IL_0012: ldarg.0 + IL_0013: sub + IL_0014: nop + IL_0015: stloc.0 + IL_0016: sizeof [runtime]System.IntPtr + IL_001c: ldc.i4.4 + IL_001d: bne.un.s IL_002f + + IL_001f: ldloc.0 + IL_0020: ldc.i8 0xffffffff + IL_0029: conv.u + IL_002a: ceq + IL_002c: nop + IL_002d: br.s IL_003d + + IL_002f: ldloc.0 + IL_0030: ldc.i8 0xffffffffffffffff + IL_0039: conv.u + IL_003a: ceq + IL_003c: nop + IL_003d: brfalse.s IL_0082 + + IL_003f: ldc.i4.1 + IL_0040: stloc.1 + IL_0041: ldc.i8 0x0 + IL_004a: conv.i + IL_004b: stloc.2 + IL_004c: ldarg.0 + IL_004d: stloc.3 + IL_004e: br.s IL_007e + + IL_0050: ldloc.3 + IL_0051: call void assembly::set_c(native int) + IL_0056: ldloc.3 + IL_0057: ldc.i8 0x1 + IL_0060: conv.i + IL_0061: add + IL_0062: stloc.3 + IL_0063: ldloc.2 + IL_0064: ldc.i8 0x1 + IL_006d: conv.i + IL_006e: add + IL_006f: stloc.2 + IL_0070: ldloc.2 + IL_0071: ldc.i8 0x0 + IL_007a: conv.i + IL_007b: cgt.un + IL_007d: stloc.1 + IL_007e: ldloc.1 + IL_007f: brtrue.s IL_0050 + + IL_0081: ret + + IL_0082: ldarg.1 + IL_0083: ldarg.0 + IL_0084: bge.s IL_0093 + + IL_0086: ldc.i8 0x0 + IL_008f: conv.i + IL_0090: nop + IL_0091: br.s IL_00a2 + + IL_0093: ldarg.1 + IL_0094: ldarg.0 + IL_0095: sub + IL_0096: ldc.i8 0x1 + IL_009f: conv.i + IL_00a0: add.ovf.un + IL_00a1: nop + IL_00a2: stloc.2 + IL_00a3: ldc.i8 0x0 + IL_00ac: conv.i + IL_00ad: stloc.3 + IL_00ae: ldarg.0 + IL_00af: stloc.s V_4 + IL_00b1: br.s IL_00d6 + + IL_00b3: ldloc.s V_4 + IL_00b5: call void assembly::set_c(native int) + IL_00ba: ldloc.s V_4 + IL_00bc: ldc.i8 0x1 + IL_00c5: conv.i + IL_00c6: add + IL_00c7: stloc.s V_4 + IL_00c9: ldloc.3 + IL_00ca: ldc.i8 0x1 + IL_00d3: conv.i + IL_00d4: add + IL_00d5: stloc.3 + IL_00d6: ldloc.3 + IL_00d7: ldloc.2 + IL_00d8: blt.un.s IL_00b3 + + IL_00da: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.i + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native int) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x2 + IL_0028: conv.i + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.i + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x5 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f7(native int start) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldc.i8 0xa + IL_0009: conv.i + IL_000a: ldarg.0 + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldc.i8 0xa + IL_0023: conv.i + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.i + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.i + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.i + IL_0048: stloc.1 + IL_0049: ldarg.0 + IL_004a: stloc.2 + IL_004b: br.s IL_006d + + IL_004d: ldloc.2 + IL_004e: call void assembly::set_c(native int) + IL_0053: ldloc.2 + IL_0054: ldc.i8 0x2 + IL_005d: conv.i + IL_005e: add + IL_005f: stloc.2 + IL_0060: ldloc.1 + IL_0061: ldc.i8 0x1 + IL_006a: conv.i + IL_006b: add + IL_006c: stloc.1 + IL_006d: ldloc.1 + IL_006e: ldloc.0 + IL_006f: blt.un.s IL_004d + + IL_0071: ret + } + + .method public static void f8(native int step) cil managed + { + + .maxstack 5 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.i + IL_000b: bne.un.s IL_002b + + IL_000d: ldc.i8 0x1 + IL_0016: conv.i + IL_0017: ldarg.0 + IL_0018: ldc.i8 0xa + IL_0021: conv.i + IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0027: pop + IL_0028: nop + IL_0029: br.s IL_002c + + IL_002b: nop + IL_002c: ldc.i8 0x0 + IL_0035: conv.i + IL_0036: ldarg.0 + IL_0037: bge.s IL_0076 + + IL_0039: ldc.i8 0xa + IL_0042: conv.i + IL_0043: ldc.i8 0x1 + IL_004c: conv.i + IL_004d: bge.s IL_005c + + IL_004f: ldc.i8 0x0 + IL_0058: conv.i + IL_0059: nop + IL_005a: br.s IL_00bd + + IL_005c: ldc.i8 0xa + IL_0065: conv.i + IL_0066: ldc.i8 0x1 + IL_006f: conv.i + IL_0070: sub + IL_0071: ldarg.0 + IL_0072: div.un + IL_0073: nop + IL_0074: br.s IL_00bd + + IL_0076: ldc.i8 0x1 + IL_007f: conv.i + IL_0080: ldc.i8 0xa + IL_0089: conv.i + IL_008a: bge.s IL_0099 + + IL_008c: ldc.i8 0x0 + IL_0095: conv.i + IL_0096: nop + IL_0097: br.s IL_00bd + + IL_0099: ldc.i8 0x1 + IL_00a2: conv.i + IL_00a3: ldc.i8 0xa + IL_00ac: conv.i + IL_00ad: sub + IL_00ae: ldarg.0 + IL_00af: not + IL_00b0: ldc.i8 0x1 + IL_00b9: conv.i + IL_00ba: add + IL_00bb: div.un + IL_00bc: nop + IL_00bd: stloc.0 + IL_00be: sizeof [runtime]System.IntPtr + IL_00c4: ldc.i4.4 + IL_00c5: bne.un.s IL_00d7 + + IL_00c7: ldloc.0 + IL_00c8: ldc.i8 0xffffffff + IL_00d1: conv.u + IL_00d2: ceq + IL_00d4: nop + IL_00d5: br.s IL_00e5 + + IL_00d7: ldloc.0 + IL_00d8: ldc.i8 0xffffffffffffffff + IL_00e1: conv.u + IL_00e2: ceq + IL_00e4: nop + IL_00e5: brfalse.s IL_012a + + IL_00e7: ldc.i4.1 + IL_00e8: stloc.1 + IL_00e9: ldc.i8 0x0 + IL_00f2: conv.i + IL_00f3: stloc.2 + IL_00f4: ldc.i8 0x1 + IL_00fd: conv.i + IL_00fe: stloc.3 + IL_00ff: br.s IL_0126 + + IL_0101: ldloc.3 + IL_0102: call void assembly::set_c(native int) + IL_0107: ldloc.3 + IL_0108: ldarg.0 + IL_0109: add + IL_010a: stloc.3 + IL_010b: ldloc.2 + IL_010c: ldc.i8 0x1 + IL_0115: conv.i + IL_0116: add + IL_0117: stloc.2 + IL_0118: ldloc.2 + IL_0119: ldc.i8 0x0 + IL_0122: conv.i + IL_0123: cgt.un + IL_0125: stloc.1 + IL_0126: ldloc.1 + IL_0127: brtrue.s IL_0101 + + IL_0129: ret + + IL_012a: ldc.i8 0x0 + IL_0133: conv.i + IL_0134: ldarg.0 + IL_0135: bge.s IL_0182 + + IL_0137: ldc.i8 0xa + IL_0140: conv.i + IL_0141: ldc.i8 0x1 + IL_014a: conv.i + IL_014b: bge.s IL_015d + + IL_014d: ldc.i8 0x0 + IL_0156: conv.i + IL_0157: nop + IL_0158: br IL_01d4 + + IL_015d: ldc.i8 0xa + IL_0166: conv.i + IL_0167: ldc.i8 0x1 + IL_0170: conv.i + IL_0171: sub + IL_0172: ldarg.0 + IL_0173: div.un + IL_0174: ldc.i8 0x1 + IL_017d: conv.i + IL_017e: add.ovf.un + IL_017f: nop + IL_0180: br.s IL_01d4 + + IL_0182: ldc.i8 0x1 + IL_018b: conv.i + IL_018c: ldc.i8 0xa + IL_0195: conv.i + IL_0196: bge.s IL_01a5 + + IL_0198: ldc.i8 0x0 + IL_01a1: conv.i + IL_01a2: nop + IL_01a3: br.s IL_01d4 + + IL_01a5: ldc.i8 0x1 + IL_01ae: conv.i + IL_01af: ldc.i8 0xa + IL_01b8: conv.i + IL_01b9: sub + IL_01ba: ldarg.0 + IL_01bb: not + IL_01bc: ldc.i8 0x1 + IL_01c5: conv.i + IL_01c6: add + IL_01c7: div.un + IL_01c8: ldc.i8 0x1 + IL_01d1: conv.i + IL_01d2: add.ovf.un + IL_01d3: nop + IL_01d4: stloc.2 + IL_01d5: ldc.i8 0x0 + IL_01de: conv.i + IL_01df: stloc.3 + IL_01e0: ldc.i8 0x1 + IL_01e9: conv.i + IL_01ea: stloc.s V_4 + IL_01ec: br.s IL_0208 + + IL_01ee: ldloc.s V_4 + IL_01f0: call void assembly::set_c(native int) + IL_01f5: ldloc.s V_4 + IL_01f7: ldarg.0 + IL_01f8: add + IL_01f9: stloc.s V_4 + IL_01fb: ldloc.3 + IL_01fc: ldc.i8 0x1 + IL_0205: conv.i + IL_0206: add + IL_0207: stloc.3 + IL_0208: ldloc.3 + IL_0209: ldloc.2 + IL_020a: blt.un.s IL_01ee + + IL_020c: ret + } + + .method public static void f9(native int finish) cil managed + { + + .maxstack 4 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.i + IL_000b: bge.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.i + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.i + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.i + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.i + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.i + IL_0048: stloc.1 + IL_0049: ldc.i8 0x1 + IL_0052: conv.i + IL_0053: stloc.2 + IL_0054: br.s IL_0076 + + IL_0056: ldloc.2 + IL_0057: call void assembly::set_c(native int) + IL_005c: ldloc.2 + IL_005d: ldc.i8 0x2 + IL_0066: conv.i + IL_0067: add + IL_0068: stloc.2 + IL_0069: ldloc.1 + IL_006a: ldc.i8 0x1 + IL_0073: conv.i + IL_0074: add + IL_0075: stloc.1 + IL_0076: ldloc.1 + IL_0077: ldloc.0 + IL_0078: blt.un.s IL_0056 + + IL_007a: ret + } + + .method public static void f10(native int start, + native int step, + native int finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.1 + IL_0001: ldc.i8 0x0 + IL_000a: conv.i + IL_000b: bne.un.s IL_0019 + + IL_000d: ldarg.2 + IL_000e: ldarg.1 + IL_000f: ldarg.2 + IL_0010: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0015: pop + IL_0016: nop + IL_0017: br.s IL_001a + + IL_0019: nop + IL_001a: ldc.i8 0x0 + IL_0023: conv.i + IL_0024: ldarg.1 + IL_0025: bge.s IL_0040 + + IL_0027: ldarg.2 + IL_0028: ldarg.2 + IL_0029: bge.s IL_0038 + + IL_002b: ldc.i8 0x0 + IL_0034: conv.i + IL_0035: nop + IL_0036: br.s IL_0063 + + IL_0038: ldarg.2 + IL_0039: ldarg.2 + IL_003a: sub + IL_003b: ldarg.1 + IL_003c: div.un + IL_003d: nop + IL_003e: br.s IL_0063 + + IL_0040: ldarg.2 + IL_0041: ldarg.2 + IL_0042: bge.s IL_0051 + + IL_0044: ldc.i8 0x0 + IL_004d: conv.i + IL_004e: nop + IL_004f: br.s IL_0063 + + IL_0051: ldarg.2 + IL_0052: ldarg.2 + IL_0053: sub + IL_0054: ldarg.1 + IL_0055: not + IL_0056: ldc.i8 0x1 + IL_005f: conv.i + IL_0060: add + IL_0061: div.un + IL_0062: nop + IL_0063: stloc.0 + IL_0064: sizeof [runtime]System.IntPtr + IL_006a: ldc.i4.4 + IL_006b: bne.un.s IL_007d + + IL_006d: ldloc.0 + IL_006e: ldc.i8 0xffffffff + IL_0077: conv.u + IL_0078: ceq + IL_007a: nop + IL_007b: br.s IL_008b + + IL_007d: ldloc.0 + IL_007e: ldc.i8 0xffffffffffffffff + IL_0087: conv.u + IL_0088: ceq + IL_008a: nop + IL_008b: brfalse.s IL_00c7 + + IL_008d: ldc.i4.1 + IL_008e: stloc.1 + IL_008f: ldc.i8 0x0 + IL_0098: conv.i + IL_0099: stloc.2 + IL_009a: ldarg.2 + IL_009b: stloc.3 + IL_009c: br.s IL_00c3 + + IL_009e: ldloc.3 + IL_009f: call void assembly::set_c(native int) + IL_00a4: ldloc.3 + IL_00a5: ldarg.1 + IL_00a6: add + IL_00a7: stloc.3 + IL_00a8: ldloc.2 + IL_00a9: ldc.i8 0x1 + IL_00b2: conv.i + IL_00b3: add + IL_00b4: stloc.2 + IL_00b5: ldloc.2 + IL_00b6: ldc.i8 0x0 + IL_00bf: conv.i + IL_00c0: cgt.un + IL_00c2: stloc.1 + IL_00c3: ldloc.1 + IL_00c4: brtrue.s IL_009e + + IL_00c6: ret + + IL_00c7: ldc.i8 0x0 + IL_00d0: conv.i + IL_00d1: ldarg.1 + IL_00d2: bge.s IL_00f8 + + IL_00d4: ldarg.2 + IL_00d5: ldarg.2 + IL_00d6: bge.s IL_00e5 + + IL_00d8: ldc.i8 0x0 + IL_00e1: conv.i + IL_00e2: nop + IL_00e3: br.s IL_0126 + + IL_00e5: ldarg.2 + IL_00e6: ldarg.2 + IL_00e7: sub + IL_00e8: ldarg.1 + IL_00e9: div.un + IL_00ea: ldc.i8 0x1 + IL_00f3: conv.i + IL_00f4: add.ovf.un + IL_00f5: nop + IL_00f6: br.s IL_0126 + + IL_00f8: ldarg.2 + IL_00f9: ldarg.2 + IL_00fa: bge.s IL_0109 + + IL_00fc: ldc.i8 0x0 + IL_0105: conv.i + IL_0106: nop + IL_0107: br.s IL_0126 + + IL_0109: ldarg.2 + IL_010a: ldarg.2 + IL_010b: sub + IL_010c: ldarg.1 + IL_010d: not + IL_010e: ldc.i8 0x1 + IL_0117: conv.i + IL_0118: add + IL_0119: div.un + IL_011a: ldc.i8 0x1 + IL_0123: conv.i + IL_0124: add.ovf.un + IL_0125: nop + IL_0126: stloc.2 + IL_0127: ldc.i8 0x0 + IL_0130: conv.i + IL_0131: stloc.3 + IL_0132: ldarg.2 + IL_0133: stloc.s V_4 + IL_0135: br.s IL_0151 + + IL_0137: ldloc.s V_4 + IL_0139: call void assembly::set_c(native int) + IL_013e: ldloc.s V_4 + IL_0140: ldarg.1 + IL_0141: add + IL_0142: stloc.s V_4 + IL_0144: ldloc.3 + IL_0145: ldc.i8 0x1 + IL_014e: conv.i + IL_014f: add + IL_0150: stloc.3 + IL_0151: ldloc.3 + IL_0152: ldloc.2 + IL_0153: blt.un.s IL_0137 + + IL_0155: ret + } + + .method public static void f11(native int start, + native int finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.i + IL_000b: ldarg.1 + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0011: pop + IL_0012: ldc.i8 0x0 + IL_001b: conv.i + IL_001c: stloc.0 + IL_001d: ldc.i8 0x0 + IL_0026: conv.i + IL_0027: stloc.1 + IL_0028: ldarg.0 + IL_0029: stloc.2 + IL_002a: br.s IL_004c + + IL_002c: ldloc.2 + IL_002d: call void assembly::set_c(native int) + IL_0032: ldloc.2 + IL_0033: ldc.i8 0x0 + IL_003c: conv.i + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i8 0x1 + IL_0049: conv.i + IL_004a: add + IL_004b: stloc.1 + IL_004c: ldloc.1 + IL_004d: ldloc.0 + IL_004e: blt.un.s IL_002c + + IL_0050: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (native int V_0, + native int V_1, + native int V_2) + IL_0000: ldc.i8 0x1 + IL_0009: conv.i + IL_000a: ldc.i8 0x0 + IL_0013: conv.i + IL_0014: ldc.i8 0xa + IL_001d: conv.i + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0023: pop + IL_0024: ldc.i8 0x0 + IL_002d: conv.i + IL_002e: stloc.0 + IL_002f: ldc.i8 0x0 + IL_0038: conv.i + IL_0039: stloc.1 + IL_003a: ldc.i8 0x1 + IL_0043: conv.i + IL_0044: stloc.2 + IL_0045: br.s IL_0067 + + IL_0047: ldloc.2 + IL_0048: call void assembly::set_c(native int) + IL_004d: ldloc.2 + IL_004e: ldc.i8 0x0 + IL_0057: conv.i + IL_0058: add + IL_0059: stloc.2 + IL_005a: ldloc.1 + IL_005b: ldc.i8 0x1 + IL_0064: conv.i + IL_0065: add + IL_0066: stloc.1 + IL_0067: ldloc.1 + IL_0068: ldloc.0 + IL_0069: blt.un.s IL_0047 + + IL_006b: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldc.i8 0xa + IL_0009: conv.i + IL_000a: ldc.i8 0x1 + IL_0013: conv.i + IL_0014: bge.s IL_0023 + + IL_0016: ldc.i8 0x0 + IL_001f: conv.i + IL_0020: nop + IL_0021: br.s IL_0039 + + IL_0023: ldc.i8 0xa + IL_002c: conv.i + IL_002d: ldc.i8 0x1 + IL_0036: conv.i + IL_0037: sub + IL_0038: nop + IL_0039: stloc.0 + IL_003a: sizeof [runtime]System.IntPtr + IL_0040: ldc.i4.4 + IL_0041: bne.un.s IL_0053 + + IL_0043: ldloc.0 + IL_0044: ldc.i8 0xffffffff + IL_004d: conv.u + IL_004e: ceq + IL_0050: nop + IL_0051: br.s IL_0061 + + IL_0053: ldloc.0 + IL_0054: ldc.i8 0xffffffffffffffff + IL_005d: conv.u + IL_005e: ceq + IL_0060: nop + IL_0061: brfalse.s IL_00af + + IL_0063: ldc.i4.1 + IL_0064: stloc.1 + IL_0065: ldc.i8 0x0 + IL_006e: conv.i + IL_006f: stloc.2 + IL_0070: ldc.i8 0xa + IL_0079: conv.i + IL_007a: stloc.3 + IL_007b: br.s IL_00ab + + IL_007d: ldloc.3 + IL_007e: call void assembly::set_c(native int) + IL_0083: ldloc.3 + IL_0084: ldc.i8 0xffffffffffffffff + IL_008d: conv.i + IL_008e: add + IL_008f: stloc.3 + IL_0090: ldloc.2 + IL_0091: ldc.i8 0x1 + IL_009a: conv.i + IL_009b: add + IL_009c: stloc.2 + IL_009d: ldloc.2 + IL_009e: ldc.i8 0x0 + IL_00a7: conv.i + IL_00a8: cgt.un + IL_00aa: stloc.1 + IL_00ab: ldloc.1 + IL_00ac: brtrue.s IL_007d + + IL_00ae: ret + + IL_00af: ldc.i8 0xa + IL_00b8: conv.i + IL_00b9: ldc.i8 0x1 + IL_00c2: conv.i + IL_00c3: bge.s IL_00d2 + + IL_00c5: ldc.i8 0x0 + IL_00ce: conv.i + IL_00cf: nop + IL_00d0: br.s IL_00f3 + + IL_00d2: ldc.i8 0xa + IL_00db: conv.i + IL_00dc: ldc.i8 0x1 + IL_00e5: conv.i + IL_00e6: sub + IL_00e7: ldc.i8 0x1 + IL_00f0: conv.i + IL_00f1: add.ovf.un + IL_00f2: nop + IL_00f3: stloc.2 + IL_00f4: ldc.i8 0x0 + IL_00fd: conv.i + IL_00fe: stloc.3 + IL_00ff: ldc.i8 0xa + IL_0108: conv.i + IL_0109: stloc.s V_4 + IL_010b: br.s IL_0130 + + IL_010d: ldloc.s V_4 + IL_010f: call void assembly::set_c(native int) + IL_0114: ldloc.s V_4 + IL_0116: ldc.i8 0xffffffffffffffff + IL_011f: conv.i + IL_0120: add + IL_0121: stloc.s V_4 + IL_0123: ldloc.3 + IL_0124: ldc.i8 0x1 + IL_012d: conv.i + IL_012e: add + IL_012f: stloc.3 + IL_0130: ldloc.3 + IL_0131: ldloc.2 + IL_0132: blt.un.s IL_010d + + IL_0134: ret + } + + .method public static void f14() cil managed + { + + .maxstack 5 + .locals init (native int V_0, + bool V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldc.i8 0xfffffffffffffffe + IL_0009: conv.i + IL_000a: ldc.i8 0x0 + IL_0013: conv.i + IL_0014: bne.un.s IL_003d + + IL_0016: ldc.i8 0xa + IL_001f: conv.i + IL_0020: ldc.i8 0xfffffffffffffffe + IL_0029: conv.i + IL_002a: ldc.i8 0x1 + IL_0033: conv.i + IL_0034: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeIntPtr(native int, + native int, + native int) + IL_0039: pop + IL_003a: nop + IL_003b: br.s IL_003e + + IL_003d: nop + IL_003e: ldc.i8 0x0 + IL_0047: conv.i + IL_0048: ldc.i8 0xfffffffffffffffe + IL_0051: conv.i + IL_0052: bge.s IL_009a + + IL_0054: ldc.i8 0x1 + IL_005d: conv.i + IL_005e: ldc.i8 0xa + IL_0067: conv.i + IL_0068: bge.s IL_0077 + + IL_006a: ldc.i8 0x0 + IL_0073: conv.i + IL_0074: nop + IL_0075: br.s IL_00ea + + IL_0077: ldc.i8 0x1 + IL_0080: conv.i + IL_0081: ldc.i8 0xa + IL_008a: conv.i + IL_008b: sub + IL_008c: ldc.i8 0xfffffffffffffffe + IL_0095: conv.i + IL_0096: div.un + IL_0097: nop + IL_0098: br.s IL_00ea + + IL_009a: ldc.i8 0xa + IL_00a3: conv.i + IL_00a4: ldc.i8 0x1 + IL_00ad: conv.i + IL_00ae: bge.s IL_00bd + + IL_00b0: ldc.i8 0x0 + IL_00b9: conv.i + IL_00ba: nop + IL_00bb: br.s IL_00ea + + IL_00bd: ldc.i8 0xa + IL_00c6: conv.i + IL_00c7: ldc.i8 0x1 + IL_00d0: conv.i + IL_00d1: sub + IL_00d2: ldc.i8 0xfffffffffffffffe + IL_00db: conv.i + IL_00dc: not + IL_00dd: ldc.i8 0x1 + IL_00e6: conv.i + IL_00e7: add + IL_00e8: div.un + IL_00e9: nop + IL_00ea: stloc.0 + IL_00eb: sizeof [runtime]System.IntPtr + IL_00f1: ldc.i4.4 + IL_00f2: bne.un.s IL_0104 + + IL_00f4: ldloc.0 + IL_00f5: ldc.i8 0xffffffff + IL_00fe: conv.u + IL_00ff: ceq + IL_0101: nop + IL_0102: br.s IL_0112 + + IL_0104: ldloc.0 + IL_0105: ldc.i8 0xffffffffffffffff + IL_010e: conv.u + IL_010f: ceq + IL_0111: nop + IL_0112: brfalse.s IL_0160 + + IL_0114: ldc.i4.1 + IL_0115: stloc.1 + IL_0116: ldc.i8 0x0 + IL_011f: conv.i + IL_0120: stloc.2 + IL_0121: ldc.i8 0xa + IL_012a: conv.i + IL_012b: stloc.3 + IL_012c: br.s IL_015c + + IL_012e: ldloc.3 + IL_012f: call void assembly::set_c(native int) + IL_0134: ldloc.3 + IL_0135: ldc.i8 0xfffffffffffffffe + IL_013e: conv.i + IL_013f: add + IL_0140: stloc.3 + IL_0141: ldloc.2 + IL_0142: ldc.i8 0x1 + IL_014b: conv.i + IL_014c: add + IL_014d: stloc.2 + IL_014e: ldloc.2 + IL_014f: ldc.i8 0x0 + IL_0158: conv.i + IL_0159: cgt.un + IL_015b: stloc.1 + IL_015c: ldloc.1 + IL_015d: brtrue.s IL_012e + + IL_015f: ret + + IL_0160: ldc.i8 0x0 + IL_0169: conv.i + IL_016a: ldc.i8 0xfffffffffffffffe + IL_0173: conv.i + IL_0174: bge.s IL_01ca + + IL_0176: ldc.i8 0x1 + IL_017f: conv.i + IL_0180: ldc.i8 0xa + IL_0189: conv.i + IL_018a: bge.s IL_019c + + IL_018c: ldc.i8 0x0 + IL_0195: conv.i + IL_0196: nop + IL_0197: br IL_0225 + + IL_019c: ldc.i8 0x1 + IL_01a5: conv.i + IL_01a6: ldc.i8 0xa + IL_01af: conv.i + IL_01b0: sub + IL_01b1: ldc.i8 0xfffffffffffffffe + IL_01ba: conv.i + IL_01bb: div.un + IL_01bc: ldc.i8 0x1 + IL_01c5: conv.i + IL_01c6: add.ovf.un + IL_01c7: nop + IL_01c8: br.s IL_0225 + + IL_01ca: ldc.i8 0xa + IL_01d3: conv.i + IL_01d4: ldc.i8 0x1 + IL_01dd: conv.i + IL_01de: bge.s IL_01ed + + IL_01e0: ldc.i8 0x0 + IL_01e9: conv.i + IL_01ea: nop + IL_01eb: br.s IL_0225 + + IL_01ed: ldc.i8 0xa + IL_01f6: conv.i + IL_01f7: ldc.i8 0x1 + IL_0200: conv.i + IL_0201: sub + IL_0202: ldc.i8 0xfffffffffffffffe + IL_020b: conv.i + IL_020c: not + IL_020d: ldc.i8 0x1 + IL_0216: conv.i + IL_0217: add + IL_0218: div.un + IL_0219: ldc.i8 0x1 + IL_0222: conv.i + IL_0223: add.ovf.un + IL_0224: nop + IL_0225: stloc.2 + IL_0226: ldc.i8 0x0 + IL_022f: conv.i + IL_0230: stloc.3 + IL_0231: ldc.i8 0xa + IL_023a: conv.i + IL_023b: stloc.s V_4 + IL_023d: br.s IL_0262 + + IL_023f: ldloc.s V_4 + IL_0241: call void assembly::set_c(native int) + IL_0246: ldloc.s V_4 + IL_0248: ldc.i8 0xfffffffffffffffe + IL_0251: conv.i + IL_0252: add + IL_0253: stloc.s V_4 + IL_0255: ldloc.3 + IL_0256: ldc.i8 0x1 + IL_025f: conv.i + IL_0260: add + IL_0261: stloc.3 + IL_0262: ldloc.3 + IL_0263: ldloc.2 + IL_0264: blt.un.s IL_023f + + IL_0266: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i8 0x0 + IL_0009: conv.i + IL_000a: stsfld native int assembly::c@1 + IL_000f: ret + } + + .property native int c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(native int) + .get native int assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepSByte.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepSByte.fs new file mode 100644 index 00000000000..ee96ee45237 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepSByte.fs @@ -0,0 +1,65 @@ +let mutable c = 0y + +let f0 () = + for n in 10y..1y do + c <- n + +let f00 () = + for n in 10y..1y..1y do + c <- n + +let f1 () = + for n in 1y..10y do + c <- n + +let f2 start = + for n in start..10y do + c <- n + +let f3 finish = + for n in 1y..finish do + c <- n + +let f4 (start: sbyte) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1y..1y..10y do + c <- n + +let f6 () = + for n in 1y..2y..10y do + c <- n + +let f7 start = + for n in start..2y..10y do + c <- n + +let f8 step = + for n in 1y..step..10y do + c <- n + +let f9 finish = + for n in 1y..2y..finish do + c <- n + +let f10 (start: sbyte) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0y..finish do + c <- n + +let f12 () = + for n in 1y..0y..10y do + c <- n + +let f13 () = + for n in 10y .. -1y .. 1y do + c <- n + +let f14 () = + for n in 10y .. -2y .. 1y do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepSByte.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepSByte.fs.opt.il.bsl new file mode 100644 index 00000000000..6ade092cfe6 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepSByte.fs.opt.il.bsl @@ -0,0 +1,786 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly int8 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static int8 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld int8 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(int8 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld int8 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (int8 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (int8 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(int8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.i2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(int8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.i2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(int8 start, + int8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.i2 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(int8) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(int8) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7(int8 start) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.i2 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(int8) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(int8 step) cil managed + { + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.0 + IL_0012: ldarg.0 + IL_0013: bge.s IL_001f + + IL_0015: ldc.i4.s 9 + IL_0017: ldarg.0 + IL_0018: div.un + IL_0019: conv.i2 + IL_001a: ldc.i4.1 + IL_001b: add + IL_001c: nop + IL_001d: br.s IL_0021 + + IL_001f: ldc.i4.0 + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldc.i4.1 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(int8) + IL_002e: ldloc.2 + IL_002f: ldarg.0 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f9(int8 finish) cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.i2 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(int8) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(int8 start, + int8 step, + int8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + int8 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldc.i4.0 + IL_0011: ldarg.1 + IL_0012: bge.s IL_0027 + + IL_0014: ldarg.2 + IL_0015: ldarg.2 + IL_0016: bge.s IL_001c + + IL_0018: ldc.i4.0 + IL_0019: nop + IL_001a: br.s IL_003b + + IL_001c: ldarg.2 + IL_001d: ldarg.2 + IL_001e: sub + IL_001f: ldarg.1 + IL_0020: div.un + IL_0021: conv.i2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: nop + IL_0025: br.s IL_003b + + IL_0027: ldarg.2 + IL_0028: ldarg.2 + IL_0029: bge.s IL_002f + + IL_002b: ldc.i4.0 + IL_002c: nop + IL_002d: br.s IL_003b + + IL_002f: ldarg.2 + IL_0030: ldarg.2 + IL_0031: sub + IL_0032: ldarg.1 + IL_0033: not + IL_0034: ldc.i4.1 + IL_0035: add + IL_0036: div.un + IL_0037: conv.i2 + IL_0038: ldc.i4.1 + IL_0039: add + IL_003a: nop + IL_003b: stloc.0 + IL_003c: ldc.i4.0 + IL_003d: stloc.1 + IL_003e: ldarg.2 + IL_003f: stloc.2 + IL_0040: br.s IL_0050 + + IL_0042: ldloc.2 + IL_0043: call void assembly::set_c(int8) + IL_0048: ldloc.2 + IL_0049: ldarg.1 + IL_004a: add + IL_004b: stloc.2 + IL_004c: ldloc.1 + IL_004d: ldc.i4.1 + IL_004e: add + IL_004f: stloc.1 + IL_0050: ldloc.1 + IL_0051: ldloc.0 + IL_0052: blt.un.s IL_0042 + + IL_0054: ret + } + + .method public static void f11(int8 start, + int8 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (int8 V_0, + int8 V_1, + int8 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(int8) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (int8 V_0, + int8 V_1, + int8 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeSByte(int8, + int8, + int8) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(int8) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method public static void f13() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.m1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.s 10 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method public static void f14() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + int8 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(int8) + IL_000d: ldloc.1 + IL_000e: ldc.i4.s -2 + IL_0010: add + IL_0011: stloc.1 + IL_0012: ldloc.0 + IL_0013: ldc.i4.1 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: blt.un.s IL_0007 + + IL_001a: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int8 assembly::c@1 + IL_0006: ret + } + + .property int8 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(int8) + .get int8 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt16.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt16.fs new file mode 100644 index 00000000000..64028b65394 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt16.fs @@ -0,0 +1,57 @@ +let mutable c = 0us + +let f0 () = + for n in 10us..1us do + c <- n + +let f00 () = + for n in 10us..1us..1us do + c <- n + +let f1 () = + for n in 1us..10us do + c <- n + +let f2 start = + for n in start..10us do + c <- n + +let f3 finish = + for n in 1us..finish do + c <- n + +let f4 (start: uint16) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1us..1us..10us do + c <- n + +let f6 () = + for n in 1us..2us..10us do + c <- n + +let f7 start = + for n in start..2us..10us do + c <- n + +let f8 step = + for n in 1us..step..10us do + c <- n + +let f9 finish = + for n in 1us..2us..finish do + c <- n + +let f10 (start: uint16) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0us..finish do + c <- n + +let f12 () = + for n in 1us..0us..10us do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt16.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt16.fs.opt.il.bsl new file mode 100644 index 00000000000..0ef1855e8d8 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt16.fs.opt.il.bsl @@ -0,0 +1,693 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly uint16 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static uint16 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint16 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint16 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint16 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint16 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint16) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f2(uint16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldarg.0 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f3(uint16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: conv.u4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldc.i4.1 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f4(uint16 start, + uint16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_000f + + IL_0008: ldarg.1 + IL_0009: ldarg.0 + IL_000a: sub + IL_000b: conv.u4 + IL_000c: ldc.i4.1 + IL_000d: add + IL_000e: nop + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: stloc.1 + IL_0012: ldarg.0 + IL_0013: stloc.2 + IL_0014: br.s IL_0024 + + IL_0016: ldloc.2 + IL_0017: call void assembly::set_c(uint16) + IL_001c: ldloc.2 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.2 + IL_0020: ldloc.1 + IL_0021: ldc.i4.1 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0016 + + IL_0028: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.s 10 + IL_0017: blt.un.s IL_0006 + + IL_0019: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint16 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.1 + IL_0003: stloc.1 + IL_0004: br.s IL_0014 + + IL_0006: ldloc.1 + IL_0007: call void assembly::set_c(uint16) + IL_000c: ldloc.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.1 + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4.5 + IL_0016: blt.un.s IL_0006 + + IL_0018: ret + } + + .method public static void f7(uint16 start) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_0009 + + IL_0005: ldc.i4.0 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldc.i4.s 10 + IL_000b: ldarg.0 + IL_000c: sub + IL_000d: ldc.i4.2 + IL_000e: div.un + IL_000f: conv.u4 + IL_0010: ldc.i4.1 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: stloc.1 + IL_0016: ldarg.0 + IL_0017: stloc.2 + IL_0018: br.s IL_0028 + + IL_001a: ldloc.2 + IL_001b: call void assembly::set_c(uint16) + IL_0020: ldloc.2 + IL_0021: ldc.i4.2 + IL_0022: add + IL_0023: stloc.2 + IL_0024: ldloc.1 + IL_0025: ldc.i4.1 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_001a + + IL_002c: ret + } + + .method public static void f8(uint16 step) cil managed + { + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.s 9 + IL_0013: ldarg.0 + IL_0014: div.un + IL_0015: conv.u4 + IL_0016: ldc.i4.1 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldc.i4.0 + IL_001a: stloc.1 + IL_001b: ldc.i4.1 + IL_001c: stloc.2 + IL_001d: br.s IL_002d + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(uint16) + IL_0025: ldloc.2 + IL_0026: ldarg.0 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: add + IL_002c: stloc.1 + IL_002d: ldloc.1 + IL_002e: ldloc.0 + IL_002f: blt.un.s IL_001f + + IL_0031: ret + } + + .method public static void f9(uint16 finish) cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0008 + + IL_0004: ldc.i4.0 + IL_0005: nop + IL_0006: br.s IL_0011 + + IL_0008: ldarg.0 + IL_0009: ldc.i4.1 + IL_000a: sub + IL_000b: ldc.i4.2 + IL_000c: div.un + IL_000d: conv.u4 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: stloc.1 + IL_0014: ldc.i4.1 + IL_0015: stloc.2 + IL_0016: br.s IL_0026 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint16) + IL_001e: ldloc.2 + IL_001f: ldc.i4.2 + IL_0020: add + IL_0021: stloc.2 + IL_0022: ldloc.1 + IL_0023: ldc.i4.1 + IL_0024: add + IL_0025: stloc.1 + IL_0026: ldloc.1 + IL_0027: ldloc.0 + IL_0028: blt.un.s IL_0018 + + IL_002a: ret + } + + .method public static void f10(uint16 start, + uint16 step, + uint16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint16 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0018 + + IL_0014: ldc.i4.0 + IL_0015: nop + IL_0016: br.s IL_0021 + + IL_0018: ldarg.2 + IL_0019: ldarg.2 + IL_001a: sub + IL_001b: ldarg.1 + IL_001c: div.un + IL_001d: conv.u4 + IL_001e: ldc.i4.1 + IL_001f: add + IL_0020: nop + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.1 + IL_0024: ldarg.2 + IL_0025: stloc.2 + IL_0026: br.s IL_0036 + + IL_0028: ldloc.2 + IL_0029: call void assembly::set_c(uint16) + IL_002e: ldloc.2 + IL_002f: ldarg.1 + IL_0030: add + IL_0031: stloc.2 + IL_0032: ldloc.1 + IL_0033: ldc.i4.1 + IL_0034: add + IL_0035: stloc.1 + IL_0036: ldloc.1 + IL_0037: ldloc.0 + IL_0038: blt.un.s IL_0028 + + IL_003a: ret + } + + .method public static void f11(uint16 start, + uint16 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint16 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(uint16) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint16 V_0, + uint16 V_1, + uint16 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt16(uint16, + uint16, + uint16) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(uint16) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld uint16 assembly::c@1 + IL_0006: ret + } + + .property uint16 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint16) + .get uint16 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt32.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt32.fs new file mode 100644 index 00000000000..d689d8d393a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt32.fs @@ -0,0 +1,57 @@ +let mutable c = 0u + +let f0 () = + for n in 10u..1u do + c <- n + +let f00 () = + for n in 10u..1u..1u do + c <- n + +let f1 () = + for n in 1u..10u do + c <- n + +let f2 start = + for n in start..10u do + c <- n + +let f3 finish = + for n in 1u..finish do + c <- n + +let f4 (start: uint32) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1u..1u..10u do + c <- n + +let f6 () = + for n in 1u..2u..10u do + c <- n + +let f7 start = + for n in start..2u..10u do + c <- n + +let f8 step = + for n in 1u..step..10u do + c <- n + +let f9 finish = + for n in 1u..2u..finish do + c <- n + +let f10 (start: uint32) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0u..finish do + c <- n + +let f12 () = + for n in 1u..0u..10u do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt32.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt32.fs.opt.il.bsl new file mode 100644 index 00000000000..80285c89dc2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt32.fs.opt.il.bsl @@ -0,0 +1,729 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly uint32 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static uint32 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint32 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint32 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint32 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint32 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.s 10 + IL_0004: stloc.1 + IL_0005: br.s IL_0015 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: add + IL_0014: stloc.0 + IL_0015: ldloc.0 + IL_0016: ldc.i4.0 + IL_0017: blt.un.s IL_0007 + + IL_0019: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.s 10 + IL_0019: conv.i8 + IL_001a: blt.un.s IL_0007 + + IL_001c: ret + } + + .method public static void f2(uint32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0013 + + IL_000a: ldc.i4.s 10 + IL_000c: ldarg.0 + IL_000d: sub + IL_000e: conv.u8 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.1 + IL_0017: ldarg.0 + IL_0018: stloc.2 + IL_0019: br.s IL_002a + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(uint32) + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldloc.0 + IL_002c: blt.un.s IL_001b + + IL_002e: ret + } + + .method public static void f3(uint32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.1 + IL_000b: sub + IL_000c: conv.u8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldc.i4.1 + IL_0016: stloc.2 + IL_0017: br.s IL_0028 + + IL_0019: ldloc.2 + IL_001a: call void assembly::set_c(uint32) + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0019 + + IL_002c: ret + } + + .method public static void f4(uint32 start, + uint32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.1 + IL_000a: ldarg.0 + IL_000b: sub + IL_000c: conv.u8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0028 + + IL_0019: ldloc.2 + IL_001a: call void assembly::set_c(uint32) + IL_001f: ldloc.2 + IL_0020: ldc.i4.1 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0019 + + IL_002c: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.1 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.s 10 + IL_0019: conv.i8 + IL_001a: blt.un.s IL_0007 + + IL_001c: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint32 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: stloc.1 + IL_0005: br.s IL_0016 + + IL_0007: ldloc.1 + IL_0008: call void assembly::set_c(uint32) + IL_000d: ldloc.1 + IL_000e: ldc.i4.2 + IL_000f: add + IL_0010: stloc.1 + IL_0011: ldloc.0 + IL_0012: ldc.i4.1 + IL_0013: conv.i8 + IL_0014: add + IL_0015: stloc.0 + IL_0016: ldloc.0 + IL_0017: ldc.i4.5 + IL_0018: conv.i8 + IL_0019: blt.un.s IL_0007 + + IL_001b: ret + } + + .method public static void f7(uint32 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: ldarg.0 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldc.i4.s 10 + IL_000c: ldarg.0 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: div.un + IL_0010: conv.u8 + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldarg.0 + IL_001a: stloc.2 + IL_001b: br.s IL_002c + + IL_001d: ldloc.2 + IL_001e: call void assembly::set_c(uint32) + IL_0023: ldloc.2 + IL_0024: ldc.i4.2 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001d + + IL_0030: ret + } + + .method public static void f8(uint32 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0010 + + IL_0003: ldc.i4.1 + IL_0004: ldarg.0 + IL_0005: ldc.i4.s 10 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_000c: pop + IL_000d: nop + IL_000e: br.s IL_0011 + + IL_0010: nop + IL_0011: ldc.i4.s 9 + IL_0013: ldarg.0 + IL_0014: div.un + IL_0015: conv.u8 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: add + IL_0019: stloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: stloc.1 + IL_001d: ldc.i4.1 + IL_001e: stloc.2 + IL_001f: br.s IL_0030 + + IL_0021: ldloc.2 + IL_0022: call void assembly::set_c(uint32) + IL_0027: ldloc.2 + IL_0028: ldarg.0 + IL_0029: add + IL_002a: stloc.2 + IL_002b: ldloc.1 + IL_002c: ldc.i4.1 + IL_002d: conv.i8 + IL_002e: add + IL_002f: stloc.1 + IL_0030: ldloc.1 + IL_0031: ldloc.0 + IL_0032: blt.un.s IL_0021 + + IL_0034: ret + } + + .method public static void f9(uint32 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0013 + + IL_0009: ldarg.0 + IL_000a: ldc.i4.1 + IL_000b: sub + IL_000c: ldc.i4.2 + IL_000d: div.un + IL_000e: conv.u8 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: nop + IL_0013: stloc.0 + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: stloc.1 + IL_0017: ldc.i4.1 + IL_0018: stloc.2 + IL_0019: br.s IL_002a + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(uint32) + IL_0021: ldloc.2 + IL_0022: ldc.i4.2 + IL_0023: add + IL_0024: stloc.2 + IL_0025: ldloc.1 + IL_0026: ldc.i4.1 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.1 + IL_002a: ldloc.1 + IL_002b: ldloc.0 + IL_002c: blt.un.s IL_001b + + IL_002e: ret + } + + .method public static void f10(uint32 start, + uint32 step, + uint32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint32 V_2) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_0023 + + IL_0019: ldarg.2 + IL_001a: ldarg.2 + IL_001b: sub + IL_001c: ldarg.1 + IL_001d: div.un + IL_001e: conv.u8 + IL_001f: ldc.i4.1 + IL_0020: conv.i8 + IL_0021: add + IL_0022: nop + IL_0023: stloc.0 + IL_0024: ldc.i4.0 + IL_0025: conv.i8 + IL_0026: stloc.1 + IL_0027: ldarg.2 + IL_0028: stloc.2 + IL_0029: br.s IL_003a + + IL_002b: ldloc.2 + IL_002c: call void assembly::set_c(uint32) + IL_0031: ldloc.2 + IL_0032: ldarg.1 + IL_0033: add + IL_0034: stloc.2 + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: conv.i8 + IL_0038: add + IL_0039: stloc.1 + IL_003a: ldloc.1 + IL_003b: ldloc.0 + IL_003c: blt.un.s IL_002b + + IL_003e: ret + } + + .method public static void f11(uint32 start, + uint32 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint32 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: ldarg.1 + IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_0008: pop + IL_0009: ldc.i4.0 + IL_000a: stloc.0 + IL_000b: ldc.i4.0 + IL_000c: stloc.1 + IL_000d: ldarg.0 + IL_000e: stloc.2 + IL_000f: br.s IL_001f + + IL_0011: ldloc.2 + IL_0012: call void assembly::set_c(uint32) + IL_0017: ldloc.2 + IL_0018: ldc.i4.0 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.1 + IL_001f: ldloc.1 + IL_0020: ldloc.0 + IL_0021: blt.un.s IL_0011 + + IL_0023: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint32 V_0, + uint32 V_1, + uint32 V_2) + IL_0000: ldc.i4.1 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.s 10 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt32(uint32, + uint32, + uint32) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: stloc.0 + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldc.i4.1 + IL_000f: stloc.2 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.2 + IL_0013: call void assembly::set_c(uint32) + IL_0018: ldloc.2 + IL_0019: ldc.i4.0 + IL_001a: add + IL_001b: stloc.2 + IL_001c: ldloc.1 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.1 + IL_0020: ldloc.1 + IL_0021: ldloc.0 + IL_0022: blt.un.s IL_0012 + + IL_0024: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld uint32 assembly::c@1 + IL_0006: ret + } + + .property uint32 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint32) + .get uint32 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt64.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt64.fs new file mode 100644 index 00000000000..2a9b1627344 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt64.fs @@ -0,0 +1,57 @@ +let mutable c = 0UL + +let f0 () = + for n in 10UL..1UL do + c <- n + +let f00 () = + for n in 10UL..1UL..1UL do + c <- n + +let f1 () = + for n in 1UL..10UL do + c <- n + +let f2 start = + for n in start..10UL do + c <- n + +let f3 finish = + for n in 1UL..finish do + c <- n + +let f4 (start: uint64) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1UL..1UL..10UL do + c <- n + +let f6 () = + for n in 1UL..2UL..10UL do + c <- n + +let f7 start = + for n in start..2UL..10UL do + c <- n + +let f8 step = + for n in 1UL..step..10UL do + c <- n + +let f9 finish = + for n in 1UL..2UL..finish do + c <- n + +let f10 (start: uint64) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0UL..finish do + c <- n + +let f12 () = + for n in 1UL..0UL..10UL do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt64.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt64.fs.opt.il.bsl new file mode 100644 index 00000000000..96c418afb00 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUInt64.fs.opt.il.bsl @@ -0,0 +1,878 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly uint64 c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static uint64 get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld uint64 assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(uint64 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld uint64 assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(uint64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.s 10 + IL_0005: conv.i8 + IL_0006: stloc.1 + IL_0007: br.s IL_0019 + + IL_0009: ldloc.1 + IL_000a: call void assembly::set_c(uint64) + IL_000f: ldloc.1 + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add + IL_0013: stloc.1 + IL_0014: ldloc.0 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.0 + IL_0019: ldloc.0 + IL_001a: ldc.i4.0 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0009 + + IL_001e: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(uint64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f2(uint64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0014 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.1 + IL_0011: conv.i8 + IL_0012: add.ovf.un + IL_0013: nop + IL_0014: stloc.0 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.1 + IL_0018: ldarg.0 + IL_0019: stloc.2 + IL_001a: br.s IL_002c + + IL_001c: ldloc.2 + IL_001d: call void assembly::set_c(uint64) + IL_0022: ldloc.2 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.2 + IL_0027: ldloc.1 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.1 + IL_002c: ldloc.1 + IL_002d: ldloc.0 + IL_002e: blt.un.s IL_001c + + IL_0030: ret + } + + .method public static void f3(uint64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.1 + IL_000f: conv.i8 + IL_0010: add.ovf.un + IL_0011: nop + IL_0012: stloc.0 + IL_0013: ldc.i4.0 + IL_0014: conv.i8 + IL_0015: stloc.1 + IL_0016: ldc.i4.1 + IL_0017: conv.i8 + IL_0018: stloc.2 + IL_0019: br.s IL_002b + + IL_001b: ldloc.2 + IL_001c: call void assembly::set_c(uint64) + IL_0021: ldloc.2 + IL_0022: ldc.i4.1 + IL_0023: conv.i8 + IL_0024: add + IL_0025: stloc.2 + IL_0026: ldloc.1 + IL_0027: ldc.i4.1 + IL_0028: conv.i8 + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.1 + IL_002c: ldloc.0 + IL_002d: blt.un.s IL_001b + + IL_002f: ret + } + + .method public static void f4(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_000d + + IL_0009: ldarg.1 + IL_000a: ldarg.0 + IL_000b: sub + IL_000c: nop + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldc.i4.m1 + IL_0010: conv.i8 + IL_0011: bne.un.s IL_0036 + + IL_0013: ldc.i4.1 + IL_0014: stloc.1 + IL_0015: ldc.i4.0 + IL_0016: conv.i8 + IL_0017: stloc.2 + IL_0018: ldarg.0 + IL_0019: stloc.3 + IL_001a: br.s IL_0032 + + IL_001c: ldloc.3 + IL_001d: call void assembly::set_c(uint64) + IL_0022: ldloc.3 + IL_0023: ldc.i4.1 + IL_0024: conv.i8 + IL_0025: add + IL_0026: stloc.3 + IL_0027: ldloc.2 + IL_0028: ldc.i4.1 + IL_0029: conv.i8 + IL_002a: add + IL_002b: stloc.2 + IL_002c: ldloc.2 + IL_002d: ldc.i4.0 + IL_002e: conv.i8 + IL_002f: cgt.un + IL_0031: stloc.1 + IL_0032: ldloc.1 + IL_0033: brtrue.s IL_001c + + IL_0035: ret + + IL_0036: ldarg.1 + IL_0037: ldarg.0 + IL_0038: bge.un.s IL_003f + + IL_003a: ldc.i4.0 + IL_003b: conv.i8 + IL_003c: nop + IL_003d: br.s IL_0046 + + IL_003f: ldarg.1 + IL_0040: ldarg.0 + IL_0041: sub + IL_0042: ldc.i4.1 + IL_0043: conv.i8 + IL_0044: add.ovf.un + IL_0045: nop + IL_0046: stloc.2 + IL_0047: ldc.i4.0 + IL_0048: conv.i8 + IL_0049: stloc.3 + IL_004a: ldarg.0 + IL_004b: stloc.s V_4 + IL_004d: br.s IL_0062 + + IL_004f: ldloc.s V_4 + IL_0051: call void assembly::set_c(uint64) + IL_0056: ldloc.s V_4 + IL_0058: ldc.i4.1 + IL_0059: conv.i8 + IL_005a: add + IL_005b: stloc.s V_4 + IL_005d: ldloc.3 + IL_005e: ldc.i4.1 + IL_005f: conv.i8 + IL_0060: add + IL_0061: stloc.3 + IL_0062: ldloc.3 + IL_0063: ldloc.2 + IL_0064: blt.un.s IL_004f + + IL_0066: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(uint64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.1 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.s 10 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0008 + + IL_001e: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.0 + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: stloc.1 + IL_0006: br.s IL_0018 + + IL_0008: ldloc.1 + IL_0009: call void assembly::set_c(uint64) + IL_000e: ldloc.1 + IL_000f: ldc.i4.2 + IL_0010: conv.i8 + IL_0011: add + IL_0012: stloc.1 + IL_0013: ldloc.0 + IL_0014: ldc.i4.1 + IL_0015: conv.i8 + IL_0016: add + IL_0017: stloc.0 + IL_0018: ldloc.0 + IL_0019: ldc.i4.5 + IL_001a: conv.i8 + IL_001b: blt.un.s IL_0008 + + IL_001d: ret + } + + .method public static void f7(uint64 start) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.s 10 + IL_0002: conv.i8 + IL_0003: ldarg.0 + IL_0004: bge.un.s IL_000b + + IL_0006: ldc.i4.0 + IL_0007: conv.i8 + IL_0008: nop + IL_0009: br.s IL_0017 + + IL_000b: ldc.i4.s 10 + IL_000d: conv.i8 + IL_000e: ldarg.0 + IL_000f: sub + IL_0010: ldc.i4.2 + IL_0011: conv.i8 + IL_0012: div.un + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: add.ovf.un + IL_0016: nop + IL_0017: stloc.0 + IL_0018: ldc.i4.0 + IL_0019: conv.i8 + IL_001a: stloc.1 + IL_001b: ldarg.0 + IL_001c: stloc.2 + IL_001d: br.s IL_002f + + IL_001f: ldloc.2 + IL_0020: call void assembly::set_c(uint64) + IL_0025: ldloc.2 + IL_0026: ldc.i4.2 + IL_0027: conv.i8 + IL_0028: add + IL_0029: stloc.2 + IL_002a: ldloc.1 + IL_002b: ldc.i4.1 + IL_002c: conv.i8 + IL_002d: add + IL_002e: stloc.1 + IL_002f: ldloc.1 + IL_0030: ldloc.0 + IL_0031: blt.un.s IL_001f + + IL_0033: ret + } + + .method public static void f8(uint64 step) cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: brtrue.s IL_0012 + + IL_0003: ldc.i4.1 + IL_0004: conv.i8 + IL_0005: ldarg.0 + IL_0006: ldc.i4.s 10 + IL_0008: conv.i8 + IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000e: pop + IL_000f: nop + IL_0010: br.s IL_0013 + + IL_0012: nop + IL_0013: ldc.i4.s 9 + IL_0015: conv.i8 + IL_0016: ldarg.0 + IL_0017: div.un + IL_0018: ldc.i4.1 + IL_0019: conv.i8 + IL_001a: add.ovf.un + IL_001b: stloc.0 + IL_001c: ldc.i4.0 + IL_001d: conv.i8 + IL_001e: stloc.1 + IL_001f: ldc.i4.1 + IL_0020: conv.i8 + IL_0021: stloc.2 + IL_0022: br.s IL_0033 + + IL_0024: ldloc.2 + IL_0025: call void assembly::set_c(uint64) + IL_002a: ldloc.2 + IL_002b: ldarg.0 + IL_002c: add + IL_002d: stloc.2 + IL_002e: ldloc.1 + IL_002f: ldc.i4.1 + IL_0030: conv.i8 + IL_0031: add + IL_0032: stloc.1 + IL_0033: ldloc.1 + IL_0034: ldloc.0 + IL_0035: blt.un.s IL_0024 + + IL_0037: ret + } + + .method public static void f9(uint64 finish) cil managed + { + + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: conv.i8 + IL_0003: bge.un.s IL_000a + + IL_0005: ldc.i4.0 + IL_0006: conv.i8 + IL_0007: nop + IL_0008: br.s IL_0015 + + IL_000a: ldarg.0 + IL_000b: ldc.i4.1 + IL_000c: conv.i8 + IL_000d: sub + IL_000e: ldc.i4.2 + IL_000f: conv.i8 + IL_0010: div.un + IL_0011: ldc.i4.1 + IL_0012: conv.i8 + IL_0013: add.ovf.un + IL_0014: nop + IL_0015: stloc.0 + IL_0016: ldc.i4.0 + IL_0017: conv.i8 + IL_0018: stloc.1 + IL_0019: ldc.i4.1 + IL_001a: conv.i8 + IL_001b: stloc.2 + IL_001c: br.s IL_002e + + IL_001e: ldloc.2 + IL_001f: call void assembly::set_c(uint64) + IL_0024: ldloc.2 + IL_0025: ldc.i4.2 + IL_0026: conv.i8 + IL_0027: add + IL_0028: stloc.2 + IL_0029: ldloc.1 + IL_002a: ldc.i4.1 + IL_002b: conv.i8 + IL_002c: add + IL_002d: stloc.1 + IL_002e: ldloc.1 + IL_002f: ldloc.0 + IL_0030: blt.un.s IL_001e + + IL_0032: ret + } + + .method public static void f10(uint64 start, + uint64 step, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + bool V_1, + uint64 V_2, + uint64 V_3, + uint64 V_4) + IL_0000: ldarg.1 + IL_0001: brtrue.s IL_000f + + IL_0003: ldarg.2 + IL_0004: ldarg.1 + IL_0005: ldarg.2 + IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000b: pop + IL_000c: nop + IL_000d: br.s IL_0010 + + IL_000f: nop + IL_0010: ldarg.2 + IL_0011: ldarg.2 + IL_0012: bge.un.s IL_0019 + + IL_0014: ldc.i4.0 + IL_0015: conv.i8 + IL_0016: nop + IL_0017: br.s IL_001f + + IL_0019: ldarg.2 + IL_001a: ldarg.2 + IL_001b: sub + IL_001c: ldarg.1 + IL_001d: div.un + IL_001e: nop + IL_001f: stloc.0 + IL_0020: ldloc.0 + IL_0021: ldc.i4.m1 + IL_0022: conv.i8 + IL_0023: bne.un.s IL_0047 + + IL_0025: ldc.i4.1 + IL_0026: stloc.1 + IL_0027: ldc.i4.0 + IL_0028: conv.i8 + IL_0029: stloc.2 + IL_002a: ldarg.2 + IL_002b: stloc.3 + IL_002c: br.s IL_0043 + + IL_002e: ldloc.3 + IL_002f: call void assembly::set_c(uint64) + IL_0034: ldloc.3 + IL_0035: ldarg.1 + IL_0036: add + IL_0037: stloc.3 + IL_0038: ldloc.2 + IL_0039: ldc.i4.1 + IL_003a: conv.i8 + IL_003b: add + IL_003c: stloc.2 + IL_003d: ldloc.2 + IL_003e: ldc.i4.0 + IL_003f: conv.i8 + IL_0040: cgt.un + IL_0042: stloc.1 + IL_0043: ldloc.1 + IL_0044: brtrue.s IL_002e + + IL_0046: ret + + IL_0047: ldarg.2 + IL_0048: ldarg.2 + IL_0049: bge.un.s IL_0050 + + IL_004b: ldc.i4.0 + IL_004c: conv.i8 + IL_004d: nop + IL_004e: br.s IL_0059 + + IL_0050: ldarg.2 + IL_0051: ldarg.2 + IL_0052: sub + IL_0053: ldarg.1 + IL_0054: div.un + IL_0055: ldc.i4.1 + IL_0056: conv.i8 + IL_0057: add.ovf.un + IL_0058: nop + IL_0059: stloc.2 + IL_005a: ldc.i4.0 + IL_005b: conv.i8 + IL_005c: stloc.3 + IL_005d: ldarg.2 + IL_005e: stloc.s V_4 + IL_0060: br.s IL_0074 + + IL_0062: ldloc.s V_4 + IL_0064: call void assembly::set_c(uint64) + IL_0069: ldloc.s V_4 + IL_006b: ldarg.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.3 + IL_0070: ldc.i4.1 + IL_0071: conv.i8 + IL_0072: add + IL_0073: stloc.3 + IL_0074: ldloc.3 + IL_0075: ldloc.2 + IL_0076: blt.un.s IL_0062 + + IL_0078: ret + } + + .method public static void f11(uint64 start, + uint64 finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: conv.i8 + IL_0003: ldarg.1 + IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_0009: pop + IL_000a: ldc.i4.0 + IL_000b: conv.i8 + IL_000c: stloc.0 + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.1 + IL_0010: ldarg.0 + IL_0011: stloc.2 + IL_0012: br.s IL_0024 + + IL_0014: ldloc.2 + IL_0015: call void assembly::set_c(uint64) + IL_001a: ldloc.2 + IL_001b: ldc.i4.0 + IL_001c: conv.i8 + IL_001d: add + IL_001e: stloc.2 + IL_001f: ldloc.1 + IL_0020: ldc.i4.1 + IL_0021: conv.i8 + IL_0022: add + IL_0023: stloc.1 + IL_0024: ldloc.1 + IL_0025: ldloc.0 + IL_0026: blt.un.s IL_0014 + + IL_0028: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (uint64 V_0, + uint64 V_1, + uint64 V_2) + IL_0000: ldc.i4.1 + IL_0001: conv.i8 + IL_0002: ldc.i4.0 + IL_0003: conv.i8 + IL_0004: ldc.i4.s 10 + IL_0006: conv.i8 + IL_0007: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUInt64(uint64, + uint64, + uint64) + IL_000c: pop + IL_000d: ldc.i4.0 + IL_000e: conv.i8 + IL_000f: stloc.0 + IL_0010: ldc.i4.0 + IL_0011: conv.i8 + IL_0012: stloc.1 + IL_0013: ldc.i4.1 + IL_0014: conv.i8 + IL_0015: stloc.2 + IL_0016: br.s IL_0028 + + IL_0018: ldloc.2 + IL_0019: call void assembly::set_c(uint64) + IL_001e: ldloc.2 + IL_001f: ldc.i4.0 + IL_0020: conv.i8 + IL_0021: add + IL_0022: stloc.2 + IL_0023: ldloc.1 + IL_0024: ldc.i4.1 + IL_0025: conv.i8 + IL_0026: add + IL_0027: stloc.1 + IL_0028: ldloc.1 + IL_0029: ldloc.0 + IL_002a: blt.un.s IL_0018 + + IL_002c: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stsfld uint64 assembly::c@1 + IL_0007: ret + } + + .property uint64 c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(uint64) + .get uint64 assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUIntPtr.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUIntPtr.fs new file mode 100644 index 00000000000..0ec7970c52a --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUIntPtr.fs @@ -0,0 +1,57 @@ +let mutable c = 0un + +let f0 () = + for n in 10un..1un do + c <- n + +let f00 () = + for n in 10un..1un..1un do + c <- n + +let f1 () = + for n in 1un..10un do + c <- n + +let f2 start = + for n in start..10un do + c <- n + +let f3 finish = + for n in 1un..finish do + c <- n + +let f4 (start: unativeint) finish = + for n in start..finish do + c <- n + +let f5 () = + for n in 1un..1un..10un do + c <- n + +let f6 () = + for n in 1un..2un..10un do + c <- n + +let f7 start = + for n in start..2un..10un do + c <- n + +let f8 step = + for n in 1un..step..10un do + c <- n + +let f9 finish = + for n in 1un..2un..finish do + c <- n + +let f10 (start: unativeint) step finish = + for n in finish..step..finish do + c <- n + +let f11 start finish = + for n in start..0un..finish do + c <- n + +let f12 () = + for n in 1un..0un..10un do + c <- n diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUIntPtr.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUIntPtr.fs.opt.il.bsl new file mode 100644 index 00000000000..394330583c9 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForEachRangeStepUIntPtr.fs.opt.il.bsl @@ -0,0 +1,1129 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.mresource public FSharpSignatureData.assembly +{ + + +} +.mresource public FSharpOptimizationData.assembly +{ + + +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed assembly + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .field static assembly native uint c@1 + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .method public specialname static native uint get_c() cil managed + { + + .maxstack 8 + IL_0000: ldsfld native uint assembly::c@1 + IL_0005: ret + } + + .method public specialname static void set_c(native uint 'value') cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: stsfld native uint assembly::c@1 + IL_0006: ret + } + + .method public static void f0() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f00() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0xa + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x0 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f1() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f2(native uint start) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldc.i8 0xa + IL_0009: conv.u + IL_000a: ldarg.0 + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldc.i8 0xa + IL_0023: conv.u + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_0094 + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.u + IL_005d: stloc.2 + IL_005e: ldarg.0 + IL_005f: stloc.3 + IL_0060: br.s IL_0090 + + IL_0062: ldloc.3 + IL_0063: call void assembly::set_c(native uint) + IL_0068: ldloc.3 + IL_0069: ldc.i8 0x1 + IL_0072: conv.u + IL_0073: add + IL_0074: stloc.3 + IL_0075: ldloc.2 + IL_0076: ldc.i8 0x1 + IL_007f: conv.u + IL_0080: add + IL_0081: stloc.2 + IL_0082: ldloc.2 + IL_0083: ldc.i8 0x0 + IL_008c: conv.u + IL_008d: cgt.un + IL_008f: stloc.1 + IL_0090: ldloc.1 + IL_0091: brtrue.s IL_0062 + + IL_0093: ret + + IL_0094: ldc.i8 0xa + IL_009d: conv.u + IL_009e: ldarg.0 + IL_009f: bge.un.s IL_00ae + + IL_00a1: ldc.i8 0x0 + IL_00aa: conv.u + IL_00ab: nop + IL_00ac: br.s IL_00c6 + + IL_00ae: ldc.i8 0xa + IL_00b7: conv.u + IL_00b8: ldarg.0 + IL_00b9: sub + IL_00ba: ldc.i8 0x1 + IL_00c3: conv.u + IL_00c4: add.ovf.un + IL_00c5: nop + IL_00c6: stloc.2 + IL_00c7: ldc.i8 0x0 + IL_00d0: conv.u + IL_00d1: stloc.3 + IL_00d2: ldarg.0 + IL_00d3: stloc.s V_4 + IL_00d5: br.s IL_00fa + + IL_00d7: ldloc.s V_4 + IL_00d9: call void assembly::set_c(native uint) + IL_00de: ldloc.s V_4 + IL_00e0: ldc.i8 0x1 + IL_00e9: conv.u + IL_00ea: add + IL_00eb: stloc.s V_4 + IL_00ed: ldloc.3 + IL_00ee: ldc.i8 0x1 + IL_00f7: conv.u + IL_00f8: add + IL_00f9: stloc.3 + IL_00fa: ldloc.3 + IL_00fb: ldloc.2 + IL_00fc: blt.un.s IL_00d7 + + IL_00fe: ret + } + + .method public static void f3(native uint finish) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.u + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_0027 + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.u + IL_0025: sub + IL_0026: nop + IL_0027: stloc.0 + IL_0028: sizeof [runtime]System.IntPtr + IL_002e: ldc.i4.4 + IL_002f: bne.un.s IL_0041 + + IL_0031: ldloc.0 + IL_0032: ldc.i8 0xffffffff + IL_003b: conv.u + IL_003c: ceq + IL_003e: nop + IL_003f: br.s IL_004f + + IL_0041: ldloc.0 + IL_0042: ldc.i8 0xffffffffffffffff + IL_004b: conv.u + IL_004c: ceq + IL_004e: nop + IL_004f: brfalse.s IL_009d + + IL_0051: ldc.i4.1 + IL_0052: stloc.1 + IL_0053: ldc.i8 0x0 + IL_005c: conv.u + IL_005d: stloc.2 + IL_005e: ldc.i8 0x1 + IL_0067: conv.u + IL_0068: stloc.3 + IL_0069: br.s IL_0099 + + IL_006b: ldloc.3 + IL_006c: call void assembly::set_c(native uint) + IL_0071: ldloc.3 + IL_0072: ldc.i8 0x1 + IL_007b: conv.u + IL_007c: add + IL_007d: stloc.3 + IL_007e: ldloc.2 + IL_007f: ldc.i8 0x1 + IL_0088: conv.u + IL_0089: add + IL_008a: stloc.2 + IL_008b: ldloc.2 + IL_008c: ldc.i8 0x0 + IL_0095: conv.u + IL_0096: cgt.un + IL_0098: stloc.1 + IL_0099: ldloc.1 + IL_009a: brtrue.s IL_006b + + IL_009c: ret + + IL_009d: ldarg.0 + IL_009e: ldc.i8 0x1 + IL_00a7: conv.u + IL_00a8: bge.un.s IL_00b7 + + IL_00aa: ldc.i8 0x0 + IL_00b3: conv.u + IL_00b4: nop + IL_00b5: br.s IL_00cf + + IL_00b7: ldarg.0 + IL_00b8: ldc.i8 0x1 + IL_00c1: conv.u + IL_00c2: sub + IL_00c3: ldc.i8 0x1 + IL_00cc: conv.u + IL_00cd: add.ovf.un + IL_00ce: nop + IL_00cf: stloc.2 + IL_00d0: ldc.i8 0x0 + IL_00d9: conv.u + IL_00da: stloc.3 + IL_00db: ldc.i8 0x1 + IL_00e4: conv.u + IL_00e5: stloc.s V_4 + IL_00e7: br.s IL_010c + + IL_00e9: ldloc.s V_4 + IL_00eb: call void assembly::set_c(native uint) + IL_00f0: ldloc.s V_4 + IL_00f2: ldc.i8 0x1 + IL_00fb: conv.u + IL_00fc: add + IL_00fd: stloc.s V_4 + IL_00ff: ldloc.3 + IL_0100: ldc.i8 0x1 + IL_0109: conv.u + IL_010a: add + IL_010b: stloc.3 + IL_010c: ldloc.3 + IL_010d: ldloc.2 + IL_010e: blt.un.s IL_00e9 + + IL_0110: ret + } + + .method public static void f4(native uint start, + native uint finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 4 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: bge.un.s IL_0011 + + IL_0004: ldc.i8 0x0 + IL_000d: conv.u + IL_000e: nop + IL_000f: br.s IL_0015 + + IL_0011: ldarg.1 + IL_0012: ldarg.0 + IL_0013: sub + IL_0014: nop + IL_0015: stloc.0 + IL_0016: sizeof [runtime]System.IntPtr + IL_001c: ldc.i4.4 + IL_001d: bne.un.s IL_002f + + IL_001f: ldloc.0 + IL_0020: ldc.i8 0xffffffff + IL_0029: conv.u + IL_002a: ceq + IL_002c: nop + IL_002d: br.s IL_003d + + IL_002f: ldloc.0 + IL_0030: ldc.i8 0xffffffffffffffff + IL_0039: conv.u + IL_003a: ceq + IL_003c: nop + IL_003d: brfalse.s IL_0082 + + IL_003f: ldc.i4.1 + IL_0040: stloc.1 + IL_0041: ldc.i8 0x0 + IL_004a: conv.u + IL_004b: stloc.2 + IL_004c: ldarg.0 + IL_004d: stloc.3 + IL_004e: br.s IL_007e + + IL_0050: ldloc.3 + IL_0051: call void assembly::set_c(native uint) + IL_0056: ldloc.3 + IL_0057: ldc.i8 0x1 + IL_0060: conv.u + IL_0061: add + IL_0062: stloc.3 + IL_0063: ldloc.2 + IL_0064: ldc.i8 0x1 + IL_006d: conv.u + IL_006e: add + IL_006f: stloc.2 + IL_0070: ldloc.2 + IL_0071: ldc.i8 0x0 + IL_007a: conv.u + IL_007b: cgt.un + IL_007d: stloc.1 + IL_007e: ldloc.1 + IL_007f: brtrue.s IL_0050 + + IL_0081: ret + + IL_0082: ldarg.1 + IL_0083: ldarg.0 + IL_0084: bge.un.s IL_0093 + + IL_0086: ldc.i8 0x0 + IL_008f: conv.u + IL_0090: nop + IL_0091: br.s IL_00a2 + + IL_0093: ldarg.1 + IL_0094: ldarg.0 + IL_0095: sub + IL_0096: ldc.i8 0x1 + IL_009f: conv.u + IL_00a0: add.ovf.un + IL_00a1: nop + IL_00a2: stloc.2 + IL_00a3: ldc.i8 0x0 + IL_00ac: conv.u + IL_00ad: stloc.3 + IL_00ae: ldarg.0 + IL_00af: stloc.s V_4 + IL_00b1: br.s IL_00d6 + + IL_00b3: ldloc.s V_4 + IL_00b5: call void assembly::set_c(native uint) + IL_00ba: ldloc.s V_4 + IL_00bc: ldc.i8 0x1 + IL_00c5: conv.u + IL_00c6: add + IL_00c7: stloc.s V_4 + IL_00c9: ldloc.3 + IL_00ca: ldc.i8 0x1 + IL_00d3: conv.u + IL_00d4: add + IL_00d5: stloc.3 + IL_00d6: ldloc.3 + IL_00d7: ldloc.2 + IL_00d8: blt.un.s IL_00b3 + + IL_00da: ret + } + + .method public static void f5() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x1 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0xa + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f6() cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1) + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stloc.0 + IL_000b: ldc.i8 0x1 + IL_0014: conv.u + IL_0015: stloc.1 + IL_0016: br.s IL_0038 + + IL_0018: ldloc.1 + IL_0019: call void assembly::set_c(native uint) + IL_001e: ldloc.1 + IL_001f: ldc.i8 0x2 + IL_0028: conv.u + IL_0029: add + IL_002a: stloc.1 + IL_002b: ldloc.0 + IL_002c: ldc.i8 0x1 + IL_0035: conv.u + IL_0036: add + IL_0037: stloc.0 + IL_0038: ldloc.0 + IL_0039: ldc.i8 0x5 + IL_0042: conv.u + IL_0043: blt.un.s IL_0018 + + IL_0045: ret + } + + .method public static void f7(native uint start) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldc.i8 0xa + IL_0009: conv.u + IL_000a: ldarg.0 + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldc.i8 0xa + IL_0023: conv.u + IL_0024: ldarg.0 + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.u + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.u + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.u + IL_0048: stloc.1 + IL_0049: ldarg.0 + IL_004a: stloc.2 + IL_004b: br.s IL_006d + + IL_004d: ldloc.2 + IL_004e: call void assembly::set_c(native uint) + IL_0053: ldloc.2 + IL_0054: ldc.i8 0x2 + IL_005d: conv.u + IL_005e: add + IL_005f: stloc.2 + IL_0060: ldloc.1 + IL_0061: ldc.i8 0x1 + IL_006a: conv.u + IL_006b: add + IL_006c: stloc.1 + IL_006d: ldloc.1 + IL_006e: ldloc.0 + IL_006f: blt.un.s IL_004d + + IL_0071: ret + } + + .method public static void f8(native uint step) cil managed + { + + .maxstack 5 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.u + IL_000b: bne.un.s IL_002b + + IL_000d: ldc.i8 0x1 + IL_0016: conv.u + IL_0017: ldarg.0 + IL_0018: ldc.i8 0xa + IL_0021: conv.u + IL_0022: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0027: pop + IL_0028: nop + IL_0029: br.s IL_002c + + IL_002b: nop + IL_002c: ldc.i8 0xa + IL_0035: conv.u + IL_0036: ldc.i8 0x1 + IL_003f: conv.u + IL_0040: bge.un.s IL_004f + + IL_0042: ldc.i8 0x0 + IL_004b: conv.u + IL_004c: nop + IL_004d: br.s IL_0067 + + IL_004f: ldc.i8 0xa + IL_0058: conv.u + IL_0059: ldc.i8 0x1 + IL_0062: conv.u + IL_0063: sub + IL_0064: ldarg.0 + IL_0065: div.un + IL_0066: nop + IL_0067: stloc.0 + IL_0068: sizeof [runtime]System.IntPtr + IL_006e: ldc.i4.4 + IL_006f: bne.un.s IL_0081 + + IL_0071: ldloc.0 + IL_0072: ldc.i8 0xffffffff + IL_007b: conv.u + IL_007c: ceq + IL_007e: nop + IL_007f: br.s IL_008f + + IL_0081: ldloc.0 + IL_0082: ldc.i8 0xffffffffffffffff + IL_008b: conv.u + IL_008c: ceq + IL_008e: nop + IL_008f: brfalse.s IL_00d4 + + IL_0091: ldc.i4.1 + IL_0092: stloc.1 + IL_0093: ldc.i8 0x0 + IL_009c: conv.u + IL_009d: stloc.2 + IL_009e: ldc.i8 0x1 + IL_00a7: conv.u + IL_00a8: stloc.3 + IL_00a9: br.s IL_00d0 + + IL_00ab: ldloc.3 + IL_00ac: call void assembly::set_c(native uint) + IL_00b1: ldloc.3 + IL_00b2: ldarg.0 + IL_00b3: add + IL_00b4: stloc.3 + IL_00b5: ldloc.2 + IL_00b6: ldc.i8 0x1 + IL_00bf: conv.u + IL_00c0: add + IL_00c1: stloc.2 + IL_00c2: ldloc.2 + IL_00c3: ldc.i8 0x0 + IL_00cc: conv.u + IL_00cd: cgt.un + IL_00cf: stloc.1 + IL_00d0: ldloc.1 + IL_00d1: brtrue.s IL_00ab + + IL_00d3: ret + + IL_00d4: ldc.i8 0xa + IL_00dd: conv.u + IL_00de: ldc.i8 0x1 + IL_00e7: conv.u + IL_00e8: bge.un.s IL_00f7 + + IL_00ea: ldc.i8 0x0 + IL_00f3: conv.u + IL_00f4: nop + IL_00f5: br.s IL_011a + + IL_00f7: ldc.i8 0xa + IL_0100: conv.u + IL_0101: ldc.i8 0x1 + IL_010a: conv.u + IL_010b: sub + IL_010c: ldarg.0 + IL_010d: div.un + IL_010e: ldc.i8 0x1 + IL_0117: conv.u + IL_0118: add.ovf.un + IL_0119: nop + IL_011a: stloc.2 + IL_011b: ldc.i8 0x0 + IL_0124: conv.u + IL_0125: stloc.3 + IL_0126: ldc.i8 0x1 + IL_012f: conv.u + IL_0130: stloc.s V_4 + IL_0132: br.s IL_014e + + IL_0134: ldloc.s V_4 + IL_0136: call void assembly::set_c(native uint) + IL_013b: ldloc.s V_4 + IL_013d: ldarg.0 + IL_013e: add + IL_013f: stloc.s V_4 + IL_0141: ldloc.3 + IL_0142: ldc.i8 0x1 + IL_014b: conv.u + IL_014c: add + IL_014d: stloc.3 + IL_014e: ldloc.3 + IL_014f: ldloc.2 + IL_0150: blt.un.s IL_0134 + + IL_0152: ret + } + + .method public static void f9(native uint finish) cil managed + { + + .maxstack 4 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x1 + IL_000a: conv.u + IL_000b: bge.un.s IL_001a + + IL_000d: ldc.i8 0x0 + IL_0016: conv.u + IL_0017: nop + IL_0018: br.s IL_003d + + IL_001a: ldarg.0 + IL_001b: ldc.i8 0x1 + IL_0024: conv.u + IL_0025: sub + IL_0026: ldc.i8 0x2 + IL_002f: conv.u + IL_0030: div.un + IL_0031: ldc.i8 0x1 + IL_003a: conv.u + IL_003b: add.ovf.un + IL_003c: nop + IL_003d: stloc.0 + IL_003e: ldc.i8 0x0 + IL_0047: conv.u + IL_0048: stloc.1 + IL_0049: ldc.i8 0x1 + IL_0052: conv.u + IL_0053: stloc.2 + IL_0054: br.s IL_0076 + + IL_0056: ldloc.2 + IL_0057: call void assembly::set_c(native uint) + IL_005c: ldloc.2 + IL_005d: ldc.i8 0x2 + IL_0066: conv.u + IL_0067: add + IL_0068: stloc.2 + IL_0069: ldloc.1 + IL_006a: ldc.i8 0x1 + IL_0073: conv.u + IL_0074: add + IL_0075: stloc.1 + IL_0076: ldloc.1 + IL_0077: ldloc.0 + IL_0078: blt.un.s IL_0056 + + IL_007a: ret + } + + .method public static void f10(native uint start, + native uint step, + native uint finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 + 00 00 00 00 ) + + .maxstack 5 + .locals init (native uint V_0, + bool V_1, + native uint V_2, + native uint V_3, + native uint V_4) + IL_0000: ldarg.1 + IL_0001: ldc.i8 0x0 + IL_000a: conv.u + IL_000b: bne.un.s IL_0019 + + IL_000d: ldarg.2 + IL_000e: ldarg.1 + IL_000f: ldarg.2 + IL_0010: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0015: pop + IL_0016: nop + IL_0017: br.s IL_001a + + IL_0019: nop + IL_001a: ldarg.2 + IL_001b: ldarg.2 + IL_001c: bge.un.s IL_002b + + IL_001e: ldc.i8 0x0 + IL_0027: conv.u + IL_0028: nop + IL_0029: br.s IL_0031 + + IL_002b: ldarg.2 + IL_002c: ldarg.2 + IL_002d: sub + IL_002e: ldarg.1 + IL_002f: div.un + IL_0030: nop + IL_0031: stloc.0 + IL_0032: sizeof [runtime]System.IntPtr + IL_0038: ldc.i4.4 + IL_0039: bne.un.s IL_004b + + IL_003b: ldloc.0 + IL_003c: ldc.i8 0xffffffff + IL_0045: conv.u + IL_0046: ceq + IL_0048: nop + IL_0049: br.s IL_0059 + + IL_004b: ldloc.0 + IL_004c: ldc.i8 0xffffffffffffffff + IL_0055: conv.u + IL_0056: ceq + IL_0058: nop + IL_0059: brfalse.s IL_0095 + + IL_005b: ldc.i4.1 + IL_005c: stloc.1 + IL_005d: ldc.i8 0x0 + IL_0066: conv.u + IL_0067: stloc.2 + IL_0068: ldarg.2 + IL_0069: stloc.3 + IL_006a: br.s IL_0091 + + IL_006c: ldloc.3 + IL_006d: call void assembly::set_c(native uint) + IL_0072: ldloc.3 + IL_0073: ldarg.1 + IL_0074: add + IL_0075: stloc.3 + IL_0076: ldloc.2 + IL_0077: ldc.i8 0x1 + IL_0080: conv.u + IL_0081: add + IL_0082: stloc.2 + IL_0083: ldloc.2 + IL_0084: ldc.i8 0x0 + IL_008d: conv.u + IL_008e: cgt.un + IL_0090: stloc.1 + IL_0091: ldloc.1 + IL_0092: brtrue.s IL_006c + + IL_0094: ret + + IL_0095: ldarg.2 + IL_0096: ldarg.2 + IL_0097: bge.un.s IL_00a6 + + IL_0099: ldc.i8 0x0 + IL_00a2: conv.u + IL_00a3: nop + IL_00a4: br.s IL_00b7 + + IL_00a6: ldarg.2 + IL_00a7: ldarg.2 + IL_00a8: sub + IL_00a9: ldarg.1 + IL_00aa: div.un + IL_00ab: ldc.i8 0x1 + IL_00b4: conv.u + IL_00b5: add.ovf.un + IL_00b6: nop + IL_00b7: stloc.2 + IL_00b8: ldc.i8 0x0 + IL_00c1: conv.u + IL_00c2: stloc.3 + IL_00c3: ldarg.2 + IL_00c4: stloc.s V_4 + IL_00c6: br.s IL_00e2 + + IL_00c8: ldloc.s V_4 + IL_00ca: call void assembly::set_c(native uint) + IL_00cf: ldloc.s V_4 + IL_00d1: ldarg.1 + IL_00d2: add + IL_00d3: stloc.s V_4 + IL_00d5: ldloc.3 + IL_00d6: ldc.i8 0x1 + IL_00df: conv.u + IL_00e0: add + IL_00e1: stloc.3 + IL_00e2: ldloc.3 + IL_00e3: ldloc.2 + IL_00e4: blt.un.s IL_00c8 + + IL_00e6: ret + } + + .method public static void f11(native uint start, + native uint finish) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) + + .maxstack 5 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldarg.0 + IL_0001: ldc.i8 0x0 + IL_000a: conv.u + IL_000b: ldarg.1 + IL_000c: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0011: pop + IL_0012: ldc.i8 0x0 + IL_001b: conv.u + IL_001c: stloc.0 + IL_001d: ldc.i8 0x0 + IL_0026: conv.u + IL_0027: stloc.1 + IL_0028: ldarg.0 + IL_0029: stloc.2 + IL_002a: br.s IL_004c + + IL_002c: ldloc.2 + IL_002d: call void assembly::set_c(native uint) + IL_0032: ldloc.2 + IL_0033: ldc.i8 0x0 + IL_003c: conv.u + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i8 0x1 + IL_0049: conv.u + IL_004a: add + IL_004b: stloc.1 + IL_004c: ldloc.1 + IL_004d: ldloc.0 + IL_004e: blt.un.s IL_002c + + IL_0050: ret + } + + .method public static void f12() cil managed + { + + .maxstack 5 + .locals init (native uint V_0, + native uint V_1, + native uint V_2) + IL_0000: ldc.i8 0x1 + IL_0009: conv.u + IL_000a: ldc.i8 0x0 + IL_0013: conv.u + IL_0014: ldc.i8 0xa + IL_001d: conv.u + IL_001e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeUIntPtr(native uint, + native uint, + native uint) + IL_0023: pop + IL_0024: ldc.i8 0x0 + IL_002d: conv.u + IL_002e: stloc.0 + IL_002f: ldc.i8 0x0 + IL_0038: conv.u + IL_0039: stloc.1 + IL_003a: ldc.i8 0x1 + IL_0043: conv.u + IL_0044: stloc.2 + IL_0045: br.s IL_0067 + + IL_0047: ldloc.2 + IL_0048: call void assembly::set_c(native uint) + IL_004d: ldloc.2 + IL_004e: ldc.i8 0x0 + IL_0057: conv.u + IL_0058: add + IL_0059: stloc.2 + IL_005a: ldloc.1 + IL_005b: ldc.i8 0x1 + IL_0064: conv.u + IL_0065: add + IL_0066: stloc.1 + IL_0067: ldloc.1 + IL_0068: ldloc.0 + IL_0069: blt.un.s IL_0047 + + IL_006b: ret + } + + .method private specialname rtspecialname static void .cctor() cil managed + { + + .maxstack 8 + IL_0000: ldc.i4.0 + IL_0001: stsfld int32 ''.$assembly::init@ + IL_0006: ldsfld int32 ''.$assembly::init@ + IL_000b: pop + IL_000c: ret + } + + .method assembly specialname static void staticInitialization@() cil managed + { + + .maxstack 8 + IL_0000: ldc.i8 0x0 + IL_0009: conv.u + IL_000a: stsfld native uint assembly::c@1 + IL_000f: ret + } + + .property native uint c() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) + .set void assembly::set_c(native uint) + .get native uint assembly::get_c() + } +} + +.class private abstract auto ansi sealed ''.$assembly + extends [runtime]System.Object +{ + .field static assembly int32 init@ + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: call void assembly::staticInitialization@() + IL_0005: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForLoop.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForLoop.fs index f98947c030b..40ca24c3a14 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForLoop.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/ForLoop.fs @@ -99,24 +99,28 @@ module ForLoopRealInternalSignatureOn = [] let ``NonTrivialBranchingBindingInEnd03_fs_opt`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=NonTrivialBranchingBindingInEnd03.fs SCFLAGS="--optimize-" # NonTrivialBranchingBindingInEnd03.fs --optimize- [] let ``NonTrivialBranchingBindingInEnd03_fs_nonopt`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=NonTrivialBranchingBindingInEnd04.fs SCFLAGS="--optimize+" # NonTrivialBranchingBindingInEnd04.fs --optimize+ [] let ``NonTrivialBranchingBindingInEnd04_fs_opt`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=NonTrivialBranchingBindingInEnd04.fs SCFLAGS="--optimize-" # NonTrivialBranchingBindingInEnd04.fs --optimize- [] let ``NonTrivialBranchingBindingInEnd04_fs_nonopt`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=NonTrivialBranchingBindingInEnd05.fs SCFLAGS="--optimize+" # NonTrivialBranchingBindingInEnd05.fs --optimize+ @@ -131,3 +135,79 @@ module ForLoopRealInternalSignatureOn = compilation |> verifyCompilation + // SOURCE=ForEachRangeStepSByte.fs SCFLAGS="--optimize+" # ForEachRangeStepSByte.fs --optimize+ + [] + let ``ForEachRangeStepSByte_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepByte.fs SCFLAGS="--optimize+" # ForEachRangeStepByte.fs --optimize+ + [] + let ``ForEachRangeStepByte_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepChar.fs SCFLAGS="--optimize+" # ForEachRangeStepChar.fs --optimize+ + [] + let ``ForEachRangeStepChar_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepInt16.fs SCFLAGS="--optimize+" # ForEachRangeStepInt16.fs --optimize+ + [] + let ``ForEachRangeStepInt16_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUInt16.fs SCFLAGS="--optimize+" # ForEachRangeStepUInt16.fs --optimize+ + [] + let ``ForEachRangeStepUInt16_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepInt32.fs SCFLAGS="--optimize+" # ForEachRangeStepInt32.fs --optimize+ + [] + let ``ForEachRangeStepInt32_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUInt32.fs SCFLAGS="--optimize+" # ForEachRangeStepUInt32.fs --optimize+ + [] + let ``ForEachRangeStepUInt32_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepInt64.fs SCFLAGS="--optimize+" # ForEachRangeStepInt64.fs --optimize+ + [] + let ``ForEachRangeStepInt64_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUInt64.fs SCFLAGS="--optimize+" # ForEachRangeStepUInt64.fs --optimize+ + [] + let ``ForEachRangeStepUInt64_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepIntPtr.fs SCFLAGS="--optimize+" # ForEachRangeStepIntPtr.fs --optimize+ + [] + let ``ForEachRangeStepIntPtr_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation + + // SOURCE=ForEachRangeStepUIntPtr.fs SCFLAGS="--optimize+" # ForEachRangeStepUIntPtr.fs --optimize+ + [] + let ``ForEachRangeStepUIntPtr_fs_opt`` compilation = + compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. + |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.il.bsl index 475e4e35c66..5cab501f026 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.il.bsl @@ -136,7 +136,11 @@ { .maxstack 7 - .locals init (int32 V_0) + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) IL_0000: ldc.i4.8 IL_0001: ldc.i4.1 IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, @@ -147,77 +151,115 @@ IL_000e: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, !!0) IL_0013: stsfld int32[] assembly::w@7 - IL_0018: ldc.i4.0 - IL_0019: ldc.i4.1 - IL_001a: call int32[] assembly::get_r() - IL_001f: ldlen - IL_0020: conv.i4 - IL_0021: stsfld int32 assembly::e1@1 - IL_0026: call int32[] assembly::get_w() - IL_002b: ldlen - IL_002c: conv.i4 - IL_002d: stsfld int32 assembly::e2@1 - IL_0032: call int32 assembly::get_e1@1() - IL_0037: call int32 assembly::get_e2@1() - IL_003c: bge.s IL_0046 - - IL_003e: call int32 assembly::get_e1@1() - IL_0043: nop - IL_0044: br.s IL_004c - - IL_0046: call int32 assembly::get_e2@1() - IL_004b: nop - IL_004c: ldc.i4.1 - IL_004d: sub - IL_004e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0053: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0058: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_005d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0067: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_006c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 - IL_0071: br.s IL_00b9 - - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_007d: stloc.0 - IL_007e: call int32[] assembly::get_r() - IL_0083: ldloc.0 - IL_0084: call int32[] assembly::get_r() - IL_0089: ldloc.0 - IL_008a: ldelem [runtime]System.Int32 - IL_008f: call int32[] assembly::get_w() - IL_0094: ldloc.0 - IL_0095: ldelem [runtime]System.Int32 - IL_009a: add - IL_009b: stelem [runtime]System.Int32 - IL_00a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00a5: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00aa: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_00af: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_00b4: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00be: brtrue.s IL_0073 - - IL_00c0: nop - IL_00c1: nop - IL_00c2: call int32[] assembly::get_r() - IL_00c7: ldc.i4.0 - IL_00c8: ldelem [runtime]System.Int32 - IL_00cd: ldc.i4.3 - IL_00ce: bne.un.s IL_00d4 - - IL_00d0: ldc.i4.0 - IL_00d1: nop - IL_00d2: br.s IL_00d6 - - IL_00d4: ldc.i4.1 - IL_00d5: nop - IL_00d6: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_00db: pop - IL_00dc: ret + IL_0018: call int32[] assembly::get_r() + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: stsfld int32 assembly::e1@1 + IL_0024: call int32[] assembly::get_w() + IL_0029: ldlen + IL_002a: conv.i4 + IL_002b: stsfld int32 assembly::e2@1 + IL_0030: call int32 assembly::get_e1@1() + IL_0035: call int32 assembly::get_e2@1() + IL_003a: bge.s IL_0044 + + IL_003c: call int32 assembly::get_e1@1() + IL_0041: nop + IL_0042: br.s IL_004a + + IL_0044: call int32 assembly::get_e2@1() + IL_0049: nop + IL_004a: ldc.i4.1 + IL_004b: sub + IL_004c: stloc.0 + IL_004d: ldloc.0 + IL_004e: ldc.i4.0 + IL_004f: bge.s IL_0056 + + IL_0051: ldc.i4.0 + IL_0052: conv.i8 + IL_0053: nop + IL_0054: br.s IL_005e + + IL_0056: ldloc.0 + IL_0057: ldc.i4.0 + IL_0058: sub + IL_0059: conv.i8 + IL_005a: ldc.i4.1 + IL_005b: conv.i8 + IL_005c: add + IL_005d: nop + IL_005e: stloc.1 + IL_005f: ldc.i4.0 + IL_0060: conv.i8 + IL_0061: stloc.3 + IL_0062: ldc.i4.0 + IL_0063: stloc.s V_4 + IL_0065: br.s IL_007c + + IL_0067: ldloca.s V_2 + IL_0069: ldloc.s V_4 + IL_006b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0070: nop + IL_0071: ldloc.s V_4 + IL_0073: ldc.i4.1 + IL_0074: add + IL_0075: stloc.s V_4 + IL_0077: ldloc.3 + IL_0078: ldc.i4.1 + IL_0079: conv.i8 + IL_007a: add + IL_007b: stloc.3 + IL_007c: ldloc.3 + IL_007d: ldloc.1 + IL_007e: blt.un.s IL_0067 + + IL_0080: ldloca.s V_2 + IL_0082: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0087: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_008c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0091: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0096: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 + IL_009b: br.s IL_00e3 + + IL_009d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00a2: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_00a7: stloc.0 + IL_00a8: call int32[] assembly::get_r() + IL_00ad: ldloc.0 + IL_00ae: call int32[] assembly::get_r() + IL_00b3: ldloc.0 + IL_00b4: ldelem [runtime]System.Int32 + IL_00b9: call int32[] assembly::get_w() + IL_00be: ldloc.0 + IL_00bf: ldelem [runtime]System.Int32 + IL_00c4: add + IL_00c5: stelem [runtime]System.Int32 + IL_00ca: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00cf: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00d4: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00d9: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_00de: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00e3: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00e8: brtrue.s IL_009d + + IL_00ea: nop + IL_00eb: nop + IL_00ec: call int32[] assembly::get_r() + IL_00f1: ldc.i4.0 + IL_00f2: ldelem [runtime]System.Int32 + IL_00f7: ldc.i4.3 + IL_00f8: bne.un.s IL_00fe + + IL_00fa: ldc.i4.0 + IL_00fb: nop + IL_00fc: br.s IL_0100 + + IL_00fe: ldc.i4.1 + IL_00ff: nop + IL_0100: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_0105: pop + IL_0106: ret } .property int32[] r() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl index 475e4e35c66..5cab501f026 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd03.fs.opt.il.bsl @@ -136,7 +136,11 @@ { .maxstack 7 - .locals init (int32 V_0) + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) IL_0000: ldc.i4.8 IL_0001: ldc.i4.1 IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, @@ -147,77 +151,115 @@ IL_000e: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, !!0) IL_0013: stsfld int32[] assembly::w@7 - IL_0018: ldc.i4.0 - IL_0019: ldc.i4.1 - IL_001a: call int32[] assembly::get_r() - IL_001f: ldlen - IL_0020: conv.i4 - IL_0021: stsfld int32 assembly::e1@1 - IL_0026: call int32[] assembly::get_w() - IL_002b: ldlen - IL_002c: conv.i4 - IL_002d: stsfld int32 assembly::e2@1 - IL_0032: call int32 assembly::get_e1@1() - IL_0037: call int32 assembly::get_e2@1() - IL_003c: bge.s IL_0046 - - IL_003e: call int32 assembly::get_e1@1() - IL_0043: nop - IL_0044: br.s IL_004c - - IL_0046: call int32 assembly::get_e2@1() - IL_004b: nop - IL_004c: ldc.i4.1 - IL_004d: sub - IL_004e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0053: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0058: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_005d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0067: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_006c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 - IL_0071: br.s IL_00b9 - - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_007d: stloc.0 - IL_007e: call int32[] assembly::get_r() - IL_0083: ldloc.0 - IL_0084: call int32[] assembly::get_r() - IL_0089: ldloc.0 - IL_008a: ldelem [runtime]System.Int32 - IL_008f: call int32[] assembly::get_w() - IL_0094: ldloc.0 - IL_0095: ldelem [runtime]System.Int32 - IL_009a: add - IL_009b: stelem [runtime]System.Int32 - IL_00a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00a5: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00aa: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_00af: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_00b4: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00be: brtrue.s IL_0073 - - IL_00c0: nop - IL_00c1: nop - IL_00c2: call int32[] assembly::get_r() - IL_00c7: ldc.i4.0 - IL_00c8: ldelem [runtime]System.Int32 - IL_00cd: ldc.i4.3 - IL_00ce: bne.un.s IL_00d4 - - IL_00d0: ldc.i4.0 - IL_00d1: nop - IL_00d2: br.s IL_00d6 - - IL_00d4: ldc.i4.1 - IL_00d5: nop - IL_00d6: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_00db: pop - IL_00dc: ret + IL_0018: call int32[] assembly::get_r() + IL_001d: ldlen + IL_001e: conv.i4 + IL_001f: stsfld int32 assembly::e1@1 + IL_0024: call int32[] assembly::get_w() + IL_0029: ldlen + IL_002a: conv.i4 + IL_002b: stsfld int32 assembly::e2@1 + IL_0030: call int32 assembly::get_e1@1() + IL_0035: call int32 assembly::get_e2@1() + IL_003a: bge.s IL_0044 + + IL_003c: call int32 assembly::get_e1@1() + IL_0041: nop + IL_0042: br.s IL_004a + + IL_0044: call int32 assembly::get_e2@1() + IL_0049: nop + IL_004a: ldc.i4.1 + IL_004b: sub + IL_004c: stloc.0 + IL_004d: ldloc.0 + IL_004e: ldc.i4.0 + IL_004f: bge.s IL_0056 + + IL_0051: ldc.i4.0 + IL_0052: conv.i8 + IL_0053: nop + IL_0054: br.s IL_005e + + IL_0056: ldloc.0 + IL_0057: ldc.i4.0 + IL_0058: sub + IL_0059: conv.i8 + IL_005a: ldc.i4.1 + IL_005b: conv.i8 + IL_005c: add + IL_005d: nop + IL_005e: stloc.1 + IL_005f: ldc.i4.0 + IL_0060: conv.i8 + IL_0061: stloc.3 + IL_0062: ldc.i4.0 + IL_0063: stloc.s V_4 + IL_0065: br.s IL_007c + + IL_0067: ldloca.s V_2 + IL_0069: ldloc.s V_4 + IL_006b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0070: nop + IL_0071: ldloc.s V_4 + IL_0073: ldc.i4.1 + IL_0074: add + IL_0075: stloc.s V_4 + IL_0077: ldloc.3 + IL_0078: ldc.i4.1 + IL_0079: conv.i8 + IL_007a: add + IL_007b: stloc.3 + IL_007c: ldloc.3 + IL_007d: ldloc.1 + IL_007e: blt.un.s IL_0067 + + IL_0080: ldloca.s V_2 + IL_0082: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0087: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_008c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0091: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0096: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 + IL_009b: br.s IL_00e3 + + IL_009d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00a2: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_00a7: stloc.0 + IL_00a8: call int32[] assembly::get_r() + IL_00ad: ldloc.0 + IL_00ae: call int32[] assembly::get_r() + IL_00b3: ldloc.0 + IL_00b4: ldelem [runtime]System.Int32 + IL_00b9: call int32[] assembly::get_w() + IL_00be: ldloc.0 + IL_00bf: ldelem [runtime]System.Int32 + IL_00c4: add + IL_00c5: stelem [runtime]System.Int32 + IL_00ca: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00cf: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00d4: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00d9: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_00de: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00e3: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00e8: brtrue.s IL_009d + + IL_00ea: nop + IL_00eb: nop + IL_00ec: call int32[] assembly::get_r() + IL_00f1: ldc.i4.0 + IL_00f2: ldelem [runtime]System.Int32 + IL_00f7: ldc.i4.3 + IL_00f8: bne.un.s IL_00fe + + IL_00fa: ldc.i4.0 + IL_00fb: nop + IL_00fc: br.s IL_0100 + + IL_00fe: ldc.i4.1 + IL_00ff: nop + IL_0100: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_0105: pop + IL_0106: ret } .property int32[] r() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.il.bsl index 07b8377812d..fd4946b43f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.il.bsl @@ -136,7 +136,11 @@ { .maxstack 7 - .locals init (int32 V_0) + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) IL_0000: ldc.i4.8 IL_0001: ldc.i4.1 IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, @@ -167,57 +171,95 @@ IL_0049: nop IL_004a: ldc.i4.1 IL_004b: sub - IL_004c: ldc.i4.m1 - IL_004d: ldc.i4.0 - IL_004e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0053: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0058: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_005d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0067: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_006c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 - IL_0071: br.s IL_00b9 - - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_007d: stloc.0 - IL_007e: call int32[] assembly::get_r() - IL_0083: ldloc.0 - IL_0084: call int32[] assembly::get_r() - IL_0089: ldloc.0 - IL_008a: ldelem [runtime]System.Int32 - IL_008f: call int32[] assembly::get_w() - IL_0094: ldloc.0 - IL_0095: ldelem [runtime]System.Int32 - IL_009a: add - IL_009b: stelem [runtime]System.Int32 - IL_00a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00a5: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00aa: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_00af: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_00b4: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00be: brtrue.s IL_0073 - - IL_00c0: nop - IL_00c1: nop - IL_00c2: call int32[] assembly::get_r() - IL_00c7: ldc.i4.0 - IL_00c8: ldelem [runtime]System.Int32 - IL_00cd: ldc.i4.3 - IL_00ce: bne.un.s IL_00d4 - - IL_00d0: ldc.i4.0 - IL_00d1: nop - IL_00d2: br.s IL_00d6 - - IL_00d4: ldc.i4.1 - IL_00d5: nop - IL_00d6: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_00db: pop - IL_00dc: ret + IL_004c: stloc.0 + IL_004d: ldloc.0 + IL_004e: ldc.i4.0 + IL_004f: bge.s IL_0056 + + IL_0051: ldc.i4.0 + IL_0052: conv.i8 + IL_0053: nop + IL_0054: br.s IL_005e + + IL_0056: ldloc.0 + IL_0057: ldc.i4.0 + IL_0058: sub + IL_0059: conv.i8 + IL_005a: ldc.i4.1 + IL_005b: conv.i8 + IL_005c: add + IL_005d: nop + IL_005e: stloc.1 + IL_005f: ldc.i4.0 + IL_0060: conv.i8 + IL_0061: stloc.3 + IL_0062: ldloc.0 + IL_0063: stloc.s V_4 + IL_0065: br.s IL_007c + + IL_0067: ldloca.s V_2 + IL_0069: ldloc.s V_4 + IL_006b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0070: nop + IL_0071: ldloc.s V_4 + IL_0073: ldc.i4.m1 + IL_0074: add + IL_0075: stloc.s V_4 + IL_0077: ldloc.3 + IL_0078: ldc.i4.1 + IL_0079: conv.i8 + IL_007a: add + IL_007b: stloc.3 + IL_007c: ldloc.3 + IL_007d: ldloc.1 + IL_007e: blt.un.s IL_0067 + + IL_0080: ldloca.s V_2 + IL_0082: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0087: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_008c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0091: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0096: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 + IL_009b: br.s IL_00e3 + + IL_009d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00a2: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_00a7: stloc.0 + IL_00a8: call int32[] assembly::get_r() + IL_00ad: ldloc.0 + IL_00ae: call int32[] assembly::get_r() + IL_00b3: ldloc.0 + IL_00b4: ldelem [runtime]System.Int32 + IL_00b9: call int32[] assembly::get_w() + IL_00be: ldloc.0 + IL_00bf: ldelem [runtime]System.Int32 + IL_00c4: add + IL_00c5: stelem [runtime]System.Int32 + IL_00ca: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00cf: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00d4: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00d9: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_00de: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00e3: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00e8: brtrue.s IL_009d + + IL_00ea: nop + IL_00eb: nop + IL_00ec: call int32[] assembly::get_r() + IL_00f1: ldc.i4.0 + IL_00f2: ldelem [runtime]System.Int32 + IL_00f7: ldc.i4.3 + IL_00f8: bne.un.s IL_00fe + + IL_00fa: ldc.i4.0 + IL_00fb: nop + IL_00fc: br.s IL_0100 + + IL_00fe: ldc.i4.1 + IL_00ff: nop + IL_0100: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_0105: pop + IL_0106: ret } .property int32[] r() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl index 07b8377812d..fd4946b43f2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/RealInternalSignatureOn/NonTrivialBranchingBindingInEnd04.fs.opt.il.bsl @@ -136,7 +136,11 @@ { .maxstack 7 - .locals init (int32 V_0) + .locals init (int32 V_0, + uint64 V_1, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_2, + uint64 V_3, + int32 V_4) IL_0000: ldc.i4.8 IL_0001: ldc.i4.1 IL_0002: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Create(int32, @@ -167,57 +171,95 @@ IL_0049: nop IL_004a: ldc.i4.1 IL_004b: sub - IL_004c: ldc.i4.m1 - IL_004d: ldc.i4.0 - IL_004e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0053: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0058: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_005d: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 - IL_0062: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0067: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_006c: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 - IL_0071: br.s IL_00b9 - - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_0078: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_007d: stloc.0 - IL_007e: call int32[] assembly::get_r() - IL_0083: ldloc.0 - IL_0084: call int32[] assembly::get_r() - IL_0089: ldloc.0 - IL_008a: ldelem [runtime]System.Int32 - IL_008f: call int32[] assembly::get_w() - IL_0094: ldloc.0 - IL_0095: ldelem [runtime]System.Int32 - IL_009a: add - IL_009b: stelem [runtime]System.Int32 - IL_00a0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00a5: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00aa: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() - IL_00af: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_00b4: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b9: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() - IL_00be: brtrue.s IL_0073 - - IL_00c0: nop - IL_00c1: nop - IL_00c2: call int32[] assembly::get_r() - IL_00c7: ldc.i4.0 - IL_00c8: ldelem [runtime]System.Int32 - IL_00cd: ldc.i4.3 - IL_00ce: bne.un.s IL_00d4 - - IL_00d0: ldc.i4.0 - IL_00d1: nop - IL_00d2: br.s IL_00d6 - - IL_00d4: ldc.i4.1 - IL_00d5: nop - IL_00d6: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) - IL_00db: pop - IL_00dc: ret + IL_004c: stloc.0 + IL_004d: ldloc.0 + IL_004e: ldc.i4.0 + IL_004f: bge.s IL_0056 + + IL_0051: ldc.i4.0 + IL_0052: conv.i8 + IL_0053: nop + IL_0054: br.s IL_005e + + IL_0056: ldloc.0 + IL_0057: ldc.i4.0 + IL_0058: sub + IL_0059: conv.i8 + IL_005a: ldc.i4.1 + IL_005b: conv.i8 + IL_005c: add + IL_005d: nop + IL_005e: stloc.1 + IL_005f: ldc.i4.0 + IL_0060: conv.i8 + IL_0061: stloc.3 + IL_0062: ldloc.0 + IL_0063: stloc.s V_4 + IL_0065: br.s IL_007c + + IL_0067: ldloca.s V_2 + IL_0069: ldloc.s V_4 + IL_006b: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0070: nop + IL_0071: ldloc.s V_4 + IL_0073: ldc.i4.m1 + IL_0074: add + IL_0075: stloc.s V_4 + IL_0077: ldloc.3 + IL_0078: ldc.i4.1 + IL_0079: conv.i8 + IL_007a: add + IL_007b: stloc.3 + IL_007c: ldloc.3 + IL_007d: ldloc.1 + IL_007e: blt.un.s IL_0067 + + IL_0080: ldloca.s V_2 + IL_0082: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0087: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::current@9 + IL_008c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_0091: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0096: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::next@9 + IL_009b: br.s IL_00e3 + + IL_009d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00a2: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_00a7: stloc.0 + IL_00a8: call int32[] assembly::get_r() + IL_00ad: ldloc.0 + IL_00ae: call int32[] assembly::get_r() + IL_00b3: ldloc.0 + IL_00b4: ldelem [runtime]System.Int32 + IL_00b9: call int32[] assembly::get_w() + IL_00be: ldloc.0 + IL_00bf: ldelem [runtime]System.Int32 + IL_00c4: add + IL_00c5: stelem [runtime]System.Int32 + IL_00ca: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00cf: call void assembly::set_current@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00d4: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_current@9() + IL_00d9: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_00de: call void assembly::set_next@9(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00e3: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_next@9() + IL_00e8: brtrue.s IL_009d + + IL_00ea: nop + IL_00eb: nop + IL_00ec: call int32[] assembly::get_r() + IL_00f1: ldc.i4.0 + IL_00f2: ldelem [runtime]System.Int32 + IL_00f7: ldc.i4.3 + IL_00f8: bne.un.s IL_00fe + + IL_00fa: ldc.i4.0 + IL_00fb: nop + IL_00fc: br.s IL_0100 + + IL_00fe: ldc.i4.1 + IL_00ff: nop + IL_0100: call !!0 [FSharp.Core]Microsoft.FSharp.Core.Operators::Exit(int32) + IL_0105: pop + IL_0106: ret } .property int32[] r() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl index 7c3b365ff57..5ad3388f883 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare08.fsx.il.bsl @@ -54,46 +54,85 @@ .locals init (int32 V_0, uint8[] V_1, uint8[] V_2, - int32 V_3) + uint16 V_3, + uint8 V_4, + uint8[] V_5, + int32 V_6) IL_0000: ldc.i4.1 IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: ldc.i4.1 - IL_0004: ldc.i4.s 100 - IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, - uint8, - uint8) - IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0010: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: ldc.i4.1 - IL_0018: ldc.i4.s 100 - IL_001a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, - uint8, - uint8) - IL_001f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0024: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0029: stloc.2 - IL_002a: ldc.i4.0 - IL_002b: stloc.3 - IL_002c: br.s IL_003a - - IL_002e: ldloc.1 - IL_002f: ldloc.2 - IL_0030: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonIntrinsic(!!0, + IL_0002: ldc.i4.s 101 + IL_0004: newarr [runtime]System.Byte + IL_0009: stloc.2 + IL_000a: ldc.i4.0 + IL_000b: stloc.3 + IL_000c: ldc.i4.0 + IL_000d: stloc.s V_4 + IL_000f: br.s IL_0020 + + IL_0011: ldloc.2 + IL_0012: ldloc.3 + IL_0013: ldloc.s V_4 + IL_0015: stelem.i1 + IL_0016: ldloc.s V_4 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.s V_4 + IL_001c: ldloc.3 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.3 + IL_0020: ldloc.3 + IL_0021: ldc.i4.s 101 + IL_0023: blt.un.s IL_0011 + + IL_0025: ldloc.2 + IL_0026: stloc.1 + IL_0027: ldc.i4.s 101 + IL_0029: newarr [runtime]System.Byte + IL_002e: stloc.s V_5 + IL_0030: ldc.i4.0 + IL_0031: stloc.3 + IL_0032: ldc.i4.0 + IL_0033: stloc.s V_4 + IL_0035: br.s IL_0047 + + IL_0037: ldloc.s V_5 + IL_0039: ldloc.3 + IL_003a: ldloc.s V_4 + IL_003c: stelem.i1 + IL_003d: ldloc.s V_4 + IL_003f: ldc.i4.1 + IL_0040: add + IL_0041: stloc.s V_4 + IL_0043: ldloc.3 + IL_0044: ldc.i4.1 + IL_0045: add + IL_0046: stloc.3 + IL_0047: ldloc.3 + IL_0048: ldc.i4.s 101 + IL_004a: blt.un.s IL_0037 + + IL_004c: ldloc.s V_5 + IL_004e: stloc.2 + IL_004f: ldc.i4.0 + IL_0050: stloc.s V_6 + IL_0052: br.s IL_0062 + + IL_0054: ldloc.1 + IL_0055: ldloc.2 + IL_0056: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonIntrinsic(!!0, !!0) - IL_0035: stloc.0 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: ldc.i4 0x989681 - IL_0040: blt.s IL_002e - - IL_0042: ldloc.0 - IL_0043: ret + IL_005b: stloc.0 + IL_005c: ldloc.s V_6 + IL_005e: ldc.i4.1 + IL_005f: add + IL_0060: stloc.s V_6 + IL_0062: ldloc.s V_6 + IL_0064: ldc.i4 0x989681 + IL_0069: blt.s IL_0054 + + IL_006b: ldloc.0 + IL_006c: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl index b734a546b40..261d118d9a9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Compare09.fsx.il.bsl @@ -54,46 +54,96 @@ .locals init (int32 V_0, int32[] V_1, int32[] V_2, - int32 V_3) + uint64 V_3, + int32 V_4, + int32[] V_5) IL_0000: ldc.i4.1 IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: ldc.i4.1 - IL_0004: ldc.i4.s 100 - IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0010: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: ldc.i4.1 - IL_0018: ldc.i4.s 100 - IL_001a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_001f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0024: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0029: stloc.2 - IL_002a: ldc.i4.0 - IL_002b: stloc.3 - IL_002c: br.s IL_003a - - IL_002e: ldloc.1 - IL_002f: ldloc.2 - IL_0030: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonIntrinsic(!!0, + IL_0002: ldc.i4.s 101 + IL_0004: conv.i8 + IL_0005: conv.ovf.i.un + IL_0006: newarr [runtime]System.Int32 + IL_000b: stloc.2 + IL_000c: ldc.i4.0 + IL_000d: conv.i8 + IL_000e: stloc.3 + IL_000f: ldc.i4.0 + IL_0010: stloc.s V_4 + IL_0012: br.s IL_0025 + + IL_0014: ldloc.2 + IL_0015: ldloc.3 + IL_0016: conv.i + IL_0017: ldloc.s V_4 + IL_0019: stelem.i4 + IL_001a: ldloc.s V_4 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.s V_4 + IL_0020: ldloc.3 + IL_0021: ldc.i4.1 + IL_0022: conv.i8 + IL_0023: add + IL_0024: stloc.3 + IL_0025: ldloc.3 + IL_0026: ldc.i4.s 101 + IL_0028: conv.i8 + IL_0029: blt.un.s IL_0014 + + IL_002b: ldloc.2 + IL_002c: stloc.1 + IL_002d: ldc.i4.s 101 + IL_002f: conv.i8 + IL_0030: conv.ovf.i.un + IL_0031: newarr [runtime]System.Int32 + IL_0036: stloc.s V_5 + IL_0038: ldc.i4.0 + IL_0039: conv.i8 + IL_003a: stloc.3 + IL_003b: ldc.i4.0 + IL_003c: stloc.s V_4 + IL_003e: br.s IL_0052 + + IL_0040: ldloc.s V_5 + IL_0042: ldloc.3 + IL_0043: conv.i + IL_0044: ldloc.s V_4 + IL_0046: stelem.i4 + IL_0047: ldloc.s V_4 + IL_0049: ldc.i4.1 + IL_004a: add + IL_004b: stloc.s V_4 + IL_004d: ldloc.3 + IL_004e: ldc.i4.1 + IL_004f: conv.i8 + IL_0050: add + IL_0051: stloc.3 + IL_0052: ldloc.3 + IL_0053: ldc.i4.s 101 + IL_0055: conv.i8 + IL_0056: blt.un.s IL_0040 + + IL_0058: ldloc.s V_5 + IL_005a: stloc.2 + IL_005b: ldc.i4.0 + IL_005c: stloc.s V_4 + IL_005e: br.s IL_006e + + IL_0060: ldloc.1 + IL_0061: ldloc.2 + IL_0062: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericComparisonIntrinsic(!!0, !!0) - IL_0035: stloc.0 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: ldc.i4 0x186a1 - IL_0040: blt.s IL_002e - - IL_0042: ldloc.0 - IL_0043: ret + IL_0067: stloc.0 + IL_0068: ldloc.s V_4 + IL_006a: ldc.i4.1 + IL_006b: add + IL_006c: stloc.s V_4 + IL_006e: ldloc.s V_4 + IL_0070: ldc.i4 0x186a1 + IL_0075: blt.s IL_0060 + + IL_0077: ldloc.0 + IL_0078: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl index a175818aeb3..9e7afe0aa8c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals07.fsx.il.bsl @@ -54,46 +54,85 @@ .locals init (bool V_0, uint8[] V_1, uint8[] V_2, - int32 V_3) + uint16 V_3, + uint8 V_4, + uint8[] V_5, + int32 V_6) IL_0000: ldc.i4.0 IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: ldc.i4.1 - IL_0004: ldc.i4.s 100 - IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, - uint8, - uint8) - IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0010: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: ldc.i4.1 - IL_0018: ldc.i4.s 100 - IL_001a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, - uint8, - uint8) - IL_001f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0024: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0029: stloc.2 - IL_002a: ldc.i4.0 - IL_002b: stloc.3 - IL_002c: br.s IL_003a - - IL_002e: ldloc.1 - IL_002f: ldloc.2 - IL_0030: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, + IL_0002: ldc.i4.s 101 + IL_0004: newarr [runtime]System.Byte + IL_0009: stloc.2 + IL_000a: ldc.i4.0 + IL_000b: stloc.3 + IL_000c: ldc.i4.0 + IL_000d: stloc.s V_4 + IL_000f: br.s IL_0020 + + IL_0011: ldloc.2 + IL_0012: ldloc.3 + IL_0013: ldloc.s V_4 + IL_0015: stelem.i1 + IL_0016: ldloc.s V_4 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.s V_4 + IL_001c: ldloc.3 + IL_001d: ldc.i4.1 + IL_001e: add + IL_001f: stloc.3 + IL_0020: ldloc.3 + IL_0021: ldc.i4.s 101 + IL_0023: blt.un.s IL_0011 + + IL_0025: ldloc.2 + IL_0026: stloc.1 + IL_0027: ldc.i4.s 101 + IL_0029: newarr [runtime]System.Byte + IL_002e: stloc.s V_5 + IL_0030: ldc.i4.0 + IL_0031: stloc.3 + IL_0032: ldc.i4.0 + IL_0033: stloc.s V_4 + IL_0035: br.s IL_0047 + + IL_0037: ldloc.s V_5 + IL_0039: ldloc.3 + IL_003a: ldloc.s V_4 + IL_003c: stelem.i1 + IL_003d: ldloc.s V_4 + IL_003f: ldc.i4.1 + IL_0040: add + IL_0041: stloc.s V_4 + IL_0043: ldloc.3 + IL_0044: ldc.i4.1 + IL_0045: add + IL_0046: stloc.3 + IL_0047: ldloc.3 + IL_0048: ldc.i4.s 101 + IL_004a: blt.un.s IL_0037 + + IL_004c: ldloc.s V_5 + IL_004e: stloc.2 + IL_004f: ldc.i4.0 + IL_0050: stloc.s V_6 + IL_0052: br.s IL_0062 + + IL_0054: ldloc.1 + IL_0055: ldloc.2 + IL_0056: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, !!0) - IL_0035: stloc.0 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: ldc.i4 0x989681 - IL_0040: blt.s IL_002e - - IL_0042: ldloc.0 - IL_0043: ret + IL_005b: stloc.0 + IL_005c: ldloc.s V_6 + IL_005e: ldc.i4.1 + IL_005f: add + IL_0060: stloc.s V_6 + IL_0062: ldloc.s V_6 + IL_0064: ldc.i4 0x989681 + IL_0069: blt.s IL_0054 + + IL_006b: ldloc.0 + IL_006c: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl index 6125092813b..02acab4575c 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Equals08.fsx.il.bsl @@ -54,46 +54,96 @@ .locals init (bool V_0, int32[] V_1, int32[] V_2, - int32 V_3) + uint64 V_3, + int32 V_4, + int32[] V_5) IL_0000: ldc.i4.0 IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: ldc.i4.1 - IL_0004: ldc.i4.s 100 - IL_0006: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0010: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0015: stloc.1 - IL_0016: ldc.i4.0 - IL_0017: ldc.i4.1 - IL_0018: ldc.i4.s 100 - IL_001a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_001f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0024: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0029: stloc.2 - IL_002a: ldc.i4.0 - IL_002b: stloc.3 - IL_002c: br.s IL_003a - - IL_002e: ldloc.1 - IL_002f: ldloc.2 - IL_0030: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, + IL_0002: ldc.i4.s 101 + IL_0004: conv.i8 + IL_0005: conv.ovf.i.un + IL_0006: newarr [runtime]System.Int32 + IL_000b: stloc.2 + IL_000c: ldc.i4.0 + IL_000d: conv.i8 + IL_000e: stloc.3 + IL_000f: ldc.i4.0 + IL_0010: stloc.s V_4 + IL_0012: br.s IL_0025 + + IL_0014: ldloc.2 + IL_0015: ldloc.3 + IL_0016: conv.i + IL_0017: ldloc.s V_4 + IL_0019: stelem.i4 + IL_001a: ldloc.s V_4 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: stloc.s V_4 + IL_0020: ldloc.3 + IL_0021: ldc.i4.1 + IL_0022: conv.i8 + IL_0023: add + IL_0024: stloc.3 + IL_0025: ldloc.3 + IL_0026: ldc.i4.s 101 + IL_0028: conv.i8 + IL_0029: blt.un.s IL_0014 + + IL_002b: ldloc.2 + IL_002c: stloc.1 + IL_002d: ldc.i4.s 101 + IL_002f: conv.i8 + IL_0030: conv.ovf.i.un + IL_0031: newarr [runtime]System.Int32 + IL_0036: stloc.s V_5 + IL_0038: ldc.i4.0 + IL_0039: conv.i8 + IL_003a: stloc.3 + IL_003b: ldc.i4.0 + IL_003c: stloc.s V_4 + IL_003e: br.s IL_0052 + + IL_0040: ldloc.s V_5 + IL_0042: ldloc.3 + IL_0043: conv.i + IL_0044: ldloc.s V_4 + IL_0046: stelem.i4 + IL_0047: ldloc.s V_4 + IL_0049: ldc.i4.1 + IL_004a: add + IL_004b: stloc.s V_4 + IL_004d: ldloc.3 + IL_004e: ldc.i4.1 + IL_004f: conv.i8 + IL_0050: add + IL_0051: stloc.3 + IL_0052: ldloc.3 + IL_0053: ldc.i4.s 101 + IL_0055: conv.i8 + IL_0056: blt.un.s IL_0040 + + IL_0058: ldloc.s V_5 + IL_005a: stloc.2 + IL_005b: ldc.i4.0 + IL_005c: stloc.s V_4 + IL_005e: br.s IL_006e + + IL_0060: ldloc.1 + IL_0061: ldloc.2 + IL_0062: call bool [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericEqualityIntrinsic(!!0, !!0) - IL_0035: stloc.0 - IL_0036: ldloc.3 - IL_0037: ldc.i4.1 - IL_0038: add - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: ldc.i4 0x989681 - IL_0040: blt.s IL_002e - - IL_0042: ldloc.0 - IL_0043: ret + IL_0067: stloc.0 + IL_0068: ldloc.s V_4 + IL_006a: ldc.i4.1 + IL_006b: add + IL_006c: stloc.s V_4 + IL_006e: ldloc.s V_4 + IL_0070: ldc.i4 0x989681 + IL_0075: blt.s IL_0060 + + IL_0077: ldloc.0 + IL_0078: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs index b421ca1bf11..57d287f2c42 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/GenericComparison.fs @@ -62,12 +62,14 @@ module GenericComparison = [] let ``Compare08_fsx`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Compare09.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Compare09.dll" # Compare09.fs [] let ``Compare09_fsx`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Compare10.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Compare10.dll" # Compare10.fs - @@ -142,12 +144,14 @@ module GenericComparison = [] let ``Hash10_fsx`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Hash11.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Hash11.dll" # Hash11.fs [] let ``Hash11_fsx`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Hash12.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Hash12.dll" # Hash12.fs - @@ -197,12 +201,14 @@ module GenericComparison = [] let ``Equals07_fsx`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Equals08.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals08.dll" # Equals08.fs - [] let ``Equals08_fsx`` compilation = compilation + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=Equals09.fsx SCFLAGS="-a -g --optimize+" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd Equals09.dll" # Equals09.fs - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl index 3c5b5009606..0ad4e24c843 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash10.fsx.il.bsl @@ -52,34 +52,55 @@ .maxstack 5 .locals init (uint8[] V_0, - int32 V_1, - int32 V_2) + uint8[] V_1, + uint16 V_2, + uint8 V_3, + int32 V_4, + int32 V_5) IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: ldc.i4.1 - IL_0003: ldc.i4.s 100 - IL_0005: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeByte(uint8, - uint8, - uint8) - IL_000a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000f: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0014: stloc.0 - IL_0015: ldc.i4.0 - IL_0016: stloc.1 - IL_0017: br.s IL_0024 - - IL_0019: ldloc.0 - IL_001a: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashIntrinsic(!!0) - IL_001f: stloc.2 + IL_0001: ldc.i4.s 101 + IL_0003: newarr [runtime]System.Byte + IL_0008: stloc.1 + IL_0009: ldc.i4.0 + IL_000a: stloc.2 + IL_000b: ldc.i4.0 + IL_000c: stloc.3 + IL_000d: br.s IL_001b + + IL_000f: ldloc.1 + IL_0010: ldloc.2 + IL_0011: ldloc.3 + IL_0012: stelem.i1 + IL_0013: ldloc.3 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: stloc.3 + IL_0017: ldloc.2 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.2 + IL_001b: ldloc.2 + IL_001c: ldc.i4.s 101 + IL_001e: blt.un.s IL_000f + IL_0020: ldloc.1 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: stloc.1 - IL_0024: ldloc.1 - IL_0025: ldc.i4 0x989681 - IL_002a: blt.s IL_0019 - - IL_002c: ret + IL_0021: stloc.0 + IL_0022: ldc.i4.0 + IL_0023: stloc.s V_4 + IL_0025: br.s IL_0035 + + IL_0027: ldloc.0 + IL_0028: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashIntrinsic(!!0) + IL_002d: stloc.s V_5 + IL_002f: ldloc.s V_4 + IL_0031: ldc.i4.1 + IL_0032: add + IL_0033: stloc.s V_4 + IL_0035: ldloc.s V_4 + IL_0037: ldc.i4 0x989681 + IL_003c: blt.s IL_0027 + + IL_003e: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl index ba62710f013..5e8ba8dc8f5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/GenericComparison/Hash11.fsx.il.bsl @@ -52,34 +52,60 @@ .maxstack 5 .locals init (int32[] V_0, - int32 V_1, - int32 V_2) + int32[] V_1, + uint64 V_2, + int32 V_3, + int32 V_4) IL_0000: nop - IL_0001: ldc.i4.0 - IL_0002: ldc.i4.1 - IL_0003: ldc.i4.s 100 - IL_0005: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_000a: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000f: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToArray(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0014: stloc.0 - IL_0015: ldc.i4.0 - IL_0016: stloc.1 - IL_0017: br.s IL_0024 - - IL_0019: ldloc.0 - IL_001a: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashIntrinsic(!!0) + IL_0001: ldc.i4.s 101 + IL_0003: conv.i8 + IL_0004: conv.ovf.i.un + IL_0005: newarr [runtime]System.Int32 + IL_000a: stloc.1 + IL_000b: ldc.i4.0 + IL_000c: conv.i8 + IL_000d: stloc.2 + IL_000e: ldc.i4.0 + IL_000f: stloc.3 + IL_0010: br.s IL_0020 + + IL_0012: ldloc.1 + IL_0013: ldloc.2 + IL_0014: conv.i + IL_0015: ldloc.3 + IL_0016: stelem.i4 + IL_0017: ldloc.3 + IL_0018: ldc.i4.1 + IL_0019: add + IL_001a: stloc.3 + IL_001b: ldloc.2 + IL_001c: ldc.i4.1 + IL_001d: conv.i8 + IL_001e: add IL_001f: stloc.2 - IL_0020: ldloc.1 - IL_0021: ldc.i4.1 - IL_0022: add - IL_0023: stloc.1 - IL_0024: ldloc.1 - IL_0025: ldc.i4 0x989681 - IL_002a: blt.s IL_0019 - - IL_002c: ret + IL_0020: ldloc.2 + IL_0021: ldc.i4.s 101 + IL_0023: conv.i8 + IL_0024: blt.un.s IL_0012 + + IL_0026: ldloc.1 + IL_0027: stloc.0 + IL_0028: ldc.i4.0 + IL_0029: stloc.3 + IL_002a: br.s IL_0038 + + IL_002c: ldloc.0 + IL_002d: call int32 [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/HashCompare::GenericHashIntrinsic(!!0) + IL_0032: stloc.s V_4 + IL_0034: ldloc.3 + IL_0035: ldc.i4.1 + IL_0036: add + IL_0037: stloc.3 + IL_0038: ldloc.3 + IL_0039: ldc.i4 0x989681 + IL_003e: blt.s IL_002c + + IL_0040: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs index abdc6368d11..78c95d80d00 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping.fs @@ -35,6 +35,7 @@ module ListExpressionStepping = let ``ListExpressionStepping02_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=ListExpressionSteppingTest2.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd ListExpressionSteppingTest2.exe" # ListExpressionSteppingTest2.fs - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl index a8e6ce9949c..4fdb1c34a07 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOff.il.bsl @@ -51,8 +51,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { .field static assembly initonly class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -63,8 +62,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed { .maxstack 7 @@ -85,8 +83,7 @@ IL_0017: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -101,8 +98,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`2> { .field static assembly initonly class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -113,8 +109,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 Invoke(class [runtime]System.Tuple`2 tupledArg) cil managed { .maxstack 7 @@ -135,8 +130,7 @@ IL_0017: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -151,8 +145,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`3> { .field static assembly initonly class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24' @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -163,8 +156,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`3 - Invoke(class [runtime]System.Tuple`3 tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`3 Invoke(class [runtime]System.Tuple`3 tupledArg) cil managed { .maxstack 7 @@ -191,8 +183,7 @@ IL_001f: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -207,8 +198,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,class [runtime]System.Tuple`3> { .field static assembly initonly class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -219,8 +209,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Tuple`3 - Invoke(class [runtime]System.Tuple`3 tupledArg) cil managed + .method public strict virtual instance class [runtime]System.Tuple`3 Invoke(class [runtime]System.Tuple`3 tupledArg) cil managed { .maxstack 7 @@ -247,8 +236,7 @@ IL_001f: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -259,8 +247,7 @@ } - .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - f1() cil managed + .method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 f1() cil managed { .maxstack 4 @@ -287,8 +274,7 @@ IL_003a: ret } - .method public static class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> - f2(!!a x) cil managed + .method public static class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> f2(!!a x) cil managed { .maxstack 6 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl index a36fbb087b0..5e88a197fcd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ListExpressionStepping/ListExpressionStepping02.fs.RealInternalSignatureOn.il.bsl @@ -79,7 +79,7 @@ IL_0010: ldc.i4.1 IL_0011: add IL_0012: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_0017: ret } @@ -126,7 +126,7 @@ IL_0010: ldc.i4.1 IL_0011: add IL_0012: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_0017: ret } @@ -178,8 +178,8 @@ IL_0018: add IL_0019: ldloc.2 IL_001a: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, - !1, - !2) + !1, + !2) IL_001f: ret } @@ -231,8 +231,8 @@ IL_0018: add IL_0019: ldloc.2 IL_001a: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, - !1, - !2) + !1, + !2) IL_001f: ret } @@ -281,14 +281,23 @@ .locals init (class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_3, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_4, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_5, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_6, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_7, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_8, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_9, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_10) + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_3, + uint64 V_4, + int32 V_5, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_6, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_7, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_8, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_9, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_10, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_11, + uint64 V_12, + int32 V_13, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_14, + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_15, + uint64 V_16, + int32 V_17, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_18, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> V_19) IL_0000: ldarg.0 IL_0001: ldarg.0 IL_0002: ldarg.0 @@ -301,80 +310,137 @@ class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0017: stloc.1 IL_0018: ldc.i4.0 - IL_0019: ldc.i4.1 - IL_001a: ldc.i4.2 - IL_001b: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0020: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0025: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_002a: stloc.2 - IL_002b: ldloc.1 - IL_002c: ldloc.2 - IL_002d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0032: stloc.3 - IL_0033: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18'::@_instance - IL_0038: ldloc.3 - IL_0039: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_003e: stloc.s V_4 - IL_0040: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19::@_instance - IL_0045: ldloc.s V_4 - IL_0047: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_004c: stloc.0 - IL_004d: ldarg.0 - IL_004e: ldarg.0 - IL_004f: ldarg.0 - IL_0050: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() - IL_0055: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0019: conv.i8 + IL_001a: stloc.s V_4 + IL_001c: ldc.i4.0 + IL_001d: stloc.s V_5 + IL_001f: br.s IL_0038 + + IL_0021: ldloca.s V_3 + IL_0023: ldloc.s V_5 + IL_0025: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_002a: nop + IL_002b: ldloc.s V_5 + IL_002d: ldc.i4.1 + IL_002e: add + IL_002f: stloc.s V_5 + IL_0031: ldloc.s V_4 + IL_0033: ldc.i4.1 + IL_0034: conv.i8 + IL_0035: add + IL_0036: stloc.s V_4 + IL_0038: ldloc.s V_4 + IL_003a: ldc.i4.3 + IL_003b: conv.i8 + IL_003c: blt.un.s IL_0021 + + IL_003e: ldloca.s V_3 + IL_0040: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0045: stloc.2 + IL_0046: ldloc.1 + IL_0047: ldloc.2 + IL_0048: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_004d: stloc.s V_6 + IL_004f: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #1 stage #2 at line 18@18'::@_instance + IL_0054: ldloc.s V_6 + IL_0056: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_005b: stloc.s V_7 + IL_005d: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs1@19::@_instance + IL_0062: ldloc.s V_7 + IL_0064: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`2>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0069: stloc.0 + IL_006a: ldarg.0 + IL_006b: ldarg.0 + IL_006c: ldarg.0 + IL_006d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() + IL_0072: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_005a: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_0077: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_005f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, + IL_007c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::Cons(!0, class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0064: stloc.s V_6 - IL_0066: ldc.i4.0 - IL_0067: ldc.i4.1 - IL_0068: ldc.i4.2 - IL_0069: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_006e: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0073: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0078: stloc.s V_7 - IL_007a: ldc.i4.0 - IL_007b: ldc.i4.1 - IL_007c: ldc.i4.2 - IL_007d: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0082: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0087: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_008c: stloc.s V_8 - IL_008e: ldloc.s V_6 - IL_0090: ldloc.s V_7 - IL_0092: ldloc.s V_8 - IL_0094: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip3(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0099: stloc.s V_9 - IL_009b: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24'::@_instance - IL_00a0: ldloc.s V_9 - IL_00a2: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00a7: stloc.s V_10 - IL_00a9: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25::@_instance - IL_00ae: ldloc.s V_10 - IL_00b0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_00b5: stloc.s V_5 - IL_00b7: ldloc.0 - IL_00b8: ldloc.s V_5 - IL_00ba: newobj instance void class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::.ctor(!0, - !1) - IL_00bf: ret + IL_0081: stloc.s V_9 + IL_0083: ldc.i4.0 + IL_0084: conv.i8 + IL_0085: stloc.s V_12 + IL_0087: ldc.i4.0 + IL_0088: stloc.s V_13 + IL_008a: br.s IL_00a3 + + IL_008c: ldloca.s V_11 + IL_008e: ldloc.s V_13 + IL_0090: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_0095: nop + IL_0096: ldloc.s V_13 + IL_0098: ldc.i4.1 + IL_0099: add + IL_009a: stloc.s V_13 + IL_009c: ldloc.s V_12 + IL_009e: ldc.i4.1 + IL_009f: conv.i8 + IL_00a0: add + IL_00a1: stloc.s V_12 + IL_00a3: ldloc.s V_12 + IL_00a5: ldc.i4.3 + IL_00a6: conv.i8 + IL_00a7: blt.un.s IL_008c + + IL_00a9: ldloca.s V_11 + IL_00ab: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_00b0: stloc.s V_10 + IL_00b2: ldc.i4.0 + IL_00b3: conv.i8 + IL_00b4: stloc.s V_16 + IL_00b6: ldc.i4.0 + IL_00b7: stloc.s V_17 + IL_00b9: br.s IL_00d2 + + IL_00bb: ldloca.s V_15 + IL_00bd: ldloc.s V_17 + IL_00bf: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_00c4: nop + IL_00c5: ldloc.s V_17 + IL_00c7: ldc.i4.1 + IL_00c8: add + IL_00c9: stloc.s V_17 + IL_00cb: ldloc.s V_16 + IL_00cd: ldc.i4.1 + IL_00ce: conv.i8 + IL_00cf: add + IL_00d0: stloc.s V_16 + IL_00d2: ldloc.s V_16 + IL_00d4: ldc.i4.3 + IL_00d5: conv.i8 + IL_00d6: blt.un.s IL_00bb + + IL_00d8: ldloca.s V_15 + IL_00da: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_00df: stloc.s V_14 + IL_00e1: ldloc.s V_9 + IL_00e3: ldloc.s V_10 + IL_00e5: ldloc.s V_14 + IL_00e7: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Zip3(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00ec: stloc.s V_18 + IL_00ee: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24' class ListExpressionSteppingTest2/ListExpressionSteppingTest2/'Pipe #2 stage #2 at line 24@24'::@_instance + IL_00f3: ldloc.s V_18 + IL_00f5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_00fa: stloc.s V_19 + IL_00fc: ldsfld class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25 class ListExpressionSteppingTest2/ListExpressionSteppingTest2/xs2@25::@_instance + IL_0101: ldloc.s V_19 + IL_0103: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::Map,class [runtime]System.Tuple`3>(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0108: stloc.s V_8 + IL_010a: ldloc.0 + IL_010b: ldloc.s V_8 + IL_010d: newobj instance void class [runtime]System.Tuple`2>,class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::.ctor(!0, + !1) + IL_0112: ret } .method private specialname rtspecialname static void .cctor() cil managed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl index 2e77dc87b3d..045bd18ffe7 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOff.il.bsl @@ -72,8 +72,7 @@ IL_0014: ret } - .method public strict virtual instance int32 - GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1>& next) cil managed + .method public strict virtual instance int32 GenerateNext(class [runtime]System.Collections.Generic.IEnumerable`1>& next) cil managed { .maxstack 7 @@ -131,8 +130,7 @@ IL_0060: ret } - .method public strict virtual instance void - Close() cil managed + .method public strict virtual instance void Close() cil managed { .maxstack 8 @@ -142,8 +140,7 @@ IL_0007: ret } - .method public strict virtual instance bool - get_CheckClose() cil managed + .method public strict virtual instance bool get_CheckClose() cil managed { .maxstack 8 @@ -179,8 +176,7 @@ IL_002f: ret } - .method public strict virtual instance class [runtime]System.Tuple`2 - get_LastGenerated() cil managed + .method public strict virtual instance class [runtime]System.Tuple`2 get_LastGenerated() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -191,8 +187,7 @@ IL_0006: ret } - .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1> - GetFreshEnumerator() cil managed + .method public strict virtual instance class [runtime]System.Collections.Generic.IEnumerator`1> GetFreshEnumerator() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -207,8 +202,7 @@ } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 - get_alist() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 get_alist() cil managed { .maxstack 8 @@ -216,8 +210,7 @@ IL_0005: ret } - .method public specialname static int32[] - get_array() cil managed + .method public specialname static int32[] get_array() cil managed { .maxstack 8 @@ -225,8 +218,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Collections.Generic.IEnumerable`1 - get_aseq() cil managed + .method public specialname static class [runtime]System.Collections.Generic.IEnumerable`1 get_aseq() cil managed { .maxstack 8 @@ -234,8 +226,7 @@ IL_0005: ret } - .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> - get_list1() cil managed + .method public specialname static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> get_list1() cil managed { .maxstack 8 @@ -243,8 +234,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Collections.Generic.IEnumerable`1> - get_seq1() cil managed + .method public specialname static class [runtime]System.Collections.Generic.IEnumerable`1> get_seq1() cil managed { .maxstack 8 @@ -252,8 +242,7 @@ IL_0005: ret } - .method public specialname static class [runtime]System.Tuple`2[] - get_array1() cil managed + .method public specialname static class [runtime]System.Tuple`2[] get_array1() cil managed { .maxstack 8 @@ -261,8 +250,7 @@ IL_0005: ret } - .method public specialname static int32[0...,0...] - get_a3() cil managed + .method public specialname static int32[0...,0...] get_a3() cil managed { .maxstack 8 @@ -270,8 +258,7 @@ IL_0005: ret } - .method public specialname static int32[0...,0...,0...] - get_array3D() cil managed + .method public specialname static int32[0...,0...,0...] get_array3D() cil managed { .maxstack 8 @@ -279,8 +266,7 @@ IL_0005: ret } - .method public specialname static int32[0...,0...,0...,0...] - get_array4D() cil managed + .method public specialname static int32[0...,0...,0...,0...] get_array4D() cil managed { .maxstack 8 @@ -288,8 +274,7 @@ IL_0005: ret } - .method public specialname static int32[] - get_a1() cil managed + .method public specialname static int32[] get_a1() cil managed { .maxstack 8 @@ -297,8 +282,7 @@ IL_0005: ret } - .method public specialname static int32[] - get_a2() cil managed + .method public specialname static int32[] get_a2() cil managed { .maxstack 8 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl index 721b81b0430..b77d95c5722 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/CodeGenRenamings01.fs.RealInternalSignatureOn.il.bsl @@ -103,7 +103,7 @@ IL_002d: ldc.i4.1 IL_002e: ldc.i4.1 IL_002f: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_0034: stfld class [runtime]System.Tuple`2 assembly/seq1@9::current IL_0039: ldc.i4.1 IL_003a: ret @@ -115,7 +115,7 @@ IL_0043: ldc.i4.2 IL_0044: ldc.i4.2 IL_0045: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) + !1) IL_004a: stfld class [runtime]System.Tuple`2 assembly/seq1@9::current IL_004f: ldc.i4.1 IL_0050: ret @@ -327,247 +327,269 @@ { .maxstack 8 - .locals init (int32 V_0, - class [runtime]System.Tuple`4 V_1, - class [runtime]System.Tuple`4 V_2, + .locals init (valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_0, + uint64 V_1, + int32 V_2, int32 V_3, - class [runtime]System.Tuple`3 V_4, - class [runtime]System.Tuple`3 V_5, + class [runtime]System.Tuple`4 V_4, + class [runtime]System.Tuple`4 V_5, int32 V_6, - class [runtime]System.Tuple`4 V_7, - class [runtime]System.Tuple`4 V_8, - int32 V_9) - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4.s 10 - IL_0004: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0009: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000e: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0013: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::alist@5 - IL_0018: ldc.i4.3 - IL_0019: newarr [runtime]System.Int32 - IL_001e: dup - IL_001f: ldc.i4.0 - IL_0020: ldc.i4.1 - IL_0021: stelem [runtime]System.Int32 - IL_0026: dup - IL_0027: ldc.i4.1 - IL_0028: ldc.i4.2 - IL_0029: stelem [runtime]System.Int32 - IL_002e: dup - IL_002f: ldc.i4.2 - IL_0030: ldc.i4.3 - IL_0031: stelem [runtime]System.Int32 - IL_0036: stsfld int32[] assembly::array@6 - IL_003b: ldc.i4.1 - IL_003c: ldc.i4.1 - IL_003d: ldc.i4.s 10 - IL_003f: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0044: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0049: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 assembly::aseq@7 + class [runtime]System.Tuple`3 V_7, + class [runtime]System.Tuple`3 V_8, + int32 V_9, + class [runtime]System.Tuple`4 V_10, + class [runtime]System.Tuple`4 V_11, + int32 V_12) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.1 + IL_0003: ldc.i4.1 + IL_0004: stloc.2 + IL_0005: br.s IL_0019 + + IL_0007: ldloca.s V_0 + IL_0009: ldloc.2 + IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_000f: nop + IL_0010: ldloc.2 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.2 + IL_0014: ldloc.1 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.1 + IL_0019: ldloc.1 + IL_001a: ldc.i4.s 10 + IL_001c: conv.i8 + IL_001d: blt.un.s IL_0007 + + IL_001f: ldloca.s V_0 + IL_0021: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0026: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::alist@5 + IL_002b: ldc.i4.3 + IL_002c: newarr [runtime]System.Int32 + IL_0031: dup + IL_0032: ldc.i4.0 + IL_0033: ldc.i4.1 + IL_0034: stelem [runtime]System.Int32 + IL_0039: dup + IL_003a: ldc.i4.1 + IL_003b: ldc.i4.2 + IL_003c: stelem [runtime]System.Int32 + IL_0041: dup + IL_0042: ldc.i4.2 + IL_0043: ldc.i4.3 + IL_0044: stelem [runtime]System.Int32 + IL_0049: stsfld int32[] assembly::array@6 IL_004e: ldc.i4.1 IL_004f: ldc.i4.1 - IL_0050: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0055: ldc.i4.2 - IL_0056: ldc.i4.2 - IL_0057: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_005c: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::get_Empty() - IL_0061: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_0066: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_006b: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::list1@8 - IL_0070: ldc.i4.0 - IL_0071: ldnull - IL_0072: newobj instance void assembly/seq1@9::.ctor(int32, - class [runtime]System.Tuple`2) - IL_0077: stsfld class [runtime]System.Collections.Generic.IEnumerable`1> assembly::seq1@9 - IL_007c: ldc.i4.2 - IL_007d: newarr class [runtime]System.Tuple`2 - IL_0082: dup + IL_0050: ldc.i4.s 10 + IL_0052: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, + int32, + int32) + IL_0057: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_005c: stsfld class [runtime]System.Collections.Generic.IEnumerable`1 assembly::aseq@7 + IL_0061: ldc.i4.1 + IL_0062: ldc.i4.1 + IL_0063: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_0068: ldc.i4.2 + IL_0069: ldc.i4.2 + IL_006a: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_006f: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::get_Empty() + IL_0074: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0079: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>::Cons(!0, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_007e: stsfld class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::list1@8 IL_0083: ldc.i4.0 - IL_0084: ldc.i4.1 - IL_0085: ldc.i4.1 - IL_0086: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_008b: stelem class [runtime]System.Tuple`2 - IL_0090: dup - IL_0091: ldc.i4.1 - IL_0092: ldc.i4.2 - IL_0093: ldc.i4.2 - IL_0094: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0099: stelem class [runtime]System.Tuple`2 - IL_009e: stsfld class [runtime]System.Tuple`2[] assembly::array1@10 - IL_00a3: ldc.i4.2 - IL_00a4: ldc.i4.2 - IL_00a5: ldc.i4.0 - IL_00a6: call !!0[0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Create(int32, + IL_0084: ldnull + IL_0085: newobj instance void assembly/seq1@9::.ctor(int32, + class [runtime]System.Tuple`2) + IL_008a: stsfld class [runtime]System.Collections.Generic.IEnumerable`1> assembly::seq1@9 + IL_008f: ldc.i4.2 + IL_0090: newarr class [runtime]System.Tuple`2 + IL_0095: dup + IL_0096: ldc.i4.0 + IL_0097: ldc.i4.1 + IL_0098: ldc.i4.1 + IL_0099: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_009e: stelem class [runtime]System.Tuple`2 + IL_00a3: dup + IL_00a4: ldc.i4.1 + IL_00a5: ldc.i4.2 + IL_00a6: ldc.i4.2 + IL_00a7: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, + !1) + IL_00ac: stelem class [runtime]System.Tuple`2 + IL_00b1: stsfld class [runtime]System.Tuple`2[] assembly::array1@10 + IL_00b6: ldc.i4.2 + IL_00b7: ldc.i4.2 + IL_00b8: ldc.i4.0 + IL_00b9: call !!0[0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Create(int32, int32, !!0) - IL_00ab: stsfld int32[0...,0...] assembly::a3@11 - IL_00b0: ldc.i4.3 - IL_00b1: ldc.i4.3 - IL_00b2: ldc.i4.3 - IL_00b3: ldc.i4.0 - IL_00b4: call !!0[0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Create(int32, + IL_00be: stsfld int32[0...,0...] assembly::a3@11 + IL_00c3: ldc.i4.3 + IL_00c4: ldc.i4.3 + IL_00c5: ldc.i4.3 + IL_00c6: ldc.i4.0 + IL_00c7: call !!0[0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Create(int32, int32, int32, !!0) - IL_00b9: stsfld int32[0...,0...,0...] assembly::array3D@12 - IL_00be: ldc.i4.4 - IL_00bf: ldc.i4.4 - IL_00c0: ldc.i4.4 - IL_00c1: ldc.i4.4 - IL_00c2: ldc.i4.0 - IL_00c3: call !!0[0...,0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Create(int32, + IL_00cc: stsfld int32[0...,0...,0...] assembly::array3D@12 + IL_00d1: ldc.i4.4 + IL_00d2: ldc.i4.4 + IL_00d3: ldc.i4.4 + IL_00d4: ldc.i4.4 + IL_00d5: ldc.i4.0 + IL_00d6: call !!0[0...,0...,0...,0...] [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Create(int32, int32, int32, int32, !!0) - IL_00c8: stsfld int32[0...,0...,0...,0...] assembly::array4D@13 - IL_00cd: call int32[] assembly::get_array() - IL_00d2: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfArray(!!0[]) - IL_00d7: pop - IL_00d8: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() - IL_00dd: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_00e2: pop - IL_00e3: call class [runtime]System.Tuple`2[] assembly::get_array1() - IL_00e8: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfArray(class [runtime]System.Tuple`2[]) - IL_00ed: pop - IL_00ee: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::get_list1() - IL_00f3: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>) - IL_00f8: pop - IL_00f9: call class [runtime]System.Collections.Generic.IEnumerable`1> assembly::get_seq1() - IL_00fe: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1>) - IL_0103: pop - IL_0104: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_alist() - IL_0109: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) - IL_010e: stsfld int32[] assembly::a1@25 - IL_0113: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() - IL_0118: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_011d: stsfld int32[] assembly::a2@26 - IL_0122: call int32[] assembly::get_a1() - IL_0127: ldc.i4.0 - IL_0128: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Get(!!0[], + IL_00db: stsfld int32[0...,0...,0...,0...] assembly::array4D@13 + IL_00e0: call int32[] assembly::get_array() + IL_00e5: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfArray(!!0[]) + IL_00ea: pop + IL_00eb: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() + IL_00f0: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.ListModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_00f5: pop + IL_00f6: call class [runtime]System.Tuple`2[] assembly::get_array1() + IL_00fb: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfArray(class [runtime]System.Tuple`2[]) + IL_0100: pop + IL_0101: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1> assembly::get_list1() + IL_0106: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>) + IL_010b: pop + IL_010c: call class [runtime]System.Collections.Generic.IEnumerable`1> assembly::get_seq1() + IL_0111: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpMap`2 [FSharp.Core]Microsoft.FSharp.Collections.MapModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1>) + IL_0116: pop + IL_0117: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 assembly::get_alist() + IL_011c: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfList(class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + IL_0121: stsfld int32[] assembly::a1@25 + IL_0126: call class [runtime]System.Collections.Generic.IEnumerable`1 assembly::get_aseq() + IL_012b: call !!0[] [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::OfSeq(class [runtime]System.Collections.Generic.IEnumerable`1) + IL_0130: stsfld int32[] assembly::a2@26 + IL_0135: call int32[] assembly::get_a1() + IL_013a: ldc.i4.0 + IL_013b: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Get(!!0[], int32) - IL_012d: stloc.0 - IL_012e: call int32[] assembly::get_a2() - IL_0133: ldc.i4.0 - IL_0134: ldloc.0 - IL_0135: call void [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Set(!!0[], + IL_0140: stloc.3 + IL_0141: call int32[] assembly::get_a2() + IL_0146: ldc.i4.0 + IL_0147: ldloc.3 + IL_0148: call void [FSharp.Core]Microsoft.FSharp.Collections.ArrayModule::Set(!!0[], int32, !!0) - IL_013a: nop - IL_013b: call int32[0...,0...] assembly::get_a3() - IL_0140: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length1(!!0[0...,0...]) - IL_0145: call int32[0...,0...] assembly::get_a3() - IL_014a: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length2(!!0[0...,0...]) - IL_014f: call int32[0...,0...] assembly::get_a3() - IL_0154: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base1(!!0[0...,0...]) - IL_0159: call int32[0...,0...] assembly::get_a3() - IL_015e: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base2(!!0[0...,0...]) - IL_0163: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, - !1, - !2, - !3) - IL_0168: stloc.1 - IL_0169: ldloc.1 - IL_016a: stloc.2 - IL_016b: call int32[0...,0...] assembly::get_a3() - IL_0170: ldc.i4.0 - IL_0171: ldc.i4.0 - IL_0172: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Get(!!0[0...,0...], + IL_014d: nop + IL_014e: call int32[0...,0...] assembly::get_a3() + IL_0153: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length1(!!0[0...,0...]) + IL_0158: call int32[0...,0...] assembly::get_a3() + IL_015d: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Length2(!!0[0...,0...]) + IL_0162: call int32[0...,0...] assembly::get_a3() + IL_0167: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base1(!!0[0...,0...]) + IL_016c: call int32[0...,0...] assembly::get_a3() + IL_0171: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Base2(!!0[0...,0...]) + IL_0176: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, + !1, + !2, + !3) + IL_017b: stloc.s V_4 + IL_017d: ldloc.s V_4 + IL_017f: stloc.s V_5 + IL_0181: call int32[0...,0...] assembly::get_a3() + IL_0186: ldc.i4.0 + IL_0187: ldc.i4.0 + IL_0188: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Get(!!0[0...,0...], int32, int32) - IL_0177: stloc.3 - IL_0178: call int32[0...,0...] assembly::get_a3() - IL_017d: ldc.i4.0 - IL_017e: ldc.i4.0 - IL_017f: ldloc.3 - IL_0180: call void [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Set(!!0[0...,0...], + IL_018d: stloc.s V_6 + IL_018f: call int32[0...,0...] assembly::get_a3() + IL_0194: ldc.i4.0 + IL_0195: ldc.i4.0 + IL_0196: ldloc.s V_6 + IL_0198: call void [FSharp.Core]Microsoft.FSharp.Collections.Array2DModule::Set(!!0[0...,0...], int32, int32, !!0) - IL_0185: nop - IL_0186: call int32[0...,0...,0...] assembly::get_array3D() - IL_018b: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length1(!!0[0...,0...,0...]) - IL_0190: call int32[0...,0...,0...] assembly::get_array3D() - IL_0195: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length2(!!0[0...,0...,0...]) - IL_019a: call int32[0...,0...,0...] assembly::get_array3D() - IL_019f: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length3(!!0[0...,0...,0...]) - IL_01a4: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, - !1, - !2) - IL_01a9: stloc.s V_4 - IL_01ab: ldloc.s V_4 - IL_01ad: stloc.s V_5 - IL_01af: call int32[0...,0...,0...] assembly::get_array3D() - IL_01b4: ldc.i4.0 - IL_01b5: ldc.i4.0 - IL_01b6: ldc.i4.0 - IL_01b7: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Get(!!0[0...,0...,0...], + IL_019d: nop + IL_019e: call int32[0...,0...,0...] assembly::get_array3D() + IL_01a3: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length1(!!0[0...,0...,0...]) + IL_01a8: call int32[0...,0...,0...] assembly::get_array3D() + IL_01ad: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length2(!!0[0...,0...,0...]) + IL_01b2: call int32[0...,0...,0...] assembly::get_array3D() + IL_01b7: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Length3(!!0[0...,0...,0...]) + IL_01bc: newobj instance void class [runtime]System.Tuple`3::.ctor(!0, + !1, + !2) + IL_01c1: stloc.s V_7 + IL_01c3: ldloc.s V_7 + IL_01c5: stloc.s V_8 + IL_01c7: call int32[0...,0...,0...] assembly::get_array3D() + IL_01cc: ldc.i4.0 + IL_01cd: ldc.i4.0 + IL_01ce: ldc.i4.0 + IL_01cf: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Get(!!0[0...,0...,0...], int32, int32, int32) - IL_01bc: stloc.s V_6 - IL_01be: call int32[0...,0...,0...] assembly::get_array3D() - IL_01c3: ldc.i4.0 - IL_01c4: ldc.i4.0 - IL_01c5: ldc.i4.0 - IL_01c6: ldloc.s V_6 - IL_01c8: call void [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Set(!!0[0...,0...,0...], + IL_01d4: stloc.s V_9 + IL_01d6: call int32[0...,0...,0...] assembly::get_array3D() + IL_01db: ldc.i4.0 + IL_01dc: ldc.i4.0 + IL_01dd: ldc.i4.0 + IL_01de: ldloc.s V_9 + IL_01e0: call void [FSharp.Core]Microsoft.FSharp.Collections.Array3DModule::Set(!!0[0...,0...,0...], int32, int32, int32, !!0) - IL_01cd: nop - IL_01ce: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_01d3: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length1(!!0[0...,0...,0...,0...]) - IL_01d8: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_01dd: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length2(!!0[0...,0...,0...,0...]) - IL_01e2: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_01e7: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length3(!!0[0...,0...,0...,0...]) - IL_01ec: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_01f1: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length4(!!0[0...,0...,0...,0...]) - IL_01f6: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, - !1, - !2, - !3) - IL_01fb: stloc.s V_7 - IL_01fd: ldloc.s V_7 - IL_01ff: stloc.s V_8 - IL_0201: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_0206: ldc.i4.0 - IL_0207: ldc.i4.0 - IL_0208: ldc.i4.0 - IL_0209: ldc.i4.0 - IL_020a: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Get(!!0[0...,0...,0...,0...], + IL_01e5: nop + IL_01e6: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_01eb: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length1(!!0[0...,0...,0...,0...]) + IL_01f0: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_01f5: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length2(!!0[0...,0...,0...,0...]) + IL_01fa: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_01ff: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length3(!!0[0...,0...,0...,0...]) + IL_0204: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_0209: call int32 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Length4(!!0[0...,0...,0...,0...]) + IL_020e: newobj instance void class [runtime]System.Tuple`4::.ctor(!0, + !1, + !2, + !3) + IL_0213: stloc.s V_10 + IL_0215: ldloc.s V_10 + IL_0217: stloc.s V_11 + IL_0219: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_021e: ldc.i4.0 + IL_021f: ldc.i4.0 + IL_0220: ldc.i4.0 + IL_0221: ldc.i4.0 + IL_0222: call !!0 [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Get(!!0[0...,0...,0...,0...], int32, int32, int32, int32) - IL_020f: stloc.s V_9 - IL_0211: call int32[0...,0...,0...,0...] assembly::get_array4D() - IL_0216: ldc.i4.0 - IL_0217: ldc.i4.0 - IL_0218: ldc.i4.0 - IL_0219: ldc.i4.0 - IL_021a: ldloc.s V_9 - IL_021c: call void [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Set(!!0[0...,0...,0...,0...], + IL_0227: stloc.s V_12 + IL_0229: call int32[0...,0...,0...,0...] assembly::get_array4D() + IL_022e: ldc.i4.0 + IL_022f: ldc.i4.0 + IL_0230: ldc.i4.0 + IL_0231: ldc.i4.0 + IL_0232: ldloc.s V_12 + IL_0234: call void [FSharp.Core]Microsoft.FSharp.Collections.Array4DModule::Set(!!0[0...,0...,0...,0...], int32, int32, int32, int32, !!0) - IL_0221: nop - IL_0222: ret + IL_0239: nop + IL_023a: ret } .property class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl index 214395fe6ad..8fd7c519810 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/ForLoop01.fs.RealInternalSignatureOn.il.bsl @@ -57,42 +57,64 @@ .method assembly specialname static void staticInitialization@() cil managed { - .maxstack 5 + .maxstack 4 .locals init (class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_0, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_1, - int32 V_2) - IL_0000: ldc.i4.1 - IL_0001: ldc.i4.1 - IL_0002: ldc.i4.3 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators::CreateSequence(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_000d: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 [FSharp.Core]Microsoft.FSharp.Collections.SeqModule::ToList(class [runtime]System.Collections.Generic.IEnumerable`1) - IL_0012: stloc.0 - IL_0013: ldloc.0 - IL_0014: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0019: stloc.1 - IL_001a: br.s IL_0042 - - IL_001c: ldloc.0 - IL_001d: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() - IL_0022: stloc.2 - IL_0023: ldstr "%A" - IL_0028: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_002d: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_0032: ldloc.2 - IL_0033: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0038: pop - IL_0039: ldloc.1 - IL_003a: stloc.0 - IL_003b: ldloc.0 - IL_003c: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() - IL_0041: stloc.1 - IL_0042: ldloc.1 - IL_0043: brtrue.s IL_001c - - IL_0045: ret + valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1 V_1, + uint64 V_2, + int32 V_3, + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 V_4, + int32 V_5) + IL_0000: ldc.i4.0 + IL_0001: conv.i8 + IL_0002: stloc.2 + IL_0003: ldc.i4.1 + IL_0004: stloc.3 + IL_0005: br.s IL_0019 + + IL_0007: ldloca.s V_1 + IL_0009: ldloc.3 + IL_000a: call instance void valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Add(!0) + IL_000f: nop + IL_0010: ldloc.3 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.3 + IL_0014: ldloc.2 + IL_0015: ldc.i4.1 + IL_0016: conv.i8 + IL_0017: add + IL_0018: stloc.2 + IL_0019: ldloc.2 + IL_001a: ldc.i4.3 + IL_001b: conv.i8 + IL_001c: blt.un.s IL_0007 + + IL_001e: ldloca.s V_1 + IL_0020: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 valuetype [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.ListCollector`1::Close() + IL_0025: stloc.0 + IL_0026: ldloc.0 + IL_0027: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_002c: stloc.s V_4 + IL_002e: br.s IL_005a + + IL_0030: ldloc.0 + IL_0031: call instance !0 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_HeadOrDefault() + IL_0036: stloc.s V_5 + IL_0038: ldstr "%A" + IL_003d: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) + IL_0042: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_0047: ldloc.s V_5 + IL_0049: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_004e: pop + IL_004f: ldloc.s V_4 + IL_0051: stloc.0 + IL_0052: ldloc.0 + IL_0053: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_TailOrNull() + IL_0058: stloc.s V_4 + IL_005a: ldloc.s V_4 + IL_005c: brtrue.s IL_0030 + + IL_005e: ret } } diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs index 5e8206137b1..3516864c122 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Misc/Misc.fs @@ -45,6 +45,7 @@ module Misc = let ``CodeGenRenamings01_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> asExe |> verifyCompilation @@ -116,6 +117,7 @@ module Misc = let ``ForLoop01_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> asExe |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs index 3b748e2be23..10346caac2a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionStepping.fs @@ -106,6 +106,7 @@ module SeqExpressionStepping = let ``SeqExpressionSteppingTest07_RealInternalSignatureOn_fs`` compilation = compilation |> withRealInternalSignatureOn + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation // SOURCE=SeqExpressionSteppingTest07.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd SeqExpressionSteppingTest7.exe" # SeqExpressionSteppingTest7.fs - @@ -113,4 +114,5 @@ module SeqExpressionStepping = let ``SeqExpressionSteppingTest07_RealInternalSignatureOff_fs`` compilation = compilation |> withRealInternalSignatureOff + |> withLangVersionPreview // TODO https://github.com/dotnet/fsharp/issues/16739: Remove this when LanguageFeature.LowerIntegralRangesToFastLoops is out of preview. |> verifyCompilation diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl index 86cc7e04485..155ad0265cc 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.net472.release.bsl @@ -419,113 +419,119 @@ int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0029 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldloc.1 - IL_002a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_002f: brtrue.s IL_0012 - - IL_0031: leave.s IL_0045 + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0034 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldloc.2 + IL_002c: ldc.i4.m1 + IL_002d: add + IL_002e: stloc.2 + IL_002f: ldloc.1 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: add + IL_0033: stloc.1 + IL_0034: ldloc.1 + IL_0035: ldloc.0 + IL_0036: blt.un.s IL_0019 - } - finally - { - IL_0033: ldloc.1 - IL_0034: isinst [runtime]System.IDisposable - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: brfalse.s IL_0044 - - IL_003d: ldloc.3 - IL_003e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0043: endfinally - IL_0044: endfinally - } - IL_0045: ret + IL_0038: ret } .method public static void testSimpleForEachIntRangeLoopDownWithTwoStatements(int32 start, int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0039 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldstr "{0}" - IL_002e: ldloc.2 - IL_002f: box [runtime]System.Int32 - IL_0034: call void [runtime]System.Console::WriteLine(string, - object) - IL_0039: ldloc.1 - IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_003f: brtrue.s IL_0012 - - IL_0041: leave.s IL_0055 - - } - finally - { - IL_0043: ldloc.1 - IL_0044: isinst [runtime]System.IDisposable - IL_0049: stloc.3 - IL_004a: ldloc.3 - IL_004b: brfalse.s IL_0054 - - IL_004d: ldloc.3 - IL_004e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0053: endfinally - IL_0054: endfinally - } - IL_0055: ret + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0044 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldstr "{0}" + IL_0030: ldloc.3 + IL_0031: box [runtime]System.Int32 + IL_0036: call void [runtime]System.Console::WriteLine(string, + object) + IL_003b: ldloc.2 + IL_003c: ldc.i4.m1 + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i4.1 + IL_0041: conv.i8 + IL_0042: add + IL_0043: stloc.1 + IL_0044: ldloc.1 + IL_0045: ldloc.0 + IL_0046: blt.un.s IL_0019 + + IL_0048: ret } .method public static void testSimpleForEachIntLoopWithOneStatement(int32 start, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl index bb5909fc008..3d78a971d68 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOff.il.netcore.release.bsl @@ -420,113 +420,119 @@ int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0029 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldloc.1 - IL_002a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_002f: brtrue.s IL_0012 - - IL_0031: leave.s IL_0045 + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0034 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldloc.2 + IL_002c: ldc.i4.m1 + IL_002d: add + IL_002e: stloc.2 + IL_002f: ldloc.1 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: add + IL_0033: stloc.1 + IL_0034: ldloc.1 + IL_0035: ldloc.0 + IL_0036: blt.un.s IL_0019 - } - finally - { - IL_0033: ldloc.1 - IL_0034: isinst [runtime]System.IDisposable - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: brfalse.s IL_0044 - - IL_003d: ldloc.3 - IL_003e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0043: endfinally - IL_0044: endfinally - } - IL_0045: ret + IL_0038: ret } .method public static void testSimpleForEachIntRangeLoopDownWithTwoStatements(int32 start, int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0039 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldstr "{0}" - IL_002e: ldloc.2 - IL_002f: box [runtime]System.Int32 - IL_0034: call void [runtime]System.Console::WriteLine(string, - object) - IL_0039: ldloc.1 - IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_003f: brtrue.s IL_0012 - - IL_0041: leave.s IL_0055 - - } - finally - { - IL_0043: ldloc.1 - IL_0044: isinst [runtime]System.IDisposable - IL_0049: stloc.3 - IL_004a: ldloc.3 - IL_004b: brfalse.s IL_0054 - - IL_004d: ldloc.3 - IL_004e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0053: endfinally - IL_0054: endfinally - } - IL_0055: ret + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0044 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldstr "{0}" + IL_0030: ldloc.3 + IL_0031: box [runtime]System.Int32 + IL_0036: call void [runtime]System.Console::WriteLine(string, + object) + IL_003b: ldloc.2 + IL_003c: ldc.i4.m1 + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i4.1 + IL_0041: conv.i8 + IL_0042: add + IL_0043: stloc.1 + IL_0044: ldloc.1 + IL_0045: ldloc.0 + IL_0046: blt.un.s IL_0019 + + IL_0048: ret } .method public static void testSimpleForEachIntLoopWithOneStatement(int32 start, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl index f0812837c64..66a9fd3e0d5 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.net472.release.bsl @@ -421,113 +421,119 @@ int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0029 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldloc.1 - IL_002a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_002f: brtrue.s IL_0012 - - IL_0031: leave.s IL_0045 + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0034 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldloc.2 + IL_002c: ldc.i4.m1 + IL_002d: add + IL_002e: stloc.2 + IL_002f: ldloc.1 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: add + IL_0033: stloc.1 + IL_0034: ldloc.1 + IL_0035: ldloc.0 + IL_0036: blt.un.s IL_0019 - } - finally - { - IL_0033: ldloc.1 - IL_0034: isinst [runtime]System.IDisposable - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: brfalse.s IL_0044 - - IL_003d: ldloc.3 - IL_003e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0043: endfinally - IL_0044: endfinally - } - IL_0045: ret + IL_0038: ret } .method public static void testSimpleForEachIntRangeLoopDownWithTwoStatements(int32 start, int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0039 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldstr "{0}" - IL_002e: ldloc.2 - IL_002f: box [runtime]System.Int32 - IL_0034: call void [runtime]System.Console::WriteLine(string, - object) - IL_0039: ldloc.1 - IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_003f: brtrue.s IL_0012 - - IL_0041: leave.s IL_0055 - - } - finally - { - IL_0043: ldloc.1 - IL_0044: isinst [runtime]System.IDisposable - IL_0049: stloc.3 - IL_004a: ldloc.3 - IL_004b: brfalse.s IL_0054 - - IL_004d: ldloc.3 - IL_004e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0053: endfinally - IL_0054: endfinally - } - IL_0055: ret + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0044 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldstr "{0}" + IL_0030: ldloc.3 + IL_0031: box [runtime]System.Int32 + IL_0036: call void [runtime]System.Console::WriteLine(string, + object) + IL_003b: ldloc.2 + IL_003c: ldc.i4.m1 + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i4.1 + IL_0041: conv.i8 + IL_0042: add + IL_0043: stloc.1 + IL_0044: ldloc.1 + IL_0045: ldloc.0 + IL_0046: blt.un.s IL_0019 + + IL_0048: ret } .method public static void testSimpleForEachIntLoopWithOneStatement(int32 start, diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl index e3eea368d57..9be862b2fd6 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/SeqExpressionStepping/SeqExpressionSteppingTest07.fs.RealInternalSignatureOn.il.netcore.release.bsl @@ -422,113 +422,119 @@ int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0029 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldloc.1 - IL_002a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_002f: brtrue.s IL_0012 - - IL_0031: leave.s IL_0045 + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0034 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldloc.2 + IL_002c: ldc.i4.m1 + IL_002d: add + IL_002e: stloc.2 + IL_002f: ldloc.1 + IL_0030: ldc.i4.1 + IL_0031: conv.i8 + IL_0032: add + IL_0033: stloc.1 + IL_0034: ldloc.1 + IL_0035: ldloc.0 + IL_0036: blt.un.s IL_0019 - } - finally - { - IL_0033: ldloc.1 - IL_0034: isinst [runtime]System.IDisposable - IL_0039: stloc.3 - IL_003a: ldloc.3 - IL_003b: brfalse.s IL_0044 - - IL_003d: ldloc.3 - IL_003e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0043: endfinally - IL_0044: endfinally - } - IL_0045: ret + IL_0038: ret } .method public static void testSimpleForEachIntRangeLoopDownWithTwoStatements(int32 start, int32 stop) cil managed { - .maxstack 5 - .locals init (class [runtime]System.Collections.Generic.IEnumerable`1 V_0, - class [runtime]System.Collections.Generic.IEnumerator`1 V_1, + .maxstack 4 + .locals init (uint64 V_0, + uint64 V_1, int32 V_2, - class [runtime]System.IDisposable V_3) + int32 V_3) IL_0000: ldarg.0 - IL_0001: ldc.i4.m1 - IL_0002: ldarg.1 - IL_0003: call class [runtime]System.Collections.Generic.IEnumerable`1 [FSharp.Core]Microsoft.FSharp.Core.Operators/OperatorIntrinsics::RangeInt32(int32, - int32, - int32) - IL_0008: stloc.0 - IL_0009: ldloc.0 - IL_000a: callvirt instance class [runtime]System.Collections.Generic.IEnumerator`1 class [runtime]System.Collections.Generic.IEnumerable`1::GetEnumerator() - IL_000f: stloc.1 - .try - { - IL_0010: br.s IL_0039 - - IL_0012: ldloc.1 - IL_0013: callvirt instance !0 class [runtime]System.Collections.Generic.IEnumerator`1::get_Current() - IL_0018: stloc.2 - IL_0019: ldstr "{0}" - IL_001e: ldloc.2 - IL_001f: box [runtime]System.Int32 - IL_0024: call void [runtime]System.Console::WriteLine(string, - object) - IL_0029: ldstr "{0}" - IL_002e: ldloc.2 - IL_002f: box [runtime]System.Int32 - IL_0034: call void [runtime]System.Console::WriteLine(string, - object) - IL_0039: ldloc.1 - IL_003a: callvirt instance bool [runtime]System.Collections.IEnumerator::MoveNext() - IL_003f: brtrue.s IL_0012 - - IL_0041: leave.s IL_0055 - - } - finally - { - IL_0043: ldloc.1 - IL_0044: isinst [runtime]System.IDisposable - IL_0049: stloc.3 - IL_004a: ldloc.3 - IL_004b: brfalse.s IL_0054 - - IL_004d: ldloc.3 - IL_004e: callvirt instance void [runtime]System.IDisposable::Dispose() - IL_0053: endfinally - IL_0054: endfinally - } - IL_0055: ret + IL_0001: ldarg.1 + IL_0002: bge.s IL_0009 + + IL_0004: ldc.i4.0 + IL_0005: conv.i8 + IL_0006: nop + IL_0007: br.s IL_0011 + + IL_0009: ldarg.0 + IL_000a: ldarg.1 + IL_000b: sub + IL_000c: conv.i8 + IL_000d: ldc.i4.1 + IL_000e: conv.i8 + IL_000f: add + IL_0010: nop + IL_0011: stloc.0 + IL_0012: ldc.i4.0 + IL_0013: conv.i8 + IL_0014: stloc.1 + IL_0015: ldarg.0 + IL_0016: stloc.2 + IL_0017: br.s IL_0044 + + IL_0019: ldloc.2 + IL_001a: stloc.3 + IL_001b: ldstr "{0}" + IL_0020: ldloc.3 + IL_0021: box [runtime]System.Int32 + IL_0026: call void [runtime]System.Console::WriteLine(string, + object) + IL_002b: ldstr "{0}" + IL_0030: ldloc.3 + IL_0031: box [runtime]System.Int32 + IL_0036: call void [runtime]System.Console::WriteLine(string, + object) + IL_003b: ldloc.2 + IL_003c: ldc.i4.m1 + IL_003d: add + IL_003e: stloc.2 + IL_003f: ldloc.1 + IL_0040: ldc.i4.1 + IL_0041: conv.i8 + IL_0042: add + IL_0043: stloc.1 + IL_0044: ldloc.1 + IL_0045: ldloc.0 + IL_0046: blt.un.s IL_0019 + + IL_0048: ret } .method public static void testSimpleForEachIntLoopWithOneStatement(int32 start, diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs index 50837863d5a..76bf2d3e88c 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/SuggestionsTests.fs @@ -139,12 +139,12 @@ open Collectons [] let ``Suggest Namespaces`` () = FSharp """ -open System.Collectons +open System.Lema """ |> typecheck |> shouldFail - |> withSingleDiagnostic (Error 39, Line 2, Col 13, Line 2, Col 23, - "The namespace 'Collectons' is not defined.") + |> withSingleDiagnostic (Error 39, Line 2, Col 13, Line 2, Col 17, + "The namespace 'Lema' is not defined.") [] let ``Suggest Record Labels`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index a6766d1ee64..1228aa221b2 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -19,7 +19,7 @@ $(DefineConstants);DEBUG true - true + true @@ -152,6 +152,7 @@ + @@ -228,9 +229,9 @@ - - - + + + @@ -280,7 +281,7 @@ - + @@ -313,12 +314,12 @@ - - %(RelativeDir)TestSource\%(Filename)%(Extension) - + + %(RelativeDir)TestSource\%(Filename)%(Extension) + %(RelativeDir)\BaseLine\%(Filename)%(Extension) @@ -329,6 +330,7 @@ + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs index 018f7419c97..b07b0d43999 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/PrimTypes.fs @@ -821,7 +821,9 @@ module internal RangeTestsHelpers = enumerator.Current |> ignore let inline exceptions zero one two = + Assert.Throws (typeof, (fun () -> {one .. zero .. two} |> Seq.length |> ignore)) |> ignore Assert.Throws (typeof, (fun () -> [one .. zero .. two] |> List.length |> ignore)) |> ignore + Assert.Throws (typeof, (fun () -> [|one .. zero .. two|] |> Array.length |> ignore)) |> ignore Assert.Throws (typeof, (fun () -> regressionExceptionBeforeStartSingleStepRangeEnumerator zero one)) |> ignore Assert.Throws (typeof, (fun () -> regressionExceptionBeforeStartVariableStepIntegralRange zero two)) |> ignore @@ -829,31 +831,65 @@ module internal RangeTestsHelpers = Assert.Throws (typeof, (fun () -> regressionExceptionAfterEndVariableStepIntegralRange zero two)) |> ignore let inline common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three) = + Assert.AreEqual ({min0 .. min3}, seq {yield min0; yield min1; yield min2; yield min3}) + Assert.AreEqual ({min0 .. one .. min3}, seq {min0; min1; min2; min3}) + Assert.AreEqual ({min0 .. two .. min3}, seq {min0; min2}) + Assert.AreEqual ({min0 .. three .. min3}, seq {min0; min3}) + Assert.AreEqual ([min0 .. min3], [min0; min1; min2; min3]) Assert.AreEqual ([min0 .. one .. min3], [min0; min1; min2; min3]) Assert.AreEqual ([min0 .. two .. min3], [min0; min2]) Assert.AreEqual ([min0 .. three .. min3], [min0; min3]) + Assert.AreEqual ([|min0 .. min3|], [|min0; min1; min2; min3|]) + Assert.AreEqual ([|min0 .. one .. min3|], [|min0; min1; min2; min3|]) + Assert.AreEqual ([|min0 .. two .. min3|], [|min0; min2|]) + Assert.AreEqual ([|min0 .. three .. min3|], [|min0; min3|]) + + Assert.AreEqual ({max3 .. max0}, seq {yield max3; yield max2; yield max1; yield max0}) + Assert.AreEqual ({max3 .. one .. max0}, seq {max3; max2; max1; max0}) + Assert.AreEqual ({max3 .. two .. max0}, seq {max3; max1}) + Assert.AreEqual ({max3 .. three .. max0}, seq {max3; max0}) + Assert.AreEqual ([max3 .. max0], [max3; max2; max1; max0]) Assert.AreEqual ([max3 .. one .. max0], [max3; max2; max1; max0]) Assert.AreEqual ([max3 .. two .. max0], [max3; max1]) Assert.AreEqual ([max3 .. three .. max0], [max3; max0]) + Assert.AreEqual ([|max3 .. max0|], [|max3; max2; max1; max0|]) + Assert.AreEqual ([|max3 .. one .. max0|], [|max3; max2; max1; max0|]) + Assert.AreEqual ([|max3 .. two .. max0|], [|max3; max1|]) + Assert.AreEqual ([|max3 .. three .. max0|], [|max3; max0|]) + + Assert.AreEqual ({max0 .. min0}, Seq.empty) + Assert.AreEqual ({max0 .. one .. min0}, Seq.empty) + Assert.AreEqual ({max0 .. two .. min0}, Seq.empty) + Assert.AreEqual ({max0 .. three .. min0}, Seq.empty) + Assert.AreEqual ([max0 .. min0], []) Assert.AreEqual ([max0 .. one .. min0], []) Assert.AreEqual ([max0 .. two .. min0], []) Assert.AreEqual ([max0 .. three .. min0], []) + Assert.AreEqual ([|max0 .. min0|], [||]) + Assert.AreEqual ([|max0 .. one .. min0|], [||]) + Assert.AreEqual ([|max0 .. two .. min0|], [||]) + Assert.AreEqual ([|max0 .. three .. min0|], [||]) + exceptions zero one two // tests for singleStepRangeEnumerator, as it only is used if start and/or end are not the // minimum or maximum of the number range and it is counting by 1s + Assert.AreEqual ({min1 .. min3}, seq {min1; min2; min3}) + Assert.AreEqual ({max3 .. max1}, seq {max3; max2; max1}) + Assert.AreEqual ([min1 .. min3], [min1; min2; min3]) Assert.AreEqual ([max3 .. max1], [max3; max2; max1]) - let inline signed min0 max0 = - let zero = LanguagePrimitives.GenericZero - let one = LanguagePrimitives.GenericOne + Assert.AreEqual ([|min1 .. min3|], [|min1; min2; min3|]) + Assert.AreEqual ([|max3 .. max1|], [|max3; max2; max1|]) + + let inline signed zero one min0 max0 = let two = one + one let three = two + one @@ -867,31 +903,73 @@ module internal RangeTestsHelpers = common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three) + Assert.AreEqual ({min0 .. max0 .. max0}, seq { min0; min0 + max0; min0 + max0 + max0 }) + Assert.AreEqual ({min0 .. max1 .. max0}, seq { min0; min0 + max1; min0 + max1 + max1 }) + Assert.AreEqual ({min0 .. max2 .. max0}, seq { min0; min0 + max2; min0 + max2 + max2 }) + Assert.AreEqual ({min0 .. max3 .. max0}, seq { min0; min0 + max3; min0 + max3 + max3 }) + Assert.AreEqual ([min0 .. max0 .. max0], [ min0; min0 + max0; min0 + max0 + max0 ]) Assert.AreEqual ([min0 .. max1 .. max0], [ min0; min0 + max1; min0 + max1 + max1 ]) Assert.AreEqual ([min0 .. max2 .. max0], [ min0; min0 + max2; min0 + max2 + max2 ]) Assert.AreEqual ([min0 .. max3 .. max0], [ min0; min0 + max3; min0 + max3 + max3 ]) + Assert.AreEqual ([|min0 .. max0 .. max0|], [| min0; min0 + max0; min0 + max0 + max0 |]) + Assert.AreEqual ([|min0 .. max1 .. max0|], [| min0; min0 + max1; min0 + max1 + max1 |]) + Assert.AreEqual ([|min0 .. max2 .. max0|], [| min0; min0 + max2; min0 + max2 + max2 |]) + Assert.AreEqual ([|min0 .. max3 .. max0|], [| min0; min0 + max3; min0 + max3 + max3 |]) + + Assert.AreEqual ({min3 .. -one .. min0}, seq {min3; min2; min1; min0}) + Assert.AreEqual ({min3 .. -two .. min0}, seq {min3; min1}) + Assert.AreEqual ({min3 .. -three .. min0}, seq {min3; min0}) + Assert.AreEqual ([min3 .. -one .. min0], [min3; min2; min1; min0]) Assert.AreEqual ([min3 .. -two .. min0], [min3; min1]) Assert.AreEqual ([min3 .. -three .. min0], [min3; min0]) + Assert.AreEqual ([|min3 .. -one .. min0|], [|min3; min2; min1; min0|]) + Assert.AreEqual ([|min3 .. -two .. min0|], [|min3; min1|]) + Assert.AreEqual ([|min3 .. -three .. min0|], [|min3; min0|]) + + Assert.AreEqual ({max0 .. -one .. max3}, seq {max0; max1; max2; max3}) + Assert.AreEqual ({max0 .. -two .. max3}, seq {max0; max2}) + Assert.AreEqual ({max0 .. -three .. max3}, seq {max0; max3}) + Assert.AreEqual ([max0 .. -one .. max3], [max0; max1; max2; max3]) Assert.AreEqual ([max0 .. -two .. max3], [max0; max2]) Assert.AreEqual ([max0 .. -three .. max3], [max0; max3]) + Assert.AreEqual ([|max0 .. -one .. max3|], [|max0; max1; max2; max3|]) + Assert.AreEqual ([|max0 .. -two .. max3|], [|max0; max2|]) + Assert.AreEqual ([|max0 .. -three .. max3|], [|max0; max3|]) + + Assert.AreEqual ({min0 .. -one .. max0}, Seq.empty) + Assert.AreEqual ({min0 .. -two .. max0}, Seq.empty) + Assert.AreEqual ({min0 .. -three .. max0}, Seq.empty) + Assert.AreEqual ([min0 .. -one .. max0], []) Assert.AreEqual ([min0 .. -two .. max0], []) Assert.AreEqual ([min0 .. -three .. max0], []) + Assert.AreEqual ([|min0 .. -one .. max0|], [||]) + Assert.AreEqual ([|min0 .. -two .. max0|], [||]) + Assert.AreEqual ([|min0 .. -three .. max0|], [||]) + + Assert.AreEqual ({max0 .. min0 .. min0}, seq {max0; max0 + min0}) + Assert.AreEqual ({max0 .. min1 .. min0}, seq {max0; max0 + min1; max0 + min1 + min1 }) + Assert.AreEqual ({max0 .. min2 .. min0}, seq {max0; max0 + min2; max0 + min2 + min2 }) + Assert.AreEqual ({max0 .. min3 .. min0}, seq {max0; max0 + min3; max0 + min3 + min3 }) + Assert.AreEqual ([max0 .. min0 .. min0], [max0; max0 + min0]) Assert.AreEqual ([max0 .. min1 .. min0], [max0; max0 + min1; max0 + min1 + min1 ]) Assert.AreEqual ([max0 .. min2 .. min0], [max0; max0 + min2; max0 + min2 + min2 ]) Assert.AreEqual ([max0 .. min3 .. min0], [max0; max0 + min3; max0 + min3 + min3 ]) - let inline unsigned min0 max0 = - let zero = LanguagePrimitives.GenericZero - let one = LanguagePrimitives.GenericOne + Assert.AreEqual ([|max0 .. min0 .. min0|], [|max0; max0 + min0|]) + Assert.AreEqual ([|max0 .. min1 .. min0|], [|max0; max0 + min1; max0 + min1 + min1 |]) + Assert.AreEqual ([|max0 .. min2 .. min0|], [|max0; max0 + min2; max0 + min2 + min2 |]) + Assert.AreEqual ([|max0 .. min3 .. min0|], [|max0; max0 + min3; max0 + min3 + min3 |]) + + let inline unsigned zero one min0 max0 = let two = one + one let three = two + one @@ -905,32 +983,238 @@ module internal RangeTestsHelpers = common (min0, min1, min2, min3) (max0, max1, max2, max3) (zero, one, two, three) + Assert.AreEqual ({min0 .. max0 .. max0}, seq {yield min0; yield min0 + max0}) + Assert.AreEqual ({min0 .. max1 .. max0}, seq {min0; min0 + max1}) + Assert.AreEqual ({min0 .. max2 .. max0}, seq {min0; min0 + max2}) + Assert.AreEqual ({min0 .. max3 .. max0}, seq {min0; min0 + max3}) + Assert.AreEqual ([min0 .. max0 .. max0], [min0; min0 + max0]) Assert.AreEqual ([min0 .. max1 .. max0], [min0; min0 + max1]) Assert.AreEqual ([min0 .. max2 .. max0], [min0; min0 + max2]) Assert.AreEqual ([min0 .. max3 .. max0], [min0; min0 + max3]) + Assert.AreEqual ([|min0 .. max0 .. max0|], [|min0; min0 + max0|]) + Assert.AreEqual ([|min0 .. max1 .. max0|], [|min0; min0 + max1|]) + Assert.AreEqual ([|min0 .. max2 .. max0|], [|min0; min0 + max2|]) + Assert.AreEqual ([|min0 .. max3 .. max0|], [|min0; min0 + max3|]) + +// Note to future contributors: if the code gen for ranges is not correct, +// some of these tests may loop forever or use up all available memory instead of failing outright. +module RangeTests = + /// [|Byte.MinValue..Byte.MaxValue|] + let allBytesArray = + [| + 0x00uy; 0x01uy; 0x02uy; 0x03uy; 0x04uy; 0x05uy; 0x06uy; 0x07uy; 0x08uy; 0x09uy; 0x0auy; 0x0buy; 0x0cuy; 0x0duy; 0x0euy; 0x0fuy + 0x10uy; 0x11uy; 0x12uy; 0x13uy; 0x14uy; 0x15uy; 0x16uy; 0x17uy; 0x18uy; 0x19uy; 0x1auy; 0x1buy; 0x1cuy; 0x1duy; 0x1euy; 0x1fuy + 0x20uy; 0x21uy; 0x22uy; 0x23uy; 0x24uy; 0x25uy; 0x26uy; 0x27uy; 0x28uy; 0x29uy; 0x2auy; 0x2buy; 0x2cuy; 0x2duy; 0x2euy; 0x2fuy + 0x30uy; 0x31uy; 0x32uy; 0x33uy; 0x34uy; 0x35uy; 0x36uy; 0x37uy; 0x38uy; 0x39uy; 0x3auy; 0x3buy; 0x3cuy; 0x3duy; 0x3euy; 0x3fuy + 0x40uy; 0x41uy; 0x42uy; 0x43uy; 0x44uy; 0x45uy; 0x46uy; 0x47uy; 0x48uy; 0x49uy; 0x4auy; 0x4buy; 0x4cuy; 0x4duy; 0x4euy; 0x4fuy + 0x50uy; 0x51uy; 0x52uy; 0x53uy; 0x54uy; 0x55uy; 0x56uy; 0x57uy; 0x58uy; 0x59uy; 0x5auy; 0x5buy; 0x5cuy; 0x5duy; 0x5euy; 0x5fuy + 0x60uy; 0x61uy; 0x62uy; 0x63uy; 0x64uy; 0x65uy; 0x66uy; 0x67uy; 0x68uy; 0x69uy; 0x6auy; 0x6buy; 0x6cuy; 0x6duy; 0x6euy; 0x6fuy + 0x70uy; 0x71uy; 0x72uy; 0x73uy; 0x74uy; 0x75uy; 0x76uy; 0x77uy; 0x78uy; 0x79uy; 0x7auy; 0x7buy; 0x7cuy; 0x7duy; 0x7euy; 0x7fuy + 0x80uy; 0x81uy; 0x82uy; 0x83uy; 0x84uy; 0x85uy; 0x86uy; 0x87uy; 0x88uy; 0x89uy; 0x8auy; 0x8buy; 0x8cuy; 0x8duy; 0x8euy; 0x8fuy + 0x90uy; 0x91uy; 0x92uy; 0x93uy; 0x94uy; 0x95uy; 0x96uy; 0x97uy; 0x98uy; 0x99uy; 0x9auy; 0x9buy; 0x9cuy; 0x9duy; 0x9euy; 0x9fuy + 0xa0uy; 0xa1uy; 0xa2uy; 0xa3uy; 0xa4uy; 0xa5uy; 0xa6uy; 0xa7uy; 0xa8uy; 0xa9uy; 0xaauy; 0xabuy; 0xacuy; 0xaduy; 0xaeuy; 0xafuy + 0xb0uy; 0xb1uy; 0xb2uy; 0xb3uy; 0xb4uy; 0xb5uy; 0xb6uy; 0xb7uy; 0xb8uy; 0xb9uy; 0xbauy; 0xbbuy; 0xbcuy; 0xbduy; 0xbeuy; 0xbfuy + 0xc0uy; 0xc1uy; 0xc2uy; 0xc3uy; 0xc4uy; 0xc5uy; 0xc6uy; 0xc7uy; 0xc8uy; 0xc9uy; 0xcauy; 0xcbuy; 0xccuy; 0xcduy; 0xceuy; 0xcfuy + 0xd0uy; 0xd1uy; 0xd2uy; 0xd3uy; 0xd4uy; 0xd5uy; 0xd6uy; 0xd7uy; 0xd8uy; 0xd9uy; 0xdauy; 0xdbuy; 0xdcuy; 0xdduy; 0xdeuy; 0xdfuy + 0xe0uy; 0xe1uy; 0xe2uy; 0xe3uy; 0xe4uy; 0xe5uy; 0xe6uy; 0xe7uy; 0xe8uy; 0xe9uy; 0xeauy; 0xebuy; 0xecuy; 0xeduy; 0xeeuy; 0xefuy + 0xf0uy; 0xf1uy; 0xf2uy; 0xf3uy; 0xf4uy; 0xf5uy; 0xf6uy; 0xf7uy; 0xf8uy; 0xf9uy; 0xfauy; 0xfbuy; 0xfcuy; 0xfduy; 0xfeuy; 0xffuy + |] + + /// [Byte.MinValue..Byte.MaxValue] + let allBytesList = List.ofArray allBytesArray + + /// {Byte.MinValue..Byte.MaxValue} + let allBytesSeq = Seq.ofArray allBytesArray + + /// [|SByte.MinValue..SByte.MaxValue|] + let allSBytesArray = + [| + 0x80y; 0x81y; 0x82y; 0x83y; 0x84y; 0x85y; 0x86y; 0x87y; 0x88y; 0x89y; 0x8ay; 0x8by; 0x8cy; 0x8dy; 0x8ey; 0x8fy + 0x90y; 0x91y; 0x92y; 0x93y; 0x94y; 0x95y; 0x96y; 0x97y; 0x98y; 0x99y; 0x9ay; 0x9by; 0x9cy; 0x9dy; 0x9ey; 0x9fy + 0xa0y; 0xa1y; 0xa2y; 0xa3y; 0xa4y; 0xa5y; 0xa6y; 0xa7y; 0xa8y; 0xa9y; 0xaay; 0xaby; 0xacy; 0xady; 0xaey; 0xafy + 0xb0y; 0xb1y; 0xb2y; 0xb3y; 0xb4y; 0xb5y; 0xb6y; 0xb7y; 0xb8y; 0xb9y; 0xbay; 0xbby; 0xbcy; 0xbdy; 0xbey; 0xbfy + 0xc0y; 0xc1y; 0xc2y; 0xc3y; 0xc4y; 0xc5y; 0xc6y; 0xc7y; 0xc8y; 0xc9y; 0xcay; 0xcby; 0xccy; 0xcdy; 0xcey; 0xcfy + 0xd0y; 0xd1y; 0xd2y; 0xd3y; 0xd4y; 0xd5y; 0xd6y; 0xd7y; 0xd8y; 0xd9y; 0xday; 0xdby; 0xdcy; 0xddy; 0xdey; 0xdfy + 0xe0y; 0xe1y; 0xe2y; 0xe3y; 0xe4y; 0xe5y; 0xe6y; 0xe7y; 0xe8y; 0xe9y; 0xeay; 0xeby; 0xecy; 0xedy; 0xeey; 0xefy + 0xf0y; 0xf1y; 0xf2y; 0xf3y; 0xf4y; 0xf5y; 0xf6y; 0xf7y; 0xf8y; 0xf9y; 0xfay; 0xfby; 0xfcy; 0xfdy; 0xfey; 0xffy + 0x00y; 0x01y; 0x02y; 0x03y; 0x04y; 0x05y; 0x06y; 0x07y; 0x08y; 0x09y; 0x0ay; 0x0by; 0x0cy; 0x0dy; 0x0ey; 0x0fy + 0x10y; 0x11y; 0x12y; 0x13y; 0x14y; 0x15y; 0x16y; 0x17y; 0x18y; 0x19y; 0x1ay; 0x1by; 0x1cy; 0x1dy; 0x1ey; 0x1fy + 0x20y; 0x21y; 0x22y; 0x23y; 0x24y; 0x25y; 0x26y; 0x27y; 0x28y; 0x29y; 0x2ay; 0x2by; 0x2cy; 0x2dy; 0x2ey; 0x2fy + 0x30y; 0x31y; 0x32y; 0x33y; 0x34y; 0x35y; 0x36y; 0x37y; 0x38y; 0x39y; 0x3ay; 0x3by; 0x3cy; 0x3dy; 0x3ey; 0x3fy + 0x40y; 0x41y; 0x42y; 0x43y; 0x44y; 0x45y; 0x46y; 0x47y; 0x48y; 0x49y; 0x4ay; 0x4by; 0x4cy; 0x4dy; 0x4ey; 0x4fy + 0x50y; 0x51y; 0x52y; 0x53y; 0x54y; 0x55y; 0x56y; 0x57y; 0x58y; 0x59y; 0x5ay; 0x5by; 0x5cy; 0x5dy; 0x5ey; 0x5fy + 0x60y; 0x61y; 0x62y; 0x63y; 0x64y; 0x65y; 0x66y; 0x67y; 0x68y; 0x69y; 0x6ay; 0x6by; 0x6cy; 0x6dy; 0x6ey; 0x6fy + 0x70y; 0x71y; 0x72y; 0x73y; 0x74y; 0x75y; 0x76y; 0x77y; 0x78y; 0x79y; 0x7ay; 0x7by; 0x7cy; 0x7dy; 0x7ey; 0x7fy + |] + + /// [SByte.MinValue..SByte.MaxValue] + let allSBytesList = List.ofArray allSBytesArray + + /// {SByte.MinValue..SByte.MaxValue} + let allSBytesSeq = Seq.ofArray allSBytesArray + + /// These tests' constant arguments are inlined, + /// and the size of the collection (for lists and arrays) or count (for for-loops) is computed at build-time. + module BuildTime = + [] + let ``Range.SByte`` () = + Assert.AreEqual(256, let mutable c = 0 in for _ in System.SByte.MinValue..System.SByte.MaxValue do c <- c + 1 done; c) + Assert.AreEqual(256, let mutable c = 0 in for _ in System.SByte.MinValue..1y..System.SByte.MaxValue do c <- c + 1 done; c) + Assert.AreEqual(256, let mutable c = 0 in for _ in System.SByte.MaxValue .. -1y .. System.SByte.MinValue do c <- c + 1 done; c) + + Assert.AreEqual(allSBytesSeq, {System.SByte.MinValue..System.SByte.MaxValue}) + Assert.AreEqual(allSBytesList, [System.SByte.MinValue..System.SByte.MaxValue]) + Assert.AreEqual(allSBytesArray, [|System.SByte.MinValue..System.SByte.MaxValue|]) + + Assert.AreEqual(allSBytesSeq, {System.SByte.MinValue..1y..System.SByte.MaxValue}) + Assert.AreEqual(allSBytesList, [System.SByte.MinValue..1y..System.SByte.MaxValue]) + Assert.AreEqual(allSBytesArray, [|System.SByte.MinValue..1y..System.SByte.MaxValue|]) + + Assert.AreEqual(Seq.rev allSBytesSeq, {System.SByte.MaxValue .. -1y .. System.SByte.MinValue}) + Assert.AreEqual(List.rev allSBytesList, [System.SByte.MaxValue .. -1y .. System.SByte.MinValue]) + Assert.AreEqual(Array.rev allSBytesArray, [|System.SByte.MaxValue .. -1y .. System.SByte.MinValue|]) + + RangeTestsHelpers.signed 0y 1y System.SByte.MinValue System.SByte.MaxValue + + [] + let ``Range.Byte`` () = + Assert.AreEqual(256, let mutable c = 0 in for _ in System.Byte.MinValue..System.Byte.MaxValue do c <- c + 1 done; c) + Assert.AreEqual(256, let mutable c = 0 in for _ in System.Byte.MinValue..1uy..System.Byte.MaxValue do c <- c + 1 done; c) + + Assert.AreEqual(allBytesSeq, {System.Byte.MinValue..System.Byte.MaxValue}) + Assert.AreEqual(allBytesList, [System.Byte.MinValue..System.Byte.MaxValue]) + Assert.AreEqual(allBytesArray, [|System.Byte.MinValue..System.Byte.MaxValue|]) + + Assert.AreEqual(allBytesSeq, {System.Byte.MinValue..1uy..System.Byte.MaxValue}) + Assert.AreEqual(allBytesList, [System.Byte.MinValue..1uy..System.Byte.MaxValue]) + Assert.AreEqual(allBytesArray, [|System.Byte.MinValue..1uy..System.Byte.MaxValue|]) + + RangeTestsHelpers.unsigned 0uy 1uy System.Byte.MinValue System.Byte.MaxValue + + //// Note: the IEnumerable range iterator doesn't currently pass these tests. Should it? + //[] + //let ``Range.Char`` () = RangeTestsHelpers.unsigned '\000' '\001' System.Char.MinValue System.Char.MaxValue + + [] + let ``Range.Int16`` () = RangeTestsHelpers.signed 0s 1s System.Int16.MinValue System.Int16.MaxValue + + [] + let ``Range.UInt16`` () = RangeTestsHelpers.unsigned 0us 1us System.UInt16.MinValue System.UInt16.MaxValue + + [] + let ``Range.Int32`` () = RangeTestsHelpers.signed 0 1 System.Int32.MinValue System.Int32.MaxValue + + [] + let ``Range.UInt32`` () = RangeTestsHelpers.unsigned 0u 1u System.UInt32.MinValue System.UInt32.MaxValue + + [] + let ``Range.Int64`` () = RangeTestsHelpers.signed 0L 1L System.Int64.MinValue System.Int64.MaxValue + + [] + let ``Range.UInt64`` () = RangeTestsHelpers.unsigned 0UL 1UL System.UInt64.MinValue System.UInt64.MaxValue + + [] + let ``Range.IntPtr`` () = + // 0x80000000n is negative on x86, but would be positive on x64. + if System.IntPtr.Size = 4 then + RangeTestsHelpers.signed 0x0n 0x1n 0x80000000n 0x7fffffffn + + if System.IntPtr.Size = 8 then + RangeTestsHelpers.signed 0x0n 0x1n 0x8000000000000000n 0x7fffffffffffffffn + + [] + let ``Range.UIntPtr`` () = + if System.UIntPtr.Size >= 4 then + RangeTestsHelpers.unsigned 0x0un 0x1un 0x0un 0xffffffffun + + if System.UIntPtr.Size >= 8 then + RangeTestsHelpers.unsigned 0x0un 0x1un 0x0un 0xffffffffffffffffun + + /// These tests' arguments are intentionally _not_ inlined + /// to force the size of the collection (for lists and arrays) or count (for for-loops) to be computed at runtime. + module Runtime = + [] + let ``Range.SByte`` (zero: sbyte) (one: sbyte) (min0: sbyte) (max0: sbyte) = + Assert.AreEqual(256, let mutable c = 0 in for _ in min0..max0 do c <- c + 1 done; c) + Assert.AreEqual(256, let mutable c = 0 in for _ in min0..one..max0 do c <- c + 1 done; c) + Assert.AreEqual(256, let mutable c = 0 in for _ in max0 .. -one .. min0 do c <- c + 1 done; c) + + Assert.AreEqual(allSBytesSeq, {min0..max0}) + Assert.AreEqual(allSBytesList, [min0..max0]) + Assert.AreEqual(allSBytesArray, [|min0..max0|]) + + Assert.AreEqual(allSBytesSeq, {min0..one..max0}) + Assert.AreEqual(allSBytesList, [min0..one..max0]) + Assert.AreEqual(allSBytesArray, [|min0..one..max0|]) -type RangeTests() = - [] member _.``Range.SByte`` () = RangeTestsHelpers.signed System.SByte.MinValue System.SByte.MaxValue - [] member _.``Range.Byte`` () = RangeTestsHelpers.unsigned System.Byte.MinValue System.Byte.MaxValue - [] member _.``Range.Int16`` () = RangeTestsHelpers.signed System.Int16.MinValue System.Int16.MaxValue - [] member _.``Range.UInt16`` () = RangeTestsHelpers.unsigned System.UInt16.MinValue System.UInt16.MaxValue - [] member _.``Range.Int32`` () = RangeTestsHelpers.signed System.Int32.MinValue System.Int32.MaxValue - [] member _.``Range.UInt32`` () = RangeTestsHelpers.unsigned System.UInt32.MinValue System.UInt32.MaxValue - [] member _.``Range.Int64`` () = RangeTestsHelpers.signed System.Int64.MinValue System.Int64.MaxValue - [] member _.``Range.UInt64`` () = RangeTestsHelpers.unsigned System.UInt64.MinValue System.UInt64.MaxValue + Assert.AreEqual(Seq.rev allSBytesSeq, {max0 .. -one .. min0}) + Assert.AreEqual(List.rev allSBytesList, [max0 .. -one .. min0]) + Assert.AreEqual(Array.rev allSBytesArray, [|max0 .. -one .. min0|]) + + RangeTestsHelpers.signed zero one min0 max0 + + [] + let ``Range.Byte`` (zero: byte) (one: byte) (min0: byte) (max0: byte) = + Assert.AreEqual(256, let mutable c = 0 in for _ in min0..max0 do c <- c + 1 done; c) + Assert.AreEqual(256, let mutable c = 0 in for _ in min0..one..max0 do c <- c + 1 done; c) + + Assert.AreEqual(allBytesSeq, {min0..max0}) + Assert.AreEqual(allBytesList, [min0..max0]) + Assert.AreEqual(allBytesArray, [|min0..max0|]) - [] - member _.``Range.IntPtr`` () = - if System.IntPtr.Size >= 4 then RangeTestsHelpers.signed (System.IntPtr System.Int32.MinValue) (System.IntPtr System.Int32.MaxValue) - if System.IntPtr.Size >= 8 then RangeTestsHelpers.signed (System.IntPtr System.Int64.MinValue) (System.IntPtr System.Int64.MaxValue) - - [] - member _.``Range.UIntPtr`` () = - if System.UIntPtr.Size >= 4 then RangeTestsHelpers.unsigned (System.UIntPtr System.UInt32.MinValue) (System.UIntPtr System.UInt32.MaxValue) - if System.UIntPtr.Size >= 8 then RangeTestsHelpers.unsigned (System.UIntPtr System.UInt64.MinValue) (System.UIntPtr System.UInt64.MaxValue) - + Assert.AreEqual(allBytesSeq, {min0..one..max0}) + Assert.AreEqual(allBytesList, [min0..one..max0]) + Assert.AreEqual(allBytesArray, [|min0..one..max0|]) + + RangeTestsHelpers.unsigned zero one min0 max0 + + //// Note: the IEnumerable range iterator doesn't currently pass these tests. Should it? + //[] + //let ``Range.Char`` (zero: char) (one: char) (min0: char) (max0: char) = RangeTestsHelpers.unsigned zero one min0 max0 + + [] + let ``Range.Int16`` (zero: int16) (one: int16) (min0: int16) (max0: int16) = RangeTestsHelpers.signed zero one min0 max0 + + [] + let ``Range.UInt16`` (zero: uint16) (one: uint16) (min0: uint16) (max0: uint16) = RangeTestsHelpers.unsigned zero one min0 max0 + + [] + let ``Range.Int32`` (zero: int) (one: int) (min0: int) (max0: int) = RangeTestsHelpers.signed zero one min0 max0 + + [] + let ``Range.UInt32`` (zero: uint) (one: uint) (min0: uint) (max0: uint) = RangeTestsHelpers.unsigned zero one min0 max0 + + [] + let ``Range.Int64`` (zero: int64) (one: int64) (min0: int64) (max0: int64) = + RangeTestsHelpers.signed zero one min0 max0 + + [] + let ``Range.UInt64`` (zero: uint64) (one: uint64) (min0: uint64) (max0: uint64) = + RangeTestsHelpers.unsigned zero one min0 max0 + + [] + let ``Range.IntPtr`` () = + // The arguments here aren't being passed in as constants, so it doesn't matter if they're inlined. + if System.IntPtr.Size = 4 then + let zero, one, min0, max0 = System.IntPtr 0, System.IntPtr 1, System.IntPtr System.Int32.MinValue, System.IntPtr System.Int32.MaxValue + RangeTestsHelpers.signed zero one min0 max0 + + if System.IntPtr.Size = 8 then + let zero, one, min0, max0 = System.IntPtr 0, System.IntPtr 1, System.IntPtr System.Int64.MinValue, System.IntPtr System.Int64.MaxValue + RangeTestsHelpers.signed zero one min0 max0 + + [] + let ``Range.UIntPtr`` () = + // The arguments here aren't being passed in as constants, so it doesn't matter if they're inlined. + if System.UIntPtr.Size >= 4 then + let zero, one, min0, max0 = System.UIntPtr 0u, System.UIntPtr 1u, System.UIntPtr System.UInt32.MinValue, System.UIntPtr System.UInt32.MaxValue + RangeTestsHelpers.unsigned zero one min0 max0 + + if System.UIntPtr.Size >= 8 then + let zero, one, min0, max0 = System.UIntPtr 0u, System.UIntPtr 1u, System.UIntPtr System.UInt64.MinValue, System.UIntPtr System.UInt64.MaxValue + RangeTestsHelpers.unsigned zero one min0 max0 open NonStructuralComparison diff --git a/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs b/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs index 32ca65bfe73..d5fe22cc3b3 100644 --- a/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs +++ b/tests/FSharp.Core.UnitTests/TestFrameworkHelpers.fs @@ -49,7 +49,7 @@ module private Impl = | :? seq as seq -> seq |> Seq.toArray :>obj | :? seq as seq -> seq |> Seq.toArray :>obj | :? seq as seq -> seq |> Seq.toArray :>obj - | :? seq as seq -> Enumerable.ToArray(seq) :>obj + | :? seq as seq -> seq |> Seq.toArray :> obj | :? seq as seq -> seq |> Seq.toArray :>obj | :? seq as seq -> seq |> Seq.toArray :>obj | :? seq as seq -> seq |> Seq.toArray :>obj diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs index 4e7028e692e..aee633f8fab 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Async.fs @@ -2,7 +2,7 @@ module Async open BenchmarkDotNet.Attributes -[] +[] [] [] [] diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj index 168c8b546e6..85aa34100c2 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/CS/MicroPerfCSharp.csproj @@ -1,7 +1,6 @@ - $(FSharpNetCoreProductTargetFramework) Library 8.0 @@ -11,8 +10,4 @@ $(NoWarn);CS1591 - - - - \ No newline at end of file diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs index fa6178e6778..50f1719c5b5 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/Collections.fs @@ -2,7 +2,7 @@ module Collections open BenchmarkDotNet.Attributes -[] +[] [] [] [] diff --git a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj index fc36640d7e6..9fc704b2ce5 100644 --- a/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj +++ b/tests/benchmarks/CompiledCodeBenchmarks/MicroPerf/MicroPerf.fsproj @@ -1,8 +1,6 @@  - $(FSharpNetCoreProductTargetFramework) Exe - true $(OtherFlags) --nowarn:1204 @@ -26,7 +24,6 @@ - - + \ No newline at end of file diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskBuilder.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskBuilder.fs deleted file mode 100644 index 9d3683e4b27..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskBuilder.fs +++ /dev/null @@ -1,416 +0,0 @@ -// TaskBuilder.fs - TPL task computation expressions for F# -// -// Written in 2016 by Robert Peele (humbobst@gmail.com) -// New operator-based overload resolution for F# 4.0 compatibility by Gustavo Leon in 2018. -// -// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights -// to this software to the public domain worldwide. This software is distributed without any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication along with this software. -// If not, see . - -namespace TaskBuilderTasks -open System -open System.Threading.Tasks -open System.Runtime.CompilerServices - -// This module is not really obsolete, but it's not intended to be referenced directly from user code. -// However, it can't be private because it is used within inline functions that *are* user-visible. -// Marking it as obsolete is a workaround to hide it from auto-completion tools. -[] -module TaskBuilder = - /// Represents the state of a computation: - /// either awaiting something with a continuation, - /// or completed with a return value. - type Step<'a> = - | Await of ICriticalNotifyCompletion * (unit -> Step<'a>) - | Return of 'a - /// We model tail calls explicitly, but still can't run them without O(n) memory usage. - | ReturnFrom of 'a Task - /// Implements the machinery of running a `Step<'m, 'm>` as a task returning a continuation task. - and StepStateMachine<'a>(firstStep) as this = - let methodBuilder = AsyncTaskMethodBuilder<'a Task>() - /// The continuation we left off awaiting on our last MoveNext(). - let mutable continuation = fun () -> firstStep - /// Returns next pending awaitable or null if exiting (including tail call). - let nextAwaitable() = - try - match continuation() with - | Return r -> - methodBuilder.SetResult(Task.FromResult(r)) - null - | ReturnFrom t -> - methodBuilder.SetResult(t) - null - | Await (await, next) -> - continuation <- next - await - with - | exn -> - methodBuilder.SetException(exn) - null - let mutable self = this - - /// Start execution as a `Task>`. - member __.Run() = - methodBuilder.Start(&self) - methodBuilder.Task - - interface IAsyncStateMachine with - /// Proceed to one of three states: result, failure, or awaiting. - /// If awaiting, MoveNext() will be called again when the awaitable completes. - member __.MoveNext() = - let mutable await = nextAwaitable() - if not (isNull await) then - // Tell the builder to call us again when this thing is done. - methodBuilder.AwaitUnsafeOnCompleted(&await, &self) - member __.SetStateMachine(_) = () // Doesn't really apply since we're a reference type. - - let unwrapException (agg : AggregateException) = - let inners = agg.InnerExceptions - if inners.Count = 1 then inners.[0] - else agg :> Exception - - /// Used to represent no-ops like the implicit empty "else" branch of an "if" expression. - let zero = Return () - - /// Used to return a value. - let ret (x : 'a) = Return x - - type Binder<'out> = - // We put the output generic parameter up here at the class level, so it doesn't get subject to - // inline rules. If we put it all in the inline function, then the compiler gets confused at the - // below and demands that the whole function either is limited to working with (x : obj), or must - // be inline itself. - // - // let yieldThenReturn (x : 'a) = - // task { - // do! Task.Yield() - // return x - // } - - static member inline GenericAwait< ^abl, ^awt, ^inp - when ^abl : (member GetAwaiter : unit -> ^awt) - and ^awt :> ICriticalNotifyCompletion - and ^awt : (member get_IsCompleted : unit -> bool) - and ^awt : (member GetResult : unit -> ^inp) > - (abl : ^abl, continuation : ^inp -> 'out Step) : 'out Step = - let awt = (^abl : (member GetAwaiter : unit -> ^awt)(abl)) // get an awaiter from the awaitable - if (^awt : (member get_IsCompleted : unit -> bool)(awt)) then // shortcut to continue immediately - continuation (^awt : (member GetResult : unit -> ^inp)(awt)) - else - Await (awt, fun () -> continuation (^awt : (member GetResult : unit -> ^inp)(awt))) - - static member inline GenericAwaitConfigureFalse< ^tsk, ^abl, ^awt, ^inp - when ^tsk : (member ConfigureAwait : bool -> ^abl) - and ^abl : (member GetAwaiter : unit -> ^awt) - and ^awt :> ICriticalNotifyCompletion - and ^awt : (member get_IsCompleted : unit -> bool) - and ^awt : (member GetResult : unit -> ^inp) > - (tsk : ^tsk, continuation : ^inp -> 'out Step) : 'out Step = - let abl = (^tsk : (member ConfigureAwait : bool -> ^abl)(tsk, false)) - Binder<'out>.GenericAwait(abl, continuation) - - /// Special case of the above for `Task<'a>`. Have to write this out by hand to avoid confusing the compiler - /// trying to decide between satisfying the constraints with `Task` or `Task<'a>`. - let bindTask (task : 'a Task) (continuation : 'a -> Step<'b>) = - let awt = task.GetAwaiter() - if awt.IsCompleted then // Proceed to the next step based on the result we already have. - continuation(awt.GetResult()) - else // Await and continue later when a result is available. - Await (awt, (fun () -> continuation(awt.GetResult()))) - - /// Special case of the above for `Task<'a>`, for the context-insensitive builder. - /// Have to write this out by hand to avoid confusing the compiler thinking our built-in bind method - /// defined on the builder has fancy generic constraints on inp and out parameters. - let bindTaskConfigureFalse (task : 'a Task) (continuation : 'a -> Step<'b>) = - let awt = task.ConfigureAwait(false).GetAwaiter() - if awt.IsCompleted then // Proceed to the next step based on the result we already have. - continuation(awt.GetResult()) - else // Await and continue later when a result is available. - Await (awt, (fun () -> continuation(awt.GetResult()))) - - /// Chains together a step with its following step. - /// Note that this requires that the first step has no result. - /// This prevents constructs like `task { return 1; return 2; }`. - let rec combine (step : Step) (continuation : unit -> Step<'b>) = - match step with - | Return _ -> continuation() - | ReturnFrom t -> - Await (t.GetAwaiter(), continuation) - | Await (awaitable, next) -> - Await (awaitable, fun () -> combine (next()) continuation) - - /// Builds a step that executes the body while the condition predicate is true. - let whileLoop (cond : unit -> bool) (body : unit -> Step) = - if cond() then - // Create a self-referencing closure to test whether to repeat the loop on future iterations. - let rec repeat () = - if cond() then - let body = body() - match body with - | Return _ -> repeat() - | ReturnFrom t -> Await(t.GetAwaiter(), repeat) - | Await (awaitable, next) -> - Await (awaitable, fun () -> combine (next()) repeat) - else zero - // Run the body the first time and chain it to the repeat logic. - combine (body()) repeat - else zero - - /// Wraps a step in a try/with. This catches exceptions both in the evaluation of the function - /// to retrieve the step, and in the continuation of the step (if any). - let rec tryWith(step : unit -> Step<'a>) (catch : exn -> Step<'a>) = - try - match step() with - | Return _ as i -> i - | ReturnFrom t -> - let awaitable = t.GetAwaiter() - Await(awaitable, fun () -> - try - awaitable.GetResult() |> Return - with - | exn -> catch exn) - | Await (awaitable, next) -> Await (awaitable, fun () -> tryWith next catch) - with - | exn -> catch exn - - /// Wraps a step in a try/finally. This catches exceptions both in the evaluation of the function - /// to retrieve the step, and in the continuation of the step (if any). - let rec tryFinally (step : unit -> Step<'a>) fin = - let step = - try step() - // Important point: we use a try/with, not a try/finally, to implement tryFinally. - // The reason for this is that if we're just building a continuation, we definitely *shouldn't* - // execute the `fin()` part yet -- the actual execution of the asynchronous code hasn't completed! - with - | _ -> - fin() - reraise() - match step with - | Return _ as i -> - fin() - i - | ReturnFrom t -> - let awaitable = t.GetAwaiter() - Await(awaitable, fun () -> - let result = - try - awaitable.GetResult() |> Return - with - | _ -> - fin() - reraise() - fin() // if we got here we haven't run fin(), because we would've reraised after doing so - result) - | Await (awaitable, next) -> - Await (awaitable, fun () -> tryFinally next fin) - - /// Implements a using statement that disposes `disp` after `body` has completed. - let using (disp : #IDisposable) (body : _ -> Step<'a>) = - // A using statement is just a try/finally with the finally block disposing if non-null. - tryFinally - (fun () -> body disp) - (fun () -> if not (isNull (box disp)) then disp.Dispose()) - - /// Implements a loop that runs `body` for each element in `sequence`. - let forLoop (sequence : 'a seq) (body : 'a -> Step) = - // A for loop is just a using statement on the sequence's enumerator... - using (sequence.GetEnumerator()) - // ... and its body is a while loop that advances the enumerator and runs the body on each element. - (fun e -> whileLoop e.MoveNext (fun () -> body e.Current)) - - /// Runs a step as a task -- with a short-circuit for immediately completed steps. - let run (firstStep : unit -> Step<'a>) = - try - match firstStep() with - | Return x -> Task.FromResult(x) - | ReturnFrom t -> t - | Await _ as step -> StepStateMachine<'a>(step).Run().Unwrap() // sadly can't do tail recursion - // Any exceptions should go on the task, rather than being thrown from this call. - // This matches C# behavior where you won't see an exception until awaiting the task, - // even if it failed before reaching the first "await". - with - | exn -> - let src = new TaskCompletionSource<_>() - src.SetException(exn) - src.Task - - // We have to have a dedicated overload for Task<'a> so the compiler doesn't get confused with Convenience overloads for Asyncs - // Everything else can use bindGenericAwaitable via an extension member - - type Priority3 = obj - type Priority2 = IComparable - - type BindS = Priority1 with - static member inline (>>=) (_:Priority2, taskLike : 't) = fun (k: _ -> 'b Step) -> Binder<'b>.GenericAwait (taskLike, k): 'b Step - static member (>>=) ( Priority1, task: 'a Task) = fun (k: 'a -> 'b Step) -> bindTask task k : 'b Step - static member (>>=) ( Priority1, a : 'a Async) = fun (k: 'a -> 'b Step) -> bindTask (Async.StartAsTask a) k : 'b Step - - type ReturnFromS = Priority1 with - static member inline ($) (Priority1, taskLike ) = Binder<_>.GenericAwait (taskLike, ret) - static member ($) (Priority1, a : 'a Async) = bindTask (Async.StartAsTask a) ret : Step<'a> - - type BindI = Priority1 with - static member inline (>>=) (_:Priority3, taskLike : 't) = fun (k : _ -> 'b Step) -> Binder<'b>.GenericAwait (taskLike, k) : 'b Step - static member inline (>>=) (_:Priority2, configurableTaskLike: 't) = fun (k : _ -> 'b Step) -> Binder<'b>.GenericAwaitConfigureFalse (configurableTaskLike, k): 'b Step - static member (>>=) ( Priority1, task: 'a Task ) = fun (k : 'a -> 'b Step) -> bindTaskConfigureFalse task k : 'b Step - static member (>>=) ( Priority1, a : 'a Async ) = fun (k : 'a -> 'b Step) -> bindTaskConfigureFalse (Async.StartAsTask a) k : 'b Step - - type ReturnFromI = Priority1 with - static member inline ($) (_:Priority2, taskLike ) = Binder<_>.GenericAwait(taskLike, ret) - static member inline ($) ( Priority1, configurableTaskLike) = Binder<_>.GenericAwaitConfigureFalse(configurableTaskLike, ret) - static member ($) ( Priority1, a : 'a Async ) = bindTaskConfigureFalse (Async.StartAsTask a) ret - - // New style task builder. - type TaskBuilderV2() = - // These methods are consistent between all builders. - member __.Delay(f : unit -> Step<_>) = f - member __.Run(f : unit -> Step<'m>) = run f - member __.Zero() = zero - member __.Return(x) = ret x - member __.Combine(step : unit Step, continuation) = combine step continuation - member __.While(condition : unit -> bool, body : unit -> unit Step) = whileLoop condition body - member __.For(sequence : _ seq, body : _ -> unit Step) = forLoop sequence body - member __.TryWith(body : unit -> _ Step, catch : exn -> _ Step) = tryWith body catch - member __.TryFinally(body : unit -> _ Step, fin : unit -> unit) = tryFinally body fin - member __.Using(disp : #IDisposable, body : #IDisposable -> _ Step) = using disp body - member __.ReturnFrom a : _ Step = ReturnFrom a - - // Old style task builder. Retained for binary compatibility. - type TaskBuilder() = - // These methods are consistent between the two builders. - // Unfortunately, inline members do not work with inheritance. - member inline __.Delay(f : unit -> Step<_>) = f - member inline __.Run(f : unit -> Step<'m>) = run f - member inline __.Zero() = zero - member inline __.Return(x) = ret x - member inline __.Combine(step : unit Step, continuation) = combine step continuation - member inline __.While(condition : unit -> bool, body : unit -> unit Step) = whileLoop condition body - member inline __.For(sequence : _ seq, body : _ -> unit Step) = forLoop sequence body - member inline __.TryWith(body : unit -> _ Step, catch : exn -> _ Step) = tryWith body catch - member inline __.TryFinally(body : unit -> _ Step, fin : unit -> unit) = tryFinally body fin - member inline __.Using(disp : #IDisposable, body : #IDisposable -> _ Step) = using disp body - // End of consistent methods -- the following methods are different between - // `TaskBuilder` and `ContextInsensitiveTaskBuilder`! - - // We have to have a dedicated overload for Task<'a> so the compiler doesn't get confused. - // Everything else can use bindGenericAwaitable via an extension member (defined later). - member inline __.ReturnFrom(task : _ Task) = ReturnFrom task - member inline __.Bind(task : 'a Task, continuation : 'a -> 'b Step) : 'b Step = - bindTask task continuation - - // Old style task builder. Retained for binary compatibility. - type ContextInsensitiveTaskBuilder() = - // These methods are consistent between the two builders. - // Unfortunately, inline members do not work with inheritance. - member inline __.Delay(f : unit -> Step<_>) = f - member inline __.Run(f : unit -> Step<'m>) = run f - member inline __.Zero() = zero - member inline __.Return(x) = ret x - member inline __.Combine(step : unit Step, continuation) = combine step continuation - member inline __.While(condition : unit -> bool, body : unit -> unit Step) = whileLoop condition body - member inline __.For(sequence : _ seq, body : _ -> unit Step) = forLoop sequence body - member inline __.TryWith(body : unit -> _ Step, catch : exn -> _ Step) = tryWith body catch - member inline __.TryFinally(body : unit -> _ Step, fin : unit -> unit) = tryFinally body fin - member inline __.Using(disp : #IDisposable, body : #IDisposable -> _ Step) = using disp body - // End of consistent methods -- the following methods are different between - // `TaskBuilder` and `ContextInsensitiveTaskBuilder`! - - // We have to have a dedicated overload for Task<'a> so the compiler doesn't get confused. - // Everything else can use bindGenericAwaitable via an extension member (defined later). - member inline __.ReturnFrom(task : _ Task) = ReturnFrom task - member inline __.Bind(task : 'a Task, continuation : 'a -> 'b Step) : 'b Step = - bindTaskConfigureFalse task continuation - - -// Don't warn about our use of the "obsolete" module we just defined (see notes at start of file). -#nowarn "44" - -[] -module ContextSensitive = - /// Builds a `System.Threading.Tasks.Task<'a>` similarly to a C# async/await method. - /// Use this like `task { let! taskResult = someTask(); return taskResult.ToString(); }`. - let taskBuilder = TaskBuilder.TaskBuilder() - - [] - let inline unitTask t = t :> Task - - // These are fallbacks when the Bind and ReturnFrom on the builder object itself don't apply. - // This is how we support binding arbitrary task-like types. - type TaskBuilder.TaskBuilder with - member inline this.ReturnFrom(taskLike) = - TaskBuilder.Binder<_>.GenericAwait(taskLike, TaskBuilder.ret) - member inline this.Bind(taskLike, continuation : _ -> 'a TaskBuilder.Step) : 'a TaskBuilder.Step = - TaskBuilder.Binder<'a>.GenericAwait(taskLike, continuation) - // Convenience overloads for Asyncs. - member __.ReturnFrom(a : 'a Async) = - TaskBuilder.bindTask (Async.StartAsTask a) TaskBuilder.ret - member __.Bind(a : 'a Async, continuation : 'a -> 'b TaskBuilder.Step) : 'b TaskBuilder.Step = - TaskBuilder.bindTask (Async.StartAsTask a) continuation - -module ContextInsensitive = - /// Builds a `System.Threading.Tasks.Task<'a>` similarly to a C# async/await method, but with - /// all awaited tasks automatically configured *not* to resume on the captured context. - /// This is often preferable when writing library code that is not context-aware, but undesirable when writing - /// e.g. code that must interact with user interface controls on the same thread as its caller. - let task = TaskBuilder.ContextInsensitiveTaskBuilder() - - [] - let inline unitTask (t : Task) = t.ConfigureAwait(false) - - // These are fallbacks when the Bind and ReturnFrom on the builder object itself don't apply. - // This is how we support binding arbitrary task-like types. - type TaskBuilder.ContextInsensitiveTaskBuilder with - member inline this.ReturnFrom(taskLike) = - TaskBuilder.Binder<_>.GenericAwait(taskLike, TaskBuilder.ret) - member inline this.Bind(taskLike, continuation : _ -> 'a TaskBuilder.Step) : 'a TaskBuilder.Step = - TaskBuilder.Binder<'a>.GenericAwait(taskLike, continuation) - - // Convenience overloads for Asyncs. - member __.ReturnFrom(a : 'a Async) = - TaskBuilder.bindTaskConfigureFalse (Async.StartAsTask a) TaskBuilder.ret - member __.Bind(a : 'a Async, continuation : 'a -> 'b TaskBuilder.Step) : 'b TaskBuilder.Step = - TaskBuilder.bindTaskConfigureFalse (Async.StartAsTask a) continuation - - [] - module HigherPriorityBinds = - // When it's possible for these to work, the compiler should prefer them since they shadow the ones above. - type TaskBuilder.ContextInsensitiveTaskBuilder with - member inline this.ReturnFrom(configurableTaskLike) = - TaskBuilder.Binder<_>.GenericAwaitConfigureFalse(configurableTaskLike, TaskBuilder.ret) - member inline this.Bind(configurableTaskLike, continuation : _ -> 'a TaskBuilder.Step) : 'a TaskBuilder.Step = - TaskBuilder.Binder<'a>.GenericAwaitConfigureFalse(configurableTaskLike, continuation) - - -module V2 = - [] - module ContextSensitive = - open TaskBuilder - - /// Builds a `System.Threading.Tasks.Task<'a>` similarly to a C# async/await method. - /// Use this like `task { let! taskResult = someTask(); return taskResult.ToString(); }`. - let taskBuilder = TaskBuilderV2() - - [] - let unitTask (t : Task) = t - - type TaskBuilderV2 with - member inline __.Bind (task, continuation : 'a -> 'b Step) : 'b Step = (BindS.Priority1 >>= task) continuation - member inline __.ReturnFrom a : 'b Step = ReturnFromS.Priority1 $ a - - module ContextInsensitive = - open TaskBuilder - - /// Builds a `System.Threading.Tasks.Task<'a>` similarly to a C# async/await method, but with - /// all awaited tasks automatically configured *not* to resume on the captured context. - /// This is often preferable when writing library code that is not context-aware, but undesirable when writing - /// e.g. code that must interact with user interface controls on the same thread as its caller. - let task = TaskBuilderV2() - - [] - let unitTask (t : Task) = t.ConfigureAwait(false) - - type TaskBuilderV2 with - member inline __.Bind (task, continuation : 'a -> 'b Step) : 'b Step = (BindI.Priority1 >>= task) continuation - member inline __.ReturnFrom a : 'b Step = ReturnFromI.Priority1 $ a \ No newline at end of file diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fs deleted file mode 100644 index 6f89f4fd6eb..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fs +++ /dev/null @@ -1,468 +0,0 @@ -namespace TaskPerf - -open System -open System.Threading.Tasks -open System.IO -open BenchmarkDotNet.Attributes -open BenchmarkDotNet.Running -open TaskBuilderTasks //.ContextSensitive // TaskBuilder.fs extension members -open FSharp.Control // AsyncSeq -open Tests.SyncBuilder -open BenchmarkDotNet.Configs -#if PREVIEW -open FSharp.Control.Async2 -open Tests.TaskSeq -#endif - -[] -module Helpers = - let bufferSize = 128 - let manyIterations = 1000 - let syncTask() = Task.FromResult 100 - let syncTask_async() = async.Return 100 - let syncTask_async2() = Task.FromResult 100 - let asyncYield() = Async.Sleep(0) - let asyncTask() = Task.Yield() - - let tenBindSync_taskBuilder() = - taskBuilder { - let! res1 = syncTask() - let! res2 = syncTask() - let! res3 = syncTask() - let! res4 = syncTask() - let! res5 = syncTask() - let! res6 = syncTask() - let! res7 = syncTask() - let! res8 = syncTask() - let! res9 = syncTask() - let! res10 = syncTask() - return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 - } - - let tenBindSync_async() = - async { - let! res1 = syncTask_async() - let! res2 = syncTask_async() - let! res3 = syncTask_async() - let! res4 = syncTask_async() - let! res5 = syncTask_async() - let! res6 = syncTask_async() - let! res7 = syncTask_async() - let! res8 = syncTask_async() - let! res9 = syncTask_async() - let! res10 = syncTask_async() - return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 - } - -#if PREVIEW - let tenBindSync_task() = - task { - let! res1 = syncTask() - let! res2 = syncTask() - let! res3 = syncTask() - let! res4 = syncTask() - let! res5 = syncTask() - let! res6 = syncTask() - let! res7 = syncTask() - let! res8 = syncTask() - let! res9 = syncTask() - let! res10 = syncTask() - return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 - } - - let tenBindSync_async2() = - async2 { - let! res1 = syncTask_async2() - let! res2 = syncTask_async2() - let! res3 = syncTask_async2() - let! res4 = syncTask_async2() - let! res5 = syncTask_async2() - let! res6 = syncTask_async2() - let! res7 = syncTask_async2() - let! res8 = syncTask_async2() - let! res9 = syncTask_async2() - let! res10 = syncTask_async2() - return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 - } -#endif - - let tenBindAsync_taskBuilder() = - taskBuilder { - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - } - - let tenBindAsync_async() = - async { - do! asyncYield() - do! asyncYield() - do! asyncYield() - do! asyncYield() - do! asyncYield() - do! asyncYield() - do! asyncYield() - do! asyncYield() - do! asyncYield() - do! asyncYield() - } -#if PREVIEW - let tenBindAsync_task() = - task { - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - } - - let tenBindAsync_async2() = - async2 { - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - do! asyncTask() - } -#endif - - let singleTask_taskBuilder() = - taskBuilder { return 1 } - - let singleTask_async() = - async { return 1 } -#if PREVIEW - let singleTask_task() = - task { return 1 } - - let singleTask_async2() = - async2 { return 1 } -#endif - -[] -[] -[] -type Benchmarks() = - - [] - member _.ManyWriteFile_CSharpTasks () = - TaskPerfCSharp.ManyWriteFileAsync(manyIterations).Wait(); - - [] - member _.ManyWriteFile_taskBuilder () = - let path = Path.GetTempFileName() - taskBuilder { - let junk = Array.zeroCreate bufferSize - use file = File.Create(path) - for i = 1 to manyIterations do - do! file.WriteAsync(junk, 0, junk.Length) - } - |> fun t -> t.Wait() - File.Delete(path) - - [] - member _.ManyWriteFile_async () = - let path = Path.GetTempFileName() - async { - let junk = Array.zeroCreate bufferSize - use file = File.Create(path) - for i = 1 to manyIterations do - do! Async.AwaitTask(file.WriteAsync(junk, 0, junk.Length)) - } - |> Async.RunSynchronously - File.Delete(path) - -#if PREVIEW - [] - member _.ManyWriteFile_task () = - let path = Path.GetTempFileName() - task { - let junk = Array.zeroCreate bufferSize - use file = File.Create(path) - for i = 1 to manyIterations do - do! file.WriteAsync(junk, 0, junk.Length) - } - |> fun t -> t.Wait() - File.Delete(path) - - [] - member _.ManyWriteFile_async2 () = - let path = Path.GetTempFileName() - async2 { - let junk = Array.zeroCreate bufferSize - use file = File.Create(path) - for i = 1 to manyIterations do - do! file.WriteAsync(junk, 0, junk.Length) - } - |> Async2.RunSynchronously - File.Delete(path) -#endif - - - - [] - member _.NonAsyncBinds_CSharpTasks() = - for i in 1 .. manyIterations*100 do - TaskPerfCSharp.TenBindsSync_CSharp().Wait() - - [] - member _.NonAsyncBinds_taskBuilder() = - for i in 1 .. manyIterations*100 do - tenBindSync_taskBuilder().Wait() - - [] - member _.NonAsyncBinds_async() = - for i in 1 .. manyIterations*100 do - tenBindSync_async() |> Async.RunSynchronously |> ignore - -#if PREVIEW - [] - member _.NonAsyncBinds_async2() = - for i in 1 .. manyIterations*100 do - tenBindSync_async2() |> Async2.RunSynchronously |> ignore - - [] - member _.NonAsyncBinds_task() = - for i in 1 .. manyIterations*100 do - tenBindSync_task().Wait() - -#endif - - - - - [] - member _.AsyncBinds_CSharpTasks() = - for i in 1 .. manyIterations do - TaskPerfCSharp.TenBindsAsync_CSharp().Wait() - - [] - member _.AsyncBinds_taskBuilder() = - for i in 1 .. manyIterations do - tenBindAsync_taskBuilder().Wait() - - [] - member _.AsyncBinds_async() = - for i in 1 .. manyIterations do - tenBindAsync_async() |> Async.RunSynchronously - -#if PREVIEW - [] - member _.AsyncBinds_task() = - for i in 1 .. manyIterations do - tenBindAsync_task().Wait() - - [] - member _.AsyncBinds_async2() = - for i in 1 .. manyIterations do - tenBindAsync_async2() |> Async2.RunSynchronously -#endif - - - [] - member _.SingleSyncTask_CSharpTasks() = - for i in 1 .. manyIterations*500 do - TaskPerfCSharp.SingleSyncTask_CSharp().Wait() - - [] - member _.SingleSyncTask_taskBuilder() = - for i in 1 .. manyIterations*500 do - singleTask_taskBuilder().Wait() - - [] - member _.SingleSyncTask_async() = - for i in 1 .. manyIterations*500 do - singleTask_async() |> Async.RunSynchronously |> ignore - -#if PREVIEW - [] - member _.SingleSyncTask_task() = - for i in 1 .. manyIterations*500 do - singleTask_task().Wait() - - [] - member _.SingleSyncTask_async2() = - for i in 1 .. manyIterations*500 do - singleTask_async2() |> Async2.RunSynchronously |> ignore -#endif - - [] - member _.SyncBuilderLoop_NormalCode() = - for i in 1 .. manyIterations do - let mutable res = 0 - for i in Seq.init 1000 id do - res <- i + res - - [] - member _.SyncBuilderLoop_WorkflowCode() = - for i in 1 .. manyIterations do - sync { let mutable res = 0 - for i in Seq.init 1000 id do - res <- i + res } - -#if FSHARP_CORE_HAS_LIST_COLLECTOR - [] - member _.TinyVariableSizedList_Builtin() = Tests.ListBuilders.Examples.tinyVariableSizeBuiltin() - - - [] - member _.TinyVariableSizedList_NewBuilder() = Tests.ListBuilders.Examples.tinyVariableSizeNew() - - - [] - member _.VariableSizedList_Builtin() = Tests.ListBuilders.Examples.variableSizeBuiltin() - - [] - member _.VariableSizedList_NewBuilder() = Tests.ListBuilders.Examples.variableSizeNew() - - - [] - member _.FixedSizeList_Builtin() = Tests.ListBuilders.Examples.fixedSizeBase() - - [] - member _.FixedSizeList_NewBuilder() = Tests.ListBuilders.Examples.fixedSizeC() -#endif - - [] - member _.TinyVariableSizedArray_Builtin() = Tests.ArrayBuilders.Examples.tinyVariableSizeBuiltin() - - [] - member _.TinyVariableSizedArray_NewBuilder() = Tests.ArrayBuilders.Examples.tinyVariableSizeNew() - - - [] - member _.VariableSizedArray_Builtin() = Tests.ArrayBuilders.Examples.variableSizeBuiltin() - - [] - member _.VariableSizedArray_NewBuilder() = Tests.ArrayBuilders.Examples.variableSizeNew() - - - [] - member _.FixedSizeArray_Builtin() = Tests.ArrayBuilders.Examples.fixedSizeBase() - - - [] - member _.FixedSizeArray_NewBuilder() = Tests.ArrayBuilders.Examples.fixedSizeC() - - - [] - member _.MultiStepOption_OldBuilder() = Tests.OptionBuilders.Examples.multiStepOldBuilder() - - [] - member _.MultiStepOption_NewBuilder() = Tests.OptionBuilders.Examples.multiStepNewBuilder() - - [] - member _.MultiStepOption_NoBuilder() = Tests.OptionBuilders.Examples.multiStepNoBuilder() - - - [] - member _.MultiStepValueOption_OldBuilder() = Tests.OptionBuilders.Examples.multiStepOldBuilderV() - - [] - member _.MultiStepValueOption_NewBuilder() = Tests.OptionBuilders.Examples.multiStepNewBuilderV() - - [] - member _.MultiStepValueOption_NoBuilder() = Tests.OptionBuilders.Examples.multiStepNoBuilderV() - - -#if PREVIEW - [] - member _.NestedForLoops_CSharpAsyncEnumerable() = - TaskPerfCSharp.perf2_AsyncEnumerable() |> TaskSeq.iter ignore - - [] - member _.NestedForLoops_taskSeq() = - Tests.TaskSeq.Examples.perf2() |> TaskSeq.iter ignore - - //[] - //member _.NestedForLoops_asyncSeq() = - // Tests.TaskSeq.Examples.perf2_AsyncSeq() |> AsyncSeq.iter ignore |> Async.RunSynchronously - -#endif - -module Main = - - [] - let main argv = - let require x msg = if not x then failwith msg - printfn "Testing that the tests run..." - printfn "Running testUsing..." - let f () = - let mutable disposed = 0 - let t = - task { - use d = - { new IAsyncDisposable with - member __.DisposeAsync() = - task { - disposed <- disposed + 1 - printfn $"in disposal, disposed = {disposed}" - do! Task.Delay(10) - disposed <- disposed + 1 - printfn $"after disposal, disposed = {disposed}" - } - |> ValueTask - } - printfn $"in using, disposed = {disposed}" - do! Task.Delay(10) - } - - printfn $"outside using, disposed = {disposed}" - t.Wait() - printfn $"after full disposal, disposed = {disposed}" - - f() - - //Benchmarks().SingleSyncTask_async2() - //Benchmarks().NonAsyncBinds_async2() - //Benchmarks().ManyWriteFile_CSharpTasks() - //Benchmarks().ManyWriteFile_task () - //Benchmarks().ManyWriteFile_taskBuilder () - //Benchmarks().ManyWriteFile_FSharpAsync () - //Benchmarks().NonAsyncBinds_CSharpTasks() - //Benchmarks().NonAsyncBinds_task() - //Benchmarks().NonAsyncBinds_taskBuilder() - //Benchmarks().NonAsyncBinds_FSharpAsync() - //Benchmarks().AsyncBinds_CSharpTasks() - //Benchmarks().AsyncBinds_task() - //Benchmarks().AsyncBinds_taskBuilder() - //Benchmarks().SingleSyncTask_CSharpTasks() - //Benchmarks().SingleSyncTask_task() - //Benchmarks().SingleSyncTask_taskBuilder() - //Benchmarks().SingleSyncTask_FSharpAsync() - - //printfn "Sample t1..." - //Tests.akSeqBuilder.Examples.t1() |> TaskSeq.iter (printfn "t1(): %s") - //printfn "Sample t2..." - //Tests.TaskSeqBuilder.Examples.t2() |> TaskSeq.iter (printfn "t2(): %s") - //printfn "Sample perf1(2)..." - //Tests.TaskSeqBuilder.Examples.perf1(2) |> TaskSeq.iter (printfn "perf1(2): %d") - //printfn "Sample perf1(3)..." - //Tests.TaskSeqBuilder.Examples.perf1(3) |> TaskSeq.iter (printfn "perf1(3): %d") - //printfn "Sample perf2..." - //Tests.TaskSeqBuilder.Examples.perf2() |> TaskSeq.iter (printfn "perf2: %d") - - //Tests.TaskSeq.Examples.perf2_AsyncSeq() |> AsyncSeq.toArrayAsync |> Async.RunSynchronously |> Array.sum |> (printf "%d."); printfn "" - //Tests.TaskSeq.Examples.perf2() |> TaskSeq.toArray |> Array.sum |> (printfn "%d.") - //TaskPerfCSharp.perf2_AsyncEnumerable() |> TaskSeq.toArray |> Array.sum |> (printfn "%d.") - - printfn "Running benchmarks..." - let results = BenchmarkRunner.Run() - 0 \ No newline at end of file diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fsproj b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fsproj deleted file mode 100644 index 31d404fb061..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/TaskPerf.fsproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - $(FSharpNetCoreProductTargetFramework) - Exe - true - - $(OtherFlags) --nowarn:1204 - - $(OtherFlags) --nowarn:57 - - - $(OtherFlags) --nowarn:3511 --nowarn:3513 - $(OtherFlags) --langversion:preview - $(OtherFlags) --define:PREVIEW - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/array.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/array.fs deleted file mode 100644 index 8c1409f1233..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/array.fs +++ /dev/null @@ -1,192 +0,0 @@ - -module Tests.ArrayBuilders - -open System -open System.Collections.Generic - -[] -module UsingInlinedCodeAndCollector = - - [] - type ArrayBuilderCollector<'T> = - [] - val mutable Result : ResizeArray<'T> - - member sm.Yield (value: 'T) = - match sm.Result with - | null -> - let ra = ResizeArray() - sm.Result <- ra - ra.Add(value) - | ra -> ra.Add(value) - - member sm.ToResizeArray() = - match sm.Result with - | null -> ResizeArray() - | ra -> ra - - member sm.ToArray() = - match sm.Result with - | null -> Array.empty - | ra -> ra.ToArray() - - type ArrayBuilderCode<'T> = delegate of byref> -> unit - - type ArrayBuilderViaCollector() = - - member inline _.Delay([] f: unit -> ArrayBuilderCode<'T>) : ArrayBuilderCode<'T> = - ArrayBuilderCode<_>(fun sm -> (f()).Invoke &sm) - - member inline _.Zero() : ArrayBuilderCode<'T> = - ArrayBuilderCode<_>(fun _sm -> ()) - - member inline _.Combine([] part1: ArrayBuilderCode<'T>, [] part2: ArrayBuilderCode<'T>) : ArrayBuilderCode<'T> = - ArrayBuilderCode<_>(fun sm -> - part1.Invoke &sm - part2.Invoke &sm) - - member inline _.While([] condition : unit -> bool, [] body : ArrayBuilderCode<'T>) : ArrayBuilderCode<'T> = - ArrayBuilderCode<_>(fun sm -> - while condition() do - body.Invoke &sm) - - member inline _.TryWith([] body: ArrayBuilderCode<'T>, [] handler: exn -> ArrayBuilderCode<'T>) : ArrayBuilderCode<'T> = - ArrayBuilderCode<_>(fun sm -> - try - body.Invoke &sm - with exn -> - (handler exn).Invoke &sm) - - member inline _.TryFinally([] body: ArrayBuilderCode<'T>, compensation : unit -> unit) : ArrayBuilderCode<'T> = - ArrayBuilderCode<_>(fun sm -> - try - body.Invoke &sm - with _ -> - compensation() - reraise() - - compensation()) - - member inline b.Using(disp : #IDisposable, [] body: #IDisposable -> ArrayBuilderCode<'T>) : ArrayBuilderCode<'T> = - // A using statement is just a try/finally with the finally block disposing if non-null. - b.TryFinally( - (fun sm -> (body disp).Invoke &sm), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - member inline b.For(sequence: seq<'TElement>, [] body: 'TElement -> ArrayBuilderCode<'T>) : ArrayBuilderCode<'T> = - b.Using (sequence.GetEnumerator(), - (fun e -> b.While((fun () -> e.MoveNext()), (fun sm -> (body e.Current).Invoke &sm)))) - - member inline _.Yield (v: 'T) : ArrayBuilderCode<'T> = - ArrayBuilderCode<_>(fun sm -> - sm.Yield v) - - member inline b.YieldFrom (source: IEnumerable<'T>) : ArrayBuilderCode<'T> = - b.For(source, (fun value -> b.Yield(value))) - - member inline _.Run([] code: ArrayBuilderCode<'T>) : 'T[] = - let mutable sm = ArrayBuilderCollector<'T>() - code.Invoke &sm - sm.ToArray() - - let arrayNew = ArrayBuilderViaCollector() - -module Examples = - - let tinyVariableSizeNew () = - for i in 1 .. 1000000 do - arrayNew { - if i % 3 = 0 then - yield "b" - } |> Array.length |> ignore - - let tinyVariableSizeBuiltin () = - for i in 1 .. 1000000 do - [| - if i % 3 = 0 then - yield "b" - |] |> Array.length |> ignore - - let variableSizeNew () = - for i in 1 .. 1000000 do - arrayNew { - yield "a" - yield "b" - yield "b" - yield "b" - yield "b" - if i % 3 = 0 then - yield "b" - yield "b" - yield "b" - yield "b" - yield "c" - } |> Array.length |> ignore - - let variableSizeBuiltin () = - for i in 1 .. 1000000 do - [| - yield "a" - yield "b" - yield "b" - yield "b" - yield "b" - if i % 3 = 0 then - yield "b" - yield "b" - yield "b" - yield "b" - yield "c" - |] |> Array.length |> ignore - - let fixedSizeC () = - for i in 1 .. 1000000 do - arrayNew { - "a" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "c" - } |> Array.length |> ignore - - let fixedSizeBase () = - for i in 1 .. 1000000 do - [| - "a" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "c" - |] |> Array.length |> ignore - - let perf s f = - let t = System.Diagnostics.Stopwatch() - t.Start() - f() - t.Stop() - printfn "PERF: %s : %d" s t.ElapsedMilliseconds - - perf "tinyVariableSizeBuiltin" tinyVariableSizeBuiltin - perf "tinyVariableSizeNew " tinyVariableSizeNew - - perf "variableSizeBuiltin" variableSizeBuiltin - perf "variableSizeNew" variableSizeNew - - perf "fixedSizeBase" fixedSizeBase - perf "fixedSizeC" fixedSizeC - // let dumpSeq (t: IEnumerable<_>) = - // let e = t.GetEnumerator() - // while e.MoveNext() do - // printfn "yield %A" e.Current - // dumpSeq (t1()) - // dumpSeq (t2()) diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/async2.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/async2.fs deleted file mode 100644 index 06938716ae1..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/async2.fs +++ /dev/null @@ -1,1131 +0,0 @@ - -namespace FSharp.Control.Async2 - -open System.Runtime.CompilerServices - -#nowarn "42" -open System -open System.Threading -open System.Threading.Tasks -open FSharp.Core.CompilerServices -open FSharp.Core.CompilerServices.StateMachineHelpers - -[] -module Utils = - let verbose = false - - let inline MoveNext(x: byref<'T> when 'T :> IAsyncStateMachine) = x.MoveNext() - -[] -type Async2StateMachineData<'T>() = - [] - val mutable cancellationToken : CancellationToken - [] - val mutable result : 'T - [] - val mutable builder : AsyncTaskMethodBuilder<'T> - [] - val mutable taken : bool - //// For tailcalls using 'return!' - //[] - //val mutable tailcallTarget: IAsync2Invocation<'T> - -and IAsync2Invokable<'T> = - abstract StartImmediate: CancellationToken -> IAsync2Invocation<'T> - -and [] IAsync2Invocation<'T> = - inherit IAsyncStateMachine - //abstract TailcallTarget: IAsync2Invocation<'T> - abstract CancellationToken: CancellationToken - abstract Task: Task<'T> - -and [] - Async2<'T>() = - - // F# requires that we implement interfaces even on an abstract class - interface IAsync2Invokable<'T> with - member _.StartImmediate(ct) = failwith "abstract" - - interface IAsync2Invocation<'T> with - //member _.TailcallTarget = failwith "abstract" - member _.CancellationToken = failwith "abstract" - member _.Task = failwith "abstract" - interface IAsyncStateMachine with - member _.MoveNext() = failwith "abstract" - member _.SetStateMachine(_state) = failwith "abstract" - - member inline x.StartImmediate(ct) = (x :> IAsync2Invokable<'T>).StartImmediate(ct) - -and [] - Async2<'Machine, 'T when 'Machine :> IAsyncStateMachine and 'Machine :> IResumableStateMachine>>() = - inherit Async2<'T>() - let initialThreadId = Environment.CurrentManagedThreadId - - [] - val mutable Machine : 'Machine - - //member internal ts.hijack() = (ts :> IAsync2Invocation<_>) - //let res = ts.Machine.Data.tailcallTarget - //match res with - //| null -> (ts :> IAsync2Invocation<_>) - //| tg -> - // match (tg :> IAsync2Invocation<_>).TailcallTarget with - // | null -> - // res - // | res2 -> - // // Cut out chains of tailcalls - // ts.Machine.Data.tailcallTarget <- res2 - // res2 - - interface IAsyncStateMachine with - member ts.MoveNext() = - MoveNext(&ts.Machine) - - //match ts.hijack() with - //| null -> - //| tg -> (tg :> IAsyncStateMachine).MoveNext() - - member ts.SetStateMachine(state) = - //printfn "SetStateMachine" - () - //ts.Machine.Data.builder.SetStateMachine(state) - - interface IAsync2Invokable<'T> with - member ts.StartImmediate(ct) = - let data = ts.Machine.Data - if (not data.taken && initialThreadId = Environment.CurrentManagedThreadId) then - data.taken <- true - data.cancellationToken <- ct - //printfn "creating" - data.builder <- AsyncTaskMethodBuilder<'T>.Create() - //printfn "starting" - data.builder.Start(&ts.Machine) - (ts :> IAsync2Invocation<_>) - else - let clone = ts.MemberwiseClone() :?> Async2<'Machine, 'T> - data.taken <- true - clone.Machine.Data.cancellationToken <- ct - clone.Machine.MoveNext() - (clone :> IAsync2Invocation<'T>) - - interface IAsync2Invocation<'T> with - member ts.CancellationToken = ts.Machine.Data.cancellationToken - member ts.Task = ts.Machine.Data.builder.Task - //member ts.TailcallTarget = ts.hijack() - -and Async2Code<'TOverall, 'T> = ResumableCode, 'T> -and Async2StateMachine<'T> = ResumableStateMachine> -and Async2ResumptionFunc<'T> = ResumptionFunc> -and Async2ResumptionDynamicInfo<'T> = ResumptionDynamicInfo> - -[] -type Async2Builder() = - - member inline _.Delay(f : unit -> Async2Code<'TOverall, 'T>) : Async2Code<'TOverall, 'T> = - Async2Code<'TOverall, 'T>(fun sm -> f().Invoke(&sm)) - - member inline _.Run(code : Async2Code<'T, 'T>) : Async2<'T> = - if __useResumableCode then - // This is the static implementation. A new struct type is created. - __stateMachine, Async2<'T>> - (MoveNextMethodImpl<_>(fun sm -> - //-- RESUMABLE CODE START - __resumeAt sm.ResumptionPoint - try - //printfn "at Run.MoveNext start" - //Console.WriteLine("[{0}] resuming by invoking {1}....", sm.MethodBuilder.Task.Id, hashq sm.ResumptionFunc ) - let __stack_code_fin = code.Invoke(&sm) - //printfn $"at Run.MoveNext, __stack_code_fin={__stack_code_fin}" - if __stack_code_fin then - //printfn $"at Run.MoveNext, done" - sm.Data.builder.SetResult(sm.Data.result) - - with exn -> - //Console.WriteLine("[{0}] SetException {1}", sm.MethodBuilder.Task.Id, exn) - sm.Data.builder.SetException(exn) - - //// tailcall - //match sm.Data.tailcallTarget with - //| null -> - // printfn $"at Run.MoveNext, await" - //| tg -> - // printfn $"at Run.MoveNext, hijack" - // let mutable tg = tg - // MoveNext(&tg) - //-- RESUMABLE CODE END - )) - (SetStateMachineMethodImpl<_>(fun sm state -> ())) - (AfterCode<_,_>(fun sm -> - let ts = Async2, 'T>() - ts.Machine <- sm - ts.Machine.Data <- Async2StateMachineData() - ts :> Async2<'T>)) - else - failwith "no dynamic implementation as yet" - // let initialResumptionFunc = Async2ResumptionFunc<'T>(fun sm -> code.Invoke(&sm)) - // let resumptionFuncExecutor = Async2ResumptionExecutor<'T>(fun sm f -> - // // TODO: add exception handling? - // if f.Invoke(&sm) then - // sm.ResumptionPoint <- -2) - // let setStateMachine = SetStateMachineMethodImpl<_>(fun sm f -> ()) - // sm.Machine.ResumptionFuncInfo <- (initialResumptionFunc, resumptionFuncExecutor, setStateMachine) - //sm.Start() - - - [] - member inline _.Zero() : Async2Code<'TOverall, unit> = - ResumableCode.Zero() - - member inline _.Combine(task1: Async2Code<'TOverall, unit>, task2: Async2Code<'TOverall, 'T>) : Async2Code<'TOverall, 'T> = - ResumableCode.Combine(task1, task2) - - member inline _.WhileAsync([] condition : unit -> ValueTask, body : Async2Code<'TOverall, unit>) : Async2Code<'TOverall, unit> = - let mutable condition_res = true - ResumableCode.While((fun () -> condition_res), - ResumableCode<_,_>(fun sm -> - let mutable __stack_condition_fin = true - let __stack_vtask = condition() - if __stack_vtask.IsCompleted then - __stack_condition_fin <- true - condition_res <- __stack_vtask.Result - else - let task = __stack_vtask.AsTask() - let mutable awaiter = task.GetAwaiter() - // This will yield with __stack_fin = false - // This will resume with __stack_fin = true - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_condition_fin <- __stack_yield_fin - - if __stack_condition_fin then - condition_res <- task.Result - else - sm.Data.builder.AwaitUnsafeOnCompleted(&awaiter, &sm) - - if __stack_condition_fin then - if condition_res then - body.Invoke(&sm) - else - true - else - false - )) - - member inline _.While([] condition : unit -> bool, body : Async2Code<'TOverall, unit>) : Async2Code<'TOverall, unit> = - ResumableCode.While(condition, body) - - member inline _.TryWith(body : Async2Code<'TOverall, 'T>, catch : exn -> Async2Code<'TOverall, 'T>) : Async2Code<'TOverall, 'T> = - ResumableCode.TryWith(body, catch) - - member inline internal _.TryFinallyAsync(body: Async2Code<'TOverall, 'T>, compensation : unit -> Task) : Async2Code<'TOverall, 'T> = - ResumableCode.TryFinallyAsync(body, ResumableCode<_,_>(fun sm -> - let mutable __stack_condition_fin = true - let __stack_vtask = compensation() - if not __stack_vtask.IsCompleted then - let mutable awaiter = __stack_vtask.GetAwaiter() - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_condition_fin <- __stack_yield_fin - - if not __stack_condition_fin then - sm.Data.builder.AwaitUnsafeOnCompleted(&awaiter, &sm) - - __stack_condition_fin)) - - member inline _.TryFinally(body: Async2Code<'TOverall, 'T>, compensation : unit -> unit) : Async2Code<'TOverall, 'T> = - ResumableCode.TryFinally(body, ResumableCode<_,_>(fun sm -> compensation(); true)) - - member inline this.Using(resource : #IAsyncDisposable, body : #IAsyncDisposable -> Async2Code<'TOverall, 'T>) : Async2Code<'TOverall, 'T> = - // A using statement is just a try/finally with the finally block disposing if non-null. - this.TryFinallyAsync( - (fun sm -> (body resource).Invoke(&sm)), - (fun () -> - if not (isNull (box resource)) then - resource.DisposeAsync().AsTask() - else - Task.CompletedTask)) - - member inline _.Return (v: 'T) : Async2Code<'T, 'T> = - Async2Code<'T, 'T>(fun sm -> - sm.Data.result <- v - true) - - member inline _.Bind (task: Task<'TResult1>, continuation: ('TResult1 -> Async2Code<'TOverall, 'T>)) : Async2Code<'TOverall, 'T> = - Async2Code<'TOverall, 'T>(fun sm -> - let mutable awaiter = task.GetAwaiter() - let mutable __stack_fin = true - if not awaiter.IsCompleted then - // This will yield with __stack_fin2 = false - // This will resume with __stack_fin2 = true - let __stack_fin2 = ResumableCode.Yield().Invoke(&sm) - __stack_fin <- __stack_fin2 - - if __stack_fin then - let result = awaiter.GetResult() - (continuation result).Invoke(&sm) - else - sm.Data.builder.AwaitUnsafeOnCompleted(&awaiter, &sm) - false) - - member inline b.Bind (computation: Async2<'TResult1>, continuation: ('TResult1 -> Async2Code<'TOverall, 'T>)) : Async2Code<'TOverall, 'T> = - Async2Code<'TOverall, 'T>(fun sm -> - let ct = sm.Data.cancellationToken - b.Bind(computation.StartImmediate(ct).Task, continuation).Invoke(&sm)) - - member inline b.Bind (computation: Async<'TResult1>, continuation: ('TResult1 -> Async2Code<'TOverall, 'T>)) : Async2Code<'TOverall, 'T> = - Async2Code<'TOverall, 'T>(fun sm -> - let ct = sm.Data.cancellationToken - b.Bind(Async.StartImmediateAsTask(computation, ct), continuation).Invoke(&sm)) - - member inline b.ReturnFrom (task: Task<'T>) : Async2Code<'T, 'T> = - // No tailcalling to tasks - b.Bind(task, (fun res -> b.Return(res))) - - member inline b.ReturnFrom (computation: Async<'T>) : Async2Code<'T, 'T> = - // No tailcalling to Async - b.Bind(computation, (fun res -> b.Return(res))) - -// TODO - implement RFC for ReturnFromTailcall to make this safe - member inline b.ReturnFrom (other: Async2<'T>) : Async2Code<'T, 'T> = - b.Bind(other, (fun res -> b.Return(res))) - //Async2Code<'T, _>(fun sm -> - // printfn "setting hijack target and starting" - // sm.Data.tailcallTarget <- other - // // For tailcalls we return 'false' and re-run from the entry (trampoline) - // false - //) - - - -[] -module Async2 = - type Async2Builder with - member inline this.Using(resource : ('TResource :> IDisposable), body : ('TResource -> Async2Code<'TOverall, 'T>)) : Async2Code<'TOverall, 'T> = - // A using statement is just a try/finally with the finally block disposing if non-null. - this.TryFinally( - (fun sm -> (body resource).Invoke(&sm)), - (fun () -> if not (isNull (box resource)) then resource.Dispose())) - - member inline _.Bind< ^TaskLike, ^TResult1, 'TResult2, ^Awaiter , 'TOverall - when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) - and ^Awaiter :> ICriticalNotifyCompletion - and ^Awaiter: (member get_IsCompleted: unit -> bool) - and ^Awaiter: (member GetResult: unit -> ^TResult1)> - (task: ^TaskLike, continuation: (^TResult1 -> Async2Code<'TOverall, 'TResult2>)) : Async2Code<'TOverall, 'TResult2> = - - Async2Code<'TOverall, 'TResult2>(fun sm -> - if __useResumableCode then - //-- RESUMABLE CODE START - // Get an awaiter from the awaitable - let mutable awaiter = (^TaskLike: (member GetAwaiter : unit -> ^Awaiter)(task)) - - let mutable __stack_fin = true - if not (^Awaiter : (member get_IsCompleted : unit -> bool)(awaiter)) then - // This will yield with __stack_yield_fin = false - // This will resume with __stack_yield_fin = true - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_fin <- __stack_yield_fin - - if __stack_fin then - let result = (^Awaiter : (member GetResult : unit -> ^TResult1)(awaiter)) - (continuation result).Invoke(&sm) - else - sm.Data.builder.AwaitUnsafeOnCompleted(&awaiter, &sm) - false - else - failwith "dynamic" //TaskWitnesses.CanBindDynamic< ^TaskLike, ^TResult1, 'TResult2, ^Awaiter , 'TOverall>(&sm, priority, task, continuation) - //-- RESUMABLE CODE END - ) - - member inline b.ReturnFrom< ^TaskLike, ^Awaiter, ^T - when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) - and ^Awaiter :> ICriticalNotifyCompletion - and ^Awaiter: (member get_IsCompleted: unit -> bool) - and ^Awaiter: (member GetResult: unit -> ^T)> - (task: ^TaskLike) : Async2Code< ^T, ^T> = - b.Bind(task, (fun res -> b.Return(res))) - - member inline this.For(sequence : seq<'TElement>, body : 'TElement -> Async2Code<'TOverall, unit>) : Async2Code<'TOverall, unit> = - // A for loop is just a using statement on the sequence's enumerator... - this.Using (sequence.GetEnumerator(), - // ... and its body is a while loop that advances the enumerator and runs the body on each element. - (fun e -> this.While((fun () -> e.MoveNext()), (fun sm -> (body e.Current).Invoke(&sm))))) - - let async2 = Async2Builder() - - let runSynchronously ct (t: Async2<'T>) = - let e = t.StartImmediate(ct) - e.Task.Result - - let cancellationTokenAsync = - async2.Run(Async2Code(fun sm -> - sm.Data.result <- sm.Data.cancellationToken - true)) - - let unitAsync = async2 { return () } - -[] -type Async2 = - - static member CancellationToken = cancellationTokenAsync - - static member CancelCheck () = unitAsync - - static member DefaultCancellationToken = Async.DefaultCancellationToken - - static member CancelDefaultToken() = Async.CancelDefaultToken() - - static member Catch (computation: Async2<'T>) = - async2 { try let! res = computation in return Choice1Of2 res with e -> return Choice2Of2 e } - - static member RunSynchronously (computation: Async2<'T>, ?timeout: int, ?cancellationToken:CancellationToken) = - // TODO: timeout - let cancellationToken = defaultArg cancellationToken Async.DefaultCancellationToken - let e = computation.StartImmediate(cancellationToken) - e.Task.Result - - static member StartImmediateAsTask (computation: Async2<'T>, ?cancellationToken ) : Task<'T> = - let cancellationToken = defaultArg cancellationToken Async.DefaultCancellationToken - let e = computation.StartImmediate(cancellationToken) - e.Task - - static member StartImmediate(computation:Async2, ?cancellationToken) : unit = - let cancellationToken = defaultArg cancellationToken Async.DefaultCancellationToken - let e = computation.StartImmediate(cancellationToken) - e |> ignore - - static member SwitchToNewThread() = - async2 { return! Task.CompletedTask.ConfigureAwait(false) } - - static member SwitchToThreadPool() : Async2 = - async2 { return! Task.CompletedTask.ConfigureAwait(false) } - - static member Start (computation: Async2, ?cancellationToken) = - let p = - async2 { - do! Async2.SwitchToThreadPool() - return! computation - } - Async2.StartImmediate(p, ?cancellationToken=cancellationToken) - - static member StartAsTask (computation: Async2<'T>, ?taskCreationOptions: TaskCreationOptions, ?cancellationToken) = - // TODO: taskCreationOptions - let p = - async2 { - do! Async2.SwitchToThreadPool() - return! computation - } - Async2.StartImmediateAsTask(p, ?cancellationToken=cancellationToken) - - static member StartChildAsTask (computation: Async2<'T>, ?taskCreationOptions) : Async2> = - async2 { - let! cancellationToken = cancellationTokenAsync - return Async2.StartAsTask (computation, ?taskCreationOptions=taskCreationOptions, cancellationToken=cancellationToken) - } - - - static member Sleep (millisecondsDueTime: int64) : Async2 = - // TODO: int64 millisecondsDueTime? - async2 { return! Task.Delay(int millisecondsDueTime)} - - static member Sleep (millisecondsDueTime: int32) : Async2 = - async2 { return! Task.Delay(millisecondsDueTime)} - - static member Sleep (dueTime: TimeSpan) = - async2 { return! Task.Delay(dueTime)} - - static member Ignore (computation: Async2<'T>) = - async2 { let! _res = computation in return () } - - static member AwaitTask (task:Task<'T>) : Async2<'T> = - async2 { return! task } - - static member AwaitTask (task:Task) : Async2 = - async2 { return! task } - - //static member FromContinuations (callback: ('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) : Async2<'T> = - // MakeAsync (fun ctxt -> - // if ctxt.IsCancellationRequested then - // ctxt.OnCancellation () - // else - // let mutable underCurrentThreadStack = true - // let mutable contToTailCall = None - // let thread = Thread.CurrentThread - // let latch = Latch() - // let once cont x = - // if not(latch.Enter()) then invalidOp(SR.GetString(SR.controlContinuationInvokedMultipleTimes)) - // if Thread.CurrentThread.Equals thread && underCurrentThreadStack then - // contToTailCall <- Some(fun () -> cont x) - // else if Trampoline.ThisThreadHasTrampoline then - // let syncCtxt = SynchronizationContext.Current - // ctxt.trampolineHolder.PostOrQueueWithTrampoline syncCtxt (fun () -> cont x) |> unfake - // else - // ctxt.trampolineHolder.ExecuteWithTrampoline (fun () -> cont x ) |> unfake - // try - // callback (once ctxt.cont, (fun exn -> once ctxt.econt (ExceptionDispatchInfo.RestoreOrCapture exn)), once ctxt.ccont) - // with exn -> - // if not(latch.Enter()) then invalidOp(SR.GetString(SR.controlContinuationInvokedMultipleTimes)) - // let edi = ExceptionDispatchInfo.RestoreOrCapture exn - // ctxt.econt edi |> unfake - - // underCurrentThreadStack <- false - - // match contToTailCall with - // | Some k -> k() - // | _ -> fake()) - - //static member Parallel (computations: seq>) = Async.Parallel(computations, ?maxDegreeOfParallelism=None) - - //static member Parallel (computations: seq>, ?maxDegreeOfParallelism: int) = - // match maxDegreeOfParallelism with - // | Some x when x < 1 -> raise(System.ArgumentException(String.Format(SR.GetString(SR.maxDegreeOfParallelismNotPositive), x), "maxDegreeOfParallelism")) - // | _ -> () - - // MakeAsync (fun ctxt -> - // let tasks, result = - // try - // Seq.toArray computations, None // manually protect eval of seq - // with exn -> - // let edi = ExceptionDispatchInfo.RestoreOrCapture exn - // null, Some (ctxt.econt edi) - - // match result with - // | Some r -> r - // | None -> - // if tasks.Length = 0 then - // // must not be in a 'protect' if we call cont explicitly; if cont throws, it should unwind the stack, preserving Dev10 behavior - // ctxt.cont [| |] - // else - // ProtectedCode ctxt (fun ctxt -> - // let ctxtWithSync = DelimitSyncContext ctxt // manually resync - // let mutable count = tasks.Length - // let mutable firstExn = None - // let results = Array.zeroCreate tasks.Length - // // Attempt to cancel the individual operations if an exception happens on any of the other threads - // let innerCTS = new LinkedSubSource(ctxtWithSync.token) - - // let finishTask remaining = - // if (remaining = 0) then - // innerCTS.Dispose() - // match firstExn with - // | None -> ctxtWithSync.trampolineHolder.ExecuteWithTrampoline (fun () -> ctxtWithSync.cont results) - // | Some (Choice1Of2 exn) -> ctxtWithSync.trampolineHolder.ExecuteWithTrampoline (fun () -> ctxtWithSync.econt exn) - // | Some (Choice2Of2 cexn) -> ctxtWithSync.trampolineHolder.ExecuteWithTrampoline (fun () -> ctxtWithSync.ccont cexn) - // else - // fake() - - // // recordSuccess and recordFailure between them decrement count to 0 and - // // as soon as 0 is reached dispose innerCancellationSource - - // let recordSuccess i res = - // results.[i] <- res - // finishTask(Interlocked.Decrement &count) - - // let recordFailure exn = - // // capture first exception and then decrement the counter to avoid race when - // // - thread 1 decremented counter and preempted by the scheduler - // // - thread 2 decremented counter and called finishTask - // // since exception is not yet captured - finishtask will fall into success branch - // match Interlocked.CompareExchange(&firstExn, Some exn, None) with - // | None -> - // // signal cancellation before decrementing the counter - this guarantees that no other thread can sneak to finishTask and dispose innerCTS - // // NOTE: Cancel may introduce reentrancy - i.e. when handler registered for the cancellation token invokes cancel continuation that will call 'recordFailure' - // // to correctly handle this we need to return decremented value, not the current value of 'count' otherwise we may invoke finishTask with value '0' several times - // innerCTS.Cancel() - // | _ -> () - // finishTask(Interlocked.Decrement &count) - - // // If maxDegreeOfParallelism is set but is higher then the number of tasks we have we set it back to None to fall into the simple - // // queue all items branch - // let maxDegreeOfParallelism = - // match maxDegreeOfParallelism with - // | None -> None - // | Some x when x >= tasks.Length -> None - // | Some _ as x -> x - - // // Simple case (no maxDegreeOfParallelism) just queue all the work, if we have maxDegreeOfParallelism set we start that many workers - // // which will make progress on the actual computations - // match maxDegreeOfParallelism with - // | None -> - // tasks |> Array.iteri (fun i p -> - // QueueAsync - // innerCTS.Token - // // on success, record the result - // (fun res -> recordSuccess i res) - // // on exception... - // (fun edi -> recordFailure (Choice1Of2 edi)) - // // on cancellation... - // (fun cexn -> recordFailure (Choice2Of2 cexn)) - // p - // |> unfake) - // | Some maxDegreeOfParallelism -> - // let mutable i = -1 - // let rec worker (trampolineHolder : TrampolineHolder) = - // if i < tasks.Length then - // let j = Interlocked.Increment &i - // if j < tasks.Length then - // if innerCTS.Token.IsCancellationRequested then - // let cexn = OperationCanceledException (innerCTS.Token) - // recordFailure (Choice2Of2 cexn) |> unfake - // worker trampolineHolder |> unfake - // else - // let taskCtxt = - // AsyncActivation.Create - // innerCTS.Token - // trampolineHolder - // (fun res -> recordSuccess j res |> unfake; worker trampolineHolder) - // (fun edi -> recordFailure (Choice1Of2 edi) |> unfake; worker trampolineHolder) - // (fun cexn -> recordFailure (Choice2Of2 cexn) |> unfake; worker trampolineHolder) - // tasks.[j].Invoke taskCtxt |> unfake - // fake() - // for x = 1 to maxDegreeOfParallelism do - // let trampolineHolder = TrampolineHolder() - // trampolineHolder.QueueWorkItemWithTrampoline (fun () -> - // worker trampolineHolder) - // |> unfake - - // fake())) - - //static member Sequential (computations: seq>) = Async.Parallel(computations, maxDegreeOfParallelism=1) - - //static member Choice(computations: Async2<'T option> seq) : Async2<'T option> = - // MakeAsync (fun ctxt -> - // let result = - // try Seq.toArray computations |> Choice1Of2 - // with exn -> ExceptionDispatchInfo.RestoreOrCapture exn |> Choice2Of2 - - // match result with - // | Choice2Of2 edi -> ctxt.econt edi - // | Choice1Of2 [||] -> ctxt.cont None - // | Choice1Of2 computations -> - // ProtectedCode ctxt (fun ctxt -> - // let ctxtWithSync = DelimitSyncContext ctxt - // let mutable count = computations.Length - // let mutable noneCount = 0 - // let mutable someOrExnCount = 0 - // let innerCts = new LinkedSubSource(ctxtWithSync.token) - - // let scont (result: 'T option) = - // let result = - // match result with - // | Some _ -> - // if Interlocked.Increment &someOrExnCount = 1 then - // innerCts.Cancel(); ctxtWithSync.trampolineHolder.ExecuteWithTrampoline (fun () -> ctxtWithSync.cont result) - // else - // fake() - - // | None -> - // if Interlocked.Increment &noneCount = computations.Length then - // innerCts.Cancel(); ctxtWithSync.trampolineHolder.ExecuteWithTrampoline (fun () -> ctxtWithSync.cont None) - // else - // fake() - - // if Interlocked.Decrement &count = 0 then - // innerCts.Dispose() - - // result - - // let econt (exn: ExceptionDispatchInfo) = - // let result = - // if Interlocked.Increment &someOrExnCount = 1 then - // innerCts.Cancel(); ctxtWithSync.trampolineHolder.ExecuteWithTrampoline (fun () -> ctxtWithSync.econt exn) - // else - // fake() - - // if Interlocked.Decrement &count = 0 then - // innerCts.Dispose() - - // result - - // let ccont (exn: OperationCanceledException) = - // let result = - // if Interlocked.Increment &someOrExnCount = 1 then - // innerCts.Cancel(); ctxtWithSync.trampolineHolder.ExecuteWithTrampoline (fun () -> ctxtWithSync.ccont exn) - // else - // fake() - - // if Interlocked.Decrement &count = 0 then - // innerCts.Dispose() - - // result - - // for c in computations do - // QueueAsync innerCts.Token scont econt ccont c |> unfake - - // fake())) - - /// StartWithContinuations, except the exception continuation is given an ExceptionDispatchInfo - //static member StartWithContinuationsUsingDispatchInfo(computation:Async2<'T>, continuation, exceptionContinuation, cancellationContinuation, ?cancellationToken) : unit = - // let cancellationToken = defaultArg cancellationToken Async.DefaultCancellationToken - // AsyncPrimitives.StartWithContinuations cancellationToken computation continuation exceptionContinuation cancellationContinuation - - //static member StartWithContinuations(computation:Async2<'T>, continuation, exceptionContinuation, cancellationContinuation, ?cancellationToken) : unit = - // Async.StartWithContinuationsUsingDispatchInfo(computation, continuation, (fun edi -> exceptionContinuation (edi.GetAssociatedSourceException())), cancellationContinuation, ?cancellationToken=cancellationToken) - - ///// Wait for a wait handle. Both timeout and cancellation are supported - //static member AwaitWaitHandle(waitHandle: WaitHandle, ?millisecondsTimeout:int) = - // let millisecondsTimeout = defaultArg millisecondsTimeout Threading.Timeout.Infinite - // if millisecondsTimeout = 0 then - // async.Delay(fun () -> - // let ok = waitHandle.WaitOne(0, exitContext=false) - // async.Return ok) - // else - // CreateDelimitedUserCodeAsync(fun ctxt -> - // let aux = ctxt.aux - // let rwh = ref (None: RegisteredWaitHandle option) - // let latch = Latch() - // let rec cancelHandler = - // Action(fun () -> - // if latch.Enter() then - // // if we got here - then we need to unregister RegisteredWaitHandle + trigger cancellation - // // entrance to TP callback is protected by latch - so savedCont will never be called - // lock rwh (fun () -> - // match !rwh with - // | None -> () - // | Some rwh -> rwh.Unregister null |> ignore) - // Async.Start (async2 { do (ctxt.ccont (OperationCanceledException(aux.token)) |> unfake) })) - - // and registration: CancellationTokenRegistration = aux.token.Register(cancelHandler) - - // let savedCont = ctxt.cont - // try - // lock rwh (fun () -> - // rwh := Some(ThreadPool.RegisterWaitForSingleObject - // (waitObject=waitHandle, - // callBack=WaitOrTimerCallback(fun _ timeOut -> - // if latch.Enter() then - // lock rwh (fun () -> rwh.Value.Value.Unregister null |> ignore) - // rwh := None - // registration.Dispose() - // ctxt.trampolineHolder.ExecuteWithTrampoline (fun () -> savedCont (not timeOut)) |> unfake), - // state=null, - // millisecondsTimeOutInterval=millisecondsTimeout, - // executeOnlyOnce=true)) - // fake()) - // with _ -> - // if latch.Enter() then - // registration.Dispose() - // reraise() // reraise exception only if we successfully enter the latch (no other continuations were called) - // else - // fake() - // ) - - //static member AwaitIAsyncResult(iar: IAsyncResult, ?millisecondsTimeout): Async2 = - // async2 { if iar.CompletedSynchronously then - // return true - // else - // return! Async.AwaitWaitHandle(iar.AsyncWaitHandle, ?millisecondsTimeout=millisecondsTimeout) } - - - ///// Bind the result of a result cell, calling the appropriate continuation. - //static member BindResult (result: AsyncResult<'T>) : Async2<'T> = - // MakeAsync (fun ctxt -> - // (match result with - // | Ok v -> ctxt.cont v - // | Error exn -> ctxt.econt exn - // | Canceled exn -> ctxt.ccont exn) ) - - ///// Await and use the result of a result cell. The resulting async doesn't support cancellation - ///// or timeout directly, rather the underlying computation must fill the result if cancellation - ///// or timeout occurs. - //static member AwaitAndBindResult_NoDirectCancelOrTimeout(resultCell: ResultCell>) : Async2<'T> = - // async2 { - // let! result = resultCell.AwaitResult_NoDirectCancelOrTimeout - // return! Async.BindResult result - // } - - ///// Await the result of a result cell belonging to a child computation. The resulting async supports timeout and if - ///// it happens the child computation will be cancelled. The resulting async doesn't support cancellation - ///// directly, rather the underlying computation must fill the result if cancellation occurs. - //static member AwaitAndBindChildResult(innerCTS: CancellationTokenSource, resultCell: ResultCell>, millisecondsTimeout) : Async2<'T> = - // match millisecondsTimeout with - // | None | Some -1 -> - // resultCell |> Async.AwaitAndBindResult_NoDirectCancelOrTimeout - - // | Some 0 -> - // async2 { if resultCell.ResultAvailable then - // let res = resultCell.GrabResult() - // return res.Commit() - // else - // return raise (System.TimeoutException()) } - // | _ -> - // async2 { try - // if resultCell.ResultAvailable then - // let res = resultCell.GrabResult() - // return res.Commit() - // else - // let! ok = Async.AwaitWaitHandle (resultCell.GetWaitHandle(), ?millisecondsTimeout=millisecondsTimeout) - // if ok then - // let res = resultCell.GrabResult() - // return res.Commit() - // else // timed out - // // issue cancellation signal - // innerCTS.Cancel() - // // wait for computation to quiesce - // let! _ = Async.AwaitWaitHandle (resultCell.GetWaitHandle()) - // return raise (System.TimeoutException()) - // finally - // resultCell.Close() } - - - //static member FromBeginEnd(beginAction, endAction, ?cancelAction): Async2<'T> = - // async2 { let! cancellationToken = cancellationTokenAsync - // let resultCell = new ResultCell<_>() - - // let once = Once() - - // let registration: CancellationTokenRegistration = - - // let onCancel () = - // // Call the cancellation routine - // match cancelAction with - // | None -> - // // Register the result. This may race with a successful result, but - // // ResultCell allows a race and throws away whichever comes last. - // once.Do(fun () -> - // let canceledResult = Canceled (OperationCanceledException cancellationToken) - // resultCell.RegisterResult(canceledResult, reuseThread=true) |> unfake - // ) - // | Some cancel -> - // // If we get an exception from a cooperative cancellation function - // // we assume the operation has already completed. - // try cancel() with _ -> () - - // cancellationToken.Register(Action(onCancel)) - - // let callback = - // System.AsyncCallback(fun iar -> - // if not iar.CompletedSynchronously then - // // The callback has been activated, so ensure cancellation is not possible - // // beyond this point. - // match cancelAction with - // | Some _ -> - // registration.Dispose() - // | None -> - // once.Do(fun () -> registration.Dispose()) - - // // Run the endAction and collect its result. - // let res = - // try - // Ok(endAction iar) - // with exn -> - // let edi = ExceptionDispatchInfo.RestoreOrCapture exn - // Error edi - - // // Register the result. This may race with a cancellation result, but - // // ResultCell allows a race and throws away whichever comes last. - // resultCell.RegisterResult(res, reuseThread=true) |> unfake) - - // let (iar:IAsyncResult) = beginAction (callback, (null:obj)) - // if iar.CompletedSynchronously then - // registration.Dispose() - // return endAction iar - // else - // // Note: ok to use "NoDirectCancel" here because cancellation has been registered above - // // Note: ok to use "NoDirectTimeout" here because no timeout parameter to this method - // return! Async.AwaitAndBindResult_NoDirectCancelOrTimeout resultCell } - - - //static member FromBeginEnd(arg, beginAction, endAction, ?cancelAction): Async2<'T> = - // Async.FromBeginEnd((fun (iar, state) -> beginAction(arg, iar, state)), endAction, ?cancelAction=cancelAction) - - //static member FromBeginEnd(arg1, arg2, beginAction, endAction, ?cancelAction): Async2<'T> = - // Async.FromBeginEnd((fun (iar, state) -> beginAction(arg1, arg2, iar, state)), endAction, ?cancelAction=cancelAction) - - //static member FromBeginEnd(arg1, arg2, arg3, beginAction, endAction, ?cancelAction): Async2<'T> = - // Async.FromBeginEnd((fun (iar, state) -> beginAction(arg1, arg2, arg3, iar, state)), endAction, ?cancelAction=cancelAction) - - //static member AsBeginEnd<'Arg, 'T> (computation:('Arg -> Async2<'T>)) : - // // The 'Begin' member - // ('Arg * System.AsyncCallback * obj -> System.IAsyncResult) * - // // The 'End' member - // (System.IAsyncResult -> 'T) * - // // The 'Cancel' member - // (System.IAsyncResult -> unit) = - // let beginAction = fun (a1, callback, state) -> AsBeginEndHelpers.beginAction ((computation a1), callback, state) - // beginAction, AsBeginEndHelpers.endAction<'T>, AsBeginEndHelpers.cancelAction<'T> - - //static member AwaitEvent(event:IEvent<'Delegate, 'T>, ?cancelAction) : Async2<'T> = - // async2 { let! cancellationToken = cancellationTokenAsync - // let resultCell = new ResultCell<_>() - // // Set up the handlers to listen to events and cancellation - // let once = Once() - // let rec registration: CancellationTokenRegistration= - // let onCancel () = - // // We've been cancelled. Call the given cancellation routine - // match cancelAction with - // | None -> - // // We've been cancelled without a cancel action. Stop listening to events - // event.RemoveHandler del - // // Register the result. This may race with a successful result, but - // // ResultCell allows a race and throws away whichever comes last. - // once.Do(fun () -> resultCell.RegisterResult(Canceled (OperationCanceledException cancellationToken), reuseThread=true) |> unfake) - // | Some cancel -> - // // If we get an exception from a cooperative cancellation function - // // we assume the operation has already completed. - // try cancel() with _ -> () - // cancellationToken.Register(Action(onCancel)) - - // and del = - // FuncDelegate<'T>.Create<'Delegate>(fun eventArgs -> - // // Stop listening to events - // event.RemoveHandler del - // // The callback has been activated, so ensure cancellation is not possible beyond this point - // once.Do(fun () -> registration.Dispose()) - // let res = Ok eventArgs - // // Register the result. This may race with a cancellation result, but - // // ResultCell allows a race and throws away whichever comes last. - // resultCell.RegisterResult(res, reuseThread=true) |> unfake) - - // // Start listening to events - // event.AddHandler del - - // // Return the async computation that allows us to await the result - // // Note: ok to use "NoDirectCancel" here because cancellation has been registered above - // // Note: ok to use "NoDirectTimeout" here because no timeout parameter to this method - // return! Async.AwaitAndBindResult_NoDirectCancelOrTimeout resultCell } - - //static member StartChild (computation:Async2<'T>, ?millisecondsTimeout) = - // async2 { - // let resultCell = new ResultCell<_>() - // let! cancellationToken = cancellationTokenAsync - // let innerCTS = new CancellationTokenSource() // innerCTS does not require disposal - // let mutable ctsRef = innerCTS - // let reg = cancellationToken.Register( - // (fun () -> - // match ctsRef with - // | null -> () - // | otherwise -> otherwise.Cancel())) - // do QueueAsync - // innerCTS.Token - // // since innerCTS is not ever Disposed, can call reg.Dispose() without a safety Latch - // (fun res -> ctsRef <- null; reg.Dispose(); resultCell.RegisterResult (Ok res, reuseThread=true)) - // (fun edi -> ctsRef <- null; reg.Dispose(); resultCell.RegisterResult (Error edi, reuseThread=true)) - // (fun err -> ctsRef <- null; reg.Dispose(); resultCell.RegisterResult (Canceled err, reuseThread=true)) - // computation - // |> unfake - - // return Async.AwaitAndBindChildResult(innerCTS, resultCell, millisecondsTimeout) } - - //static member SwitchToContext syncContext = - // let t = - // Task.Factory.StartNew( - // (fun () -> ()), // this will use current synchronization context - // CancellationToken.None, - // TaskCreationOptions.None, - // TaskScheduler. .FromCurrentSynchronizationContext()) - // async2 { match syncContext with - // | null -> - // // no synchronization context, just switch to the thread pool - // do! Async.SwitchToThreadPool() - // | syncCtxt -> - // // post the continuation to the synchronization context - // return! CreateSwitchToAsync syncCtxt } - - //static member OnCancel interruption = - // async2 { let! cancellationToken = cancellationTokenAsync - // // latch protects CancellationTokenRegistration.Dispose from being called twice - // let latch = Latch() - // let rec handler () = - // try - // if latch.Enter() then registration.Dispose() - // interruption () - // with _ -> () - // and registration: CancellationTokenRegistration = cancellationToken.Register(Action(handler)) - // return { new System.IDisposable with - // member this.Dispose() = - // // dispose CancellationTokenRegistration only if cancellation was not requested. - // // otherwise - do nothing, disposal will be performed by the handler itself - // if not cancellationToken.IsCancellationRequested then - // if latch.Enter() then registration.Dispose() } } - - //static member TryCancelled (computation: Async2<'T>, compensation) = - // CreateWhenCancelledAsync compensation computation - -//module CommonExtensions = - -// type System.IO.Stream with - -// [] // give the extension member a 'nice', unmangled compiled name, unique within this module -// member stream.AsyncRead(buffer: byte[], ?offset, ?count) = -// let offset = defaultArg offset 0 -// let count = defaultArg count buffer.Length -// Async.FromBeginEnd (buffer, offset, count, stream.BeginRead, stream.EndRead) - -// [] // give the extension member a 'nice', unmangled compiled name, unique within this module -// member stream.AsyncRead count = -// async2 { -// let buffer = Array.zeroCreate count -// let mutable i = 0 -// while i < count do -// let! n = stream.AsyncRead(buffer, i, count - i) -// i <- i + n -// if n = 0 then -// raise(System.IO.EndOfStreamException()) -// return buffer } - -// [] // give the extension member a 'nice', unmangled compiled name, unique within this module -// member stream.AsyncWrite(buffer:byte[], ?offset:int, ?count:int) = -// let offset = defaultArg offset 0 -// let count = defaultArg count buffer.Length -// Async.FromBeginEnd (buffer, offset, count, stream.BeginWrite, stream.EndWrite) - - -//module WebExtensions = - -// type System.Net.WebRequest with -// [] // give the extension member a 'nice', unmangled compiled name, unique within this module -// member req.AsyncGetResponse() : Async2 = - -// let mutable canceled = false // WebException with Status = WebExceptionStatus.RequestCanceled can be raised in other situations except cancellation, use flag to filter out false positives - -// // Use CreateTryWithFilterAsync to allow propagation of exception without losing stack -// Async.FromBeginEnd(beginAction=req.BeginGetResponse, -// endAction = req.EndGetResponse, -// cancelAction = fun() -> canceled <- true; req.Abort()) -// |> CreateTryWithFilterAsync (fun exn -> -// match exn with -// | :? System.Net.WebException as webExn -// when webExn.Status = System.Net.WebExceptionStatus.RequestCanceled && canceled -> - -// Some (Async.BindResult(AsyncResult.Canceled (OperationCanceledException webExn.Message))) -// | _ -> -// None) - -// type System.Net.WebClient with -// member inline private this.Download(event: IEvent<'T, _>, handler: _ -> 'T, start, result) = -// let downloadAsync = -// Async.FromContinuations (fun (cont, econt, ccont) -> -// let userToken = obj() -// let rec delegate' (_: obj) (args: #ComponentModel.AsyncCompletedEventArgs) = -// // ensure we handle the completed event from correct download call -// if userToken = args.UserState then -// event.RemoveHandler handle -// if args.Cancelled then -// ccont (OperationCanceledException()) -// elif isNotNull args.Error then -// econt args.Error -// else -// cont (result args) -// and handle = handler delegate' -// event.AddHandler handle -// start userToken -// ) - -// async2 { -// use! _holder = Async.OnCancel(fun _ -> this.CancelAsync()) -// return! downloadAsync -// } - -// [] // give the extension member a 'nice', unmangled compiled name, unique within this module -// member this.AsyncDownloadString (address:Uri) : Async2 = -// this.Download( -// event = this.DownloadStringCompleted, -// handler = (fun action -> Net.DownloadStringCompletedEventHandler action), -// start = (fun userToken -> this.DownloadStringAsync(address, userToken)), -// result = (fun args -> args.Result) -// ) - -// [] // give the extension member a 'nice', unmangled compiled name, unique within this module -// member this.AsyncDownloadData (address:Uri) : Async2 = -// this.Download( -// event = this.DownloadDataCompleted, -// handler = (fun action -> Net.DownloadDataCompletedEventHandler action), -// start = (fun userToken -> this.DownloadDataAsync(address, userToken)), -// result = (fun args -> args.Result) -// ) - -// [] // give the extension member a 'nice', unmangled compiled name, unique within this module -// member this.AsyncDownloadFile (address:Uri, fileName:string) : Async2 = -// this.Download( -// event = this.DownloadFileCompleted, -// handler = (fun action -> ComponentModel.AsyncCompletedEventHandler action), -// start = (fun userToken -> this.DownloadFileAsync(address, fileName, userToken)), -// result = (fun _ -> ()) -// ) - -module Examples = - - let t1 () = - async2 { - printfn "in t1" - do! Async2.Sleep 100 - printfn "resuming t1" - - return "a" - } - - let testTailcallTiny () = - async2 { - return! t1() - } - let rec testTailcall (n: int) = - async2 { - if n % 100 = 0 then - printfn $"in t1, n = {n}" - if n > 0 then - return! testTailcall(n-1) - //yield () - } - - //let t2 () = - // async2 { - // printfn "in t2" - // yield "d" - // printfn "in t2 b" - // for x in t1 () do - // printfn "t2 - got %A" x - // yield "e" - // let! v = - // task { - // printfn "hey yo" - // do! Task.Delay(200) - // } - // yield "[T1]" + x - // let! v = - // task { - // printfn "hey yo" - // do! Task.Delay(10) - // } - // yield "f" - // } - - let perf1 (x: int) = - async2 { - return 1 - } - - //let perf1_AsyncSeq (x: int) = - // FSharp.Control.AsyncSeqExtensions.asyncSeq { - // yield 1 - // yield 2 - // if x >= 2 then - // yield 3 - // yield 4 - // } - - //let perf2_AsyncSeq () = - // FSharp.Control.AsyncSeqExtensions.asyncSeq { - // for i1 in perf1_AsyncSeq 3 do - // for i2 in perf1_AsyncSeq 3 do - // for i3 in perf1_AsyncSeq 3 do - // for i4 in perf1_AsyncSeq 3 do - // for i5 in perf1_AsyncSeq 3 do - // yield! perf1_AsyncSeq i5 - // } - - let dumpAsync2 (t: Async2<_>) = - printfn "-----" - let e = t.StartImmediate(CancellationToken()) - let res = e.Task.Result - printfn "result: %A" res - - //dumpAsync2 (t1()) - dumpAsync2 (testTailcallTiny()) - ////dumpAsync2 (t2()) - - //printfn "t1() = %A" (Async2.toArray (t1())) - //printfn "testTailcallTiny() = %A" (Async2.toArray (testTailcallTiny())) - //dumpAsync2 (testTailcall(100000)) - //printfn "t2() = %A" (Async2.toArray (t2())) - - //printfn "perf2() = %A" (Async2.toArray (perf2()) |> Array.sum) - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/async2.fsi b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/async2.fsi deleted file mode 100644 index 9398b1223c2..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/async2.fsi +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace rec FSharp.Control.Async2 - -open System -open System.Threading -open System.Threading.Tasks -open FSharp.Core.CompilerServices -open System.Runtime.CompilerServices - -[] -type Async2StateMachineData<'T> = - new: unit -> Async2StateMachineData<'T> - [] - val mutable cancellationToken: CancellationToken - [] - val mutable result: 'T - [] - val mutable builder: AsyncTaskMethodBuilder<'T> - [] - val mutable taken: bool - //// For tailcalls using 'return!' - //[] - //val mutable tailcallTarget: IAsync2Invocation<'T> - -type Async2Code<'TOverall, 'T> = ResumableCode, 'T> -and Async2StateMachine<'T> = ResumableStateMachine> -and Async2ResumptionFunc<'T> = ResumptionFunc> -and Async2ResumptionDynamicInfo<'T> = ResumptionDynamicInfo> - -type IAsync2Invokable<'T> = - abstract StartImmediate: CancellationToken -> IAsync2Invocation<'T> - -type IAsync2Invocation<'T> = - inherit IAsyncStateMachine - //abstract TailcallTarget: IAsync2Invocation<'T> - abstract CancellationToken: CancellationToken - abstract Task: Task<'T> - -[] -type Async2<'T> = - interface IAsync2Invokable<'T> - interface IAsync2Invocation<'T> - interface IAsyncStateMachine - member inline StartImmediate: ct: CancellationToken -> IAsync2Invocation<'T> - -[] -type Async2<'Machine, 'T when 'Machine :> IAsyncStateMachine and 'Machine :> IResumableStateMachine>> = - new : unit -> Async2<'Machine, 'T> - inherit Async2<'T> - [] - val mutable Machine: 'Machine - interface IAsyncStateMachine - interface IAsync2Invokable<'T> - interface IAsync2Invocation<'T> - -[] -type Async2 = - - static member RunSynchronously: computation:Async2<'T> * ?timeout: int * ?cancellationToken:CancellationToken-> 'T - - static member Start: computation:Async2 * ?cancellationToken:CancellationToken -> unit - - static member StartAsTask: computation:Async2<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T> -(* - static member StartChildAsTask: computation:Async2<'T> * ?taskCreationOptions:TaskCreationOptions -> Async2> -*) - - static member Catch: computation:Async2<'T> -> Async2> - - (* - static member TryCancelled: computation:Async2<'T> * compensation:(OperationCanceledException -> unit) -> Async2<'T> - - static member OnCancel: interruption: (unit -> unit) -> Async2 - *) - - static member CancellationToken: Async2 - - static member CancelDefaultToken: unit -> unit - - static member DefaultCancellationToken: CancellationToken - - //---------- Parallelism -(* - static member StartChild: computation:Async2<'T> * ?millisecondsTimeout: int -> Async2> - - static member Parallel: computations:seq> -> Async2<'T[]> - - static member Parallel: computations:seq> * ?maxDegreeOfParallelism: int -> Async2<'T[]> - - static member Sequential: computations:seq> -> Async2<'T[]> - - static member Choice: computations:seq> -> Async2<'T option> -*) - static member SwitchToNewThread: unit -> Async2 - - static member SwitchToThreadPool: unit -> Async2 - -(* - static member SwitchToContext: syncContext:System.Threading.SynchronizationContext -> Async2 - - static member FromContinuations: callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async2<'T> - - static member AwaitEvent: event:IEvent<'Del,'T> * ?cancelAction: (unit -> unit) -> Async2<'T> when 'Del: delegate<'T,unit> and 'Del :> System.Delegate - - static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout:int -> Async2 - - static member AwaitIAsyncResult: iar: System.IAsyncResult * ?millisecondsTimeout:int -> Async2 -*) - static member AwaitTask: task: Task<'T> -> Async2<'T> - - static member AwaitTask: task: Task -> Async2 - - static member Sleep: millisecondsDueTime:int -> Async2 - - static member Ignore: computation: Async2<'T> -> Async2 -(* - static member StartWithContinuations: - computation:Async2<'T> * - continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * - ?cancellationToken:CancellationToken-> unit -*) - static member StartImmediate: - computation:Async2 * ?cancellationToken:CancellationToken-> unit - - static member StartImmediateAsTask: - computation:Async2<'T> * ?cancellationToken:CancellationToken-> Task<'T> - -(* -type Async2Return - -[] -type Async2Activation<'T> = - - member IsCancellationRequested: bool - - member OnSuccess: 'T -> Async2Return - - member OnExceptionRaised: unit -> unit - - member OnCancellation: unit -> Async2Return - -[] -module Async2Primitives = - - val MakeAsync: body:(Async2Activation<'T> -> Async2Return) -> Async2<'T> - - val Invoke: computation: Async2<'T> -> ctxt:Async2Activation<'T> -> Async2Return - - val CallThenInvoke: ctxt:Async2Activation<'T> -> result1:'U -> part2:('U -> Async2<'T>) -> Async2Return - - val Bind: ctxt:Async2Activation<'T> -> part1:Async2<'U> -> part2:('U -> Async2<'T>) -> Async2Return - - val TryFinally: ctxt:Async2Activation<'T> -> computation: Async2<'T> -> finallyFunction: (unit -> unit) -> Async2Return - - val TryWith: ctxt:Async2Activation<'T> -> computation: Async2<'T> -> catchFunction: (Exception -> Async2<'T> option) -> Async2Return - -*) - -[] -type Async2Builder = - - member inline Run: code : Async2Code<'T, 'T> -> Async2<'T> - - [] - member inline Zero: unit -> Async2Code<'TOverall, unit> - - member inline Combine: task1: Async2Code<'TOverall, unit> * task2: Async2Code<'TOverall, 'T> -> Async2Code<'TOverall, 'T> - - member inline While: [] condition: (unit -> bool) * body: Async2Code<'TOverall, unit> -> Async2Code<'TOverall, unit> - - member inline Return: v: 'T -> Async2Code<'T, 'T> - - member inline ReturnFrom: task: Task<'T> -> Async2Code<'T, 'T> - - member inline ReturnFrom: computation: Async<'T> -> Async2Code<'T, 'T> - - member inline ReturnFrom: other: Async2<'T> -> Async2Code<'T, 'T> - - member inline Delay: f: (unit -> Async2Code<'TOverall, 'T>) -> Async2Code<'TOverall, 'T> - - member inline Using: resource: ('TResource :> IAsyncDisposable) * body: ('TResource -> Async2Code<'TOverall, 'T>) -> Async2Code<'TOverall, 'T> - - member inline TryFinally: body: Async2Code<'TOverall, 'T> * compensation: (unit -> unit) -> Async2Code<'TOverall, 'T> - - member inline TryWith: body: Async2Code<'TOverall, 'T> * catch: (exn -> Async2Code<'TOverall, 'T>) -> Async2Code<'TOverall, 'T> - - member inline Bind: task: Task<'TResult1> * continuation: ('TResult1 -> Async2Code<'TOverall, 'T>) -> Async2Code<'TOverall, 'T> - - member inline Bind: computation: Async<'TResult1> * continuation: ('TResult1 -> Async2Code<'TOverall, 'T>) -> Async2Code<'TOverall, 'T> - - member inline Bind: computation: Async2<'TResult1> * continuation: ('TResult1 -> Async2Code<'TOverall, 'T>) -> Async2Code<'TOverall, 'T> - - -[] -module Async2 = - type Async2Builder with - member inline ReturnFrom< ^TaskLike, ^Awaiter, ^T - when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) - and ^Awaiter :> ICriticalNotifyCompletion - and ^Awaiter: (member get_IsCompleted: unit -> bool) - and ^Awaiter: (member GetResult: unit -> ^T)> - : task: ^TaskLike -> Async2Code< ^T, ^T> - - member inline Bind< ^TaskLike, ^TResult1, 'TResult2, ^Awaiter , 'TOverall - when ^TaskLike: (member GetAwaiter: unit -> ^Awaiter) - and ^Awaiter :> ICriticalNotifyCompletion - and ^Awaiter: (member get_IsCompleted: unit -> bool) - and ^Awaiter: (member GetResult: unit -> ^TResult1)> - : task: ^TaskLike * continuation: (^TResult1 -> Async2Code<'TOverall, 'TResult2>) -> Async2Code<'TOverall, 'TResult2> - - member inline Using: resource: ('TResource :> IDisposable) * body: ('TResource -> Async2Code<'TOverall, 'T>) -> Async2Code<'TOverall, 'T> - - member inline For: sequence: seq<'TElement> * body: ('TElement -> Async2Code<'TOverall, unit>) -> Async2Code<'TOverall, unit> - - val async2: Async2Builder -//[] -///// A module of extension members providing asynchronous operations for some basic CLI types related to concurrency and I/O. -///// -///// Async Programming -//module CommonExtensions = - -// type System.IO.Stream with - -// /// Returns an asynchronous computation that will read from the stream into the given buffer. -// /// The buffer to read into. -// /// An optional offset as a number of bytes in the stream. -// /// An optional number of bytes to read from the stream. -// /// -// /// An asynchronous computation that will read from the stream into the given buffer. -// /// Thrown when the sum of offset and count is longer than -// /// the buffer length. -// /// Thrown when offset or count is negative. -// member AsyncRead: buffer:byte[] * ?offset:int * ?count:int -> Async2 - -// /// Returns an asynchronous computation that will read the given number of bytes from the stream. -// /// -// /// The number of bytes to read. -// /// -// /// An asynchronous computation that returns the read byte[] when run. -// member AsyncRead: count:int -> Async2 - -// /// Returns an asynchronous computation that will write the given bytes to the stream. -// /// -// /// The buffer to write from. -// /// An optional offset as a number of bytes in the stream. -// /// An optional number of bytes to write to the stream. -// /// -// /// An asynchronous computation that will write the given bytes to the stream. -// /// Thrown when the sum of offset and count is longer than -// /// the buffer length. -// /// Thrown when offset or count is negative. -// member AsyncWrite: buffer:byte[] * ?offset:int * ?count:int -> Async2 - - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/coroutine.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/coroutine.fs deleted file mode 100644 index 04c4defdbfc..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/coroutine.fs +++ /dev/null @@ -1,279 +0,0 @@ - - -// This is a sample and test showing how to use resumable code to implement -// coroutines with tailcall support -// -// A coroutine is a value of type Coroutine normally constructed using this form: -// -// coroutine { -// printfn "in t1" -// yield () -// printfn "hey" -// } -// -// We also support `yield!` and tailcalls using the (non-standard) syntax of `return!`/ReturnFrom - -module Tests.Coroutines - -open System -open System.Runtime.CompilerServices -open FSharp.Core.CompilerServices -open FSharp.Core.CompilerServices.StateMachineHelpers -open FSharp.Core.LanguagePrimitives.IntrinsicOperators -open FSharp.Collections - -let verbose = false - -/// Helpers to do zero-allocation call to interface methods on structs -[] -module internal Helpers = - let inline MoveNext(x: byref<'T> when 'T :> IAsyncStateMachine) = x.MoveNext() - let inline SetStateMachine(x: byref<'T> when 'T :> IAsyncStateMachine, state) = x.SetStateMachine(state) - let inline GetResumptionPoint(x: byref<'T> when 'T :> IResumableStateMachine<'Data>) = x.ResumptionPoint - -/// This is the type of coroutines -[] -type Coroutine() = - - /// Checks if the coroutine is completed - abstract IsCompleted: bool - - /// Executes the coroutine until the next 'yield' - abstract MoveNext: unit -> unit - - /// Gets the tailcall target if the coroutine has executed a `return!` - abstract TailcallTarget: Coroutine option - -/// This is the implementation of Coroutine with respect to a particular struct state machine type. -and [] - Coroutine<'Machine when 'Machine : struct - and 'Machine :> IAsyncStateMachine - and 'Machine :> ICoroutineStateMachine>() = - inherit Coroutine() - - // The state machine struct - [] - val mutable Machine: 'Machine - - override cr.IsCompleted = - match cr.TailcallTarget with - | None -> - GetResumptionPoint(&cr.Machine) = -1 - | Some tg -> - tg.IsCompleted - - override cr.TailcallTarget = - CoroutineStateMachineData.GetHijackTarget(&cr.Machine) - - override cr.MoveNext() = - match cr.TailcallTarget with - | None -> //if verbose then printfn $"[{cr.Id}] move" - MoveNext(&cr.Machine) - | Some tg -> - match tg.TailcallTarget with - | None -> tg.MoveNext() - | Some tg2 -> - // Cut out chains of tailcalls - CoroutineStateMachineData.SetHijackTarget(&cr.Machine, tg2) - tg2.MoveNext() -/// This extra data stored in ResumableStateMachine (and it's templated copies using __stateMachine) -/// It only contains one field, the hijack target for tailcalls. -and [] - CoroutineStateMachineData = - - /// This is used for tailcalls using 'return!' - [] - val mutable TailcallTarget: Coroutine option - - static member GetHijackTarget(x: byref<'Machine> when 'Machine :> IResumableStateMachine) = - x.Data.TailcallTarget - - static member SetHijackTarget(x: byref<'Machine>, tg: Coroutine) : unit when 'Machine :> IResumableStateMachine = - let mutable newData = CoroutineStateMachineData() - newData.TailcallTarget <- Some tg - x.Data <- newData - -/// These are standard definitions filling in the 'Data' parameter of each -and ICoroutineStateMachine = IResumableStateMachine -and CoroutineStateMachine = ResumableStateMachine -and CoroutineResumptionFunc = ResumptionFunc -and CoroutineResumptionDynamicInfo = ResumptionDynamicInfo -and CoroutineCode = ResumableCode - - -/// The builder for tailcalls, defined using resumable code combinators -type CoroutineBuilder() = - - member inline _.Delay(f : unit -> CoroutineCode) : CoroutineCode = ResumableCode.Delay(f) - - /// Create the state machine and outer execution logic - member inline _.Run(code : CoroutineCode) : Coroutine = - if __useResumableCode then - __stateMachine - - // IAsyncStateMachine.MoveNext - (MoveNextMethodImpl<_>(fun sm -> - //-- RESUMABLE CODE START - __resumeAt sm.ResumptionPoint - let __stack_code_fin = code.Invoke(&sm) - if __stack_code_fin then - sm.ResumptionPoint <- -1 // indicates complete - else - // Goto request - match sm.Data.TailcallTarget with - | Some tg -> tg.MoveNext() // recurse - | None -> () - //-- RESUMABLE CODE END - )) - - // IAsyncStateMachine.SetStateMachine - (SetStateMachineMethodImpl<_>(fun sm state -> SetStateMachine(&sm, state))) - - // Box the coroutine. In this example we don't start execution of the coroutine. - (AfterCode<_,_>(fun sm -> - let mutable cr = Coroutine() - cr.Machine <- sm - cr :> Coroutine)) - else - // The dynamic implementation - let initialResumptionFunc = CoroutineResumptionFunc(fun sm -> code.Invoke(&sm)) - let resumptionInfo = - { new CoroutineResumptionDynamicInfo(initialResumptionFunc) with - member info.MoveNext(sm) = - if info.ResumptionFunc.Invoke(&sm) then - sm.ResumptionPoint <- -1 - member info.SetStateMachine(sm, state) = () - } - let mutable cr = Coroutine() - cr.Machine.ResumptionDynamicInfo <- resumptionInfo - cr :> Coroutine - - /// Used to represent no-ops like the implicit empty "else" branch of an "if" expression. - [] - member inline _.Zero() : CoroutineCode = ResumableCode.Zero() - - /// Chains together a step with its following step. - /// Note that this requires that the first step has no result. - /// This prevents constructs like `task { return 1; return 2; }`. - member inline _.Combine(code1: CoroutineCode, code2: CoroutineCode) : CoroutineCode = - ResumableCode.Combine(code1, code2) - - /// Builds a step that executes the body while the condition predicate is true. - member inline _.While ([] condition : unit -> bool, body : CoroutineCode) : CoroutineCode = - ResumableCode.While(condition, body) - - /// Wraps a step in a try/with. This catches exceptions both in the evaluation of the function - /// to retrieve the step, and in the continuation of the step (if any). - member inline _.TryWith (body: CoroutineCode, catch: exn -> CoroutineCode) : CoroutineCode = - ResumableCode.TryWith(body, catch) - - /// Wraps a step in a try/finally. This catches exceptions both in the evaluation of the function - /// to retrieve the step, and in the continuation of the step (if any). - member inline _.TryFinally (body: CoroutineCode, [] compensation : unit -> unit) : CoroutineCode = - ResumableCode.TryFinally(body, ResumableCode<_,_>(fun _ -> compensation(); true)) - - member inline _.Using (resource : 'Resource, body : 'Resource -> CoroutineCode) : CoroutineCode when 'Resource :> IDisposable = - ResumableCode.Using(resource, body) - - member inline _.For (sequence : seq<'T>, body : 'T -> CoroutineCode) : CoroutineCode = - ResumableCode.For(sequence, body) - - member inline _.Yield (_dummy: unit) : CoroutineCode = - ResumableCode.Yield() - - // The implementation of `yield!` - member inline _.YieldFrom (other: Coroutine) : CoroutineCode = - ResumableCode.While((fun () -> not other.IsCompleted), CoroutineCode(fun sm -> - other.MoveNext() - let __stack_other_fin = other.IsCompleted - if not __stack_other_fin then - // This will yield with __stack_yield_fin = false - // This will resume with __stack_yield_fin = true - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_yield_fin - else - true)) - - // The implementation of `return!`, non-standard for tailcalls - member inline _.ReturnFrom (other: Coroutine) : CoroutineCode = - ResumableCode<_,_>(fun sm -> - sm.Data.TailcallTarget <- Some other - // For tailcalls we return 'false' and re-run from the entry (trampoline) - false - // We could do this immediately with future cut-out, though this will stack-dive on sync code. - // We could also trampoline less frequently via a counter - // b.YieldFrom(other).Invoke(&sm) - ) - -[] -module CoroutineBuilder = - - let coroutine = CoroutineBuilder() - - -module Examples = - - let t1 () = - coroutine { - printfn "in t1" - yield () - printfn "hey ho" - yield () - yield! - coroutine{ - printfn "hey yo" - yield () - printfn "hey go" - } - } - - let testTailcallTiny () = - coroutine { - return! t1() - } - let rec testTailcall (n: int) = - coroutine { - if n % 100 = 0 then printfn $"in t1, n = {n}" - yield () - if n > 0 then - return! testTailcall(n-1) - } - - - let t2 () = - coroutine { - printfn "in t2" - yield () - printfn "in t2 b" - yield! t1() - //for x in t1 () do - // printfn "t2 - got %A" x - // yield () - // yield! - // coroutine { - // printfn "hey yo" - // } - // yield "[T1]" + x - yield! - coroutine { - printfn "hey yo" - //do! Task.Delay(10) - } - yield () - } - - - let dumpCoroutine (t: Coroutine) = - printfn "-----" - while ( //if verbose then printfn $"[{t.Id}] calling t.MoveNext, will resume at {t.ResumptionPoint}"; - t.MoveNext() - not t.IsCompleted) do - () // printfn "yield" - - dumpCoroutine (t1()) - dumpCoroutine (testTailcallTiny()) - dumpCoroutine (testTailcall(1000000)) - dumpCoroutine (t2()) - - - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/coroutineBasic.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/coroutineBasic.fs deleted file mode 100644 index 8f8d707b6de..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/coroutineBasic.fs +++ /dev/null @@ -1,169 +0,0 @@ -// This is a sample and test showing how to use resumable code to implement coroutines -// -// A coroutine is a value of type Coroutine normally constructed using this form: -// -// coroutine { -// printfn "in t1" -// yield () -// printfn "hey" -// } - -module rec Tests.CoroutinesBasic - -open System -open System.Runtime.CompilerServices -open FSharp.Core.CompilerServices -open FSharp.Core.CompilerServices.StateMachineHelpers - -/// This is the type of coroutines -[] -type Coroutine() = - - /// Checks if the coroutine is completed - abstract IsCompleted: bool - - /// Executes the coroutine until the next 'yield' - abstract MoveNext: unit -> unit - -/// Helpers to do zero-allocation call to interface methods on structs -[] -module internal Helpers = - let inline MoveNext(x: byref<'T> when 'T :> IAsyncStateMachine) = x.MoveNext() - let inline GetResumptionPoint(x: byref<'T> when 'T :> IResumableStateMachine<'Data>) = x.ResumptionPoint - let inline SetData(x: byref<'T> when 'T :> IResumableStateMachine<'Data>, data) = x.Data <- data - -/// This is the implementation of Coroutine with respect to a particular struct state machine type. -[] -type Coroutine<'Machine when 'Machine : struct - and 'Machine :> IAsyncStateMachine - and 'Machine :> ICoroutineStateMachine>() = - inherit Coroutine() - - // The state machine struct - [] - val mutable Machine: 'Machine - - override cr.IsCompleted = - GetResumptionPoint(&cr.Machine) = -1 - - override cr.MoveNext() = - MoveNext(&cr.Machine) - -/// This extra data stored in ResumableStateMachine (and it's templated copies using __stateMachine) -/// In this example there is just an ID -[] -type CoroutineStateMachineData(id: int) = - member _.Id = id - -let nextId = - let mutable n = 0 - fun () -> n <- n + 1; n - -/// These are standard definitions filling in the 'Data' parameter of each -type ICoroutineStateMachine = IResumableStateMachine -type CoroutineStateMachine = ResumableStateMachine -type CoroutineResumptionFunc = ResumptionFunc -type CoroutineResumptionDynamicInfo = ResumptionDynamicInfo -type CoroutineCode = ResumableCode - -type CoroutineBuilder() = - - member inline _.Delay(f : unit -> CoroutineCode) : CoroutineCode = ResumableCode.Delay(f) - - /// Used to represent no-ops like the implicit empty "else" branch of an "if" expression. - [] - member inline _.Zero() : CoroutineCode = ResumableCode.Zero() - - // The implementation of `e1; e2` - member inline _.Combine(code1: CoroutineCode, code2: CoroutineCode) : CoroutineCode = - ResumableCode.Combine(code1, code2) - - // The implementation of `while` - member inline _.While ([] condition : unit -> bool, body : CoroutineCode) : CoroutineCode = - ResumableCode.While(condition, body) - - // The implementation of `try/with` - member inline _.TryWith (body: CoroutineCode, catch: exn -> CoroutineCode) : CoroutineCode = - ResumableCode.TryWith(body, catch) - - // The implementation of `try/finally` - member inline _.TryFinally (body: CoroutineCode, [] compensation : unit -> unit) : CoroutineCode = - ResumableCode.TryFinally(body, ResumableCode<_,_>(fun _ -> compensation(); true)) - - // The implementation of `use` - member inline _.Using (resource : 'Resource, body : 'Resource -> CoroutineCode) : CoroutineCode when 'Resource :> IDisposable = - ResumableCode.Using(resource, body) - - // The implementation of `for` - member inline _.For (sequence : seq<'T>, body : 'T -> CoroutineCode) : CoroutineCode = - ResumableCode.For(sequence, body) - - // The implementation of `yield` - member inline _.Yield (_dummy: unit) : CoroutineCode = - ResumableCode.Yield() - - // The implementation of `yield!` - member inline _.YieldFrom (other: Coroutine) : CoroutineCode = - ResumableCode.While((fun () -> not other.IsCompleted), CoroutineCode(fun sm -> - other.MoveNext() - let __stack_other_fin = other.IsCompleted - if not __stack_other_fin then - ResumableCode.Yield().Invoke(&sm) - else - true)) - - /// Create the state machine and outer execution logic - member inline _.Run(code : CoroutineCode) : Coroutine = - if __useResumableCode then - __stateMachine - - // IAsyncStateMachine.MoveNext - (MoveNextMethodImpl<_>(fun sm -> - __resumeAt sm.ResumptionPoint - let __stack_code_fin = code.Invoke(&sm) - if __stack_code_fin then - sm.ResumptionPoint <- -1 // indicates complete - )) - - // IAsyncStateMachine.SetStateMachine - (SetStateMachineMethodImpl<_>(fun sm state -> ())) - - // Box the coroutine. In this example we don't start execution of the coroutine. - (AfterCode<_,_>(fun sm -> - let mutable cr = Coroutine() - SetData(&cr.Machine, CoroutineStateMachineData(nextId())) - cr.Machine <- sm - cr :> Coroutine)) - else - // The dynamic implementation - let initialResumptionFunc = CoroutineResumptionFunc(fun sm -> code.Invoke(&sm)) - let resumptionInfo = - { new CoroutineResumptionDynamicInfo(initialResumptionFunc) with - member info.MoveNext(sm) = - if info.ResumptionFunc.Invoke(&sm) then - sm.ResumptionPoint <- -1 - member info.SetStateMachine(sm, state) = () - } - let mutable cr = Coroutine() - cr.Machine.ResumptionDynamicInfo <- resumptionInfo - cr :> Coroutine - -[] -module CoroutineBuilder = - - let coroutine = CoroutineBuilder() - -module Examples = - let t1 () = - coroutine { - printfn "in t1" - yield () - printfn "hey ho" - yield () - } - let dumpCoroutine (t: Coroutine) = - printfn "-----" - while ( t.MoveNext() - not t.IsCompleted) do - printfn "yield" - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/empty.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/empty.fs deleted file mode 100644 index 41ce540367b..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/empty.fs +++ /dev/null @@ -1,5 +0,0 @@ - -module Tests.Empty - - -let _ = printfn "hello" \ No newline at end of file diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/list.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/list.fs deleted file mode 100644 index 14240aac764..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/list.fs +++ /dev/null @@ -1,195 +0,0 @@ - -module Tests.ListBuilders - -#if FSHARP_CORE_HAS_LIST_COLLECTOR -open System -open System.Collections.Generic -open FSharp.Core.CompilerServices - -#nowarn "57" - -[] -module UsingInlinedCodeAndCollector = - [] - type ListBuilderCollector<'T> = - [] - val mutable Collector : ListCollector<'T> - - member sm.Yield (value: 'T) = sm.Collector.Yield(value) - - member sm.ToList() = sm.Collector.ToList() - - type ListBuilderCode<'T> = delegate of byref> -> unit - - type ListBuilderViaCollector() = - - member inline _.Delay([] f: unit -> ListBuilderCode<'T>) : ListBuilderCode<'T> = - ListBuilderCode<_>(fun sm -> (f()).Invoke &sm) - - member inline _.Zero() : ListBuilderCode<'T> = - ListBuilderCode<_>(fun _sm -> ()) - - member inline _.Combine([] part1: ListBuilderCode<'T>, [] part2: ListBuilderCode<'T>) : ListBuilderCode<'T> = - ListBuilderCode<_>(fun sm -> - part1.Invoke &sm - part2.Invoke &sm) - - member inline _.While([] condition : unit -> bool, [] body : ListBuilderCode<'T>) : ListBuilderCode<'T> = - ListBuilderCode<_>(fun sm -> - while condition() do - body.Invoke &sm) - - member inline _.TryWith([] body: ListBuilderCode<'T>, [] handler: exn -> ListBuilderCode<'T>) : ListBuilderCode<'T> = - ListBuilderCode<_>(fun sm -> - try - body.Invoke &sm - with exn -> - (handler exn).Invoke &sm) - - member inline _.TryFinally([] body: ListBuilderCode<'T>, compensation : unit -> unit) : ListBuilderCode<'T> = - ListBuilderCode<_>(fun sm -> - try - body.Invoke &sm - with _ -> - compensation() - reraise() - - compensation()) - - member inline b.Using(disp : #IDisposable, [] body: #IDisposable -> ListBuilderCode<'T>) : ListBuilderCode<'T> = - // A using statement is just a try/finally with the finally block disposing if non-null. - b.TryFinally( - (fun sm -> (body disp).Invoke &sm), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - member inline b.For(sequence: seq<'TElement>, [] body: 'TElement -> ListBuilderCode<'T>) : ListBuilderCode<'T> = - b.Using (sequence.GetEnumerator(), - (fun e -> b.While((fun () -> e.MoveNext()), (fun sm -> (body e.Current).Invoke &sm)))) - - member inline _.Yield (v: 'T) : ListBuilderCode<'T> = - ListBuilderCode<_>(fun sm -> - sm.Yield v) - - member inline b.YieldFrom (source: IEnumerable<'T>) : ListBuilderCode<'T> = - b.For(source, (fun value -> b.Yield(value))) - - member inline _.Run([] code: ListBuilderCode<'T>) : 'T list = - let mutable sm = ListBuilderCollector<'T>() - code.Invoke &sm - sm.ToList() - - let listc = ListBuilderViaCollector() - -module Examples = - let t1C () = - listc { - printfn "in t1" - yield "a" - let x = "d" - yield "b" - yield "c" + x - } - - let t2C () = - listc { - printfn "in t2" - yield "d" - for x in t1C () do - printfn "t2 - got %A" x - yield "e" - yield "[T1]" + x - yield "f" - } - - let tinyVariableSizeNew () = - for i in 1 .. 1000000 do - listc { - if i % 3 = 0 then - yield "b" - } |> List.length |> ignore - - let tinyVariableSizeBuiltin () = - for i in 1 .. 1000000 do - [ - if i % 3 = 0 then - yield "b" - ] |> List.length |> ignore - - let variableSizeNew () = - for i in 1 .. 1000000 do - listc { - yield "a" - yield "b" - yield "b" - yield "b" - yield "b" - if i % 3 = 0 then - yield "b" - yield "b" - yield "b" - yield "b" - yield "c" - } |> List.length |> ignore - - let variableSizeBuiltin () = - for i in 1 .. 1000000 do - [ - yield "a" - yield "b" - yield "b" - yield "b" - yield "b" - if i % 3 = 0 then - yield "b" - yield "b" - yield "b" - yield "b" - yield "c" - ] |> List.length |> ignore - - let fixedSizeC () = - for i in 1 .. 1000000 do - listc { - "a" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "c" - } |> List.length |> ignore - - let fixedSizeBase () = - for i in 1 .. 1000000 do - [ - "a" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "b" - "c" - ] |> List.length |> ignore - - let perf s f = - let t = System.Diagnostics.Stopwatch() - t.Start() - f() - t.Stop() - printfn "PERF: %s : %d" s t.ElapsedMilliseconds - - perf "tinyVariableSizeBuiltin" tinyVariableSizeBuiltin - perf "tinyVariableSizeNew " tinyVariableSizeNew - - perf "variableSizeBuiltin" variableSizeBuiltin - perf "variableSizeNew" variableSizeNew - - perf "fixedSizeBase" fixedSizeBase - perf "fixedSizeC" fixedSizeC -#endif \ No newline at end of file diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/option.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/option.fs deleted file mode 100644 index 2df8610880f..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/option.fs +++ /dev/null @@ -1,310 +0,0 @@ - -module Tests.OptionBuilders - -open System - -type OptionCode<'T> = unit -> 'T voption - -type OptionBuilderUsingInlineIfLambdaBase() = - - member inline _.Delay([] f : unit -> OptionCode<'T>) : OptionCode<'T> = - (fun () -> (f())()) - // Note, not "f()()" - the F# compiler optimzier likes arguments to match lamdas in order to preserve - // argument evaluation order, so for "(f())()" the optimizer reduces one lambda then another, while "f()()" doesn't - - member inline _.Combine([] task1: OptionCode, [] task2: OptionCode<'T>) : OptionCode<'T> = - (fun () -> - match task1() with - | ValueNone -> ValueNone - | ValueSome() -> task2()) - - member inline _.Bind(res1: 'T1 option, [] task2: ('T1 -> OptionCode<'T>)) : OptionCode<'T> = - (fun () -> - match res1 with - | None -> ValueNone - | Some v -> (task2 v)()) - - member inline _.Bind(res1: 'T1 voption, [] task2: ('T1 -> OptionCode<'T>)) : OptionCode<'T> = - (fun () -> - match res1 with - | ValueNone -> ValueNone - | ValueSome v -> (task2 v)()) - - member inline _.While([] condition : unit -> bool, [] body : OptionCode) : OptionCode = - (fun () -> - let mutable proceed = true - while proceed && condition() do - match body() with - | ValueNone -> proceed <- false - | ValueSome () -> () - ValueSome(())) - - member inline _.TryWith([] body : OptionCode<'T>, [] catch : exn -> OptionCode<'T>) : OptionCode<'T> = - (fun () -> - try - body() - with exn -> - (catch exn)()) - - member inline _.TryFinally([] body: OptionCode<'T>, [] compensation : unit -> unit) : OptionCode<'T> = - (fun () -> - let res = - try - body() - with _ -> - compensation() - reraise() - - compensation() - res) - - member inline this.Using(disp: #IDisposable, [] body: #IDisposable -> OptionCode<'T>) : OptionCode<'T> = - // A using statement is just a try/finally with the finally block disposing if non-null. - this.TryFinally( - (fun () -> (body disp)()), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - member inline this.For(sequence : seq<'TElement>, [] body : 'TElement -> OptionCode) : OptionCode = - this.Using (sequence.GetEnumerator(), - (fun e -> this.While((fun () -> e.MoveNext()), (fun () -> (body e.Current)())))) - - member inline _.Return (value: 'T) : OptionCode<'T> = - (fun () -> - ValueSome value) - - member inline _.ReturnFrom (source: 'T option) : OptionCode<'T> = - (fun () -> - match source with Some x -> ValueOption.Some x | None -> ValueOption.None) - - member inline _.ReturnFrom (source: voption<'T>) : OptionCode<'T> = - (fun () -> source) - -type OptionBuilderUsingInlineIfLambda() = - inherit OptionBuilderUsingInlineIfLambdaBase() - - member inline _.Run([] code : OptionCode<'T>) : 'T option = - match code () with - | ValueNone -> None - | ValueSome v -> Some v - -type ValueOptionBuilderUsingInlineIfLambda() = - inherit OptionBuilderUsingInlineIfLambdaBase() - - member inline _.Run([] code : OptionCode<'T>) : 'T voption = - code() - -let optionNew = OptionBuilderUsingInlineIfLambda() -let voptionNew = ValueOptionBuilderUsingInlineIfLambda() - - -type SlowOptionBuilder() = - member inline _.Zero() = None - - member inline _.Return(x: 'T) = Some x - - member inline _.ReturnFrom(m: 'T option) = m - - member inline _.Bind(m: 'T option, f) = Option.bind f m - - member inline _.Delay(f: unit -> _) = f - - member inline _.Run(f) = f() - - member this.TryWith(delayedExpr, handler) = - try this.Run(delayedExpr) - with exn -> handler exn - - member this.TryFinally(delayedExpr, compensation) = - try this.Run(delayedExpr) - finally compensation() - - member this.Using(resource:#IDisposable, body) = - this.TryFinally(this.Delay(fun ()->body resource), fun () -> match box resource with null -> () | _ -> resource.Dispose()) - -let optionOld = SlowOptionBuilder() - -type SlowValueOptionBuilder() = - member inline _.Zero() = ValueNone - - member inline _.Return(x: 'T) = ValueSome x - - member inline _.ReturnFrom(m: 'T voption) = m - - member inline _.Bind(m: 'T voption, f) = ValueOption.bind f m - - member inline _.Delay(f: unit -> _) = f - - member inline _.Run(f) = f() - - member inline this.TryWith(delayedExpr, handler) = - try this.Run(delayedExpr) - with exn -> handler exn - - member inline this.TryFinally(delayedExpr, compensation) = - try this.Run(delayedExpr) - finally compensation() - - member inline this.Using(resource:#IDisposable, body) = - this.TryFinally(this.Delay(fun ()->body resource), fun () -> match box resource with null -> () | _ -> resource.Dispose()) - -let voptionOld = SlowValueOptionBuilder() - -module Examples = - - - let multiStepOldBuilder () = - let mutable res = 0 - for i in 1 .. 1000000 do - let v = - optionOld { - try - let! x1 = (if i % 5 <> 2 then Some i else None) - let! x2 = (if i % 3 <> 1 then Some i else None) - let! x3 = (if i % 3 <> 1 then Some i else None) - let! x4 = (if i % 3 <> 1 then Some i else None) - res <- res + 1 - return x1 + x2 + x3 + x4 - with e -> - return failwith "unexpected" - } - v |> ignore - res - - let multiStepOldBuilderV () = - let mutable res = 0 - for i in 1 .. 1000000 do - let v = - voptionOld { - try - let! x1 = (if i % 5 <> 2 then ValueSome i else ValueNone) - let! x2 = (if i % 3 <> 1 then ValueSome i else ValueNone) - let! x3 = (if i % 3 <> 1 then ValueSome i else ValueNone) - let! x4 = (if i % 3 <> 1 then ValueSome i else ValueNone) - res <- res + 1 - return x1 + x2 + x3 + x4 - with e -> - return failwith "unexpected" - } - v |> ignore - res - - let multiStepNoBuilder () = - let mutable res = 0 - for i in 1 .. 1000000 do - let v = - try - match (if i % 5 <> 2 then Some i else None) with - | None -> None - | Some x1 -> - match (if i % 3 <> 1 then Some i else None) with - | None -> None - | Some x2 -> - match (if i % 3 <> 1 then Some i else None) with - | None -> None - | Some x3 -> - match (if i % 3 <> 1 then Some i else None) with - | None -> None - | Some x4 -> - res <- res + 1 - Some (x1 + x2 + x3 + x4) - with e -> - failwith "unexpected" - v |> ignore - res - - let multiStepNoBuilderV () = - let mutable res = 0 - for i in 1 .. 1000000 do - let v = - try - match (if i % 5 <> 2 then ValueSome i else ValueNone) with - | ValueNone -> ValueNone - | ValueSome x1 -> - match (if i % 3 <> 1 then ValueSome i else ValueNone) with - | ValueNone -> ValueNone - | ValueSome x2 -> - match (if i % 3 <> 1 then ValueSome i else ValueNone) with - | ValueNone -> ValueNone - | ValueSome x3 -> - match (if i % 3 <> 1 then ValueSome i else ValueNone) with - | ValueNone -> ValueNone - | ValueSome x4 -> - res <- res + 1 - ValueSome (x1 + x2 + x3 + x4) - with e -> - failwith "unexpected" - v |> ignore - res - - let multiStepNewBuilder () = - let mutable res = 0 - for i in 1 .. 1000000 do - let v = - optionNew { - try - let! x1 = (if i % 5 <> 2 then Some i else None) - let! x2 = (if i % 3 <> 1 then Some i else None) - let! x3 = (if i % 3 <> 1 then Some i else None) - let! x4 = (if i % 3 <> 1 then Some i else None) - res <- res + 1 - return x1 + x2 + x3 + x4 - with e -> - return failwith "unexpected" - } - v |> ignore - res - - - let multiStepNewBuilderV () = - let mutable res = 0 - for i in 1 .. 1000000 do - let v = - voptionNew { - try - let! x1 = (if i % 5 <> 2 then ValueSome i else ValueNone) - let! x2 = (if i % 3 <> 1 then ValueSome i else ValueNone) - let! x3 = (if i % 3 <> 1 then ValueSome i else ValueNone) - let! x4 = (if i % 3 <> 1 then ValueSome i else ValueNone) - res <- res + 1 - return x1 + x2 + x3 + x4 - with e -> - return failwith "unexpected" - } - v |> ignore - res - - // let perf s f = - // let t = System.Diagnostics.Stopwatch() - // t.Start() - // for i in 1 .. 100 do - // f() |> ignore - // t.Stop() - // printfn "PERF: %s : %d" s t.ElapsedMilliseconds - - // printfn "check %d = %d = %d"(multiStepStateMachineBuilder()) (multiStepNoBuilder()) (multiStepOldBuilder()) - - // perf "perf (state mechine option)" multiStepStateMachineBuilder - // perf "perf (no builder option)" multiStepNoBuilder - // perf "perf (slow builder option)" multiStepOldBuilder - - // printfn "check %d = %d = %d" (multiStepStateMachineBuilderV()) (multiStepNoBuilder()) (multiStepOldBuilder()) - // perf "perf (state mechine voption)" multiStepStateMachineBuilderV - // perf "perf (no builder voption)" multiStepNoBuilderV - // perf "perf (slow builder voption)" multiStepOldBuilderV - -module A = - - let multiStepNewBuilder (i) = - let mutable res = 0 - optionNew { - try - let! x1 = (if i % 5 <> 2 then Some i else None) - let! x2 = (if i % 3 <> 1 then Some i else None) - let! x3 = (if i % 3 <> 1 then Some i else None) - let! x4 = (if i % 3 <> 1 then Some i else None) - res <- res + 1 - return x1 + x2 + x3 + x4 - with e -> - return failwith "unexpected" - } - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/option2.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/option2.fs deleted file mode 100644 index 7d911b68890..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/option2.fs +++ /dev/null @@ -1,25 +0,0 @@ - -module Tests.OptionBuilderUsingInlineIfLambda - -open System - - - // let perf s f = - // let t = System.Diagnostics.Stopwatch() - // t.Start() - // for i in 1 .. 100 do - // f() |> ignore - // t.Stop() - // printfn "PERF: %s : %d" s t.ElapsedMilliseconds - - // printfn "check %d = %d = %d"(multiStepInlineIfLambdaBuilder()) (multiStepNoBuilder()) (multiStepOldBuilder()) - - // perf "perf (state mechine option)" multiStepInlineIfLambdaBuilder - // perf "perf (no builder option)" multiStepNoBuilder - // perf "perf (slow builder option)" multiStepOldBuilder - - // printfn "check %d = %d = %d" (multiStepInlineIfLambdaBuilderV()) (multiStepNoBuilder()) (multiStepOldBuilder()) - // perf "perf (state mechine voption)" multiStepInlineIfLambdaBuilderV - // perf "perf (no builder voption)" multiStepNoBuilderV - // perf "perf (slow builder voption)" multiStepOldBuilderV - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/seq2.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/seq2.fs deleted file mode 100644 index 5df130c6eae..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/seq2.fs +++ /dev/null @@ -1,262 +0,0 @@ - -module Tests.Seq2 - -#nowarn "42" -open System -open System.Collections -open System.Collections.Generic -open System.Runtime.CompilerServices -open FSharp.Core.CompilerServices -open FSharp.Core.CompilerServices.StateMachineHelpers - -[] -type SeqStateMachine<'T>() = - let disposalStack = ResizeArray<(unit -> unit)>() - - /// Proceed to the next state or raise an exception. Returns true if completed - abstract Step : unit -> bool - - member val Current : 'T voption = ValueNone with get, set - - member val ResumptionPoint: int = 0 with get, set - - member val ResumptionFunc: (SeqStateMachine<'T> -> bool) = Unchecked.defaultof<_> with get, set - - interface IEnumerable with - member this.GetEnumerator() = - // TODO: make new object if needed - (this :> IEnumerator) - - interface IEnumerable<'T> with - member this.GetEnumerator() = - // TODO: make new object if needed - (this :> IEnumerator<'T>) - - interface IDisposable with - member __.Dispose() = - let mutable exn = None - for d in Seq.rev disposalStack do - try - d() - with e -> - exn <- Some e // keep the last exception - TODO - check this - match exn with - | None -> () - | Some e -> raise e - - interface IEnumerator with - - member __.Reset() = failwith "no reset supported" - member sm.Current = box sm.Current - member sm.MoveNext() = sm.Step() - - interface IEnumerator<'T> with - member sm.Current = match sm.Current with ValueNone -> failwith "no value available yet" | ValueSome x -> x - - member __.PushDispose (f: unit -> unit) = disposalStack.Add(f) - - member __.PopDispose () = disposalStack.RemoveAt(disposalStack.Count - 1) - - [] - member sm.Start() = (sm :> IEnumerable<'T>) - -type SeqCode<'T> = SeqStateMachine<'T> -> bool - -type SeqBuilder() = - - [] - member inline __.Delay(__expand_f : unit -> SeqCode<'T>) : SeqCode<'T> = (fun sm -> __expand_f () sm) - - [] - member inline __.Run(__expand_code : SeqCode<'T>) : IEnumerable<'T> = - if __useResumableCode then - (__resumableStateMachine - { new SeqStateMachine<'T>() with - member sm.Step () = - __resumeAt sm.ResumptionPoint - __expand_code sm }).Start() - else - let sm = - { new SeqStateMachine<'T>() with - member sm.Step () = - sm.ResumptionFunc sm } - sm.ResumptionFunc <- __expand_code - sm.Start() - - [] - member inline __.Zero() : SeqCode<'T> = - (fun _sm -> true) - - [] - member inline __.Combine(__expand_task1: SeqCode<'T>, __expand_task2: SeqCode<'T>) : SeqCode<'T> = - (fun sm -> - if __useResumableCode then - let __stack_step = __expand_task1 sm - if __stack_step then - __expand_task2 sm - else - false - else - let completed = __expand_task1 sm - if completed then - __expand_task2 sm - else - // If state machines are not supported, then we must adjust the resumption to also run __expand_task2 on completion - let rec resume rf = - (fun (sm: SeqStateMachine<_>) -> - let completed = rf sm - if completed then - __expand_task2 sm - else - sm.ResumptionFunc <- resume sm.ResumptionFunc - false) - - sm.ResumptionFunc <- resume sm.ResumptionFunc - false) - - [] - member inline __.While(__expand_condition : unit -> bool, __expand_body : SeqCode<'T>) : SeqCode<'T> = - (fun sm -> - if __useResumableCode then - let mutable __stack_completed = false - while __stack_completed && __expand_condition() do - // NOTE: The body of the 'while' may contain await points, resuming may branch directly into the while loop - let __stack_step = __expand_body sm - // If we make it to the assignment we prove we've made a step - __stack_completed <- __stack_step - __stack_completed - else - let rec repeat sm = - if __expand_condition() then - let step = __expand_body sm - if step then - repeat sm - else - //Console.WriteLine("[{0}] rebinding ResumptionFunc for While", sm.MethodBuilder.Task.Id) - sm.ResumptionFunc <- resume sm.ResumptionFunc - false - else - true - and resume mf sm = - //Console.WriteLine("[{0}] resume WhileLoop body", sm.MethodBuilder.Task.Id) - let step = mf sm - if step then - repeat sm - else - //Console.WriteLine("[{0}] rebinding ResumptionFunc for While", sm.MethodBuilder.Task.Id) - sm.ResumptionFunc <- resume sm.ResumptionFunc - false - - repeat sm) - - [] - member inline __.TryWith(__expand_body : SeqCode<'T>, __expand_catch : exn -> SeqCode<'T>) : SeqCode<'T> = - (fun sm -> - if __useResumableCode then - let mutable __stack_completed = false - let mutable __stack_caught = false - let mutable __stack_savedExn = Unchecked.defaultof<_> - try - // The try block may contain await points. - let __stack_step = __expand_body sm - // If we make it to the assignment we prove we've made a step - __stack_completed <- __stack_step - with exn -> - __stack_caught <- true - __stack_savedExn <- exn - - if __stack_caught then - // Place the catch code outside the catch block - __expand_catch __stack_savedExn sm - else - __stack_completed - else - failwith "tbd") - - [] - member inline __.TryFinally(__expand_body: SeqCode<'T>, compensation : unit -> unit) : SeqCode<'T> = - (fun sm -> - let mutable completed = false - sm.PushDispose compensation - try - let __stack_step = __expand_body sm - // If we make it to the assignment we prove we've made a step without an exception - completed <- __stack_step - with _ -> - sm.PopDispose() - compensation() - reraise() - - if completed then - sm.PopDispose() - compensation() - completed) - - [] - member inline this.Using(disp : #IDisposable, __expand_body : #IDisposable -> SeqCode<'T>) = - // A using statement is just a try/finally with the finally block disposing if non-null. - this.TryFinally( - (fun sm -> __expand_body disp sm), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - [] - member inline this.For(sequence : seq<'TElement>, __expand_body : 'TElement -> SeqCode<'T>) : SeqCode<'T> = - // A for loop is just a using statement on the sequence's enumerator... - this.Using (sequence.GetEnumerator(), - // ... and its body is a while loop that advances the enumerator and runs the body on each element. - (fun e -> this.While((fun () -> e.MoveNext()), (fun sm -> __expand_body e.Current sm)))) - - [] - member inline __.Yield (v: 'T) : SeqCode<'T> = - (fun sm -> - if __useResumableCode then - match __resumableEntry() with - | Some contID -> - sm.ResumptionPoint <- contID - sm.Current <- ValueSome v - false - | None -> - sm.Current <- ValueNone - true - else - let cont (sm: SeqStateMachine<'T>) = - sm.Current <- ValueNone - true - sm.ResumptionFunc <- cont - sm.Current <- ValueSome v - false) - - [] - member inline this.YieldFrom (source: IEnumerable<'T>) : SeqCode<'T> = - this.For(source, (fun v -> this.Yield v)) - -let seq2 = SeqBuilder() - -module Examples = - - let t1 () = - seq2 { - printfn "in t1" - yield "a" - let x = 1 - yield "b" - yield "c" - } - - let t2 () = - seq2 { - printfn "in t2" - yield "d" - for x in t1 () do - printfn "t2 - got %A" x - yield "e" - yield "[T1]" + x - yield "f" - } - - let dumpSeq (t: IEnumerable<_>) = - let e = t.GetEnumerator() - while e.MoveNext() do - printfn "yield %A" e.Current - dumpSeq (t1()) - dumpSeq (t2()) diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/sync.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/sync.fs deleted file mode 100644 index 9a4ccb5b72f..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/sync.fs +++ /dev/null @@ -1,88 +0,0 @@ - -module Tests.SyncBuilder - -open System - -type SyncCode<'T> = unit -> 'T - -type SyncBuilder() = - - member inline _.Delay([] f: unit -> SyncCode<'T>) : SyncCode<'T> = - (fun () -> (f())()) - - member inline _.Run([] code : SyncCode<'T>) : 'T = - code() - -#if PREVIEW - [] -#endif - member inline _.Zero() : SyncCode< unit> = - (fun () -> ()) - - member inline _.Return (x: 'T) : SyncCode<'T> = - (fun () -> x) - - member inline _.Combine([] code1: SyncCode, [] code2: SyncCode<'T>) : SyncCode<'T> = - (fun () -> - code1() - code2()) - - member inline _.While([] condition: unit -> bool, [] body: SyncCode) : SyncCode = - (fun () -> - while condition() do - body()) - - member inline _.TryWith([] body: SyncCode<'T>, [] catch: exn -> 'T) : SyncCode<'T> = - (fun () -> - try - body() - with exn -> - catch exn) - - member inline _.TryFinally([] body: SyncCode<'T>, compensation: unit -> unit) : SyncCode<'T> = - (fun () -> - let __stack_step = - try - body() - with _ -> - compensation() - reraise() - compensation() - __stack_step) - - member inline this.Using(disp : #IDisposable, [] body: #IDisposable -> SyncCode<'T>) : SyncCode<'T> = - this.TryFinally( - (fun () -> (body disp)()), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - member inline this.For(sequence : seq<'T>, [] body : 'T -> SyncCode) : SyncCode = - this.Using (sequence.GetEnumerator(), - (fun e -> this.While((fun () -> e.MoveNext()), (fun () -> (body e.Current)())))) - - member inline _.ReturnFrom (value: 'T) : SyncCode<'T> = - (fun () -> - value) - - member inline _.Bind (v: 'TResult1, [] continuation: 'TResult1 -> SyncCode<'TResult2>) : SyncCode<'TResult2> = - (fun () -> - (continuation v)()) - -let sync = SyncBuilder() - -module Examples = - - let t1 y = - sync { - let x = 4 + 5 + y - return x - } - - let t2 y = - sync { - printfn "in t2" - let! x = t1 y - return x + y - } - - - //printfn "t2 6 = %d" (t2 6) diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/taskSeq.fs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/taskSeq.fs deleted file mode 100644 index c87c79f37db..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerf/taskSeq.fs +++ /dev/null @@ -1,599 +0,0 @@ - -module Tests.TaskSeq - -open System.Runtime.CompilerServices -open System.Threading.Tasks.Sources - -#nowarn "42" -open System -open System.Collections.Generic -open System.Threading -open System.Threading.Tasks -open FSharp.Core.CompilerServices -open FSharp.Core.CompilerServices.StateMachineHelpers - -let verbose = false - -let inline MoveNext(x: byref<'T> when 'T :> IAsyncStateMachine) = x.MoveNext() - -type taskSeq<'T> = IAsyncEnumerable<'T> - -type IPriority1 = interface end -type IPriority2 = interface end - -[] -type TaskSeqStateMachineData<'T>() = - [] - val mutable cancellationToken : CancellationToken - [] - val mutable disposalStack : ResizeArray<(unit -> Task)> - [] - val mutable awaiter : ICriticalNotifyCompletion - [] - val mutable promiseOfValueOrEnd: ManualResetValueTaskSourceCore - [] - val mutable builder : AsyncIteratorMethodBuilder - [] - val mutable taken : bool - [] - val mutable current : ValueOption<'T> - [] - val mutable boxed: TaskSeq<'T> - // For tailcalls using 'return!' - [] - val mutable tailcallTarget: TaskSeq<'T> option - - member data.PushDispose (f: unit -> Task) = - match data.disposalStack with - | null -> data.disposalStack <- ResizeArray() - | _ -> () - data.disposalStack.Add(f) - - member data.PopDispose () = - match data.disposalStack with - | null -> () - | _ -> - data.disposalStack.RemoveAt(data.disposalStack.Count - 1) - -and [] - TaskSeq<'T>() = - abstract TailcallTarget: TaskSeq<'T> option - abstract MoveNextAsyncResult: unit -> ValueTask - - // F# requires that we implement interfaces even on an abstract class - interface IAsyncEnumerator<'T> with - member _.Current = failwith "abstract" - member _.MoveNextAsync() = failwith "abstract" - interface IAsyncDisposable with - member _.DisposeAsync() = failwith "abstract" - interface IAsyncEnumerable<'T> with - member _.GetAsyncEnumerator(ct) = failwith "abstract" - interface IAsyncStateMachine with - member _.MoveNext() = failwith "abstract" - member _.SetStateMachine(_state) = failwith "abstract" - interface IValueTaskSource with - member _.GetResult(_token: int16) = failwith "abstract" - member _.GetStatus(_token: int16) = failwith "abstract" - member _.OnCompleted(_continuation, _state, _token, _flags) = failwith "abstract" - interface IValueTaskSource with - member _.GetStatus(_token: int16) = failwith "abstract" - member _.GetResult(_token: int16) = failwith "abstract" - member _.OnCompleted(_continuation, _state, _token, _flags) = failwith "abstract" - -and [] - TaskSeq<'Machine, 'T when 'Machine :> IAsyncStateMachine and 'Machine :> IResumableStateMachine>>() = - inherit TaskSeq<'T>() - let initialThreadId = Environment.CurrentManagedThreadId - - [] - val mutable Machine : 'Machine - - member internal ts.hijack() = - let res = ts.Machine.Data.tailcallTarget - match res with - | Some tg -> - match tg.TailcallTarget with - | None -> - res - | (Some tg2 as res2) -> - // Cut out chains of tailcalls - ts.Machine.Data.tailcallTarget <- Some tg2 - res2 - | None -> - res - - // Note: Not entirely clear if this is needed, everything still compiles without it - interface IValueTaskSource with - member ts.GetResult(token: int16) = - match ts.hijack() with - | Some tg -> (tg :> IValueTaskSource).GetResult(token) - | None -> ts.Machine.Data.promiseOfValueOrEnd.GetResult(token) |> ignore - member ts.GetStatus(token: int16) = - match ts.hijack() with - | Some tg -> (tg :> IValueTaskSource).GetStatus(token) - | None -> ts.Machine.Data.promiseOfValueOrEnd.GetStatus(token) - member ts.OnCompleted(continuation, state, token, flags) = - match ts.hijack() with - | Some tg -> (tg :> IValueTaskSource).OnCompleted(continuation, state, token, flags) - | None -> ts.Machine.Data.promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags) - - // Needed for MoveNextAsync to return a ValueTask - interface IValueTaskSource with - member ts.GetStatus(token: int16) = - match ts.hijack() with - | Some tg -> (tg :> IValueTaskSource).GetStatus(token) - | None -> ts.Machine.Data.promiseOfValueOrEnd.GetStatus(token) - member ts.GetResult(token: int16) = - match ts.hijack() with - | Some tg -> (tg :> IValueTaskSource).GetResult(token) - | None -> ts.Machine.Data.promiseOfValueOrEnd.GetResult(token) - member ts.OnCompleted(continuation, state, token, flags) = - match ts.hijack() with - | Some tg -> (tg :> IValueTaskSource).OnCompleted(continuation, state, token, flags) - | None -> ts.Machine.Data.promiseOfValueOrEnd.OnCompleted(continuation, state, token, flags) - - interface IAsyncStateMachine with - member ts.MoveNext() = - match ts.hijack() with - | Some tg -> (tg :> IAsyncStateMachine).MoveNext() - | None -> MoveNext(&ts.Machine) - - member _.SetStateMachine(_state) = () // not needed for reference type - - interface IAsyncEnumerable<'T> with - member ts.GetAsyncEnumerator(ct) = - let data = ts.Machine.Data - if (not data.taken && initialThreadId = Environment.CurrentManagedThreadId) then - data.taken <- true - data.cancellationToken <- ct - data.builder <- AsyncIteratorMethodBuilder.Create() - (ts :> IAsyncEnumerator<_>) - else - if verbose then printfn "GetAsyncEnumerator, cloning..." - let clone = ts.MemberwiseClone() :?> TaskSeq<'Machine, 'T> - data.taken <- true - clone.Machine.Data.cancellationToken <- ct - (clone :> System.Collections.Generic.IAsyncEnumerator<'T>) - - interface IAsyncDisposable with - member ts.DisposeAsync() = - match ts.hijack() with - | Some tg -> (tg :> IAsyncDisposable).DisposeAsync() - | None -> - if verbose then printfn "DisposeAsync..." - task { - match ts.Machine.Data.disposalStack with - | null -> () - | _ -> - let mutable exn = None - for d in Seq.rev ts.Machine.Data.disposalStack do - try - do! d() - with e -> - if exn.IsNone then - exn <- Some e - match exn with - | None -> () - | Some e -> raise e - } - |> ValueTask - - interface System.Collections.Generic.IAsyncEnumerator<'T> with - member ts.Current = - match ts.hijack() with - | Some tg -> (tg :> IAsyncEnumerator<'T>).Current - | None -> - match ts.Machine.Data.current with - | ValueSome x -> x - | ValueNone -> failwith "no current value" - - member ts.MoveNextAsync() = - match ts.hijack() with - | Some tg -> (tg :> IAsyncEnumerator<'T>).MoveNextAsync() - | None -> - if verbose then printfn "MoveNextAsync..." - if ts.Machine.ResumptionPoint = -1 then // can't use as IAsyncEnumerator before IAsyncEnumerable - ValueTask() - else - let data = ts.Machine.Data - data.promiseOfValueOrEnd.Reset() - let mutable ts = ts - data.builder.MoveNext(&ts) - - // If the move did a hijack then get the result from the final one - match ts.hijack() with - | Some tg -> tg.MoveNextAsyncResult() - | None -> ts.MoveNextAsyncResult() - - override ts.MoveNextAsyncResult() = - let data = ts.Machine.Data - let version = data.promiseOfValueOrEnd.Version - let status = data.promiseOfValueOrEnd.GetStatus(version) - if status = ValueTaskSourceStatus.Succeeded then - let result = data.promiseOfValueOrEnd.GetResult(version) - ValueTask(result) - else - if verbose then printfn "MoveNextAsync pending/faulted/cancelled..." - ValueTask(ts, version) // uses IValueTaskSource<'T> - - override cr.TailcallTarget = - cr.hijack() - -and TaskSeqCode<'T> = ResumableCode, unit> -and TaskSeqStateMachine<'T> = ResumableStateMachine> -and TaskSeqResumptionFunc<'T> = ResumptionFunc> -and TaskSeqResumptionDynamicInfo<'T> = ResumptionDynamicInfo> - -type TaskSeqBuilder() = - - member inline _.Delay(f : unit -> TaskSeqCode<'T>) : TaskSeqCode<'T> = - TaskSeqCode<'T>(fun sm -> f().Invoke(&sm)) - - member inline _.Run(code : TaskSeqCode<'T>) : IAsyncEnumerable<'T> = - if __useResumableCode then - // This is the static implementation. A new struct type is created. - __stateMachine, IAsyncEnumerable<'T>> - // IAsyncStateMachine.MoveNext - (MoveNextMethodImpl<_>(fun sm -> - //-- RESUMABLE CODE START - __resumeAt sm.ResumptionPoint - try - //printfn "at Run.MoveNext start" - //Console.WriteLine("[{0}] resuming by invoking {1}....", sm.MethodBuilder.Task.Id, hashq sm.ResumptionFunc ) - let __stack_code_fin = code.Invoke(&sm) - //printfn $"at Run.MoveNext, __stack_code_fin={__stack_code_fin}" - if __stack_code_fin then - //printfn $"at Run.MoveNext, done" - sm.Data.promiseOfValueOrEnd.SetResult(false) - sm.Data.builder.Complete() - elif sm.Data.current.IsSome then - //printfn $"at Run.MoveNext, yield" - sm.Data.promiseOfValueOrEnd.SetResult(true) - else - // Goto request - match sm.Data.tailcallTarget with - | Some tg -> - //printfn $"at Run.MoveNext, hijack" - let mutable tg = tg - MoveNext(&tg) - | None -> - //printfn $"at Run.MoveNext, await" - let boxed = sm.Data.boxed - sm.Data.awaiter.UnsafeOnCompleted(Action(fun () -> - let mutable boxed = boxed - MoveNext(&boxed))) - - with exn -> - //Console.WriteLine("[{0}] SetException {1}", sm.MethodBuilder.Task.Id, exn) - sm.Data.promiseOfValueOrEnd.SetException(exn) - sm.Data.builder.Complete() - //-- RESUMABLE CODE END - )) - (SetStateMachineMethodImpl<_>(fun sm state -> ())) - (AfterCode<_,_>(fun sm -> - let ts = TaskSeq, 'T>() - ts.Machine <- sm - ts.Machine.Data <- TaskSeqStateMachineData() - ts.Machine.Data.boxed <- ts - ts :> IAsyncEnumerable<'T>)) - else - failwith "no dynamic implementation as yet" - // let initialResumptionFunc = TaskSeqResumptionFunc<'T>(fun sm -> code.Invoke(&sm)) - // let resumptionFuncExecutor = TaskSeqResumptionExecutor<'T>(fun sm f -> - // // TODO: add exception handling? - // if f.Invoke(&sm) then - // sm.ResumptionPoint <- -2) - // let setStateMachine = SetStateMachineMethodImpl<_>(fun sm f -> ()) - // sm.Machine.ResumptionFuncInfo <- (initialResumptionFunc, resumptionFuncExecutor, setStateMachine) - //sm.Start() - - - member inline _.Zero() : TaskSeqCode<'T> = - ResumableCode.Zero() - - member inline _.Combine(task1: TaskSeqCode<'T>, task2: TaskSeqCode<'T>) : TaskSeqCode<'T> = - ResumableCode.Combine(task1, task2) - - member inline _.WhileAsync([] condition : unit -> ValueTask, body : TaskSeqCode<'T>) : TaskSeqCode<'T> = - let mutable condition_res = true - ResumableCode.While((fun () -> condition_res), - ResumableCode<_,_>(fun sm -> - let mutable __stack_condition_fin = true - let __stack_vtask = condition() - if __stack_vtask.IsCompleted then - __stack_condition_fin <- true - condition_res <- __stack_vtask.Result - else - let task = __stack_vtask.AsTask() - let mutable awaiter = task.GetAwaiter() - // This will yield with __stack_fin = false - // This will resume with __stack_fin = true - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_condition_fin <- __stack_yield_fin - - if __stack_condition_fin then - condition_res <- task.Result - else - //if verbose then printfn "calling AwaitUnsafeOnCompleted" - sm.Data.awaiter <- awaiter - sm.Data.current <- ValueNone - - if __stack_condition_fin then - if condition_res then - body.Invoke(&sm) - else - true - else - false - )) - - member inline b.While([] condition : unit -> bool, body : TaskSeqCode<'T>) : TaskSeqCode<'T> = - b.WhileAsync((fun () -> ValueTask(condition())), body) - - member inline _.TryWith(body : TaskSeqCode<'T>, catch : exn -> TaskSeqCode<'T>) : TaskSeqCode<'T> = - ResumableCode.TryWith(body, catch) - - member inline _.TryFinallyAsync(body: TaskSeqCode<'T>, compensation : unit -> Task) : TaskSeqCode<'T> = - ResumableCode.TryFinallyAsync( - TaskSeqCode<'T>(fun sm -> - sm.Data.PushDispose (fun () -> compensation()) - body.Invoke(&sm)), - ResumableCode<_,_>(fun sm -> - sm.Data.PopDispose(); - let mutable __stack_condition_fin = true - let __stack_vtask = compensation() - if not __stack_vtask.IsCompleted then - let mutable awaiter = __stack_vtask.GetAwaiter() - let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm) - __stack_condition_fin <- __stack_yield_fin - - if not __stack_condition_fin then - sm.Data.awaiter <- awaiter - - __stack_condition_fin)) - - member inline _.TryFinally(body: TaskSeqCode<'T>, compensation : unit -> unit) : TaskSeqCode<'T> = - ResumableCode.TryFinally( - TaskSeqCode<'T>(fun sm -> - sm.Data.PushDispose (fun () -> compensation(); Task.CompletedTask) - body.Invoke(&sm)), - ResumableCode<_,_>(fun sm -> sm.Data.PopDispose(); compensation(); true)) - - member inline this.Using(disp : #IDisposable, body : #IDisposable -> TaskSeqCode<'T>, ?priority: IPriority2) : TaskSeqCode<'T> = - ignore priority - // A using statement is just a try/finally with the finally block disposing if non-null. - this.TryFinally( - (fun sm -> (body disp).Invoke(&sm)), - (fun () -> if not (isNull (box disp)) then disp.Dispose())) - - member inline this.Using(disp : #IAsyncDisposable, body : #IAsyncDisposable -> TaskSeqCode<'T>, ?priority: IPriority1) : TaskSeqCode<'T> = - ignore priority - // A using statement is just a try/finally with the finally block disposing if non-null. - this.TryFinallyAsync( - (fun sm -> (body disp).Invoke(&sm)), - (fun () -> - if not (isNull (box disp)) then - disp.DisposeAsync().AsTask() - else - Task.CompletedTask)) - - member inline this.For(sequence : seq<'TElement>, body : 'TElement -> TaskSeqCode<'T>) : TaskSeqCode<'T> = - // A for loop is just a using statement on the sequence's enumerator... - this.Using (sequence.GetEnumerator(), - // ... and its body is a while loop that advances the enumerator and runs the body on each element. - (fun e -> this.While((fun () -> e.MoveNext()), (fun sm -> (body e.Current).Invoke(&sm))))) - - member inline this.For(source: #IAsyncEnumerable<'TElement>, body : 'TElement -> TaskSeqCode<'T>) : TaskSeqCode<'T> = - TaskSeqCode<'T>(fun sm -> - this.Using(source.GetAsyncEnumerator(sm.Data.cancellationToken), - (fun e -> this.WhileAsync((fun () -> e.MoveNextAsync()), - (fun sm -> (body e.Current).Invoke(&sm))))).Invoke(&sm)) - - member inline _.Yield (v: 'T) : TaskSeqCode<'T> = - TaskSeqCode<'T>(fun sm -> - // This will yield with __stack_fin = false - // This will resume with __stack_fin = true - let __stack_fin = ResumableCode.Yield().Invoke(&sm) - sm.Data.current <- ValueSome v - sm.Data.awaiter <- null - __stack_fin) - - member inline this.YieldFrom (source: IAsyncEnumerable<'T>) : TaskSeqCode<'T> = - this.For(source, (fun v -> this.Yield(v))) - - member inline _.Bind (task: Task<'TResult1>, continuation: ('TResult1 -> TaskSeqCode<'T>)) : TaskSeqCode<'T> = - TaskSeqCode<'T>(fun sm -> - let mutable awaiter = task.GetAwaiter() - let mutable __stack_fin = true - if not awaiter.IsCompleted then - // This will yield with __stack_fin2 = false - // This will resume with __stack_fin2 = true - let __stack_fin2 = ResumableCode.Yield().Invoke(&sm) - __stack_fin <- __stack_fin2 - - if __stack_fin then - let result = awaiter.GetResult() - (continuation result).Invoke(&sm) - else - if verbose then printfn "calling AwaitUnsafeOnCompleted" - sm.Data.awaiter <- awaiter - sm.Data.current <- ValueNone - false) - - // TODO: using return! for tailcalls is wrong. We should use yield! and have F# - // desugar to a different builder method when in tailcall position - // - // Because of this using return! from non-tailcall position e.g. in a try-finally or try-with will - // giv incorrect results (escaping the exception handler - 'close up shop and draw results from somewhere else') - member inline b.ReturnFrom (other: IAsyncEnumerable<'T>) : TaskSeqCode<'T> = - TaskSeqCode<_>(fun sm -> - match other with - | :? TaskSeq<'T> as other -> - sm.Data.tailcallTarget <- Some other - sm.Data.awaiter <- null - sm.Data.current <- ValueNone - // For tailcalls we return 'false' and re-run from the entry (trampoline) - false - | _ -> - b.YieldFrom(other).Invoke(&sm) - ) - -let taskSeq = TaskSeqBuilder() - -module TaskSeq = - let toList (t: taskSeq<'T>) = - [ let e = t.GetAsyncEnumerator(CancellationToken()) - try - while (let vt = e.MoveNextAsync() in if vt.IsCompleted then vt.Result else vt.AsTask().Result) do - yield e.Current - finally - e.DisposeAsync().AsTask().Wait() ] - - let toArray (t: taskSeq<'T>) = - [| let e = t.GetAsyncEnumerator(CancellationToken()) - try - while (let vt = e.MoveNextAsync() in if vt.IsCompleted then vt.Result else vt.AsTask().Result) do - yield e.Current - finally - e.DisposeAsync().AsTask().Wait() |] - - let toArrayAsync (t: taskSeq<'T>) : Task<'T[]> = - task { - let res = ResizeArray<'T>() - let e = t.GetAsyncEnumerator(CancellationToken()) - let mutable go = true - let! step = e.MoveNextAsync() - go <- step - while go do - res.Add e.Current - if verbose then printfn "yield %A" e.Current - let! step = e.MoveNextAsync() - go <- step - return res.ToArray() - } - - let iter f (t: taskSeq<'T>) = - let e = t.GetAsyncEnumerator(CancellationToken()) - try - while (let vt = e.MoveNextAsync() in if vt.IsCompleted then vt.Result else vt.AsTask().Result) do - f e.Current - finally - e.DisposeAsync().AsTask().Wait() - -module Examples = - - let t1 () = - taskSeq { - printfn "in t1" - yield "a" - let x = 1 - let! v = - task { - printfn "hey" - do! Task.Delay(10) - } - yield "b" - let! v = - task { - printfn "hey yo" - do! Task.FromResult(()) - } - yield "c" - let! v = - task { - printfn "and a bottle of rum" - do! Task.Delay(0) - } - yield "d" - } - - let testTailcallTiny () = - taskSeq { - return! t1() - } - let rec testTailcall (n: int) = - taskSeq { - if n % 100 = 0 then printfn $"in t1, n = {n}" - yield n - if n > 0 then - return! testTailcall(n-1) - //yield () - } - - //let t2 () = - // taskSeq { - // printfn "in t2" - // yield "d" - // printfn "in t2 b" - // for x in t1 () do - // printfn "t2 - got %A" x - // yield "e" - // let! v = - // task { - // printfn "hey yo" - // do! Task.Delay(200) - // } - // yield "[T1]" + x - // let! v = - // task { - // printfn "hey yo" - // do! Task.Delay(10) - // } - // yield "f" - // } - - let perf1 (x: int) = - taskSeq { - yield 1 - yield 2 - if x >= 2 then - yield 3 - yield 4 - } - - let perf2 () = - taskSeq { - for i1 in perf1 3 do - for i2 in perf1 3 do - for i3 in perf1 3 do - for i4 in perf1 3 do - for i5 in perf1 3 do - yield! perf1 i5 - } - - //let perf1_AsyncSeq (x: int) = - // FSharp.Control.AsyncSeqExtensions.asyncSeq { - // yield 1 - // yield 2 - // if x >= 2 then - // yield 3 - // yield 4 - // } - - //let perf2_AsyncSeq () = - // FSharp.Control.AsyncSeqExtensions.asyncSeq { - // for i1 in perf1_AsyncSeq 3 do - // for i2 in perf1_AsyncSeq 3 do - // for i3 in perf1_AsyncSeq 3 do - // for i4 in perf1_AsyncSeq 3 do - // for i5 in perf1_AsyncSeq 3 do - // yield! perf1_AsyncSeq i5 - // } - - let dumpTaskSeq (t: IAsyncEnumerable<_>) = - printfn "-----" - let e = t.GetAsyncEnumerator(CancellationToken()) - while (let vt = e.MoveNextAsync() in if vt.IsCompleted then vt.Result else vt.AsTask().Result) do - printfn "yield %A" e.Current - - //dumpTaskSeq (t1()) - //dumpTaskSeq (testTailcallTiny()) - ////dumpTaskSeq (t2()) - - //printfn "t1() = %A" (TaskSeq.toArray (t1())) - //printfn "testTailcallTiny() = %A" (TaskSeq.toArray (testTailcallTiny())) - //dumpTaskSeq (testTailcall(100000)) - //printfn "t2() = %A" (TaskSeq.toArray (t2())) - - printfn "perf2() = %A" (TaskSeq.toArray (perf2()) |> Array.sum) - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.cs b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.cs deleted file mode 100644 index 32ea6fcb66c..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Threading.Tasks; - -#pragma warning disable 1998 - -public static class TaskPerfCSharp -{ - public const int BufferSize = 128; - //public const int ManyIterations = 10000; - - public static async Task ManyWriteFileAsync(int ManyIterations) - { - const string path = "tmp"; - var junk = new byte[BufferSize]; - using (var file = File.Create(path)) - { - for (var i = 1; i <= ManyIterations; i++) - { - await file.WriteAsync(junk, 0, junk.Length); - } - } - File.Delete(path); - } - - public static System.Runtime.CompilerServices.YieldAwaitable AsyncTask() - { - return Task.Yield(); - } - - public static Task SyncTask() - { - return Task.FromResult(100); - } - - public static async Task TenBindsSync_CSharp() - { - var x1 = await SyncTask(); - var x2 = await SyncTask(); - var x3 = await SyncTask(); - var x4 = await SyncTask(); - var x5 = await SyncTask(); - var x6 = await SyncTask(); - var x7 = await SyncTask(); - var x8 = await SyncTask(); - var x9 = await SyncTask(); - var x10 = await SyncTask(); - return x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10; - } - - public static async Task TenBindsAsync_CSharp() - { - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - await AsyncTask(); - return 100; - } - - public static async Task SingleSyncTask_CSharp() - { - return 1; - } - - public static async Task SingleSyncExceptionTask_CSharp() - { - throw (new System.Exception("fail")); - } - - - public static async IAsyncEnumerable perf1_AsyncEnumerable(int x) - { - yield return 1; - yield return 2; - if (x >= 2) - { - yield return 3; - yield return 4; - } - } - - public static async IAsyncEnumerable perf2_AsyncEnumerable() - { - await foreach (var i1 in perf1_AsyncEnumerable(3)) - { - await foreach (var i2 in perf1_AsyncEnumerable(3)) - { - await foreach (var i3 in perf1_AsyncEnumerable(3)) - { - await foreach (var i4 in perf1_AsyncEnumerable(3)) - { - await foreach (var i5 in perf1_AsyncEnumerable(3)) - { - await foreach (var i6 in perf1_AsyncEnumerable(i5)) - { - yield return i6; - - } - } - - } - - } - - } - - } - } - -#if MAIN - public static void Main() { - var t = SingleSyncExceptionTask_CSharp(); - System.Console.WriteLine("t = {0}", t); - } -#endif -} - diff --git a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.csproj b/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.csproj deleted file mode 100644 index 29148a7450d..00000000000 --- a/tests/benchmarks/CompiledCodeBenchmarks/TaskPerf/TaskPerfCSharp/TaskPerfCSharp.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(FSharpNetCoreProductTargetFramework) - Library - 8.0 - - - - - $(NoWarn);CS1591 - - - - - - - - diff --git a/tests/benchmarks/Directory.Build.props b/tests/benchmarks/Directory.Build.props new file mode 100644 index 00000000000..ba9f0b7a4fa --- /dev/null +++ b/tests/benchmarks/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + true + $(FSharpNetCoreProductTargetFramework) + + diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj index 1781b4784dc..cc42c675f31 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.Runner/HistoricalBenchmark.Runner.fsproj @@ -1,18 +1,17 @@ - + - $(FSharpNetCoreProductTargetFramework) - true - HistoricalBenchmark.Utilities - $(NoWarn);NETSDK1206 + true + HistoricalBenchmark.Utilities + $(NoWarn);NETSDK1206 - + - + diff --git a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj index 48cfa7b4975..2440c65d727 100644 --- a/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj +++ b/tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj @@ -2,8 +2,6 @@ Exe - $(FSharpNetCoreProductTargetFramework) - true Release diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj index c7a873a2cc4..4c66d9cfb87 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/FSharp.Compiler.Benchmarks.fsproj @@ -2,8 +2,6 @@ Exe - $(FSharpNetCoreProductTargetFramework) - true false diff --git a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj index 265ab45ac19..a400d5fbad3 100644 --- a/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj +++ b/tests/benchmarks/FCSBenchmarks/FCSSourceFiles/FCSSourceFiles.fsproj @@ -2,8 +2,6 @@ Exe - $(FSharpNetCoreProductTargetFramework) - true @@ -11,7 +9,7 @@ - + diff --git a/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj b/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj index 615a5ab3a77..03f8e031a9a 100644 --- a/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj +++ b/tests/benchmarks/FSharp.Benchmarks.Common/FSharp.Benchmarks.Common.fsproj @@ -1,10 +1,5 @@  - - $(FSharpNetCoreProductTargetFramework) - true - - diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index ac97046351b..3e5488adac4 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -109,7 +109,7 @@ false - + diff --git a/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx b/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx index 59e13687105..b72489a9358 100644 --- a/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx +++ b/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx @@ -1072,6 +1072,46 @@ module ForLoopRegularCode = printfn $"hello, x = {x}" printfn $"hello, x = {x}" + let testSimpleForEachIntRangeStepLoopWithOneStatement (start, step, stop) = + for x in start .. step .. stop do + printfn $"hello, x = {x}" + + let testSimpleForEachIntRangeStepLoopWithTwoStatements (start, step, stop) = + for x in start .. step .. stop do + printfn $"hello, x = {x}" + printfn $"hello, x = {x}" + + let testSimpleForEachInt64RangeLoopWithOneStatement (start: int64, stop) = + for x in start .. stop do + printfn $"hello, x = {x}" + + let testSimpleForEachInt64RangeLoopWithTwoStatements (start: int64, stop) = + for x in start .. stop do + printfn $"hello, x = {x}" + printfn $"hello, x = {x}" + + let testSimpleForEachInt64RangeLoopDownWithOneStatement (start: int64, stop) = + for x in start .. -1L .. stop do + printfn $"hello, x = {x}" + + let testSimpleForEachInt64RangeLoopDownWithTwoStatements (start: int64, stop) = + for x in start .. -1L .. stop do + printfn $"hello, x = {x}" + printfn $"hello, x = {x}" + + let testSimpleForEachInt64RangeStepLoopWithOneStatement (start: int64, step, stop) = + for x in start .. step .. stop do + printfn $"hello, x = {x}" + + let testSimpleForEachInt64RangeStepLoopWithTwoStatements (start: int64, step, stop) = + for x in start .. step .. stop do + printfn $"hello, x = {x}" + printfn $"hello, x = {x}" + + let testSimpleForEachInt64RangeStepLoopWithConstCount () = + for x in 1L .. 3L .. 9L do + printfn $"hello, x = {x}" + let testSimpleForEachIntLoopWithOneStatement (start, stop) = for x = start to stop do printfn $"hello, x = {x}" @@ -1102,6 +1142,17 @@ module ForLoopRegularCode = testSimpleForEachIntRangeLoopWithTwoStatements (1, 3) testSimpleForEachIntRangeLoopDownWithOneStatement (1, 3) testSimpleForEachIntRangeLoopDownWithTwoStatements (1, 3) + + testSimpleForEachIntRangeStepLoopWithOneStatement (-1, 5, 10) + testSimpleForEachIntRangeStepLoopWithTwoStatements (-1, 5, 10) + testSimpleForEachInt64RangeLoopWithOneStatement (3L, 7L) + testSimpleForEachInt64RangeLoopWithTwoStatements (-4L, 0L) + testSimpleForEachInt64RangeLoopDownWithOneStatement (3L, -1L) + testSimpleForEachInt64RangeLoopDownWithTwoStatements (3L, -1L) + testSimpleForEachInt64RangeStepLoopWithOneStatement (0L, 2L, 5L) + testSimpleForEachInt64RangeStepLoopWithTwoStatements (0L, 2L, 5L) + testSimpleForEachInt64RangeStepLoopWithConstCount () + testSimpleForEachIntLoopWithOneStatement (1, 3) testSimpleForEachIntLoopWithTwoStatements (1, 3) testSimpleForEachIntLoopDownWithOneStatement (1, 3)