* CustomAttributeBuilder.cs (get_umarshal): Fix typo. The name of
[mono.git] / mcs / class / corlib / System.Reflection.Emit / OpCodes.cs
index d10b4e913ad0b3a5a981de44e9cfded23f7654fe..a0c78a94ec421c1480a94a6316a41de6e2397f66 100644 (file)
@@ -1,5 +1,14 @@
+using System.Runtime.InteropServices;
+
 namespace System.Reflection.Emit {
+#if NET_2_0
+       [ComVisible (true)]
+#endif
        public class OpCodes {
+
+               internal OpCodes () {
+               }
+
                //
                // The order is:
                //       Op1, Op2, StackBehaviourPush, StackBehaviourPop
@@ -465,6 +474,9 @@ namespace System.Reflection.Emit {
                        0xFF << 0 | 0x73 << 8 | (byte) StackBehaviour.Pushref << 16 | (byte) StackBehaviour.Varpop << 24,
                        1 << 0 | (byte) OpCodeType.Objmodel << 8 | (byte) OperandType.InlineMethod << 16 | (byte) FlowControl.Call << 24);
 
+#if NET_2_0
+       [ComVisible (true)]
+#endif
                public static readonly OpCode Castclass = new OpCode (
                        0xFF << 0 | 0x74 << 8 | (byte) StackBehaviour.Pushref << 16 | (byte) StackBehaviour.Popref << 24,
                        1 << 0 | (byte) OpCodeType.Objmodel << 8 | (byte) OperandType.InlineType << 16 | (byte) FlowControl.Next << 24);
@@ -653,6 +665,14 @@ namespace System.Reflection.Emit {
                        0xFF << 0 | 0xA4 << 8 | (byte) StackBehaviour.Push0 << 16 | (byte) StackBehaviour.Popref_popi_popref << 24,
                        1 << 0 | (byte) OpCodeType.Objmodel << 8 | (byte) OperandType.InlineType << 16 | (byte) FlowControl.Next << 24);
 
+               public static readonly OpCode Ldelem = new OpCode (
+                       0xFF << 0 | 0xA3 << 8 | (byte) StackBehaviour.Push1 << 16 | (byte) StackBehaviour.Popref_popi << 24,
+                       1 << 0 | (byte) OpCodeType.Objmodel << 8 | (byte) OperandType.InlineType << 16 | (byte) FlowControl.Next << 24);
+
+               public static readonly OpCode Stelem = new OpCode (
+                       0xFF << 0 | 0xA4 << 8 | (byte) StackBehaviour.Push0 << 16 | (byte) StackBehaviour.Popref_popi_popref << 24,
+                       1 << 0 | (byte) OpCodeType.Objmodel << 8 | (byte) OperandType.InlineType << 16 | (byte) FlowControl.Next << 24);
+
                public static readonly OpCode Unbox_Any = new OpCode (
                        0xFF << 0 | 0xA5 << 8 | (byte) StackBehaviour.Push1 << 16 | (byte) StackBehaviour.Popref << 24,
                        1 << 0 | (byte) OpCodeType.Objmodel << 8 | (byte) OperandType.InlineType << 16 | (byte) FlowControl.Next << 24);
@@ -905,6 +925,15 @@ namespace System.Reflection.Emit {
                        0xFE << 0 | 0x1D << 8 | (byte) StackBehaviour.Pushi << 16 | (byte) StackBehaviour.Pop1 << 24,
                        2 << 0 | (byte) OpCodeType.Primitive << 8 | (byte) OperandType.InlineNone << 16 | (byte) FlowControl.Next << 24);
 
-
+                public static bool TakesSingleByteArgument (OpCode inst)
+                {
+                       OperandType t = inst.OperandType;
+                       
+                       // check for short-inline instructions
+                       return t == OperandType.ShortInlineBrTarget
+                       || t == OperandType.ShortInlineI
+                           || t == OperandType.ShortInlineR
+                           || t == OperandType.ShortInlineVar;
+               }
        }
 }