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 #include <stdio.h>
22 #include <zend.h>
23
24 static const char *zend_vm_opcodes_names[187] = {
25 "ZEND_NOP",
26 "ZEND_ADD",
27 "ZEND_SUB",
28 "ZEND_MUL",
29 "ZEND_DIV",
30 "ZEND_MOD",
31 "ZEND_SL",
32 "ZEND_SR",
33 "ZEND_CONCAT",
34 "ZEND_BW_OR",
35 "ZEND_BW_AND",
36 "ZEND_BW_XOR",
37 "ZEND_BW_NOT",
38 "ZEND_BOOL_NOT",
39 "ZEND_BOOL_XOR",
40 "ZEND_IS_IDENTICAL",
41 "ZEND_IS_NOT_IDENTICAL",
42 "ZEND_IS_EQUAL",
43 "ZEND_IS_NOT_EQUAL",
44 "ZEND_IS_SMALLER",
45 "ZEND_IS_SMALLER_OR_EQUAL",
46 "ZEND_CAST",
47 "ZEND_QM_ASSIGN",
48 "ZEND_ASSIGN_ADD",
49 "ZEND_ASSIGN_SUB",
50 "ZEND_ASSIGN_MUL",
51 "ZEND_ASSIGN_DIV",
52 "ZEND_ASSIGN_MOD",
53 "ZEND_ASSIGN_SL",
54 "ZEND_ASSIGN_SR",
55 "ZEND_ASSIGN_CONCAT",
56 "ZEND_ASSIGN_BW_OR",
57 "ZEND_ASSIGN_BW_AND",
58 "ZEND_ASSIGN_BW_XOR",
59 "ZEND_PRE_INC",
60 "ZEND_PRE_DEC",
61 "ZEND_POST_INC",
62 "ZEND_POST_DEC",
63 "ZEND_ASSIGN",
64 "ZEND_ASSIGN_REF",
65 "ZEND_ECHO",
66 "ZEND_GENERATOR_CREATE",
67 "ZEND_JMP",
68 "ZEND_JMPZ",
69 "ZEND_JMPNZ",
70 "ZEND_JMPZNZ",
71 "ZEND_JMPZ_EX",
72 "ZEND_JMPNZ_EX",
73 "ZEND_CASE",
74 "ZEND_CHECK_VAR",
75 "ZEND_SEND_VAR_NO_REF_EX",
76 "ZEND_MAKE_REF",
77 "ZEND_BOOL",
78 "ZEND_FAST_CONCAT",
79 "ZEND_ROPE_INIT",
80 "ZEND_ROPE_ADD",
81 "ZEND_ROPE_END",
82 "ZEND_BEGIN_SILENCE",
83 "ZEND_END_SILENCE",
84 "ZEND_INIT_FCALL_BY_NAME",
85 "ZEND_DO_FCALL",
86 "ZEND_INIT_FCALL",
87 "ZEND_RETURN",
88 "ZEND_RECV",
89 "ZEND_RECV_INIT",
90 "ZEND_SEND_VAL",
91 "ZEND_SEND_VAR_EX",
92 "ZEND_SEND_REF",
93 "ZEND_NEW",
94 "ZEND_INIT_NS_FCALL_BY_NAME",
95 "ZEND_FREE",
96 "ZEND_INIT_ARRAY",
97 "ZEND_ADD_ARRAY_ELEMENT",
98 "ZEND_INCLUDE_OR_EVAL",
99 "ZEND_UNSET_VAR",
100 "ZEND_UNSET_DIM",
101 "ZEND_UNSET_OBJ",
102 "ZEND_FE_RESET_R",
103 "ZEND_FE_FETCH_R",
104 "ZEND_EXIT",
105 "ZEND_FETCH_R",
106 "ZEND_FETCH_DIM_R",
107 "ZEND_FETCH_OBJ_R",
108 "ZEND_FETCH_W",
109 "ZEND_FETCH_DIM_W",
110 "ZEND_FETCH_OBJ_W",
111 "ZEND_FETCH_RW",
112 "ZEND_FETCH_DIM_RW",
113 "ZEND_FETCH_OBJ_RW",
114 "ZEND_FETCH_IS",
115 "ZEND_FETCH_DIM_IS",
116 "ZEND_FETCH_OBJ_IS",
117 "ZEND_FETCH_FUNC_ARG",
118 "ZEND_FETCH_DIM_FUNC_ARG",
119 "ZEND_FETCH_OBJ_FUNC_ARG",
120 "ZEND_FETCH_UNSET",
121 "ZEND_FETCH_DIM_UNSET",
122 "ZEND_FETCH_OBJ_UNSET",
123 "ZEND_FETCH_LIST",
124 "ZEND_FETCH_CONSTANT",
125 NULL,
126 "ZEND_EXT_STMT",
127 "ZEND_EXT_FCALL_BEGIN",
128 "ZEND_EXT_FCALL_END",
129 "ZEND_EXT_NOP",
130 "ZEND_TICKS",
131 "ZEND_SEND_VAR_NO_REF",
132 "ZEND_CATCH",
133 "ZEND_THROW",
134 "ZEND_FETCH_CLASS",
135 "ZEND_CLONE",
136 "ZEND_RETURN_BY_REF",
137 "ZEND_INIT_METHOD_CALL",
138 "ZEND_INIT_STATIC_METHOD_CALL",
139 "ZEND_ISSET_ISEMPTY_VAR",
140 "ZEND_ISSET_ISEMPTY_DIM_OBJ",
141 "ZEND_SEND_VAL_EX",
142 "ZEND_SEND_VAR",
143 "ZEND_INIT_USER_CALL",
144 "ZEND_SEND_ARRAY",
145 "ZEND_SEND_USER",
146 "ZEND_STRLEN",
147 "ZEND_DEFINED",
148 "ZEND_TYPE_CHECK",
149 "ZEND_VERIFY_RETURN_TYPE",
150 "ZEND_FE_RESET_RW",
151 "ZEND_FE_FETCH_RW",
152 "ZEND_FE_FREE",
153 "ZEND_INIT_DYNAMIC_CALL",
154 "ZEND_DO_ICALL",
155 "ZEND_DO_UCALL",
156 "ZEND_DO_FCALL_BY_NAME",
157 "ZEND_PRE_INC_OBJ",
158 "ZEND_PRE_DEC_OBJ",
159 "ZEND_POST_INC_OBJ",
160 "ZEND_POST_DEC_OBJ",
161 "ZEND_ASSIGN_OBJ",
162 "ZEND_OP_DATA",
163 "ZEND_INSTANCEOF",
164 "ZEND_DECLARE_CLASS",
165 "ZEND_DECLARE_INHERITED_CLASS",
166 "ZEND_DECLARE_FUNCTION",
167 "ZEND_YIELD_FROM",
168 "ZEND_DECLARE_CONST",
169 "ZEND_ADD_INTERFACE",
170 "ZEND_DECLARE_INHERITED_CLASS_DELAYED",
171 "ZEND_VERIFY_ABSTRACT_CLASS",
172 "ZEND_ASSIGN_DIM",
173 "ZEND_ISSET_ISEMPTY_PROP_OBJ",
174 "ZEND_HANDLE_EXCEPTION",
175 "ZEND_USER_OPCODE",
176 "ZEND_ASSERT_CHECK",
177 "ZEND_JMP_SET",
178 "ZEND_DECLARE_LAMBDA_FUNCTION",
179 "ZEND_ADD_TRAIT",
180 "ZEND_BIND_TRAITS",
181 "ZEND_SEPARATE",
182 "ZEND_FETCH_CLASS_NAME",
183 "ZEND_CALL_TRAMPOLINE",
184 "ZEND_DISCARD_EXCEPTION",
185 "ZEND_YIELD",
186 "ZEND_GENERATOR_RETURN",
187 "ZEND_FAST_CALL",
188 "ZEND_FAST_RET",
189 "ZEND_RECV_VARIADIC",
190 "ZEND_SEND_UNPACK",
191 "ZEND_POW",
192 "ZEND_ASSIGN_POW",
193 "ZEND_BIND_GLOBAL",
194 "ZEND_COALESCE",
195 "ZEND_SPACESHIP",
196 "ZEND_DECLARE_ANON_CLASS",
197 "ZEND_DECLARE_ANON_INHERITED_CLASS",
198 "ZEND_FETCH_STATIC_PROP_R",
199 "ZEND_FETCH_STATIC_PROP_W",
200 "ZEND_FETCH_STATIC_PROP_RW",
201 "ZEND_FETCH_STATIC_PROP_IS",
202 "ZEND_FETCH_STATIC_PROP_FUNC_ARG",
203 "ZEND_FETCH_STATIC_PROP_UNSET",
204 "ZEND_UNSET_STATIC_PROP",
205 "ZEND_ISSET_ISEMPTY_STATIC_PROP",
206 "ZEND_FETCH_CLASS_CONSTANT",
207 "ZEND_BIND_LEXICAL",
208 "ZEND_BIND_STATIC",
209 "ZEND_FETCH_THIS",
210 NULL,
211 "ZEND_ISSET_ISEMPTY_THIS",
212 };
213
214 static uint32_t zend_vm_opcodes_flags[187] = {
215 0x00000000,
216 0x00000707,
217 0x00000707,
218 0x00000707,
219 0x00000707,
220 0x00000707,
221 0x00000707,
222 0x00000707,
223 0x00000707,
224 0x00000707,
225 0x00000707,
226 0x00000707,
227 0x00000007,
228 0x00000007,
229 0x00000707,
230 0x00000303,
231 0x00000303,
232 0x00000707,
233 0x00000707,
234 0x00000707,
235 0x00000707,
236 0x07000003,
237 0x00000003,
238 0x04006751,
239 0x04006751,
240 0x04006751,
241 0x04006751,
242 0x04006751,
243 0x04006751,
244 0x04006751,
245 0x04006751,
246 0x04006751,
247 0x04006751,
248 0x04006751,
249 0x00000001,
250 0x00000001,
251 0x00000001,
252 0x00000001,
253 0x00000301,
254 0x0b000101,
255 0x00000007,
256 0x00000000,
257 0x00000020,
258 0x00002007,
259 0x00002007,
260 0x03002007,
261 0x00002007,
262 0x00002007,
263 0x00000707,
264 0x00000101,
265 0x00001001,
266 0x00000101,
267 0x00000007,
268 0x00000707,
269 0x01000701,
270 0x01000701,
271 0x01000701,
272 0x00000000,
273 0x00000001,
274 0x01000300,
275 0x00000000,
276 0x01000310,
277 0x00000003,
278 0x00000010,
279 0x00000310,
280 0x00001007,
281 0x00001001,
282 0x00001001,
283 0x01000073,
284 0x01000300,
285 0x00004005,
286 0x00186703,
287 0x00106703,
288 0x08000007,
289 0x00030107,
290 0x00000701,
291 0x00000751,
292 0x00002003,
293 0x03000001,
294 0x00000007,
295 0x00010107,
296 0x00000707,
297 0x00000753,
298 0x00010107,
299 0x00006701,
300 0x00000751,
301 0x00010107,
302 0x00006701,
303 0x00000751,
304 0x00010107,
305 0x00000707,
306 0x00000757,
307 0x00050107,
308 0x01006703,
309 0x01000753,
310 0x00010107,
311 0x00000701,
312 0x00000751,
313 0x00000707,
314 0x06000301,
315 0x00000000,
316 0x00000000,
317 0x00000000,
318 0x00000000,
319 0x00000000,
320 0x01000000,
321 0x00001001,
322 0x03000103,
323 0x00000003,
324 0x05000700,
325 0x00000057,
326 0x0b000003,
327 0x01000757,
328 0x01008773,
329 0x00030107,
330 0x00020707,
331 0x00001003,
332 0x00001001,
333 0x01000703,
334 0x00000000,
335 0x00001003,
336 0x00000007,
337 0x00000003,
338 0x07000003,
339 0x00000103,
340 0x00002003,
341 0x03000001,
342 0x00004005,
343 0x01000700,
344 0x00000000,
345 0x00000000,
346 0x00000000,
347 0x00000751,
348 0x00000751,
349 0x00000751,
350 0x00000751,
351 0x00000751,
352 0x00000000,
353 0x00007305,
354 0x00000000,
355 0x00000100,
356 0x00000000,
357 0x00000003,
358 0x00000303,
359 0x00000300,
360 0x00000100,
361 0x00000000,
362 0x00006701,
363 0x00020757,
364 0x00000000,
365 0x00000000,
366 0x00002000,
367 0x00002003,
368 0x00000103,
369 0x00000000,
370 0x00000000,
371 0x00000101,
372 0x05000000,
373 0x00000000,
374 0x00000000,
375 0x0b000303,
376 0x00000003,
377 0x00000020,
378 0x00003000,
379 0x00000010,
380 0x00000000,
381 0x00000707,
382 0x04006751,
383 0x00000301,
384 0x00002003,
385 0x00000707,
386 0x03000000,
387 0x03000100,
388 0x00007307,
389 0x00007307,
390 0x00007307,
391 0x00007307,
392 0x01007307,
393 0x00007307,
394 0x00007307,
395 0x00027307,
396 0x00000373,
397 0x00100101,
398 0x00100301,
399 0x00000101,
400 0x00000000,
401 0x00000101,
402 };
403
zend_get_opcode_name(zend_uchar opcode)404 ZEND_API const char* zend_get_opcode_name(zend_uchar opcode) {
405 return zend_vm_opcodes_names[opcode];
406 }
zend_get_opcode_flags(zend_uchar opcode)407 ZEND_API uint32_t zend_get_opcode_flags(zend_uchar opcode) {
408 return zend_vm_opcodes_flags[opcode];
409 }
410