Dan Bryant
Dan Bryant

Reputation: 27505

What do the IL Prefix OpCodes do?

I've been playing around with IL and I noticed OpCodes like Prefix1, with documentation basically telling me not to worry about it. Naturally, this makes me quite curious as to what these various Prefix OpCodes actually do. A quick Google search didn't turn up anything, so I thought I'd ask the experts here. Does anybody know what these mean?

Upvotes: 3

Views: 644

Answers (2)

Hans Passant
Hans Passant

Reputation: 941635

While most opcodes are a single byte, there are several opcodes in current use that contain 2 bytes. For example, Opcodes.LdLoc is encoded as 0xfe + 0x0c. You can probably guess the value of Opcodes.Prefix1, it ix 0xfe. Prefix2-7 are for future extensibility. They are marked as "do not use" because multi-byte opcodes already have the prefix included in their value (fields m_s1 and m_s2).

If you're interested in the background info, you'll want to take a look at the Ecma-335 standard document.

Upvotes: 5

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

http://msdn.microsoft.com/en-us/library/812xyxy2(v=VS.95).aspx

As for the Prefix1, it is a reserved instruction that you should not use. Maybe it is reserved for some future version.

Upvotes: 1

Related Questions