-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove LocalFunctionRewriting pass #21408
Remove LocalFunctionRewriting pass #21408
Conversation
Perform synthesis of closure methods to an early pass before visitation, meaning we no longer need to do a second visitation of the tree to lower local functions. Fixes https://github.com/dotnet/roslyn/projects/26#card-3753331
The baselines have been changed because we now do closure id and synthessis in order of closure visitation, rather than bound node visitation. Closure visitation visits all the closures in a given scope, then recurs into nested scopes, while BoundNode visitation treats closures as scopes themselves, so nested closures are visited before closures declared in the same scope.
945e05c
to
64090ae
Compare
var start = loweredSymbol.ParameterCount - frameCount; | ||
for (int i = start; i < loweredSymbol.ParameterCount; i++) | ||
{ | ||
// will always be a LambdaFrame, it's always a capture frame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we assert this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 lines down :)
MethodSymbol localFunc, | ||
out BoundExpression receiver, | ||
out MethodSymbol method, | ||
ref ImmutableArray<BoundExpression> parameters) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't changed in this PR, but should this be arguments
? (same with parametersBuilder
, comments, etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I'll file a follow up bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
var syntax = originalMethod.DeclaringSyntaxReferences[0].GetSyntax(); | ||
var structClosures = closure.CapturedEnvironments | ||
.Where(env => env.IsStruct).Select(env => env.SynthesizedEnvironment).AsImmutable(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though this is beautiful, we tend to avoid Linq in the compilers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I'll change it.
translatedLambdaContainer = containerAsFrame = GetStaticFrame(Diagnostics, syntax); | ||
closureKind = ClosureKind.Singleton; | ||
closureOrdinal = LambdaDebugInfo.StaticClosureOrdinal; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can merge the tails of both branches (last statement is identical).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…-literal-text * dotnet/features/ioperation: Fix no completion in partially written code before 'await'. parameter refness update in local functions/lambda should be caught a… (dotnet#21573) Don't offer to use pattern matching if a user defined operator was involved. Fix crash in VisualBasic.Binder.MemberLookup.AddLookupSymbolsInfoInTypeParameter when it is called with Cref TypeParameter. (dotnet#21586) Additional refactors. Refactor IConditionalChoiceExpression. use PerformIO utility put dispose under finally. Update to Microsoft.DiaSymReader.PortablePdb, Microsoft.DiaSymReader.Converter.Xml to 1.4.0-beta1-62016-01 (dotnet#21557) removed usage of ImmutableArray in json.net Update PULL_REQUEST_TEMPLATE.md Add test documentation to the PR template Remove LocalFunctionRewriting pass (dotnet#21408) PR feedbacks 3 product changes and 1 test change
…nversion * dotnet/features/ioperation: (81 commits) Fix no completion in partially written code before 'await'. parameter refness update in local functions/lambda should be caught a… (dotnet#21573) Don't offer to use pattern matching if a user defined operator was involved. Fix crash in VisualBasic.Binder.MemberLookup.AddLookupSymbolsInfoInTypeParameter when it is called with Cref TypeParameter. (dotnet#21586) Additional refactors. Refactor variable names. Refactor IConditionalChoiceExpression. use PerformIO utility put dispose under finally. Update to Microsoft.DiaSymReader.PortablePdb, Microsoft.DiaSymReader.Converter.Xml to 1.4.0-beta1-62016-01 (dotnet#21557) removed usage of ImmutableArray in json.net Update PULL_REQUEST_TEMPLATE.md Add test documentation to the PR template Remove LocalFunctionRewriting pass (dotnet#21408) PR feedbacks Rename parameters. renamed methods. Rename method. Move integration test machines to 15.3 RTM (dotnet#21535) Update comment ...
This PR depends on #21367
Perform synthesis of closure methods to an early pass before visitation,
meaning we no longer need to do a second visitation of the tree to lower
local functions.
Fixes https://github.com/dotnet/roslyn/projects/26#card-3753331