Introduction
Three real instructions that belong with no group, and the eight reserved opcode bytes.
Exceptions and verifiability, for the whole page. nop and break throw nothing; localloc can fail as described below.
Instructions
| Opcode | Instruction | Stack | What it does | Exceptions · verifiability |
|---|---|---|---|---|
00 | nop | … → … | Does nothing. Compilers emit it in debug builds so that a breakpoint has an instruction to stop on, and to pad a branch target. | None. |
01 | break | … → … | Tells the debugger that a breakpoint was reached, so it stops here (the instruction behind Debugger.Break). Without a debugger it does nothing. | None. |
FE 0F | localloc | …, size → …, pointer | Pops a size in bytes (a native unsigned integer) and allocates a block of that size on the stack frame, pushing an unmanaged pointer to it. The block lives until the method returns. It is zeroed if the body’s InitLocals flag is set. It must be used with only the size on the stack, and cannot be in a filter, catch, finally or fault block. C# stackalloc compiles to it. | StackOverflowException if there is no room; OutOfMemoryException. Not verifiable. |
Reserved bytes
The runtime library’s opcode table (System.Reflection.Emit.OpCodes) lists eight more single-byte opcodes, all with no operand and no stack effect and of a type it calls
Nternal: they are the bytes F8 to FF. They are reserved for the runtime’s own use and are not instructions a runtime accepts in a body.
The explorer decodes them as the instructions the table names and reports each one as a problem on the body. FE, the one that matters, is the first byte of the two-byte opcodes
(see the opcode map) and is never an instruction alone.
| Opcode | Name in the table | Meaning |
|---|---|---|
F8 | prefix7 | Reserved. |
F9 | prefix6 | Reserved. |
FA | prefix5 | Reserved. |
FB | prefix4 | Reserved. |
FC | prefix3 | Reserved. |
FD | prefix2 | Reserved. |
FE | prefix1 | The table’s name for the byte that starts every two-byte opcode. |
FF | prefixref | Reserved. |
Not described
Known, not yet covered
- What the reserved bytes were meant for: the table gives their names only; their purpose is not documented here.
Unknown
- Whether any tool uses the reserved bytes in practice.
Links
Reference
- ECMA-335 – partition III: nop, break, localloc
- System.Reflection.Emit.OpCodes – the runtime library’s table of opcodes, including the reserved ones (.NET)