ECMA-335 specifies the no. opcode prefix as the following (III.2.2):
This prefix indicates that the subsequent instruction need not perform the specified fault check
when it is executed. The byte that follows the instruction code indicates which checks can
optionally be skipped.
In short, it allows for automatic type checks, range checks or null checks to be skipped, which would be useful for optimizing hot code paths.
The current implementation throws InvalidProgramException whenever it encounters this prefix. This opcode is simply marked as unused right now:
https://github.com/dotnet/coreclr/blob/8499136a9a79fd37a4acb9dc690a4815edd8081d/src/inc/opcode.def#L320
Here's a simple method which reproduces the problem:
.method private hidebysig static
int32 NoPrefix () cil managed
{
.maxstack 2
IL_0000: ldc.i4.1
IL_0001: newarr [mscorlib]System.Int32
IL_0006: ldc.i4.0
IL_0007: no. 6 // this is rangecheck | nullcheck
IL_000a: ldelem.i4
IL_000b: ret
}
category:correctness
theme:msil
skill-level:intermediate
cost:medium
ECMA-335 specifies the
no.opcode prefix as the following (III.2.2):In short, it allows for automatic type checks, range checks or null checks to be skipped, which would be useful for optimizing hot code paths.
The current implementation throws
InvalidProgramExceptionwhenever it encounters this prefix. This opcode is simply marked as unused right now:https://github.com/dotnet/coreclr/blob/8499136a9a79fd37a4acb9dc690a4815edd8081d/src/inc/opcode.def#L320
Here's a simple method which reproduces the problem:
category:correctness
theme:msil
skill-level:intermediate
cost:medium