Skip to content

Commit

Permalink
fix ISZERO
Browse files Browse the repository at this point in the history
  • Loading branch information
Demuirgos committed Nov 5, 2024
1 parent 324393f commit f5f3cf7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/Nethermind/Nethermind.Evm.Test/CodeAnalysis/IlEvmTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,19 @@ public override void Setup()
.PushSingle(1)
.SSTORE()
.Done, EvmExceptionType.None);

yield return (Instruction.ISZERO, Prepare.EvmCode
.ISZERO(7)
.PushData(7)
.SSTORE()
.ISZERO(0)
.PushData(1)
.SSTORE()
.ISZERO(UInt256.MaxValue)
.PushData(23)
.SSTORE()
.Done, EvmExceptionType.None);

yield return (Instruction.SUB, Prepare.EvmCode
.PushSingle(23)
.PushSingle(7)
Expand Down Expand Up @@ -1434,7 +1439,6 @@ public void JIT_Mode_Segment_Has_Jump_Into_Another_Segment_Agressive_Mode_On()
Assert.That(actualTracePattern, Is.EqualTo(desiredTracePattern));
}


[Test]
public void JIT_Mode_Segment_Has_Jump_Into_Another_Segment_Agressive_Mode_Off()
{
Expand Down Expand Up @@ -1511,7 +1515,6 @@ public void JIT_Mode_Segment_Has_Jump_Into_Another_Segment_Agressive_Mode_Off()
Assert.That(actualTracePattern, Is.EqualTo(desiredTracePattern));
}


[Test]
public void JIT_Mode_Segment_Has_Jump_Into_Another_Segment_Agressive_Mode_On_Equiv()
{
Expand Down Expand Up @@ -1589,7 +1592,6 @@ public void JIT_Mode_Segment_Has_Jump_Into_Another_Segment_Agressive_Mode_On_Equ
Assert.That(actual, Is.EqualTo(expected));
}


[Test]
public void JIT_Mode_Segment_Has_Jump_Into_Another_Segment_Agressive_Mode_Off_Equiv()
{
Expand Down Expand Up @@ -1709,7 +1711,6 @@ public void JIT_invalid_opcode_results_in_failure()
Assert.That(hasFailed, Is.True);
}


[Test]
public void Pure_Opcode_Emition_Coveraga()
{
Expand Down
8 changes: 7 additions & 1 deletion src/Nethermind/Nethermind.Evm/CodeAnalysis/IL/ILCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,14 @@ private static ushort[] EmitSegmentBody(Emit<ExecuteSegment> method, OpcodeInfo[
case Instruction.ISZERO:
{// we load the stack
method.StackLoadPrevious(stack, head, 1);
method.Duplicate();
method.Call(Word.GetIsZero);
method.StoreLocal(lbool);

method.StackLoadPrevious(stack, head, 1);
method.Call(Word.SetToZero);

method.StackLoadPrevious(stack, head, 1);
method.LoadLocal(lbool);
method.Call(Word.SetByte0);
}
break;
Expand Down

0 comments on commit f5f3cf7

Please sign in to comment.