Skip to content

Commit e506185

Browse files
committed
merge main
2 parents ad630f5 + 4c68fe8 commit e506185

Some content is hidden

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

42 files changed

+338
-280
lines changed

.config/service-branch-merge.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"ExtraSwitches": "-QuietComments"
1111
},
1212
"release/dev17.14": {
13+
"MergeToBranch": "release/dev18.0",
14+
"ExtraSwitches": "-QuietComments"
15+
},
16+
"release/dev18.0": {
1317
"MergeToBranch": "main",
1418
"ExtraSwitches": "-QuietComments"
1519
}

docs/large-inputs-and-stack-overflows.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,12 @@ The previous example is considered incomplete, because arbitrary _combinations_
8989

9090
## Stack Guards
9191

92-
The `StackGuard` type is used to count synchronous recursive processing and move to a new thread if a limit is reached. Compilation globals are re-installed. Sample:
92+
The `StackGuard` type is used to move to a new thread if there is no sufficient stack space for a synchronous recursive call. Compilation globals are re-installed. Sample:
9393

9494
```fsharp
95-
let TcStackGuardDepth = StackGuard.GetDepthOption "Tc"
9695
9796
...
98-
stackGuard = StackGuard(TcMaxStackGuardDepth)
97+
stackGuard = StackGuard("TcExpr")
9998
10099
let rec ....
101100
@@ -108,10 +107,17 @@ and TcExpr cenv ty (env: TcEnv) tpenv (expr: SynExpr) =
108107
109108
```
110109

111-
Note stack guarding doesn't result in a tailcall so will appear in recursive stack frames, because a counter must be decremented after the call. This is used systematically for recursive processing of:
110+
Note stack guarding doesn't result in a tailcall so will appear in recursive stack frames, because a counter must be decremented after the call.
112111

113-
* SyntaxTree SynExpr
114-
* TypedTree Expr
112+
Compiling with `--times` option will show a summary if any thread switches were made due to stack guarding:
115113

116-
We don't use it for other inputs.
114+
115+
```
116+
StackGuard jumps:
117+
-----------------------------------------------------
118+
| caller | source | jumps | min depth |
119+
|--------|----------------------|-------|-----------|
120+
| exprF | TypedTreeOps.fs:7444 | 25 | 1601 |
121+
-----------------------------------------------------
122+
```
117123

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### Fixed
2+
* Fix excessive StackGuard thread jumping ([PR #18971](https://github.com/dotnet/fsharp/pull/18971))
3+
4+
### Added
5+
6+
### Changed
7+
8+
### Breaking Changes

eng/Version.Details.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This file should be imported by eng/Versions.props
1818
<SystemReflectionMetadataPackageVersion>9.0.0</SystemReflectionMetadataPackageVersion>
1919
<SystemThreadingTasksDataflowPackageVersion>9.0.0</SystemThreadingTasksDataflowPackageVersion>
2020
<!-- dotnet/arcade dependencies -->
21-
<MicrosoftDotNetArcadeSdkPackageVersion>10.0.0-beta.25426.3</MicrosoftDotNetArcadeSdkPackageVersion>
21+
<MicrosoftDotNetArcadeSdkPackageVersion>11.0.0-beta.25508.3</MicrosoftDotNetArcadeSdkPackageVersion>
2222
<!-- _git/dotnet-optimization dependencies -->
2323
<optimizationlinuxarm64MIBCRuntimePackageVersion>1.0.0-prerelease.25502.1</optimizationlinuxarm64MIBCRuntimePackageVersion>
2424
<optimizationlinuxx64MIBCRuntimePackageVersion>1.0.0-prerelease.25502.1</optimizationlinuxx64MIBCRuntimePackageVersion>

eng/Version.Details.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Dependencies>
3-
<Source Uri="https://github.com/dotnet/dotnet" Mapping="fsharp" Sha="2dea164f01d307c409cfe0d0ee5cb8a0691e3c94" BarId="283828" />
3+
<Source Uri="https://github.com/dotnet/dotnet" Mapping="fsharp" Sha="5ba49ea344c5f1cc24a19d12a6a0f52745df281b" BarId="283828" />
44
<ProductDependencies>
55
<Dependency Name="Microsoft.Build" Version="18.0.0-preview-25502-01">
66
<Uri>https://github.com/dotnet/msbuild</Uri>
@@ -44,9 +44,9 @@
4444
</Dependency>
4545
</ProductDependencies>
4646
<ToolsetDependencies>
47-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="10.0.0-beta.25426.3">
47+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="11.0.0-beta.25508.3">
4848
<Uri>https://github.com/dotnet/arcade</Uri>
49-
<Sha>5db998e02282e63bc375948a237bcdfef534a5c5</Sha>
49+
<Sha>41dda26a1806c552974e29d5ba476107ec0311a1</Sha>
5050
</Dependency>
5151
<Dependency Name="optimization.windows_nt-x64.MIBC.Runtime" Version="1.0.0-prerelease.25502.1">
5252
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>

eng/common/SetupNugetSources.ps1

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# See example call for this script below.
88
#
99
# - task: PowerShell@2
10-
# displayName: Setup Private Feeds Credentials
10+
# displayName: Setup internal Feeds Credentials
1111
# condition: eq(variables['Agent.OS'], 'Windows_NT')
1212
# inputs:
1313
# filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1
@@ -34,19 +34,28 @@ Set-StrictMode -Version 2.0
3434

3535
. $PSScriptRoot\tools.ps1
3636

37+
# Adds or enables the package source with the given name
38+
function AddOrEnablePackageSource($sources, $disabledPackageSources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) {
39+
if ($disabledPackageSources -eq $null -or -not (EnableInternalPackageSource -DisabledPackageSources $disabledPackageSources -Creds $creds -PackageSourceName $SourceName)) {
40+
AddPackageSource -Sources $sources -SourceName $SourceName -SourceEndPoint $SourceEndPoint -Creds $creds -Username $userName -pwd $Password
41+
}
42+
}
43+
3744
# Add source entry to PackageSources
3845
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) {
3946
$packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")
4047

4148
if ($packageSource -eq $null)
4249
{
50+
Write-Host "Adding package source $SourceName"
51+
4352
$packageSource = $doc.CreateElement("add")
4453
$packageSource.SetAttribute("key", $SourceName)
4554
$packageSource.SetAttribute("value", $SourceEndPoint)
4655
$sources.AppendChild($packageSource) | Out-Null
4756
}
4857
else {
49-
Write-Host "Package source $SourceName already present."
58+
Write-Host "Package source $SourceName already present and enabled."
5059
}
5160

5261
AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd
@@ -59,6 +68,8 @@ function AddCredential($creds, $source, $username, $pwd) {
5968
return;
6069
}
6170

71+
Write-Host "Inserting credential for feed: " $source
72+
6273
# Looks for credential configuration for the given SourceName. Create it if none is found.
6374
$sourceElement = $creds.SelectSingleNode($Source)
6475
if ($sourceElement -eq $null)
@@ -91,24 +102,27 @@ function AddCredential($creds, $source, $username, $pwd) {
91102
$passwordElement.SetAttribute("value", $pwd)
92103
}
93104

94-
function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $pwd) {
95-
$maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")
96-
97-
Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."
98-
99-
ForEach ($PackageSource in $maestroPrivateSources) {
100-
Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
101-
AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -pwd $pwd
105+
# Enable all darc-int package sources.
106+
function EnableMaestroInternalPackageSources($DisabledPackageSources, $Creds) {
107+
$maestroInternalSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
108+
ForEach ($DisabledPackageSource in $maestroInternalSources) {
109+
EnableInternalPackageSource -DisabledPackageSources $DisabledPackageSources -Creds $Creds -PackageSourceName $DisabledPackageSource.key
102110
}
103111
}
104112

105-
function EnablePrivatePackageSources($DisabledPackageSources) {
106-
$maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
107-
ForEach ($DisabledPackageSource in $maestroPrivateSources) {
108-
Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource"
113+
# Enables an internal package source by name, if found. Returns true if the package source was found and enabled, false otherwise.
114+
function EnableInternalPackageSource($DisabledPackageSources, $Creds, $PackageSourceName) {
115+
$DisabledPackageSource = $DisabledPackageSources.SelectSingleNode("add[@key='$PackageSourceName']")
116+
if ($DisabledPackageSource) {
117+
Write-Host "Enabling internal source '$($DisabledPackageSource.key)'."
118+
109119
# Due to https://github.com/NuGet/Home/issues/10291, we must actually remove the disabled entries
110120
$DisabledPackageSources.RemoveChild($DisabledPackageSource)
121+
122+
AddCredential -Creds $creds -Source $DisabledPackageSource.Key -Username $userName -pwd $Password
123+
return $true
111124
}
125+
return $false
112126
}
113127

114128
if (!(Test-Path $ConfigFile -PathType Leaf)) {
@@ -121,15 +135,17 @@ $doc = New-Object System.Xml.XmlDocument
121135
$filename = (Get-Item $ConfigFile).FullName
122136
$doc.Load($filename)
123137

124-
# Get reference to <PackageSources> or create one if none exist already
138+
# Get reference to <PackageSources> - fail if none exist
125139
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
126140
if ($sources -eq $null) {
127-
$sources = $doc.CreateElement("packageSources")
128-
$doc.DocumentElement.AppendChild($sources) | Out-Null
141+
Write-PipelineTelemetryError -Category 'Build' -Message "Eng/common/SetupNugetSources.ps1 returned a non-zero exit code. NuGet config file must contain a packageSources section: $ConfigFile"
142+
ExitWithExitCode 1
129143
}
130144

131145
$creds = $null
146+
$feedSuffix = "v3/index.json"
132147
if ($Password) {
148+
$feedSuffix = "v2"
133149
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
134150
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
135151
if ($creds -eq $null) {
@@ -138,33 +154,22 @@ if ($Password) {
138154
}
139155
}
140156

157+
$userName = "dn-bot"
158+
141159
# Check for disabledPackageSources; we'll enable any darc-int ones we find there
142160
$disabledSources = $doc.DocumentElement.SelectSingleNode("disabledPackageSources")
143161
if ($disabledSources -ne $null) {
144162
Write-Host "Checking for any darc-int disabled package sources in the disabledPackageSources node"
145-
EnablePrivatePackageSources -DisabledPackageSources $disabledSources
146-
}
147-
148-
$userName = "dn-bot"
149-
150-
# Insert credential nodes for Maestro's private feeds
151-
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -pwd $Password
152-
153-
# 3.1 uses a different feed url format so it's handled differently here
154-
$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']")
155-
if ($dotnet31Source -ne $null) {
156-
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password
157-
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password
163+
EnableMaestroInternalPackageSources -DisabledPackageSources $disabledSources -Creds $creds
158164
}
159-
160-
$dotnetVersions = @('5','6','7','8','9')
165+
$dotnetVersions = @('5','6','7','8','9','10')
161166

162167
foreach ($dotnetVersion in $dotnetVersions) {
163168
$feedPrefix = "dotnet" + $dotnetVersion;
164169
$dotnetSource = $sources.SelectSingleNode("add[@key='$feedPrefix']")
165170
if ($dotnetSource -ne $null) {
166-
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password
167-
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password
171+
AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password
172+
AddOrEnablePackageSource -Sources $sources -DisabledPackageSources $disabledSources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/$feedSuffix" -Creds $creds -Username $userName -pwd $Password
168173
}
169174
}
170175

0 commit comments

Comments
 (0)