xref: /PHP-7.2/Zend/zend_vm_opcodes.h (revision 7a7ec01a)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend Engine                                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1998-2018 Zend Technologies Ltd. (http://www.zend.com) |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 2.00 of the Zend license,     |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.zend.com/license/2_00.txt.                                |
11    | If you did not receive a copy of the Zend license and are unable to  |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@zend.com so we can mail you a copy immediately.              |
14    +----------------------------------------------------------------------+
15    | Authors: Andi Gutmans <andi@zend.com>                                |
16    |          Zeev Suraski <zeev@zend.com>                                |
17    |          Dmitry Stogov <dmitry@zend.com>                             |
18    +----------------------------------------------------------------------+
19 */
20 
21 #ifndef ZEND_VM_OPCODES_H
22 #define ZEND_VM_OPCODES_H
23 
24 #define ZEND_VM_SPEC		1
25 #define ZEND_VM_LINES		0
26 #define ZEND_VM_KIND_CALL	1
27 #define ZEND_VM_KIND_SWITCH	2
28 #define ZEND_VM_KIND_GOTO	3
29 #define ZEND_VM_KIND_HYBRID	4
30 /* HYBRID requires support for computed GOTO and global register variables*/
31 #if (defined(__GNUC__) && defined(HAVE_GCC_GLOBAL_REGS))
32 # define ZEND_VM_KIND		ZEND_VM_KIND_HYBRID
33 #else
34 # define ZEND_VM_KIND		ZEND_VM_KIND_CALL
35 #endif
36 
37 #define ZEND_VM_OP_SPEC          0x00000001
38 #define ZEND_VM_OP_CONST         0x00000002
39 #define ZEND_VM_OP_TMPVAR        0x00000004
40 #define ZEND_VM_OP_TMPVARCV      0x00000008
41 #define ZEND_VM_OP_MASK          0x000000f0
42 #define ZEND_VM_OP_NUM           0x00000010
43 #define ZEND_VM_OP_JMP_ADDR      0x00000020
44 #define ZEND_VM_OP_TRY_CATCH     0x00000030
45 #define ZEND_VM_OP_LIVE_RANGE    0x00000040
46 #define ZEND_VM_OP_THIS          0x00000050
47 #define ZEND_VM_OP_NEXT          0x00000060
48 #define ZEND_VM_OP_CLASS_FETCH   0x00000070
49 #define ZEND_VM_OP_CONSTRUCTOR   0x00000080
50 #define ZEND_VM_EXT_VAR_FETCH    0x00010000
51 #define ZEND_VM_EXT_ISSET        0x00020000
52 #define ZEND_VM_EXT_ARG_NUM      0x00040000
53 #define ZEND_VM_EXT_ARRAY_INIT   0x00080000
54 #define ZEND_VM_EXT_REF          0x00100000
55 #define ZEND_VM_EXT_MASK         0x0f000000
56 #define ZEND_VM_EXT_NUM          0x01000000
57 #define ZEND_VM_EXT_JMP_ADDR     0x03000000
58 #define ZEND_VM_EXT_DIM_OBJ      0x04000000
59 #define ZEND_VM_EXT_CLASS_FETCH  0x05000000
60 #define ZEND_VM_EXT_CONST_FETCH  0x06000000
61 #define ZEND_VM_EXT_TYPE         0x07000000
62 #define ZEND_VM_EXT_EVAL         0x08000000
63 #define ZEND_VM_EXT_SRC          0x0b000000
64 #define ZEND_VM_NO_CONST_CONST   0x40000000
65 #define ZEND_VM_COMMUTATIVE      0x80000000
66 #define ZEND_VM_OP1_FLAGS(flags) (flags & 0xff)
67 #define ZEND_VM_OP2_FLAGS(flags) ((flags >> 8) & 0xff)
68 
69 BEGIN_EXTERN_C()
70 
71 ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);
72 ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode);
73 
74 END_EXTERN_C()
75 
76 #define ZEND_NOP                               0
77 #define ZEND_ADD                               1
78 #define ZEND_SUB                               2
79 #define ZEND_MUL                               3
80 #define ZEND_DIV                               4
81 #define ZEND_MOD                               5
82 #define ZEND_SL                                6
83 #define ZEND_SR                                7
84 #define ZEND_CONCAT                            8
85 #define ZEND_BW_OR                             9
86 #define ZEND_BW_AND                           10
87 #define ZEND_BW_XOR                           11
88 #define ZEND_BW_NOT                           12
89 #define ZEND_BOOL_NOT                         13
90 #define ZEND_BOOL_XOR                         14
91 #define ZEND_IS_IDENTICAL                     15
92 #define ZEND_IS_NOT_IDENTICAL                 16
93 #define ZEND_IS_EQUAL                         17
94 #define ZEND_IS_NOT_EQUAL                     18
95 #define ZEND_IS_SMALLER                       19
96 #define ZEND_IS_SMALLER_OR_EQUAL              20
97 #define ZEND_CAST                             21
98 #define ZEND_QM_ASSIGN                        22
99 #define ZEND_ASSIGN_ADD                       23
100 #define ZEND_ASSIGN_SUB                       24
101 #define ZEND_ASSIGN_MUL                       25
102 #define ZEND_ASSIGN_DIV                       26
103 #define ZEND_ASSIGN_MOD                       27
104 #define ZEND_ASSIGN_SL                        28
105 #define ZEND_ASSIGN_SR                        29
106 #define ZEND_ASSIGN_CONCAT                    30
107 #define ZEND_ASSIGN_BW_OR                     31
108 #define ZEND_ASSIGN_BW_AND                    32
109 #define ZEND_ASSIGN_BW_XOR                    33
110 #define ZEND_PRE_INC                          34
111 #define ZEND_PRE_DEC                          35
112 #define ZEND_POST_INC                         36
113 #define ZEND_POST_DEC                         37
114 #define ZEND_ASSIGN                           38
115 #define ZEND_ASSIGN_REF                       39
116 #define ZEND_ECHO                             40
117 #define ZEND_GENERATOR_CREATE                 41
118 #define ZEND_JMP                              42
119 #define ZEND_JMPZ                             43
120 #define ZEND_JMPNZ                            44
121 #define ZEND_JMPZNZ                           45
122 #define ZEND_JMPZ_EX                          46
123 #define ZEND_JMPNZ_EX                         47
124 #define ZEND_CASE                             48
125 #define ZEND_CHECK_VAR                        49
126 #define ZEND_SEND_VAR_NO_REF_EX               50
127 #define ZEND_MAKE_REF                         51
128 #define ZEND_BOOL                             52
129 #define ZEND_FAST_CONCAT                      53
130 #define ZEND_ROPE_INIT                        54
131 #define ZEND_ROPE_ADD                         55
132 #define ZEND_ROPE_END                         56
133 #define ZEND_BEGIN_SILENCE                    57
134 #define ZEND_END_SILENCE                      58
135 #define ZEND_INIT_FCALL_BY_NAME               59
136 #define ZEND_DO_FCALL                         60
137 #define ZEND_INIT_FCALL                       61
138 #define ZEND_RETURN                           62
139 #define ZEND_RECV                             63
140 #define ZEND_RECV_INIT                        64
141 #define ZEND_SEND_VAL                         65
142 #define ZEND_SEND_VAR_EX                      66
143 #define ZEND_SEND_REF                         67
144 #define ZEND_NEW                              68
145 #define ZEND_INIT_NS_FCALL_BY_NAME            69
146 #define ZEND_FREE                             70
147 #define ZEND_INIT_ARRAY                       71
148 #define ZEND_ADD_ARRAY_ELEMENT                72
149 #define ZEND_INCLUDE_OR_EVAL                  73
150 #define ZEND_UNSET_VAR                        74
151 #define ZEND_UNSET_DIM                        75
152 #define ZEND_UNSET_OBJ                        76
153 #define ZEND_FE_RESET_R                       77
154 #define ZEND_FE_FETCH_R                       78
155 #define ZEND_EXIT                             79
156 #define ZEND_FETCH_R                          80
157 #define ZEND_FETCH_DIM_R                      81
158 #define ZEND_FETCH_OBJ_R                      82
159 #define ZEND_FETCH_W                          83
160 #define ZEND_FETCH_DIM_W                      84
161 #define ZEND_FETCH_OBJ_W                      85
162 #define ZEND_FETCH_RW                         86
163 #define ZEND_FETCH_DIM_RW                     87
164 #define ZEND_FETCH_OBJ_RW                     88
165 #define ZEND_FETCH_IS                         89
166 #define ZEND_FETCH_DIM_IS                     90
167 #define ZEND_FETCH_OBJ_IS                     91
168 #define ZEND_FETCH_FUNC_ARG                   92
169 #define ZEND_FETCH_DIM_FUNC_ARG               93
170 #define ZEND_FETCH_OBJ_FUNC_ARG               94
171 #define ZEND_FETCH_UNSET                      95
172 #define ZEND_FETCH_DIM_UNSET                  96
173 #define ZEND_FETCH_OBJ_UNSET                  97
174 #define ZEND_FETCH_LIST                       98
175 #define ZEND_FETCH_CONSTANT                   99
176 #define ZEND_EXT_STMT                        101
177 #define ZEND_EXT_FCALL_BEGIN                 102
178 #define ZEND_EXT_FCALL_END                   103
179 #define ZEND_EXT_NOP                         104
180 #define ZEND_TICKS                           105
181 #define ZEND_SEND_VAR_NO_REF                 106
182 #define ZEND_CATCH                           107
183 #define ZEND_THROW                           108
184 #define ZEND_FETCH_CLASS                     109
185 #define ZEND_CLONE                           110
186 #define ZEND_RETURN_BY_REF                   111
187 #define ZEND_INIT_METHOD_CALL                112
188 #define ZEND_INIT_STATIC_METHOD_CALL         113
189 #define ZEND_ISSET_ISEMPTY_VAR               114
190 #define ZEND_ISSET_ISEMPTY_DIM_OBJ           115
191 #define ZEND_SEND_VAL_EX                     116
192 #define ZEND_SEND_VAR                        117
193 #define ZEND_INIT_USER_CALL                  118
194 #define ZEND_SEND_ARRAY                      119
195 #define ZEND_SEND_USER                       120
196 #define ZEND_STRLEN                          121
197 #define ZEND_DEFINED                         122
198 #define ZEND_TYPE_CHECK                      123
199 #define ZEND_VERIFY_RETURN_TYPE              124
200 #define ZEND_FE_RESET_RW                     125
201 #define ZEND_FE_FETCH_RW                     126
202 #define ZEND_FE_FREE                         127
203 #define ZEND_INIT_DYNAMIC_CALL               128
204 #define ZEND_DO_ICALL                        129
205 #define ZEND_DO_UCALL                        130
206 #define ZEND_DO_FCALL_BY_NAME                131
207 #define ZEND_PRE_INC_OBJ                     132
208 #define ZEND_PRE_DEC_OBJ                     133
209 #define ZEND_POST_INC_OBJ                    134
210 #define ZEND_POST_DEC_OBJ                    135
211 #define ZEND_ASSIGN_OBJ                      136
212 #define ZEND_OP_DATA                         137
213 #define ZEND_INSTANCEOF                      138
214 #define ZEND_DECLARE_CLASS                   139
215 #define ZEND_DECLARE_INHERITED_CLASS         140
216 #define ZEND_DECLARE_FUNCTION                141
217 #define ZEND_YIELD_FROM                      142
218 #define ZEND_DECLARE_CONST                   143
219 #define ZEND_ADD_INTERFACE                   144
220 #define ZEND_DECLARE_INHERITED_CLASS_DELAYED 145
221 #define ZEND_VERIFY_ABSTRACT_CLASS           146
222 #define ZEND_ASSIGN_DIM                      147
223 #define ZEND_ISSET_ISEMPTY_PROP_OBJ          148
224 #define ZEND_HANDLE_EXCEPTION                149
225 #define ZEND_USER_OPCODE                     150
226 #define ZEND_ASSERT_CHECK                    151
227 #define ZEND_JMP_SET                         152
228 #define ZEND_DECLARE_LAMBDA_FUNCTION         153
229 #define ZEND_ADD_TRAIT                       154
230 #define ZEND_BIND_TRAITS                     155
231 #define ZEND_SEPARATE                        156
232 #define ZEND_FETCH_CLASS_NAME                157
233 #define ZEND_CALL_TRAMPOLINE                 158
234 #define ZEND_DISCARD_EXCEPTION               159
235 #define ZEND_YIELD                           160
236 #define ZEND_GENERATOR_RETURN                161
237 #define ZEND_FAST_CALL                       162
238 #define ZEND_FAST_RET                        163
239 #define ZEND_RECV_VARIADIC                   164
240 #define ZEND_SEND_UNPACK                     165
241 #define ZEND_POW                             166
242 #define ZEND_ASSIGN_POW                      167
243 #define ZEND_BIND_GLOBAL                     168
244 #define ZEND_COALESCE                        169
245 #define ZEND_SPACESHIP                       170
246 #define ZEND_DECLARE_ANON_CLASS              171
247 #define ZEND_DECLARE_ANON_INHERITED_CLASS    172
248 #define ZEND_FETCH_STATIC_PROP_R             173
249 #define ZEND_FETCH_STATIC_PROP_W             174
250 #define ZEND_FETCH_STATIC_PROP_RW            175
251 #define ZEND_FETCH_STATIC_PROP_IS            176
252 #define ZEND_FETCH_STATIC_PROP_FUNC_ARG      177
253 #define ZEND_FETCH_STATIC_PROP_UNSET         178
254 #define ZEND_UNSET_STATIC_PROP               179
255 #define ZEND_ISSET_ISEMPTY_STATIC_PROP       180
256 #define ZEND_FETCH_CLASS_CONSTANT            181
257 #define ZEND_BIND_LEXICAL                    182
258 #define ZEND_BIND_STATIC                     183
259 #define ZEND_FETCH_THIS                      184
260 #define ZEND_ISSET_ISEMPTY_THIS              186
261 #define ZEND_SWITCH_LONG                     187
262 #define ZEND_SWITCH_STRING                   188
263 #define ZEND_IN_ARRAY                        189
264 #define ZEND_COUNT                           190
265 #define ZEND_GET_CLASS                       191
266 #define ZEND_GET_CALLED_CLASS                192
267 #define ZEND_GET_TYPE                        193
268 #define ZEND_FUNC_NUM_ARGS                   194
269 #define ZEND_FUNC_GET_ARGS                   195
270 #define ZEND_UNSET_CV                        196
271 #define ZEND_ISSET_ISEMPTY_CV                197
272 
273 #define ZEND_VM_LAST_OPCODE                  197
274 
275 #endif
276