diff --git a/src/Hyperbee.Expressions/Transformation/AwaitBinder.cs b/src/Hyperbee.Expressions/Transformation/AwaitBinder.cs index e361f50..76d2f71 100644 --- a/src/Hyperbee.Expressions/Transformation/AwaitBinder.cs +++ b/src/Hyperbee.Expressions/Transformation/AwaitBinder.cs @@ -32,7 +32,7 @@ internal AwaitBinder( GetResultImplDelegate = getResultImplDelegate; // Pre-jit methods and delegates - // This saves a little time when the methods are called for the first time + // This saves a little time when the methods are executed for the first time RuntimeHelpers.PrepareMethod( WaitMethod.MethodHandle ); RuntimeHelpers.PrepareMethod( GetAwaiterMethod.MethodHandle ); @@ -45,7 +45,7 @@ internal AwaitBinder( RuntimeHelpers.PrepareDelegate( getResultImplDelegate ); } - // Await methods + // Wait methods [MethodImpl( MethodImplOptions.AggressiveInlining )] internal void Wait( ref TAwaitable awaitable, bool configureAwait ) diff --git a/src/Hyperbee.Expressions/Transformation/JumpTableBuilder.cs b/src/Hyperbee.Expressions/Transformation/JumpTableBuilder.cs index 960b83a..15e6a62 100644 --- a/src/Hyperbee.Expressions/Transformation/JumpTableBuilder.cs +++ b/src/Hyperbee.Expressions/Transformation/JumpTableBuilder.cs @@ -75,5 +75,4 @@ private static List GetNestedTestValues( StateContext.Scope return testCases; } - } diff --git a/src/Hyperbee.Expressions/Transformation/LoweringVisitor.cs b/src/Hyperbee.Expressions/Transformation/LoweringVisitor.cs index 06fc129..e02529d 100644 --- a/src/Hyperbee.Expressions/Transformation/LoweringVisitor.cs +++ b/src/Hyperbee.Expressions/Transformation/LoweringVisitor.cs @@ -186,7 +186,7 @@ protected override Expression VisitBlock( BlockExpression node ) previousVariable = updated.Result.Variable; joinState.Result.Variable = previousVariable; - // Fix tail link list of Transitions. + // Fix tail linked list of Transitions. if ( previousTail != null ) previousTail.Transition = new GotoTransition { TargetNode = updated }; diff --git a/src/Hyperbee.Expressions/Transformation/ReflectionHelper.cs b/src/Hyperbee.Expressions/Transformation/ReflectionHelper.cs index 0ccec8a..3739be3 100644 --- a/src/Hyperbee.Expressions/Transformation/ReflectionHelper.cs +++ b/src/Hyperbee.Expressions/Transformation/ReflectionHelper.cs @@ -123,9 +123,8 @@ internal static MethodInfo FindExtensionMethod( Type targetType, string methodNa { // Search for an extension method with the specified name that extends the specified target type. // - // Extension searching is a very expensive operation. To minimize the performance impact, we - // will search in a specific order to try and reduce the number of assemblies that need to be - // searched. + // Extension searching is an expensive operation. To minimize the performance impact, we will + // search in a specific order to try and reduce the number of assemblies that need to be searched. // // The search order is: // diff --git a/src/Hyperbee.Expressions/Transformation/StateContext.cs b/src/Hyperbee.Expressions/Transformation/StateContext.cs index 60efa6a..802539b 100644 --- a/src/Hyperbee.Expressions/Transformation/StateContext.cs +++ b/src/Hyperbee.Expressions/Transformation/StateContext.cs @@ -12,10 +12,9 @@ internal sealed class StateContext private readonly Stack _joinStates; private readonly Stack _scopeIndexes; + public List Scopes { get; } - public StateNode TailState { get; private set; } - private Scope CurrentScope => Scopes[_scopeIndexes.Peek()]; public StateContext( int initialCapacity ) @@ -184,5 +183,4 @@ static bool IsDefaultVoid( Expression expression ) } public readonly record struct JumpCase( LabelTarget ResultLabel, int StateId, int? ParentId ); - } diff --git a/test/Hyperbee.Expressions.Benchmark/AsyncBenchmarks.cs b/test/Hyperbee.Expressions.Benchmark/AsyncBenchmarks.cs index c64d8f6..17cbcdf 100644 --- a/test/Hyperbee.Expressions.Benchmark/AsyncBenchmarks.cs +++ b/test/Hyperbee.Expressions.Benchmark/AsyncBenchmarks.cs @@ -174,6 +174,17 @@ public async Task DotNext_AsyncLambda_Execute() // Helpers + public static async Task NativeTestAsync() + { + var variable = await InitVariableAsync(); + if ( await IsTrueAsync() ) + { + variable = await AddAsync( variable, variable ); + } + + return variable; + } + public static Task InitVariableAsync() { return Task.FromResult( Random.Shared.Next( 0, 10 ) ); @@ -188,15 +199,4 @@ public static Task AddAsync( int a, int b ) { return Task.FromResult( a + b ); } - - public static async Task NativeTestAsync() - { - var variable = await InitVariableAsync(); - if ( await IsTrueAsync() ) - { - variable = await AddAsync( variable, variable ); - } - - return variable; - } }