Skip to content

Commit

Permalink
simplify ISZERO and EQ
Browse files Browse the repository at this point in the history
  • Loading branch information
Demuirgos committed Oct 25, 2024
1 parent 2b3a80c commit be53a03
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Nethermind/Nethermind.Evm/CodeAnalysis/IL/ILCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -560,21 +560,14 @@ private static ushort[] EmitSegmentBody(Emit<ExecuteSegment> method, OpcodeInfo[
EmitComparaisonInt256Method(method, uint256R, (stack, head), typeof(Int256.Int256).GetMethod(nameof(Int256.Int256.CompareTo), new[] { typeof(Int256.Int256) }), true, evmExceptionLabels, uint256A, uint256B);
break;
case Instruction.EQ:
EmitComparaisonUInt256Method(method, uint256R, (stack, head), typeof(UInt256).GetMethod("op_Equality", new[] { typeof(UInt256).MakeByRefType(), typeof(UInt256).MakeByRefType() }), evmExceptionLabels, uint256A, uint256B);
EmitBitwiseUInt256Method(method, uint256R, (stack, head), typeof(Vector256).GetMethod(nameof(Vector256.Equals), BindingFlags.Public | BindingFlags.Static)!, evmExceptionLabels);
break;
case Instruction.ISZERO:
{// we load the stack
method.StackLoadPrevious(stack, head, 1);
method.Duplicate();
method.Call(Word.GetIsZero);
method.StoreLocal(byte8A);
method.StackPop(head, 1);

// we convert the result to a Uint256 and store it in the stack
method.CleanWord(stack, head);
method.Load(stack, head);
method.LoadLocal(byte8A);
method.StoreField(Word.Byte0Field);
method.StackPush(head);
}
break;
case Instruction.POP:
Expand Down

0 comments on commit be53a03

Please sign in to comment.