Skip to content

Commit 4b657b7

Browse files
committed
output count of total and unique lambdas
1 parent 2781fea commit 4b657b7

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

src/FastExpressionCompiler/FastExpressionCompiler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3580,7 +3580,7 @@ public static bool TryEmitConstant(ConstantExpression expr, Type exprType, ILGen
35803580
if (constValue != null)
35813581
ok = TryEmitConstant(closure.ContainsConstantsOrNestedLambdas(), exprType, constValue.GetType(), constValue, il, ref closure, byRefIndex);
35823582
else if (exprType.IsValueType)
3583-
// null for a value type and yep, this is a proper way to emit the Nullable null
3583+
// null for a value type and yep, this is a proper way to emit the Nullable null
35843584
ok = EmitLoadLocalVariable(il, InitValueTypeVariable(il, exprType));
35853585
else
35863586
{

src/FastExpressionCompiler/TestTools.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,17 @@ public static void PrintIL(this IDelegateDebugInfo diagInfo, [CallerMemberName]
157157
SmallMap4<IDelegateDebugInfo, string, RefEq<IDelegateDebugInfo>,
158158
SmallMap4.SingleArrayEntries<IDelegateDebugInfo, string, RefEq<IDelegateDebugInfo>>
159159
> uniquePrinted = default;
160-
PrintIL(diagInfo, ref uniquePrinted, tag);
160+
var totalNestedCount = 0;
161+
PrintIL(diagInfo, ref totalNestedCount, ref uniquePrinted, tag);
162+
if (totalNestedCount > 0)
163+
{
164+
Console.WriteLine("--------------------------------------");
165+
Console.WriteLine($"Total nested lambdas: {totalNestedCount}, unique printed: {uniquePrinted.Count}");
166+
}
161167
}
162168

163169
private static void PrintIL(this IDelegateDebugInfo diagInfo,
170+
ref int totalNestedCount,
164171
ref SmallMap4<IDelegateDebugInfo, string, RefEq<IDelegateDebugInfo>,
165172
SmallMap4.SingleArrayEntries<IDelegateDebugInfo, string, RefEq<IDelegateDebugInfo>>> uniquePrinted,
166173
[CallerMemberName] string tag = null)
@@ -176,9 +183,10 @@ private static void PrintIL(this IDelegateDebugInfo diagInfo,
176183
else
177184
{
178185
printedTag = $"{n}_{tag}";
179-
PrintIL(nested, ref uniquePrinted, printedTag);
186+
PrintIL(nested, ref totalNestedCount, ref uniquePrinted, printedTag);
180187
}
181188
++n;
189+
++totalNestedCount;
182190
}
183191
}
184192

0 commit comments

Comments
 (0)