Skip to content

Commit 6c4d322

Browse files
committed
small polishing and removing wips
1 parent a144cca commit 6c4d322

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/FastExpressionCompiler/FastExpressionCompiler.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4372,7 +4372,7 @@ private static bool TryEmitArithmeticAndOrAssign(
43724372

43734373
// required for calling the method on the value type parameter
43744374
var objType = objExpr.Type;
4375-
objVarByAddress = objType.IsValueType && !closure.LastEmitIsAddress && // todo: @wip avoid ad-hocking with parameter here
4375+
objVarByAddress = !closure.LastEmitIsAddress && objType.IsValueType && // todo: @wip avoid ad-hocking with parameter here
43764376
(objExpr.NodeType != ExpressionType.Parameter || !((ParameterExpression)objExpr).IsByRef);
43774377
if (objVarByAddress)
43784378
objVar = EmitStoreAndLoadLocalVariableAddress(il, objType);
@@ -8425,13 +8425,14 @@ public static ILGenerator RentPooledOrNewILGenerator(DynamicMethod dynMethod, Ty
84258425
// the default ILGenerator size is 64 in .NET 8.0+
84268426
int newStreamSize = 64)
84278427
{
8428-
if (DynamicMethodHacks.ReuseDynamicILGenerator != null)
8428+
var reuseILGenerator = DynamicMethodHacks.ReuseDynamicILGenerator;
8429+
if (reuseILGenerator != null)
84298430
{
84308431
var pooledIL = _pooledILGenerator;
84318432
_pooledILGenerator = null;
84328433
if (pooledIL != null)
84338434
{
8434-
DynamicMethodHacks.ReuseDynamicILGenerator(dynMethod, pooledIL, returnType, paramTypes);
8435+
reuseILGenerator(dynMethod, pooledIL, returnType, paramTypes);
84358436
return pooledIL;
84368437
}
84378438
else
@@ -8446,9 +8447,6 @@ public static ILGenerator RentPooledOrNewILGenerator(DynamicMethod dynMethod, Ty
84468447
[MethodImpl((MethodImplOptions)256)]
84478448
public static void FreePooledILGenerator(DynamicMethod dynMethod, ILGenerator il)
84488449
{
8449-
// todo: @wip #475 might be required to avoid the undefined behavior when the previous DynamicMethod is still linked to the wrong ILGenerator
8450-
// ILGeneratorField.SetValue(dynMethod, null);
8451-
84528450
if (DynamicMethodHacks.ReuseDynamicILGenerator != null)
84538451
_pooledILGenerator = il;
84548452
}

test/FastExpressionCompiler.IssueTests/Issue475_Reuse_DynamicMethod_if_possible.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ void TryToReuseTheDynamicMethod_FailedWithInternalClrError_BecauseTheResultDeleg
628628
// d.StoreDynamicMethod(this);
629629
// return d;
630630

631-
// todo: @wip Calling this second time in `-c:Release` will produce `Fatal error. Internal CLR error. (0x80131506) ## :-( Failed with ERROR: -1073741819` (the -c:Debug is working fine)
631+
// note: Calling this second time in `-c:Release` will produce `Fatal error. Internal CLR error. (0x80131506) ## :-( Failed with ERROR: -1073741819` (the -c:Debug is working fine)
632632
// runtimeMethodHandle = GetMethodDescriptorMethod.Invoke(dynMethod, null);
633633

634634
// var func2 = (Func<int, int>)CreateDelegateMethod.Invoke(null, [typeof(Func<int, int>), ExpressionCompiler.EmptyArrayClosure, runtimeMethodHandle]);

test/FastExpressionCompiler.LightExpression.IssueTests/Issue346_Is_it_possible_to_implement_ref_local_variables.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public void Check_assignment_to_by_ref_float_parameter_PostIncrement_Returning()
148148

149149
var f = e.CompileFast(true, CompilerFlags.EnableDelegateDebugInfo);
150150
f.PrintIL();
151-
// todo: @wip the IL codes is the same for the System Compile but the expected values are different
151+
// todo: @wip the IL codes is the same for the System.Compile but the expected values are different
152152
// f.AssertOpCodes(
153153
// IL_0000: ldarg.1
154154
// IL_0001: ldarg.1

test/FastExpressionCompiler.UnitTests/AssignTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ public void Array_multi_dimensional_index_assign_value_type_block()
380380
// todo: @wip #431 generates different names for the unnamed variables which is not comparable
381381
Asserts.AreEqual(expr.ToCSharpString(), restoredExpr.ToCSharpString());
382382
#endif
383-
384383
Asserts.IsNotNull(fs);
385384
Asserts.AreEqual(5, fs());
386385
}

0 commit comments

Comments
 (0)