Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ public void Advance(ILOpcode opcode, in ILReader reader, MethodIL methodIL)
break;
return;
case State.TypeEqualityCheck_StlocLdloc:
if (opcode == ILOpcode.ldloc || opcode == ILOpcode.ldloc_s || (opcode >= ILOpcode.ldloc_0 && opcode <= ILOpcode.ldloc_3))
_state = State.TypeEqualityCheck;
else
throw new UnreachableException();
_state = opcode is ILOpcode.ldloc or ILOpcode.ldloc_s or (>= ILOpcode.ldloc_0 and <= ILOpcode.ldloc_3) ? State.TypeEqualityCheck
: throw new UnreachableException();
return;
default:
throw new UnreachableException();
Expand Down Expand Up @@ -165,11 +163,12 @@ static bool IsObjectGetType(ILOpcode opcode, in ILReader reader, MethodIL method
&& method.IsIntrinsic && method.Name.SequenceEqual("GetType"u8) && method.OwningType.IsObject;

static bool IsArgumentOrLocalLoad(ILOpcode opcode)
=> opcode is (>= ILOpcode.ldloc_0 and <= ILOpcode.ldloc_3) or (>= ILOpcode.ldarg_0 and <= ILOpcode.ldarg_3);
=> opcode is (>= ILOpcode.ldloc_0 and <= ILOpcode.ldloc_3) or (>= ILOpcode.ldarg_0 and <= ILOpcode.ldarg_3)
or ILOpcode.ldloc or ILOpcode.ldloc_s or ILOpcode.ldarg or ILOpcode.ldarg_s;

static bool IsStlocLdlocSequence(ILOpcode opcode, in ILReader reader)
{
if (opcode == ILOpcode.stloc || opcode == ILOpcode.stloc_s || (opcode >= ILOpcode.stloc_0 && opcode <= ILOpcode.stloc_3))
if (opcode is ILOpcode.stloc or ILOpcode.stloc_s or (>= ILOpcode.stloc_0 and <= ILOpcode.stloc_3))
{
ILReader nestedReader = reader;
int locIndex = opcode switch
Expand All @@ -179,7 +178,8 @@ static bool IsStlocLdlocSequence(ILOpcode opcode, in ILReader reader)
_ => opcode - ILOpcode.stloc_0,
};
ILOpcode otherOpcode = nestedReader.ReadILOpcode();
return (otherOpcode == ILOpcode.ldloc || otherOpcode == ILOpcode.ldloc_s || (otherOpcode >= ILOpcode.ldloc_0 && otherOpcode <= ILOpcode.ldloc_3))

return (otherOpcode is ILOpcode.ldloc or ILOpcode.ldloc_s or (>= ILOpcode.ldloc_0 and <= ILOpcode.ldloc_3))
&& otherOpcode switch
{
ILOpcode.ldloc => nestedReader.ReadILUInt16(),
Expand Down
Loading