Skip to content

Commit d0aaa47

Browse files
committed
Fixed a bug with beq and bne instruction
1 parent 342b29b commit d0aaa47

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

ILRuntime/Runtime/Intepreter/ILIntepreter.cs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,13 @@ public object Run(ILMethod method, object instance, object[] p)
15901590
throw new NotImplementedException();
15911591
}
15921592
}
1593+
else
1594+
{
1595+
if (a->ObjectType == ObjectTypes.Null && b->ObjectType == ObjectTypes.Object)
1596+
transfer = mStack[b->Value] == null;
1597+
else if (b->ObjectType == ObjectTypes.Null && a->ObjectType == ObjectTypes.Object)
1598+
transfer = mStack[a->Value] == null;
1599+
}
15931600
Free(esp - 1);
15941601
Free(esp - 2);
15951602
esp = esp - 2;
@@ -1634,7 +1641,14 @@ public object Run(ILMethod method, object instance, object[] p)
16341641
}
16351642
}
16361643
else
1637-
transfer = true;
1644+
{
1645+
if (a->ObjectType == ObjectTypes.Null && b->ObjectType == ObjectTypes.Object)
1646+
transfer = mStack[b->Value] != null;
1647+
else if (b->ObjectType == ObjectTypes.Null && a->ObjectType == ObjectTypes.Object)
1648+
transfer = mStack[a->Value] != null;
1649+
else
1650+
transfer = true;
1651+
}
16381652
Free(esp - 1);
16391653
Free(esp - 2);
16401654
esp = esp - 2;
@@ -5841,7 +5855,12 @@ void CopyToStack(StackObject* dst, StackObject* src, AutoList mStack, AutoList d
58415855
{
58425856
dst->Value = dstmStack.Count;
58435857
var obj = mStack[src->Value];
5844-
dstmStack.Add(obj);
5858+
if (obj != null)
5859+
dstmStack.Add(obj);
5860+
else
5861+
{
5862+
PushNull(dst);
5863+
}
58455864
}
58465865
}
58475866
}

0 commit comments

Comments
 (0)