Binder\LocalScopeBinder.cs (17)
21private ImmutableArray<LocalSymbol> _locals;
35internal sealed override ImmutableArray<LocalSymbol> Locals
41ImmutableInterlocked.InterlockedCompareExchange(ref _locals, BuildLocals(), default(ImmutableArray<LocalSymbol>));
48protected virtual ImmutableArray<LocalSymbol> BuildLocals()
50return ImmutableArray<LocalSymbol>.Empty;
89private SmallDictionary<string, LocalSymbol> _lazyLocalsMap;
90private SmallDictionary<string, LocalSymbol> LocalsMap
148protected ImmutableArray<LocalSymbol> BuildLocals(SyntaxList<StatementSyntax> statements, Binder enclosingBinder)
164ArrayBuilder<LocalSymbol> locals = ArrayBuilder<LocalSymbol>.GetInstance(DefaultLocalSymbolArrayCapacity);
173internal void BuildLocals(Binder enclosingBinder, StatementSyntax statement, ArrayBuilder<LocalSymbol> locals)
287static void findExpressionVariablesInRankSpecifier(ExpressionSyntax expression, (LocalScopeBinder localScopeBinder, ArrayBuilder<LocalSymbol> locals, Binder localDeclarationBinder) args)
383LocalSymbol result = null;
389foreach (var local in this.Locals)
444LocalSymbol localSymbol;
510declaredInThisScope |= newSymbolKind == SymbolKind.Local && this.Locals.Contains((LocalSymbol)newSymbol);
543LocalSymbol existingLocal = null;
Binder\RefSafetyAnalysis.cs (15)
63private Dictionary<LocalSymbol, (uint RefEscapeScope, uint ValEscapeScope)>? _localEscapeScopes;
92private readonly ImmutableArray<LocalSymbol> _locals;
94public LocalScope(RefSafetyAnalysis analysis, ImmutableArray<LocalSymbol> locals)
99foreach (var local in locals)
107foreach (var local in _locals)
176private (uint RefEscapeScope, uint ValEscapeScope) GetLocalScopes(LocalSymbol local)
185private void SetLocalScopes(LocalSymbol local, uint refEscapeScope, uint valEscapeScope)
435private void AddLocalScopes(LocalSymbol local, uint refEscapeScope, uint valEscapeScope)
462private void AddOrSetLocalScopes(LocalSymbol local, uint refEscapeScope, uint valEscapeScope)
464_localEscapeScopes ??= new Dictionary<LocalSymbol, (uint RefEscapeScope, uint ValEscapeScope)>();
469private void RemoveLocalScopes(LocalSymbol local)
619if (pattern.Variable is LocalSymbol local)
1074using var _ = new LocalScope(this, ImmutableArray<LocalSymbol>.Empty);
1076foreach (var local in node.IterationVariables)
1099foreach (var local in node.IterationVariables)
CodeGen\Optimizer.cs (31)
61out HashSet<LocalSymbol> stackLocals)
66var locals = PooledDictionary<LocalSymbol, LocalDefUseInfo>.GetInstance();
79stackLocals = new HashSet<LocalSymbol>(locals.Keys);
93private static void FilterValidStackLocals(Dictionary<LocalSymbol, LocalDefUseInfo> info)
98foreach (var local in info.Keys.ToArray())
126private static void RemoveIntersectingLocals(Dictionary<LocalSymbol, LocalDefUseInfo> info, ArrayBuilder<LocalDefUseInfo> dummies)
404private readonly Dictionary<LocalSymbol, LocalDefUseInfo> _locals;
418private StackOptimizerPass1(Dictionary<LocalSymbol, LocalDefUseInfo> locals,
433Dictionary<LocalSymbol, LocalDefUseInfo> locals,
697foreach (var local in locals)
757private bool IsNestedLocalOfCompoundOperator(LocalSymbol local, BoundSequence node)
807private readonly LocalSymbol _local;
810internal LocalUsedWalker(LocalSymbol local, int recursionDepth)
981LocalSymbol localSymbol = assignmentLocal.LocalSymbol;
1427var localSym = ((BoundLocal)boundExpression).LocalSymbol;
1863private void ShouldNotSchedule(LocalSymbol localSymbol)
1872private void RecordVarRef(LocalSymbol local)
1885private void RecordVarRead(LocalSymbol local)
1931private bool EvalStackHasLocal(LocalSymbol local)
1940private void RecordDummyWrite(LocalSymbol local)
1953private void RecordVarWrite(LocalSymbol local)
1983private bool CanScheduleToStack(LocalSymbol local)
1989private void DeclareLocals(ImmutableArray<LocalSymbol> locals, int stack)
1991foreach (var local in locals)
1997private void DeclareLocal(LocalSymbol local, int stack)
2032private readonly Dictionary<LocalSymbol, LocalDefUseInfo> _info;
2034private StackOptimizerPass2(Dictionary<LocalSymbol, LocalDefUseInfo> info)
2039public static BoundStatement Rewrite(BoundStatement src, Dictionary<LocalSymbol, LocalDefUseInfo> info)
2301var sourceLocal = ((BoundLocal)exceptionSource).LocalSymbol;
2359internal override LocalSymbol WithSynthesizedLocalKindAndSyntax(
2406internal override ConstantValue GetConstantValue(SyntaxNode node, LocalSymbol inProgress, BindingDiagnosticBag diagnostics)
Generated\BoundNodes.xml.Generated.cs (97)
291protected BoundEqualsValue(BoundKind kind, SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
302public ImmutableArray<LocalSymbol> Locals { get; }
308public BoundFieldEqualsValue(SyntaxNode syntax, FieldSymbol field, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
324public BoundFieldEqualsValue Update(FieldSymbol field, ImmutableArray<LocalSymbol> locals, BoundExpression value)
338public BoundPropertyEqualsValue(SyntaxNode syntax, PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
354public BoundPropertyEqualsValue Update(PropertySymbol property, ImmutableArray<LocalSymbol> locals, BoundExpression value)
368public BoundParameterEqualsValue(SyntaxNode syntax, ParameterSymbol parameter, ImmutableArray<LocalSymbol> locals, BoundExpression value, bool hasErrors = false)
384public BoundParameterEqualsValue Update(ParameterSymbol parameter, ImmutableArray<LocalSymbol> locals, BoundExpression value)
2261public BoundBlockInstrumentation(SyntaxNode syntax, OneOrMany<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue, bool hasErrors = false)
2272public OneOrMany<LocalSymbol> Locals { get; }
2279public BoundBlockInstrumentation Update(OneOrMany<LocalSymbol> locals, BoundStatement? prologue, BoundStatement? epilogue)
2333public BoundLocalId(SyntaxNode syntax, LocalSymbol local, FieldSymbol? hoistedField, TypeSymbol type, bool hasErrors)
2344public BoundLocalId(SyntaxNode syntax, LocalSymbol local, FieldSymbol? hoistedField, TypeSymbol type)
2356public LocalSymbol Local { get; }
2362public BoundLocalId Update(LocalSymbol local, FieldSymbol? hoistedField, TypeSymbol type)
3304public BoundBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3318public ImmutableArray<LocalSymbol> Locals { get; }
3326public BoundBlock Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, bool hasUnsafeModifier, BoundBlockInstrumentation? instrumentation, ImmutableArray<BoundStatement> statements)
3340public BoundScope(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
3350public ImmutableArray<LocalSymbol> Locals { get; }
3355public BoundScope Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
3400public BoundLocalDeclaration(SyntaxNode syntax, LocalSymbol localSymbol, BoundTypeExpression? declaredTypeOpt, BoundExpression? initializerOpt, ImmutableArray<BoundExpression> argumentsOpt, bool inferredType, bool hasErrors = false)
3413public LocalSymbol LocalSymbol { get; }
3422public BoundLocalDeclaration Update(LocalSymbol localSymbol, BoundTypeExpression? declaredTypeOpt, BoundExpression? initializerOpt, ImmutableArray<BoundExpression> argumentsOpt, bool inferredType)
3770public BoundSwitchStatement(SyntaxNode syntax, BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<LocalFunctionSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, GeneratedLabelSymbol breakLabel, bool hasErrors = false)
3791public ImmutableArray<LocalSymbol> InnerLocals { get; }
3801public BoundSwitchStatement Update(BoundExpression expression, ImmutableArray<LocalSymbol> innerLocals, ImmutableArray<LocalFunctionSymbol> innerLocalFunctions, ImmutableArray<BoundSwitchSection> switchSections, BoundDecisionDag reachabilityDecisionDag, BoundSwitchLabel? defaultLabel, GeneratedLabelSymbol breakLabel)
3912protected BoundConditionalLoopStatement(BoundKind kind, SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3927public ImmutableArray<LocalSymbol> Locals { get; }
3934public BoundDoStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3950public BoundDoStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3964public BoundWhileStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
3980public BoundWhileStatement Update(ImmutableArray<LocalSymbol> locals, BoundExpression condition, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
3994public BoundForStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
4012public ImmutableArray<LocalSymbol> OuterLocals { get; }
4014public ImmutableArray<LocalSymbol> InnerLocals { get; }
4022public BoundForStatement Update(ImmutableArray<LocalSymbol> outerLocals, BoundStatement? initializer, ImmutableArray<LocalSymbol> innerLocals, BoundExpression? condition, BoundStatement? increment, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
4036public BoundForEachStatement(SyntaxNode syntax, ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundAwaitableInfo? awaitOpt, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel, bool hasErrors = false)
4063public ImmutableArray<LocalSymbol> IterationVariables { get; }
4073public BoundForEachStatement Update(ForEachEnumeratorInfo? enumeratorInfoOpt, BoundValuePlaceholder? elementPlaceholder, BoundExpression? elementConversion, BoundTypeExpression iterationVariableType, ImmutableArray<LocalSymbol> iterationVariables, BoundExpression? iterationErrorExpressionOpt, BoundExpression expression, BoundForEachDeconstructStep? deconstructionOpt, BoundAwaitableInfo? awaitOpt, BoundStatement body, GeneratedLabelSymbol breakLabel, GeneratedLabelSymbol continueLabel)
4118public BoundUsingStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt, bool hasErrors = false)
4133public ImmutableArray<LocalSymbol> Locals { get; }
4143public BoundUsingStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations? declarationsOpt, BoundExpression? expressionOpt, BoundStatement body, BoundAwaitableInfo? awaitOpt, MethodArgumentInfo? patternDisposeInfoOpt)
4157public BoundFixedStatement(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body, bool hasErrors = false)
4170public ImmutableArray<LocalSymbol> Locals { get; }
4177public BoundFixedStatement Update(ImmutableArray<LocalSymbol> locals, BoundMultipleLocalDeclarations declarations, BoundStatement body)
4259public BoundCatchBlock(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundExpression? exceptionSourceOpt, TypeSymbol? exceptionTypeOpt, BoundStatementList? exceptionFilterPrologueOpt, BoundExpression? exceptionFilterOpt, BoundBlock body, bool isSynthesizedAsyncCatchAll, bool hasErrors = false)
4275public ImmutableArray<LocalSymbol> Locals { get; }
4286public BoundCatchBlock Update(ImmutableArray<LocalSymbol> locals, BoundExpression? exceptionSourceOpt, TypeSymbol? exceptionTypeOpt, BoundStatementList? exceptionFilterPrologueOpt, BoundExpression? exceptionFilterOpt, BoundBlock body, bool isSynthesizedAsyncCatchAll)
4505public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type, bool hasErrors)
4518public BoundLocal(SyntaxNode syntax, LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type)
4532public LocalSymbol LocalSymbol { get; }
4540public BoundLocal Update(LocalSymbol localSymbol, BoundLocalDeclarationKind declarationKind, ConstantValue? constantValueOpt, bool isNullableUnknown, TypeSymbol type)
4554public BoundPseudoVariable(SyntaxNode syntax, LocalSymbol localSymbol, PseudoVariableExpressions emitExpressions, TypeSymbol type, bool hasErrors)
4566public BoundPseudoVariable(SyntaxNode syntax, LocalSymbol localSymbol, PseudoVariableExpressions emitExpressions, TypeSymbol type)
4579public LocalSymbol LocalSymbol { get; }
4585public BoundPseudoVariable Update(LocalSymbol localSymbol, PseudoVariableExpressions emitExpressions, TypeSymbol type)
4903public BoundSwitchExpressionArm(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundPattern pattern, BoundExpression? whenClause, BoundExpression value, LabelSymbol label, bool hasErrors = false)
4919public ImmutableArray<LocalSymbol> Locals { get; }
4928public BoundSwitchExpressionArm Update(ImmutableArray<LocalSymbol> locals, BoundPattern pattern, BoundExpression? whenClause, BoundExpression value, LabelSymbol label)
5658public BoundSwitchSection(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements, bool hasErrors = false)
5670public ImmutableArray<LocalSymbol> Locals { get; }
5676public BoundSwitchSection Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundSwitchLabel> switchLabels, ImmutableArray<BoundStatement> statements)
5765public BoundSequence(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundExpression> sideEffects, BoundExpression value, TypeSymbol type, bool hasErrors = false)
5780public ImmutableArray<LocalSymbol> Locals { get; }
5787public BoundSequence Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundExpression> sideEffects, BoundExpression value, TypeSymbol type)
5801public BoundSpillSequence(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type, bool hasErrors = false)
5816public ImmutableArray<LocalSymbol> Locals { get; }
5823public BoundSpillSequence Update(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression value, TypeSymbol type)
8730public BoundConstructorMethodBody(SyntaxNode syntax, ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody, bool hasErrors = false)
8740public ImmutableArray<LocalSymbol> Locals { get; }
8746public BoundConstructorMethodBody Update(ImmutableArray<LocalSymbol> locals, BoundStatement? initializer, BoundBlock? blockBody, BoundBlock? expressionBody)
12231ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
12239ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
12247ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13015LocalSymbol local = GetUpdatedSymbol(node, node.Local);
13353ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13362ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13376LocalSymbol localSymbol = GetUpdatedSymbol(node, node.LocalSymbol);
13393ImmutableArray<LocalSymbol> innerLocals = GetUpdatedArray(node, node.InnerLocals);
13404ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13412ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13420ImmutableArray<LocalSymbol> outerLocals = GetUpdatedArray(node, node.OuterLocals);
13421ImmutableArray<LocalSymbol> innerLocals = GetUpdatedArray(node, node.InnerLocals);
13431ImmutableArray<LocalSymbol> iterationVariables = GetUpdatedArray(node, node.IterationVariables);
13445ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13455ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13463ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13546LocalSymbol localSymbol = GetUpdatedSymbol(node, node.LocalSymbol);
13563LocalSymbol localSymbol = GetUpdatedSymbol(node, node.LocalSymbol);
13627ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13725ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13750ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
13769ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
14914ImmutableArray<LocalSymbol> locals = GetUpdatedArray(node, node.Locals);
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (6)
200protected override void InitializeStateMachine(ArrayBuilder<BoundStatement> bodyBuilder, NamedTypeSymbol frameType, LocalSymbol stateMachineLocal)
262protected override BoundStatement GenerateStateMachineCreation(LocalSymbol stateMachineVariable, NamedTypeSymbol frameType, IReadOnlyDictionary<Symbol, CapturedSymbolReplacement> proxies)
324out LocalSymbol instSymbol,
336var versionSymbol = F.SynthesizedLocal(F.SpecialType(SpecialType.System_Int16));
367private void GetPartsForStartingMachine(out BoundExpressionStatement callReset, out LocalSymbol instSymbol, out BoundStatement instAssignment,
434out LocalSymbol instSymbol,
Lowering\ClosureConversion\ClosureConversion.cs (29)
97private readonly HashSet<LocalSymbol> _assignLocals;
133private ArrayBuilder<LocalSymbol> _addedLocals;
168HashSet<LocalSymbol> assignLocals)
202Debug.Assert(localOrParameter is LocalSymbol || localOrParameter is ParameterSymbol ||
239HashSet<LocalSymbol> assignLocals)
631var localFrame = (LocalSymbol)framePointer;
659private BoundNode IntroduceFrame(BoundNode node, Analysis.ClosureEnvironment env, Func<ArrayBuilder<BoundExpression>, ArrayBuilder<LocalSymbol>, BoundNode> F)
666LocalSymbol framePointer = new SynthesizedLocal(_topLevelMethod, TypeWithAnnotations.Create(frameType), SynthesizedLocalKind.LambdaDisplayClass, frame.ScopeSyntaxOpt);
721var addedLocals = ArrayBuilder<LocalSymbol>.GetInstance();
744private void InitVariableProxy(SyntaxNode syntax, Symbol symbol, LocalSymbol framePointer, ArrayBuilder<BoundExpression> prologue)
764var local = (LocalSymbol)symbol;
770LocalSymbol localToUse;
1123locals: ImmutableArray<LocalSymbol>.Empty,
1134private BoundSequence RewriteSequence(BoundSequence node, ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals)
1155return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1160return RewriteBlock(node, ArrayBuilder<BoundExpression>.GetInstance(), ArrayBuilder<LocalSymbol>.GetInstance());
1164private BoundBlock RewriteBlock(BoundBlock node, ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals)
1201var newLocals = ArrayBuilder<LocalSymbol>.GetInstance();
1219return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1226return RewriteCatch(node, ArrayBuilder<BoundExpression>.GetInstance(), ArrayBuilder<LocalSymbol>.GetInstance());
1230private BoundNode RewriteCatch(BoundCatchBlock node, ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals)
1248ImmutableArray.Create<LocalSymbol>(),
1293return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1300return RewriteSequence(node, ArrayBuilder<BoundExpression>.GetInstance(), ArrayBuilder<LocalSymbol>.GetInstance());
1310return IntroduceFrame(node, frame, (ArrayBuilder<BoundExpression> prologue, ArrayBuilder<LocalSymbol> newLocals) =>
1719var cacheLocal = F.SynthesizedLocal(type, kind: SynthesizedLocalKind.CachedAnonymousMethodDelegate);
1720if (_addedLocals == null) _addedLocals = ArrayBuilder<LocalSymbol>.GetInstance();
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (10)
852locals: ImmutableArray<LocalSymbol>.Empty,
1098locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1287locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1396locals: ImmutableArray<LocalSymbol>.Empty,
1440var locals = ArrayBuilder<LocalSymbol>.GetInstance();
1489ArrayBuilder<LocalSymbol> locals,
1734locals: ImmutableArray.Create<LocalSymbol>(boundTemp.LocalSymbol),
1795locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1883locals: ImmutableArray.Create<LocalSymbol>(boundTempX.LocalSymbol, boundTempY.LocalSymbol),
1964locals: ImmutableArray<LocalSymbol>.Empty,
Lowering\LocalRewriter\LocalRewriter_Call.cs (17)
141ref ArrayBuilder<LocalSymbol> temps,
399ArrayBuilder<LocalSymbol>? temps = null;
446ImmutableArray<LocalSymbol> temps)
662ref ArrayBuilder<LocalSymbol>? tempsOpt,
718tempsOpt ??= ArrayBuilder<LocalSymbol>.GetInstance();
808ImmutableArray<LocalSymbol>.Empty,
816void ensureTempTrackingSetup([NotNull] ref ArrayBuilder<LocalSymbol>? tempsOpt, ref BitVector positionsAssignedToTemp)
818tempsOpt ??= ArrayBuilder<LocalSymbol>.GetInstance();
831ref ArrayBuilder<LocalSymbol>? tempsOpt,
885visitedArgumentsBuilder[argIndex] = _factory.Sequence(ImmutableArray<LocalSymbol>.Empty, ImmutableArray.Create<BoundExpression>(store), local);
931private void ReferToTempIfReferenceTypeReceiver(BoundLocal receiverTemp, ref BoundAssignmentOperator assignmentToTemp, out BoundAssignmentOperator? extraRefInitialization, ArrayBuilder<LocalSymbol> temps)
1004[NotNull] ref ArrayBuilder<LocalSymbol>? temps,
1016temps ??= ArrayBuilder<LocalSymbol>.GetInstance();
1456ArrayBuilder<LocalSymbol> temporariesBuilder)
1580ImmutableArray<LocalSymbol>.Empty,
1604ArrayBuilder<LocalSymbol> temporariesBuilder)
1644locals: ImmutableArray<LocalSymbol>.Empty,
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (12)
27var temps = ArrayBuilder<LocalSymbol>.GetInstance();
58var eventTemps = ArrayBuilder<LocalSymbol>.GetInstance();
161private BoundExpression? TransformPropertyOrEventReceiver(Symbol propertyOrEvent, BoundExpression? receiverOpt, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
227private BoundDynamicMemberAccess TransformDynamicMemberAccess(BoundDynamicMemberAccess memberAccess, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
244private BoundIndexerAccess TransformIndexerAccess(BoundIndexerAccess indexerAccess, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
320ArrayBuilder<LocalSymbol> temps)
409ArrayBuilder<LocalSymbol> temps,
423private BoundExpression TransformIndexPatternIndexerAccess(BoundImplicitIndexerAccess implicitIndexerAccess, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps, bool isDynamicAssignment)
459private bool TransformCompoundAssignmentFieldOrEventAccessReceiver(Symbol fieldOrEvent, ref BoundExpression? receiver, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
502private BoundDynamicIndexerAccess TransformDynamicIndexerAccess(BoundDynamicIndexerAccess indexerAccess, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps)
561private BoundExpression TransformCompoundAssignmentLHS(BoundExpression originalLHS, bool isRegularCompoundAssignment, ArrayBuilder<BoundExpression> stores, ArrayBuilder<LocalSymbol> temps, bool isDynamicAssignment)
780ArrayBuilder<LocalSymbol> temps)
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (27)
141ImmutableArray<LocalSymbol> iterationVariables,
157LocalSymbol enumeratorVar = _factory.SynthesizedLocal(enumeratorType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachEnumerator);
260tryBlock: new BoundBlock(forEachSyntax, locals: ImmutableArray<LocalSymbol>.Empty, statements: ImmutableArray.Create(whileLoop)),
411locals: ImmutableArray<LocalSymbol>.Empty,
424LocalSymbol disposableVar = _factory.SynthesizedLocal(idisposableTypeSymbol);
603ImmutableArray<LocalSymbol> iterationVariables,
618LocalSymbol? preambleLocal = null;
623LocalSymbol collectionTemp = _factory.SynthesizedLocal(collectionType, forEachSyntax, kind: SynthesizedLocalKind.ForEachArray, refKind: collectionTempRefKind);
639LocalSymbol positionVar = _factory.SynthesizedLocal(intType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArrayIndex);
693outerLocals: preambleLocal is null ? ImmutableArray.Create<LocalSymbol>(collectionTemp, positionVar) : ImmutableArray.Create<LocalSymbol>(preambleLocal, collectionTemp, positionVar),
707private delegate BoundStatement? GetForEachStatementAsForPreamble(LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind);
746return static (LocalRewriter rewriter, SyntaxNode syntax, ForEachEnumeratorInfo enumeratorInfo, ref BoundExpression rewrittenExpression, out LocalSymbol? preambleLocal, out RefKind collectionTempRefKind) =>
812ImmutableArray<LocalSymbol> iterationVariables,
838ImmutableArray<LocalSymbol> iterationVariables,
899ImmutableArray<LocalSymbol> iterationVariables,
917LocalSymbol arrayVar = _factory.SynthesizedLocal(arrayType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArray);
928LocalSymbol positionVar = _factory.SynthesizedLocal(intType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArrayIndex);
989outerLocals: ImmutableArray.Create<LocalSymbol>(arrayVar, positionVar),
1048ImmutableArray<LocalSymbol> iterationVariables,
1073LocalSymbol arrayVar = _factory.SynthesizedLocal(arrayType, syntax: forEachSyntax, kind: SynthesizedLocalKind.ForEachArray);
1087LocalSymbol[] upperVar = new LocalSymbol[rank];
1109LocalSymbol[] positionVar = new LocalSymbol[rank];
1232private static BoundLocal MakeBoundLocal(CSharpSyntaxNode syntax, LocalSymbol local, TypeSymbol type)
1240private BoundStatement MakeLocalDeclaration(CSharpSyntaxNode syntax, LocalSymbol local, BoundExpression rewrittenInitialValue)
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (8)
159ArrayBuilder<LocalSymbol>? temps = null;
251var localsBuilder = ArrayBuilder<LocalSymbol>.GetInstance();
456var locals = ArrayBuilder<LocalSymbol>.GetInstance(2);
477ArrayBuilder<LocalSymbol> locals)
758var localsBuilder = ArrayBuilder<LocalSymbol>.GetInstance();
769private BoundExpression VisitRangePatternIndexerAccess(BoundImplicitIndexerAccess node, ArrayBuilder<LocalSymbol> localsBuilder, ArrayBuilder<BoundExpression> sideEffectsBuilder, bool cacheAllArgumentsOnly)
996private BoundExpression MakeRangeSize(ref BoundExpression startExpr, BoundExpression endExpr, ArrayBuilder<LocalSymbol> localsBuilder, ArrayBuilder<BoundExpression> sideEffectsBuilder)
1027private void DeconstructRange(BoundExpression rewrittenRangeArg, BoundExpression lengthAccess, ArrayBuilder<LocalSymbol> localsBuilder, ArrayBuilder<BoundExpression> sideEffectsBuilder, out BoundExpression startExpr, out BoundExpression rangeSizeExpr)
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (14)
33ref ArrayBuilder<LocalSymbol>? temps,
175ArrayBuilder<LocalSymbol>? temps = null;
212private BoundExpression VisitObjectInitializerMember(BoundObjectInitializerMember node, ref BoundExpression rewrittenReceiver, ArrayBuilder<BoundExpression> sideEffects, ref ArrayBuilder<LocalSymbol>? temps)
220ArrayBuilder<LocalSymbol>? constructionTemps = null;
251ref ArrayBuilder<LocalSymbol>? temps,
271ref ArrayBuilder<LocalSymbol>? temps,
424temps ??= ArrayBuilder<LocalSymbol>.GetInstance();
460temps = ArrayBuilder<LocalSymbol>.GetInstance();
482temps ??= ArrayBuilder<LocalSymbol>.GetInstance();
591ref ArrayBuilder<LocalSymbol>? temps)
605(LocalRewriter rewriter, ArrayBuilder<BoundExpression> sideeffects, ArrayBuilder<LocalSymbol>? temps) elementArg = (rewriter: this, sideeffects, temps);
608static (BoundExpression element, ref (LocalRewriter rewriter, ArrayBuilder<BoundExpression> sideeffects, ArrayBuilder<LocalSymbol>? temps) elementArg) =>
637private BoundExpression EvaluateSideEffects(BoundExpression arg, RefKind refKind, ArrayBuilder<BoundExpression> sideeffects, ref ArrayBuilder<LocalSymbol>? temps)
646temps = ArrayBuilder<LocalSymbol>.GetInstance();
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (14)
32var temps = ArrayBuilder<LocalSymbol>.GetInstance();
101ArrayBuilder<LocalSymbol> temps)
142ArrayBuilder<LocalSymbol> temps)
183ArrayBuilder<LocalSymbol> temps,
247ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind)
267TypeSymbol boolType, ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind)
308BoundExpression innerSequence = _factory.Sequence(locals: ImmutableArray<LocalSymbol>.Empty, innerEffects.ToImmutableAndFree(), logicalExpression);
322return _factory.Sequence(ImmutableArray<LocalSymbol>.Empty, outerEffects.ToImmutableAndFree(),
330return _factory.Sequence(ImmutableArray<LocalSymbol>.Empty, outerEffects.ToImmutableAndFree(),
339_factory.Sequence(ImmutableArray<LocalSymbol>.Empty, outerEffects.ToImmutableAndFree(),
353private void MakeNullableParts(BoundExpression expr, ArrayBuilder<LocalSymbol> temps, ArrayBuilder<BoundExpression> innerEffects,
416private BoundLocal MakeTemp(BoundExpression loweredExpression, ArrayBuilder<LocalSymbol> temps, ArrayBuilder<BoundExpression> effects)
429ArrayBuilder<LocalSymbol> temps,
486ArrayBuilder<LocalSymbol> temps, BinaryOperatorKind operatorKind)
Lowering\SpillSequenceSpiller.cs (37)
22private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
23private readonly PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> _receiverSubstitution;
27PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution,
28PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> receiverSubstitution,
41private ArrayBuilder<LocalSymbol> _locals;
67public ImmutableArray<LocalSymbol> GetLocals()
69return (_locals == null) ? ImmutableArray<LocalSymbol>.Empty : _locals.ToImmutable();
122public void AddLocal(LocalSymbol local)
126_locals = ArrayBuilder<LocalSymbol>.GetInstance();
132public void AddLocals(ImmutableArray<LocalSymbol> locals)
134foreach (var local in locals)
183private readonly PooledDictionary<LocalSymbol, LocalSymbol> _tempSubstitution;
184private readonly PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> _receiverSubstitution;
187PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution,
188PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> receiverSubstitution,
197PooledDictionary<LocalSymbol, LocalSymbol> tempSubstitution,
198PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver> receiverSubstitution,
214LocalSymbol longLived;
234var tempSubstitution = PooledDictionary<LocalSymbol, LocalSymbol>.GetInstance();
235var receiverSubstitution = PooledDictionary<LocalSymbol, BoundComplexConditionalReceiver>.GetInstance();
357out LocalSymbol receiverRefLocal,
530out LocalSymbol outReceiverRefLocal,
996var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1135var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1150var tmp = _F.SynthesizedLocal(condition.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1250var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1306var clone = _F.SynthesizedLocal(receiver.Type, _F.Syntax, refKind: RefKind.None, kind: SynthesizedLocalKind.Spill);
1336var tmp = _F.SynthesizedLocal(node.Type, kind: SynthesizedLocalKind.Spill, syntax: _F.Syntax);
1487private void PromoteAndAddLocals(BoundSpillSequenceBuilder builder, ImmutableArray<LocalSymbol> locals)
1489foreach (var local in locals)
1497LocalSymbol longLived = local.WithSynthesizedLocalKindAndSyntax(SynthesizedLocalKind.Spill, _F.Syntax);
Lowering\SyntheticBoundNodeFactory.cs (27)
220public BoundExpression This(LocalSymbol thisTempOpt)
450return Block(ImmutableArray<LocalSymbol>.Empty, statements);
458public BoundBlock Block(ImmutableArray<LocalSymbol> locals, params BoundStatement[] statements)
463public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> statements)
468public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, params BoundStatement[] statements)
473public BoundBlock Block(ImmutableArray<LocalSymbol> locals, ImmutableArray<LocalFunctionSymbol> localFunctions, ImmutableArray<BoundStatement> statements)
502public BoundBlockInstrumentation CombineInstrumentation(BoundBlockInstrumentation? innerInstrumentation = null, LocalSymbol? local = null, BoundStatement? prologue = null, BoundStatement? epilogue = null)
581public LocalSymbol SynthesizedLocal(
603public LocalSymbol InterpolatedStringHandlerLocal(
916return If(condition, ImmutableArray<LocalSymbol>.Empty, thenClause, elseClauseOpt);
924public BoundStatement If(BoundExpression condition, ImmutableArray<LocalSymbol> locals, BoundStatement thenClause, BoundStatement? elseClauseOpt = null)
980public BoundLocal Local(LocalSymbol local)
985public BoundExpression MakeSequence(LocalSymbol temp, params BoundExpression[] parts)
987return MakeSequence(ImmutableArray.Create<LocalSymbol>(temp), parts);
992return MakeSequence(ImmutableArray<LocalSymbol>.Empty, parts);
995public BoundExpression MakeSequence(ImmutableArray<LocalSymbol> locals, params BoundExpression[] parts)
1021return new BoundSequence(Syntax, ImmutableArray<LocalSymbol>.Empty, sideEffects.AsImmutableOrNull(), result, resultType) { WasCompilerGenerated = true };
1024public BoundExpression Sequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundExpression> sideEffects, BoundExpression result)
1033public BoundSpillSequence SpillSequence(ImmutableArray<LocalSymbol> locals, ImmutableArray<BoundStatement> sideEffects, BoundExpression result)
1322public BoundExpression LocalId(LocalSymbol symbol)
1591LocalSymbol local,
1602return new BoundCatchBlock(Syntax, ImmutableArray<LocalSymbol>.Empty, source, source.Type, exceptionFilterPrologueOpt: null, exceptionFilterOpt: null, body: block, isSynthesizedAsyncCatchAll: false);
1710internal BoundLocal MakeTempForDiscard(BoundDiscardExpression node, ArrayBuilder<LocalSymbol> temps)
1712LocalSymbol temp;
1718internal BoundLocal MakeTempForDiscard(BoundDiscardExpression node, out LocalSymbol temp)
1726internal ImmutableArray<BoundExpression> MakeTempsForDiscardArguments(ImmutableArray<BoundExpression> arguments, ArrayBuilder<LocalSymbol> builder)
1844locals: ImmutableArray<LocalSymbol>.Empty,