Welcome to mirror list, hosted at ThFree Co, Russian Federation.

OpCode.cs « System.Reflection.Emit « corlib « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1bdd19fcc9b6e6ef0b606c5bcdd14caeb63b44c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//
// System.Reflection.Emit.OpCode
//
// Author:
//   Sergey Chaban (serge@wildwestsoftware.com)
//

using System;
using System.Reflection;
using System.Reflection.Emit;


namespace System.Reflection.Emit {

	public struct OpCode {

		internal string name;
		internal int size;
		internal OpCodeType type;
		internal OperandType operandType;
		internal StackBehaviour pop;
		internal StackBehaviour push;
		internal FlowControl flowCtrl;
		internal byte op1;
		internal byte op2;

		internal OpCode (string name, int size,
		                 OpCodeType opcodeType,
		                 OperandType operandType,
                                 StackBehaviour pop,
                                 StackBehaviour push,
		                 FlowControl flowCtrl,
		                 byte op1, byte op2)
		{
			this.name = name;
			this.size = size;
			this.type = opcodeType;
			this.operandType = operandType;
			this.pop = pop;
			this.push = push;
			this.flowCtrl = flowCtrl;
			this.op1 = op1;
			this.op2 = op2;
		}



		/// <summary>
		/// </summary>
		public string Name {
			get {
				return name;
			}
		}

		/// <summary>
		/// </summary>
		public int Size {
			get {
				return size;
			}
		}


		/// <summary>
		/// </summary>
		public OpCodeType OpCodeType {
			get {
				return type;
			}
		}

		/// <summary>
		/// </summary>
		public OperandType OperandType {
			get {
				return operandType;
			}
		}

		/// <summary>
		/// </summary>
		public FlowControl FlowControl {
			get {
				return flowCtrl;
			}
		}


		/// <summary>
		/// </summary>
		public StackBehaviour StackBehaviourPop {
			get {
				return pop;
			}
		}


		/// <summary>
		/// </summary>
		public StackBehaviour StackBehaviourPush {
			get {
				return push;
			}
		}


		/// <summary>
		/// </summary>
		public short Value {
			get {
				if (size == 1) {
					return op2;
				} else {
					// two byte instruction - combine
					// give the same values as the mscorlib impl
					// this makes the Value property useless
					return (short) ((op1 << 2) | op2);
				}
			}
		}

	} // OpCode

} // System.Reflection.Emit