php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_opcode.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 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@php.net> |
16 | Zeev Suraski <zeev@php.net> |
17 | Dmitry Stogov <dmitry@php.net> |
18 +----------------------------------------------------------------------+
19*/
20
21#include <stdio.h>
22
23#include "zend.h"
24#include "zend_alloc.h"
25#include "zend_compile.h"
26#include "zend_extensions.h"
27#include "zend_API.h"
28#include "zend_sort.h"
29#include "zend_constants.h"
30#include "zend_observer.h"
31
32#include "zend_vm.h"
33
34static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array)
35{
36 if (extension->op_array_ctor) {
37 extension->op_array_ctor(op_array);
38 }
39}
40
41static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array)
42{
43 if (extension->op_array_dtor) {
44 extension->op_array_dtor(op_array);
45 }
46}
47
48void init_op_array(zend_op_array *op_array, uint8_t type, int initial_ops_size)
49{
50 op_array->type = type;
51 op_array->arg_flags[0] = 0;
52 op_array->arg_flags[1] = 0;
53 op_array->arg_flags[2] = 0;
54
55 op_array->refcount = (uint32_t *) emalloc(sizeof(uint32_t));
56 *op_array->refcount = 1;
57 op_array->last = 0;
58 op_array->opcodes = emalloc(initial_ops_size * sizeof(zend_op));
59
60 op_array->last_var = 0;
61 op_array->vars = NULL;
62
63 op_array->T = 0;
64
65 op_array->function_name = NULL;
66 op_array->filename = zend_string_copy(zend_get_compiled_filename());
67 op_array->doc_comment = NULL;
68 op_array->attributes = NULL;
69
70 op_array->arg_info = NULL;
71 op_array->num_args = 0;
72 op_array->required_num_args = 0;
73
74 op_array->scope = NULL;
75 op_array->prototype = NULL;
76 op_array->prop_info = NULL;
77
78 op_array->live_range = NULL;
79 op_array->try_catch_array = NULL;
80 op_array->last_live_range = 0;
81
82 op_array->static_variables = NULL;
83 ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, NULL);
84 op_array->last_try_catch = 0;
85
86 op_array->fn_flags = 0;
87
88 op_array->last_literal = 0;
89 op_array->literals = NULL;
90
91 op_array->num_dynamic_func_defs = 0;
92 op_array->dynamic_func_defs = NULL;
93
94 ZEND_MAP_PTR_INIT(op_array->run_time_cache, NULL);
95 op_array->cache_size = zend_op_array_extension_handles * sizeof(void*);
96
97 memset(op_array->reserved, 0, ZEND_MAX_RESERVED_RESOURCES * sizeof(void*));
98
100 zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_ctor_handler, op_array);
101 }
102}
103
111
114 zend_type *list_type;
116 zend_type_release(*list_type, persistent);
120 }
121 } else if (ZEND_TYPE_HAS_NAME(type)) {
122 zend_string_release(ZEND_TYPE_NAME(type));
123 }
124}
125
128 function->arg_info) {
129
130 uint32_t i;
131 uint32_t num_args = function->num_args + 1;
132 zend_internal_arg_info *arg_info = function->arg_info - 1;
133
134 if (function->fn_flags & ZEND_ACC_VARIADIC) {
135 num_args++;
136 }
137 for (i = 0 ; i < num_args; i++) {
138 zend_type_release(arg_info[i].type, /* persistent */ 1);
139 }
140 free(arg_info);
141 }
142}
143
145{
147
148 if (function->type == ZEND_USER_FUNCTION) {
149 ZEND_ASSERT(function->common.function_name);
150 destroy_op_array(&function->op_array);
151 /* op_arrays are allocated on arena, so we don't have to free them */
152 } else {
154 ZEND_ASSERT(function->common.function_name);
155 zend_string_release_ex(function->common.function_name, 1);
156
157 /* For methods this will be called explicitly. */
158 if (!function->common.scope) {
159 zend_free_internal_arg_info(&function->internal_function);
160
161 if (function->common.attributes) {
162 zend_hash_release(function->common.attributes);
163 function->common.attributes = NULL;
164 }
165 }
166
167 if (function->common.doc_comment) {
168 zend_string_release_ex(function->common.doc_comment, 1);
169 function->common.doc_comment = NULL;
170 }
171
172 if (!(function->common.fn_flags & ZEND_ACC_ARENA_ALLOCATED)) {
173 pefree(function, 1);
174 }
175 }
176}
177
179{
180 if (ZEND_MAP_PTR(ce->static_members_table) && CE_STATIC_MEMBERS(ce)) {
181 zval *static_members = CE_STATIC_MEMBERS(ce);
182 zval *p = static_members;
184 ZEND_MAP_PTR_SET(ce->static_members_table, NULL);
185 while (p != end) {
186 if (UNEXPECTED(Z_ISREF_P(p))) {
189 if (prop_info->ce == ce && p - static_members == prop_info->offset) {
191 break; /* stop iteration here, the array might be realloc()'ed */
192 }
194 }
195 i_zval_ptr_dtor(p);
196 p++;
197 }
198 efree(static_members);
199 }
200}
201
202static void _destroy_zend_class_traits_info(zend_class_entry *ce)
203{
204 uint32_t i;
205
206 for (i = 0; i < ce->num_traits; i++) {
209 }
210 efree(ce->trait_names);
211
212 if (ce->trait_aliases) {
213 i = 0;
214 while (ce->trait_aliases[i]) {
217 }
220 }
221
222 if (ce->trait_aliases[i]->alias) {
224 }
225
226 efree(ce->trait_aliases[i]);
227 i++;
228 }
229
230 efree(ce->trait_aliases);
231 }
232
233 if (ce->trait_precedences) {
234 uint32_t j;
235
236 i = 0;
237 while (ce->trait_precedences[i]) {
240
241 for (j = 0; j < ce->trait_precedences[i]->num_excludes; j++) {
243 }
244 efree(ce->trait_precedences[i]);
245 i++;
246 }
248 }
249}
250
252{
253 zend_class_mutable_data *mutable_data = ZEND_MAP_PTR_GET_IMM(ce->mutable_data);
254
255 if (mutable_data) {
256 HashTable *constants_table;
257 zval *p;
258
259 constants_table = mutable_data->constants_table;
260 if (constants_table && constants_table != &ce->constants_table) {
262
263 ZEND_HASH_MAP_FOREACH_PTR(constants_table, c) {
264 if (c->ce == ce || (Z_CONSTANT_FLAGS(c->value) & CONST_OWNED)) {
265 zval_ptr_dtor_nogc(&c->value);
266 }
268 zend_hash_destroy(constants_table);
269 mutable_data->constants_table = NULL;
270 }
271
272 p = mutable_data->default_properties_table;
273 if (p && p != ce->default_properties_table) {
275
276 while (p < end) {
277 zval_ptr_dtor_nogc(p);
278 p++;
279 }
280 mutable_data->default_properties_table = NULL;
281 }
282
283 if (mutable_data->backed_enum_table) {
284 zend_hash_release(mutable_data->backed_enum_table);
285 mutable_data->backed_enum_table = NULL;
286 }
287
288 ZEND_MAP_PTR_SET_IMM(ce->mutable_data, NULL);
289 }
290}
291
293{
296 zend_function *fn;
297
298 if (ce->ce_flags & ZEND_ACC_IMMUTABLE) {
299 return;
300 }
301
302 /* We don't increase the refcount for class aliases,
303 * skip the destruction of aliases entirely. */
305 return;
306 }
307
308 if (ce->ce_flags & ZEND_ACC_FILE_CACHED) {
310 zval *p, *end;
311
313 if (c->ce == ce) {
314 zval_ptr_dtor_nogc(&c->value);
315 }
317
318 if (ce->default_properties_table) {
321
322 while (p < end) {
323 zval_ptr_dtor_nogc(p);
324 p++;
325 }
326 }
327 return;
328 }
329
330 ZEND_ASSERT(ce->refcount > 0);
331
332 if (--ce->refcount > 0) {
333 return;
334 }
335
336 switch (ce->type) {
337 case ZEND_USER_CLASS:
338 if (!(ce->ce_flags & ZEND_ACC_CACHED)) {
339 if (ce->parent_name && !(ce->ce_flags & ZEND_ACC_RESOLVED_PARENT)) {
341 }
342
345
346 if (ce->doc_comment) {
348 }
349
350 if (ce->attributes) {
351 zend_hash_release(ce->attributes);
352 }
353
354 if (ce->num_interfaces > 0 && !(ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES)) {
355 uint32_t i;
356
357 for (i = 0; i < ce->num_interfaces; i++) {
360 }
362 }
363
364 if (ce->num_traits > 0) {
365 _destroy_zend_class_traits_info(ce);
366 }
367 }
368
369 if (ce->default_properties_table) {
372
373 while (p != end) {
374 i_zval_ptr_dtor(p);
375 p++;
376 }
378 }
382
383 while (p != end) {
385 i_zval_ptr_dtor(p);
386 p++;
387 }
389 }
391 if (prop_info->ce == ce) {
393 if (prop_info->doc_comment) {
394 zend_string_release_ex(prop_info->doc_comment, 0);
395 }
396 if (prop_info->attributes) {
397 zend_hash_release(prop_info->attributes);
398 }
399 zend_type_release(prop_info->type, /* persistent */ 0);
400 if (prop_info->hooks) {
401 for (uint32_t i = 0; i < ZEND_PROPERTY_HOOK_COUNT; i++) {
402 if (prop_info->hooks[i]) {
403 destroy_op_array(&prop_info->hooks[i]->op_array);
404 }
405 }
406 }
407 }
411 if (zend_hash_num_elements(&ce->constants_table)) {
413
415 if (c->ce == ce || (Z_CONSTANT_FLAGS(c->value) & CONST_OWNED)) {
416 zval_ptr_dtor_nogc(&c->value);
417 if (c->doc_comment) {
419 }
420 if (c->attributes) {
421 zend_hash_release(c->attributes);
422 }
423 }
425 }
428 efree(ce->interfaces);
429 }
430 if (ce->backed_enum_table) {
431 zend_hash_release(ce->backed_enum_table);
432 }
433 break;
435 if (ce->doc_comment) {
437 }
438
439 if (ce->backed_enum_table) {
440 zend_hash_release(ce->backed_enum_table);
441 }
442 if (ce->default_properties_table) {
445
446 while (p != end) {
448 p++;
449 }
450 free(ce->default_properties_table);
451 }
455
456 while (p != end) {
458 p++;
459 }
461 }
462
464 if (prop_info->ce == ce) {
465 zend_string_release(prop_info->name);
466 zend_type_release(prop_info->type, /* persistent */ 1);
467 if (prop_info->attributes) {
468 zend_hash_release(prop_info->attributes);
469 }
470 free(prop_info);
471 }
475
476 /* TODO: eliminate this loop for classes without functions with arg_info / attributes */
478 if (fn->common.scope == ce) {
481 }
482
483 if (fn->common.attributes) {
484 zend_hash_release(fn->common.attributes);
485 fn->common.attributes = NULL;
486 }
487 }
489
491 if (zend_hash_num_elements(&ce->constants_table)) {
493
495 if (c->ce == ce) {
496 if (Z_TYPE(c->value) == IS_CONSTANT_AST) {
497 /* We marked this as IMMUTABLE, but do need to free it when the
498 * class is destroyed. */
500 free(Z_AST(c->value));
501 } else {
503 }
504 if (c->doc_comment) {
506 }
507 if (c->attributes) {
508 zend_hash_release(c->attributes);
509 }
510 }
511 free(c);
514 }
515 if (ce->iterator_funcs_ptr) {
516 free(ce->iterator_funcs_ptr);
517 }
518 if (ce->arrayaccess_funcs_ptr) {
519 free(ce->arrayaccess_funcs_ptr);
520 }
521 if (ce->num_interfaces > 0) {
522 free(ce->interfaces);
523 }
524 if (ce->properties_info_table) {
525 free(ce->properties_info_table);
526 }
527 if (ce->attributes) {
528 zend_hash_release(ce->attributes);
529 }
530 free(ce);
531 break;
532 }
533}
534
536{
538
539 if (Z_TYPE_P(zv) != IS_ALIAS_PTR && !(ce->ce_flags & ZEND_ACC_IMMUTABLE)) {
540 ce->refcount++;
541 }
542}
543
545{
546 if (ZEND_MAP_PTR(op_array->static_variables_ptr)) {
547 HashTable *ht = ZEND_MAP_PTR_GET(op_array->static_variables_ptr);
548 if (ht) {
550 ZEND_MAP_PTR_SET(op_array->static_variables_ptr, NULL);
551 }
552 }
553}
554
556{
557 uint32_t i;
558
559 if ((op_array->fn_flags & ZEND_ACC_HEAP_RT_CACHE)
560 && ZEND_MAP_PTR(op_array->run_time_cache)) {
561 efree(ZEND_MAP_PTR(op_array->run_time_cache));
562 }
563
564 if (op_array->function_name) {
566 }
567
568 if (!op_array->refcount || --(*op_array->refcount) > 0) {
569 return;
570 }
571
572 efree_size(op_array->refcount, sizeof(*(op_array->refcount)));
573
574 if (op_array->vars) {
575 i = op_array->last_var;
576 while (i > 0) {
577 i--;
578 zend_string_release_ex(op_array->vars[i], 0);
579 }
580 efree(op_array->vars);
581 }
582
583 if (op_array->literals) {
584 zval *literal = op_array->literals;
585 zval *end = literal + op_array->last_literal;
586 while (literal < end) {
587 zval_ptr_dtor_nogc(literal);
588 literal++;
589 }
591 || !(op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO)) {
592 efree(op_array->literals);
593 }
594 }
595 efree(op_array->opcodes);
596
597 zend_string_release_ex(op_array->filename, 0);
598 if (op_array->doc_comment) {
600 }
601 if (op_array->attributes) {
602 zend_hash_release(op_array->attributes);
603 }
604 if (op_array->live_range) {
605 efree(op_array->live_range);
606 }
607 if (op_array->try_catch_array) {
608 efree(op_array->try_catch_array);
609 }
611 if (op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) {
612 zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_dtor_handler, op_array);
613 }
614 }
615 if (op_array->arg_info) {
616 uint32_t num_args = op_array->num_args;
617 zend_arg_info *arg_info = op_array->arg_info;
618
619 if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
620 arg_info--;
621 num_args++;
622 }
623 if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
624 num_args++;
625 }
626 for (i = 0 ; i < num_args; i++) {
627 if (arg_info[i].name) {
628 zend_string_release_ex(arg_info[i].name, 0);
629 }
630 zend_type_release(arg_info[i].type, /* persistent */ 0);
631 }
632 efree(arg_info);
633 }
634 if (op_array->static_variables) {
636 }
637 if (op_array->num_dynamic_func_defs) {
638 for (i = 0; i < op_array->num_dynamic_func_defs; i++) {
639 /* Closures overwrite static_variables in their copy.
640 * Make sure to destroy them when the prototype function is destroyed. */
641 if (op_array->dynamic_func_defs[i]->static_variables
642 && (op_array->dynamic_func_defs[i]->fn_flags & ZEND_ACC_CLOSURE)) {
645 }
647 }
648 efree(op_array->dynamic_func_defs);
649 }
650}
651
652static void zend_update_extended_stmts(zend_op_array *op_array)
653{
654 zend_op *opline = op_array->opcodes, *end=opline+op_array->last;
655
656 while (opline<end) {
657 if (opline->opcode == ZEND_EXT_STMT) {
658 if (opline+1<end) {
659 if ((opline+1)->opcode == ZEND_EXT_STMT) {
660 opline->opcode = ZEND_NOP;
661 opline++;
662 continue;
663 }
664 if (opline+1<end) {
665 opline->lineno = (opline+1)->lineno;
666 }
667 } else {
668 opline->opcode = ZEND_NOP;
669 }
670 }
671 opline++;
672 }
673}
674
675static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array)
676{
677 if (extension->op_array_handler) {
678 extension->op_array_handler(op_array);
679 }
680}
681
682static void zend_check_finally_breakout(zend_op_array *op_array, uint32_t op_num, uint32_t dst_num)
683{
684 int i;
685
686 for (i = 0; i < op_array->last_try_catch; i++) {
687 if ((op_num < op_array->try_catch_array[i].finally_op ||
688 op_num >= op_array->try_catch_array[i].finally_end)
689 && (dst_num >= op_array->try_catch_array[i].finally_op &&
690 dst_num <= op_array->try_catch_array[i].finally_end)) {
691 CG(in_compilation) = 1;
692 CG(active_op_array) = op_array;
693 CG(zend_lineno) = op_array->opcodes[op_num].lineno;
694 zend_error_noreturn(E_COMPILE_ERROR, "jump into a finally block is disallowed");
695 } else if ((op_num >= op_array->try_catch_array[i].finally_op
696 && op_num <= op_array->try_catch_array[i].finally_end)
697 && (dst_num > op_array->try_catch_array[i].finally_end
698 || dst_num < op_array->try_catch_array[i].finally_op)) {
699 CG(in_compilation) = 1;
700 CG(active_op_array) = op_array;
701 CG(zend_lineno) = op_array->opcodes[op_num].lineno;
702 zend_error_noreturn(E_COMPILE_ERROR, "jump out of a finally block is disallowed");
703 }
704 }
705}
706
707static uint32_t zend_get_brk_cont_target(const zend_op_array *op_array, const zend_op *opline) {
708 int nest_levels = opline->op2.num;
709 int array_offset = opline->op1.num;
710 zend_brk_cont_element *jmp_to;
711 do {
712 jmp_to = &CG(context).brk_cont_array[array_offset];
713 if (nest_levels > 1) {
714 array_offset = jmp_to->parent;
715 }
716 } while (--nest_levels > 0);
717
718 return opline->opcode == ZEND_BRK ? jmp_to->brk : jmp_to->cont;
719}
720
721static void emit_live_range_raw(
722 zend_op_array *op_array, uint32_t var_num, uint32_t kind, uint32_t start, uint32_t end) {
723 zend_live_range *range;
724
725 op_array->last_live_range++;
726 op_array->live_range = erealloc(op_array->live_range,
727 sizeof(zend_live_range) * op_array->last_live_range);
728
730 range = &op_array->live_range[op_array->last_live_range - 1];
731 range->var = EX_NUM_TO_VAR(op_array->last_var + var_num);
732 range->var |= kind;
733 range->start = start;
734 range->end = end;
735}
736
737static void emit_live_range(
738 zend_op_array *op_array, uint32_t var_num, uint32_t start, uint32_t end,
739 zend_needs_live_range_cb needs_live_range) {
740 zend_op *def_opline = &op_array->opcodes[start], *orig_def_opline = def_opline;
741 zend_op *use_opline = &op_array->opcodes[end];
742 uint32_t kind;
743
744 switch (def_opline->opcode) {
745 /* These should never be the first def. */
748 case ZEND_ROPE_ADD:
750 return;
751 /* Result is boolean, it doesn't have to be destroyed. */
752 case ZEND_JMPZ_EX:
753 case ZEND_JMPNZ_EX:
754 case ZEND_BOOL:
755 case ZEND_BOOL_NOT:
756 /* Classes don't have to be destroyed. */
757 case ZEND_FETCH_CLASS:
759 /* FAST_CALLs don't have to be destroyed. */
760 case ZEND_FAST_CALL:
761 return;
764 start++;
765 break;
766 case ZEND_ROPE_INIT:
768 /* ROPE live ranges include the generating opcode. */
769 def_opline--;
770 break;
771 case ZEND_FE_RESET_R:
772 case ZEND_FE_RESET_RW:
774 start++;
775 break;
776 /* Objects created via ZEND_NEW are only fully initialized
777 * after the DO_FCALL (constructor call).
778 * We are creating two live-ranges: ZEND_LINE_NEW for uninitialized
779 * part, and ZEND_LIVE_TMPVAR for initialized.
780 */
781 case ZEND_NEW:
782 {
783 int level = 0;
784 uint32_t orig_start = start;
785
786 while (def_opline + 1 < use_opline) {
787 def_opline++;
788 start++;
789 switch (def_opline->opcode) {
790 case ZEND_INIT_FCALL:
798 case ZEND_NEW:
799 level++;
800 break;
801 case ZEND_DO_FCALL:
803 case ZEND_DO_ICALL:
804 case ZEND_DO_UCALL:
805 if (level == 0) {
806 goto done;
807 }
808 level--;
809 break;
810 }
811 }
812done:
813 emit_live_range_raw(op_array, var_num, ZEND_LIVE_NEW, orig_start + 1, start + 1);
814 if (start + 1 == end) {
815 /* Trivial live-range, no need to store it. */
816 return;
817 }
818 }
820 default:
821 start++;
823
824 /* Check hook to determine whether a live range is necessary,
825 * e.g. based on type info. */
826 if (needs_live_range && !needs_live_range(op_array, orig_def_opline)) {
827 return;
828 }
829 break;
830 case ZEND_COPY_TMP:
831 {
832 /* COPY_TMP has a split live-range: One from the definition until the use in
833 * "null" branch, and another from the start of the "non-null" branch to the
834 * FREE opcode. */
835 uint32_t rt_var_num = EX_NUM_TO_VAR(op_array->last_var + var_num);
836 if (needs_live_range && !needs_live_range(op_array, orig_def_opline)) {
837 return;
838 }
839
841 if (use_opline->opcode != ZEND_FREE) {
842 /* This can happen if one branch of the coalesce has been optimized away.
843 * In this case we should emit a normal live-range instead. */
844 start++;
845 break;
846 }
847
848 zend_op *block_start_op = use_opline;
849 while ((block_start_op-1)->opcode == ZEND_FREE) {
850 block_start_op--;
851 }
852
853 start = block_start_op - op_array->opcodes;
854 if (start != end) {
855 emit_live_range_raw(op_array, var_num, kind, start, end);
856 }
857
858 do {
859 use_opline--;
860
861 /* The use might have been optimized away, in which case we will hit the def
862 * instead. */
863 if (use_opline->opcode == ZEND_COPY_TMP && use_opline->result.var == rt_var_num) {
864 start = def_opline + 1 - op_array->opcodes;
865 emit_live_range_raw(op_array, var_num, kind, start, end);
866 return;
867 }
868 } while (!(
869 ((use_opline->op1_type & (IS_TMP_VAR|IS_VAR)) && use_opline->op1.var == rt_var_num) ||
870 ((use_opline->op2_type & (IS_TMP_VAR|IS_VAR)) && use_opline->op2.var == rt_var_num)
871 ));
872
873 start = def_opline + 1 - op_array->opcodes;
874 end = use_opline - op_array->opcodes;
875 emit_live_range_raw(op_array, var_num, kind, start, end);
876 return;
877 }
878 }
879
880 emit_live_range_raw(op_array, var_num, kind, start, end);
881}
882
883static bool is_fake_def(zend_op *opline) {
884 /* These opcodes only modify the result, not create it. */
885 return opline->opcode == ZEND_ROPE_ADD
886 || opline->opcode == ZEND_ADD_ARRAY_ELEMENT
887 || opline->opcode == ZEND_ADD_ARRAY_UNPACK;
888}
889
890static bool keeps_op1_alive(zend_op *opline) {
891 /* These opcodes don't consume their OP1 operand,
892 * it is later freed by something else. */
893 if (opline->opcode == ZEND_CASE
894 || opline->opcode == ZEND_CASE_STRICT
895 || opline->opcode == ZEND_SWITCH_LONG
896 || opline->opcode == ZEND_SWITCH_STRING
897 || opline->opcode == ZEND_MATCH
898 || opline->opcode == ZEND_MATCH_ERROR
899 || opline->opcode == ZEND_FETCH_LIST_R
900 || opline->opcode == ZEND_FETCH_LIST_W
901 || opline->opcode == ZEND_COPY_TMP) {
902 return 1;
903 }
905 && opline->opcode != ZEND_FE_FETCH_RW
906 && opline->opcode != ZEND_VERIFY_RETURN_TYPE
907 && opline->opcode != ZEND_BIND_LEXICAL
908 && opline->opcode != ZEND_ROPE_ADD);
909 return 0;
910}
911
912/* Live ranges must be sorted by increasing start opline */
913static int cmp_live_range(const zend_live_range *a, const zend_live_range *b) {
914 return a->start - b->start;
915}
916static void swap_live_range(zend_live_range *a, zend_live_range *b) {
917 uint32_t tmp;
918 tmp = a->var;
919 a->var = b->var;
920 b->var = tmp;
921 tmp = a->start;
922 a->start = b->start;
923 b->start = tmp;
924 tmp = a->end;
925 a->end = b->end;
926 b->end = tmp;
927}
928
929static void zend_calc_live_ranges(
930 zend_op_array *op_array, zend_needs_live_range_cb needs_live_range) {
931 uint32_t opnum = op_array->last;
932 zend_op *opline = &op_array->opcodes[opnum];
933 ALLOCA_FLAG(use_heap)
934 uint32_t var_offset = op_array->last_var;
935 uint32_t *last_use = do_alloca(sizeof(uint32_t) * op_array->T, use_heap);
936 memset(last_use, -1, sizeof(uint32_t) * op_array->T);
937
938 ZEND_ASSERT(!op_array->live_range);
939 while (opnum > 0) {
940 opnum--;
941 opline--;
942
943 /* SEPARATE always redeclares its op1. For the purposes of live-ranges,
944 * its declaration is irrelevant. Don't terminate the current live-range
945 * to avoid breaking special handling of COPY_TMP. */
946 if (opline->opcode == ZEND_SEPARATE) {
947 ZEND_ASSERT(opline->op1.var == opline->result.var);
948 continue;
949 }
950
951 if ((opline->result_type & (IS_TMP_VAR|IS_VAR)) && !is_fake_def(opline)) {
952 uint32_t var_num = EX_VAR_TO_NUM(opline->result.var) - var_offset;
953 /* Defs without uses can occur for two reasons: Either because the result is
954 * genuinely unused (e.g. omitted FREE opcode for an unused boolean result), or
955 * because there are multiple defining opcodes (e.g. JMPZ_EX and QM_ASSIGN), in
956 * which case the last one starts the live range. As such, we can simply ignore
957 * missing uses here. */
958 if (EXPECTED(last_use[var_num] != (uint32_t) -1)) {
959 /* Skip trivial live-range */
960 if (opnum + 1 != last_use[var_num]) {
961 uint32_t num;
962
963#if 1
964 /* OP_DATA uses only op1 operand */
965 ZEND_ASSERT(opline->opcode != ZEND_OP_DATA);
966 num = opnum;
967#else
968 /* OP_DATA is really part of the previous opcode. */
969 num = opnum - (opline->opcode == ZEND_OP_DATA);
970#endif
971 emit_live_range(op_array, var_num, num, last_use[var_num], needs_live_range);
972 }
973 last_use[var_num] = (uint32_t) -1;
974 }
975 }
976
977 if ((opline->op1_type & (IS_TMP_VAR|IS_VAR))) {
978 uint32_t var_num = EX_VAR_TO_NUM(opline->op1.var) - var_offset;
979 if (EXPECTED(last_use[var_num] == (uint32_t) -1)) {
980 if (EXPECTED(!keeps_op1_alive(opline))) {
981 /* OP_DATA is really part of the previous opcode. */
982 last_use[var_num] = opnum - (opline->opcode == ZEND_OP_DATA);
983 }
984 }
985 }
986 if (opline->op2_type & (IS_TMP_VAR|IS_VAR)) {
987 uint32_t var_num = EX_VAR_TO_NUM(opline->op2.var) - var_offset;
988 if (UNEXPECTED(opline->opcode == ZEND_FE_FETCH_R
989 || opline->opcode == ZEND_FE_FETCH_RW)) {
990 /* OP2 of FE_FETCH is actually a def, not a use. */
991 if (last_use[var_num] != (uint32_t) -1) {
992 if (opnum + 1 != last_use[var_num]) {
993 emit_live_range(
994 op_array, var_num, opnum, last_use[var_num], needs_live_range);
995 }
996 last_use[var_num] = (uint32_t) -1;
997 }
998 } else if (EXPECTED(last_use[var_num] == (uint32_t) -1)) {
999#if 1
1000 /* OP_DATA uses only op1 operand */
1001 ZEND_ASSERT(opline->opcode != ZEND_OP_DATA);
1002 last_use[var_num] = opnum;
1003#else
1004 /* OP_DATA is really part of the previous opcode. */
1005 last_use[var_num] = opnum - (opline->opcode == ZEND_OP_DATA);
1006#endif
1007 }
1008 }
1009 }
1010
1011 if (op_array->last_live_range > 1) {
1012 zend_live_range *r1 = op_array->live_range;
1013 zend_live_range *r2 = r1 + op_array->last_live_range - 1;
1014
1015 /* In most cases we need just revert the array */
1016 while (r1 < r2) {
1017 swap_live_range(r1, r2);
1018 r1++;
1019 r2--;
1020 }
1021
1022 r1 = op_array->live_range;
1023 r2 = r1 + op_array->last_live_range - 1;
1024 while (r1 < r2) {
1025 if (r1->start > (r1+1)->start) {
1026 zend_sort(r1, r2 - r1 + 1, sizeof(zend_live_range),
1027 (compare_func_t) cmp_live_range, (swap_func_t) swap_live_range);
1028 break;
1029 }
1030 r1++;
1031 }
1032 }
1033
1034 free_alloca(last_use, use_heap);
1035}
1036
1038 zend_op_array *op_array, zend_needs_live_range_cb needs_live_range) {
1039 /* We assume that we never create live-ranges where there were none before. */
1040 ZEND_ASSERT(op_array->live_range);
1041 efree(op_array->live_range);
1042 op_array->live_range = NULL;
1043 op_array->last_live_range = 0;
1044 zend_calc_live_ranges(op_array, needs_live_range);
1045}
1046
1048{
1049 zend_op *opline, *end;
1050
1051 if (!ZEND_USER_CODE(op_array->type)) {
1052 return;
1053 }
1054 if (CG(compiler_options) & ZEND_COMPILE_EXTENDED_STMT) {
1055 zend_update_extended_stmts(op_array);
1056 }
1057 if (CG(compiler_options) & ZEND_COMPILE_HANDLE_OP_ARRAY) {
1059 zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array);
1060 }
1061 }
1062
1063 if (CG(context).vars_size != op_array->last_var) {
1064 op_array->vars = (zend_string**) erealloc(op_array->vars, sizeof(zend_string*)*op_array->last_var);
1065 CG(context).vars_size = op_array->last_var;
1066 }
1067
1068#if ZEND_USE_ABS_CONST_ADDR
1069 if (CG(context).opcodes_size != op_array->last) {
1070 op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
1071 CG(context).opcodes_size = op_array->last;
1072 }
1073 if (CG(context).literals_size != op_array->last_literal) {
1074 op_array->literals = (zval*)erealloc(op_array->literals, sizeof(zval) * op_array->last_literal);
1075 CG(context).literals_size = op_array->last_literal;
1076 }
1077#else
1078 op_array->opcodes = (zend_op *) erealloc(op_array->opcodes,
1079 ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) * op_array->last, 16) +
1080 sizeof(zval) * op_array->last_literal);
1081 if (op_array->literals) {
1082 memcpy(((char*)op_array->opcodes) + ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) * op_array->last, 16),
1083 op_array->literals, sizeof(zval) * op_array->last_literal);
1084 efree(op_array->literals);
1085 op_array->literals = (zval*)(((char*)op_array->opcodes) + ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) * op_array->last, 16));
1086 }
1087 CG(context).opcodes_size = op_array->last;
1088 CG(context).literals_size = op_array->last_literal;
1089#endif
1090
1091 op_array->T += ZEND_OBSERVER_ENABLED; // reserve last temporary for observers if enabled
1092
1093 /* Needs to be set directly after the opcode/literal reallocation, to ensure destruction
1094 * happens correctly if any of the following fixups generate a fatal error. */
1095 op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO;
1096
1097 opline = op_array->opcodes;
1098 end = opline + op_array->last;
1099 while (opline < end) {
1100 switch (opline->opcode) {
1101 case ZEND_RECV_INIT:
1102 {
1103 zval *val = CT_CONSTANT(opline->op2);
1104 if (Z_TYPE_P(val) == IS_CONSTANT_AST) {
1105 uint32_t slot = ZEND_MM_ALIGNED_SIZE_EX(op_array->cache_size, 8);
1106 Z_CACHE_SLOT_P(val) = slot;
1107 op_array->cache_size += sizeof(zval);
1108 }
1109 }
1110 break;
1111 case ZEND_FAST_CALL:
1112 opline->op1.opline_num = op_array->try_catch_array[opline->op1.num].finally_op;
1113 ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
1114 break;
1115 case ZEND_BRK:
1116 case ZEND_CONT:
1117 {
1118 uint32_t jmp_target = zend_get_brk_cont_target(op_array, opline);
1119
1120 if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
1121 zend_check_finally_breakout(op_array, opline - op_array->opcodes, jmp_target);
1122 }
1123 opline->opcode = ZEND_JMP;
1124 opline->op1.opline_num = jmp_target;
1125 opline->op2.num = 0;
1126 ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
1127 }
1128 break;
1129 case ZEND_GOTO:
1130 zend_resolve_goto_label(op_array, opline);
1131 if (op_array->fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK) {
1132 zend_check_finally_breakout(op_array, opline - op_array->opcodes, opline->op1.opline_num);
1133 }
1135 case ZEND_JMP:
1136 ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op1);
1137 break;
1138 case ZEND_JMPZ:
1139 case ZEND_JMPNZ:
1140 case ZEND_JMPZ_EX:
1141 case ZEND_JMPNZ_EX:
1142 case ZEND_JMP_SET:
1143 case ZEND_COALESCE:
1144 case ZEND_FE_RESET_R:
1145 case ZEND_FE_RESET_RW:
1146 case ZEND_JMP_NULL:
1148 case ZEND_JMP_FRAMELESS:
1149 ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
1150 break;
1151 case ZEND_ASSERT_CHECK:
1152 {
1153 /* If result of assert is unused, result of check is unused as well */
1154 zend_op *call = &op_array->opcodes[opline->op2.opline_num - 1];
1155 if (call->opcode == ZEND_EXT_FCALL_END) {
1156 call--;
1157 }
1158 if (call->result_type == IS_UNUSED) {
1159 opline->result_type = IS_UNUSED;
1160 }
1161 ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
1162 break;
1163 }
1164 case ZEND_FE_FETCH_R:
1165 case ZEND_FE_FETCH_RW:
1166 /* absolute index to relative offset */
1167 opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value);
1168 break;
1169 case ZEND_CATCH:
1170 if (!(opline->extended_value & ZEND_LAST_CATCH)) {
1171 ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, opline->op2);
1172 }
1173 break;
1174 case ZEND_RETURN:
1175 case ZEND_RETURN_BY_REF:
1176 if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
1177 opline->opcode = ZEND_GENERATOR_RETURN;
1178 }
1179 break;
1180 case ZEND_SWITCH_LONG:
1181 case ZEND_SWITCH_STRING:
1182 case ZEND_MATCH:
1183 {
1184 /* absolute indexes to relative offsets */
1185 HashTable *jumptable = Z_ARRVAL_P(CT_CONSTANT(opline->op2));
1186 zval *zv;
1187 ZEND_HASH_FOREACH_VAL(jumptable, zv) {
1188 Z_LVAL_P(zv) = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, Z_LVAL_P(zv));
1190
1191 opline->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline->extended_value);
1192 break;
1193 }
1194 }
1195 if (opline->op1_type == IS_CONST) {
1196 ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op1);
1197 } else if (opline->op1_type & (IS_VAR|IS_TMP_VAR)) {
1198 opline->op1.var = EX_NUM_TO_VAR(op_array->last_var + opline->op1.var);
1199 }
1200 if (opline->op2_type == IS_CONST) {
1201 ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op2);
1202 } else if (opline->op2_type & (IS_VAR|IS_TMP_VAR)) {
1203 opline->op2.var = EX_NUM_TO_VAR(op_array->last_var + opline->op2.var);
1204 }
1205 if (opline->result_type & (IS_VAR|IS_TMP_VAR)) {
1206 opline->result.var = EX_NUM_TO_VAR(op_array->last_var + opline->result.var);
1207 }
1209 opline++;
1210 }
1211
1212 zend_calc_live_ranges(op_array, NULL);
1213
1214 return;
1215}
1216
1218{
1219 switch (opcode) {
1220 case ZEND_BW_NOT:
1222 case ZEND_BOOL_NOT:
1224 default:
1225 return (unary_op_type) NULL;
1226 }
1227}
1228
1230{
1231 switch (opcode) {
1232 case ZEND_ADD:
1234 case ZEND_SUB:
1236 case ZEND_MUL:
1238 case ZEND_POW:
1240 case ZEND_DIV:
1242 case ZEND_MOD:
1244 case ZEND_SL:
1246 case ZEND_SR:
1248 case ZEND_FAST_CONCAT:
1249 case ZEND_CONCAT:
1251 case ZEND_IS_IDENTICAL:
1252 case ZEND_CASE_STRICT:
1256 case ZEND_IS_EQUAL:
1257 case ZEND_CASE:
1259 case ZEND_IS_NOT_EQUAL:
1261 case ZEND_IS_SMALLER:
1265 case ZEND_SPACESHIP:
1267 case ZEND_BW_OR:
1269 case ZEND_BW_AND:
1271 case ZEND_BW_XOR:
1273 case ZEND_BOOL_XOR:
1275 default:
1277 return (binary_op_type) NULL;
1278 }
1279}
zend_ffi_type * type
Definition ffi.c:3812
zval * zv
Definition ffi.c:3975
new_type kind
Definition ffi.c:4363
memcpy(ptr1, ptr2, size)
memset(ptr, 0, type->size)
zval * val
Definition ffi.c:4262
HashTable * ht
Definition ffi.c:4838
buf start
Definition ffi.c:4687
ffi persistent
Definition ffi.c:3633
#define NULL
Definition gdcache.h:45
again j
unsigned const char * end
Definition php_ffi.h:51
p
Definition session.c:1105
zend_class_entry * ce
zend_string * doc_comment
HashTable constants_table
Definition zend.h:165
zend_class_iterator_funcs * iterator_funcs_ptr
Definition zend.h:189
zval * default_static_members_table
Definition zend.h:161
HashTable * backed_enum_table
Definition zend.h:222
struct _zend_class_entry::@126215362204241324314155352336150042254204116267::@166057154351252324007362117353350250255142166322 user
HashTable properties_info
Definition zend.h:164
zend_trait_precedence ** trait_precedences
Definition zend.h:218
zend_string * filename
Definition zend.h:228
zend_class_name * trait_names
Definition zend.h:216
zend_class_name * interface_names
Definition zend.h:213
zend_string * name
Definition zend.h:149
union _zend_class_entry::@126215362204241324314155352336150042254204116267 info
uint32_t num_traits
Definition zend.h:206
uint32_t num_interfaces
Definition zend.h:205
zend_class_arrayaccess_funcs * arrayaccess_funcs_ptr
Definition zend.h:191
zend_string * parent_name
Definition zend.h:153
uint32_t ce_flags
Definition zend.h:156
int default_properties_count
Definition zend.h:158
char type
Definition zend.h:148
zend_trait_alias ** trait_aliases
Definition zend.h:217
zend_class_entry ** interfaces
Definition zend.h:212
int default_static_members_count
Definition zend.h:159
HashTable * attributes
Definition zend.h:219
int refcount
Definition zend.h:155
struct _zend_property_info ** properties_info_table
Definition zend.h:170
zend_string * doc_comment
Definition zend.h:224
zval * default_properties_table
Definition zend.h:160
HashTable function_table
Definition zend.h:163
zval * default_properties_table
Definition zend.h:116
HashTable * backed_enum_table
Definition zend.h:119
HashTable * constants_table
Definition zend.h:117
zend_string * lc_name
Definition zend.h:87
zend_string * name
Definition zend.h:86
op_array_dtor_func_t op_array_dtor
op_array_ctor_func_t op_array_ctor
op_array_handler_func_t op_array_handler
uint32_t * refcount
zend_function * prototype
HashTable * attributes
HashTable * static_variables
zend_op_array ** dynamic_func_defs
const zend_property_info * prop_info
zend_string * filename
zend_string * doc_comment
uint32_t required_num_args
zend_class_entry * scope
uint8_t arg_flags[3]
zend_arg_info * arg_info
uint32_t num_args
zend_try_catch_element * try_catch_array
zend_string ** vars
zend_op * opcodes
zend_live_range * live_range
void * reserved[ZEND_MAX_RESERVED_RESOURCES]
zend_string * function_name
uint32_t fn_flags
uint32_t num_dynamic_func_defs
znode_op op1
uint8_t result_type
znode_op op2
znode_op result
uint8_t opcode
uint8_t op1_type
uint32_t extended_value
uint32_t lineno
uint8_t op2_type
zend_trait_method_reference trait_method
Definition zend.h:102
zend_string * alias
Definition zend.h:107
zend_string * method_name
Definition zend.h:91
zend_string * class_name
Definition zend.h:92
zend_trait_method_reference trait_method
Definition zend.h:96
zend_string * exclude_class_names[1]
Definition zend.h:98
uint32_t num_excludes
Definition zend.h:97
Definition dce.c:49
$obj a
Definition test.php:84
zend_class_entry * scope
struct _zend_function::@236135173067030250234125302313220025134003177336 common
HashTable * attributes
uint32_t fn_flags
zend_internal_function internal_function
uint32_t opline_num
uint32_t var
uint32_t num
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format,...)
Definition zend.c:1703
struct _zend_class_mutable_data zend_class_mutable_data
#define CE_STATIC_MEMBERS(ce)
Definition zend_API.h:328
#define efree_size(ptr, size)
Definition zend_alloc.h:138
#define ZEND_MM_ALIGNED_SIZE_EX(size, alignment)
Definition zend_alloc.h:37
#define efree(ptr)
Definition zend_alloc.h:155
#define pefree(ptr, persistent)
Definition zend_alloc.h:191
#define erealloc(ptr, size)
Definition zend_alloc.h:159
#define emalloc(size)
Definition zend_alloc.h:151
@ ZEND_AST_CONST_ENUM_INIT
Definition zend_ast.h:169
struct _zval_struct zval
uint32_t num_args
zend_string_release_ex(func->internal_function.function_name, 0)
void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline)
ZEND_API zend_string * zend_get_compiled_filename(void)
#define ZEND_PROPERTY_HOOK_COUNT
zend_result(ZEND_FASTCALL * binary_op_type)(zval *, zval *, zval *)
struct _zend_brk_cont_element zend_brk_cont_element
#define ZEND_LIVE_TMPVAR
struct _zend_op zend_op
#define ZEND_LIVE_LOOP
#define ZEND_USER_CODE(type)
#define ZEND_LIVE_NEW
#define IS_UNUSED
#define CT_CONSTANT(node)
#define ZEND_ACC_IMMUTABLE
#define ZEND_ACC_CACHED
#define IS_CONST
#define ZEND_ACC_HAS_TYPE_HINTS
#define ZEND_COMPILE_EXTENDED_STMT
#define ZEND_BRK
#define ZEND_INTERNAL_FUNCTION
#define ZEND_ACC_DONE_PASS_TWO
#define EX_VAR_TO_NUM(n)
#define IS_VAR
bool(* zend_needs_live_range_cb)(zend_op_array *op_array, zend_op *opline)
#define EX_NUM_TO_VAR(n)
#define ZEND_CONT
#define ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, node)
#define ZEND_USER_FUNCTION
#define ZEND_ACC_GENERATOR
struct _zend_op_array zend_op_array
struct _zend_class_constant zend_class_constant
#define ZEND_GOTO
struct _zend_property_info zend_property_info
#define ZEND_ACC_RESOLVED_PARENT
struct _zend_internal_arg_info zend_internal_arg_info
#define ZEND_ACC_HAS_RETURN_TYPE
struct _zend_arg_info zend_arg_info
#define ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, node)
#define ZEND_ACC_HEAP_RT_CACHE
#define ZEND_LIVE_ROPE
#define ZEND_ACC_FILE_CACHED
#define ZEND_ACC_RESOLVED_INTERFACES
#define ZEND_ACC_ARENA_ALLOCATED
#define ZEND_USE_ABS_CONST_ADDR
#define ZEND_ACC_VARIADIC
#define ZEND_USER_CLASS
#define ZEND_LIVE_SILENCE
#define IS_TMP_VAR
#define ZEND_ACC_HAS_FINALLY_BLOCK
struct _zend_live_range zend_live_range
#define ZEND_INTERNAL_CLASS
struct _zend_internal_function zend_internal_function
zend_result(ZEND_FASTCALL * unary_op_type)(zval *, zval *)
#define ZEND_COMPILE_HANDLE_OP_ARRAY
#define ZEND_LAST_CATCH
#define ZEND_ACC_CLOSURE
#define ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline_num)
#define ZEND_API
#define CONST_OWNED
#define E_COMPILE_ERROR
Definition zend_errors.h:29
#define ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop)
#define ZEND_REF_DEL_TYPE_SOURCE(ref, source)
#define ZEND_REF_FOREACH_TYPE_SOURCES_END()
ZEND_API uint32_t zend_extension_flags
ZEND_API zend_llist zend_extensions
ZEND_API int zend_op_array_extension_handles
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_CTOR
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_HANDLER
#define ZEND_EXTENSIONS_HAVE_OP_ARRAY_DTOR
struct _zend_extension zend_extension
union _zend_function zend_function
#define CG(v)
ZEND_API void ZEND_FASTCALL zend_hash_destroy(HashTable *ht)
Definition zend_hash.c:1727
ZEND_API void ZEND_FASTCALL zend_array_destroy(HashTable *ht)
Definition zend_hash.c:1808
#define ZEND_HASH_MAP_FOREACH_PTR(ht, _ptr)
Definition zend_hash.h:1326
#define ZEND_HASH_FOREACH_END()
Definition zend_hash.h:1086
#define ZEND_HASH_FOREACH_VAL(ht, _val)
Definition zend_hash.h:1102
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg)
Definition zend_llist.c:231
void(* llist_apply_with_arg_func_t)(void *data, void *arg)
Definition zend_llist.h:34
struct _zend_string zend_string
#define ZEND_MAP_PTR_INIT(ptr, val)
#define ZEND_MAP_PTR_GET(ptr)
#define ZEND_MAP_PTR_GET_IMM(ptr)
#define ZEND_MAP_PTR_SET_IMM(ptr, val)
#define ZEND_MAP_PTR(ptr)
#define ZEND_MAP_PTR_SET(ptr, val)
#define ZEND_OBSERVER_ENABLED
ZEND_API void destroy_op_array(zend_op_array *op_array)
ZEND_API void zend_function_dtor(zval *zv)
ZEND_API void pass_two(zend_op_array *op_array)
ZEND_API void destroy_zend_function(zend_function *function)
void init_op_array(zend_op_array *op_array, uint8_t type, int initial_ops_size)
Definition zend_opcode.c:48
ZEND_API binary_op_type get_binary_op(int opcode)
ZEND_API void destroy_zend_class(zval *zv)
ZEND_API unary_op_type get_unary_op(int opcode)
ZEND_API void zend_destroy_static_vars(zend_op_array *op_array)
ZEND_API void zend_type_release(zend_type type, bool persistent)
void zend_class_add_ref(zval *zv)
void zend_free_internal_arg_info(zend_internal_function *function)
ZEND_API void zend_cleanup_mutable_class_data(zend_class_entry *ce)
ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce)
ZEND_API void zend_recalc_live_ranges(zend_op_array *op_array, zend_needs_live_range_cb needs_live_range)
ZEND_API zend_result ZEND_FASTCALL compare_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL boolean_not_function(zval *result, zval *op1)
ZEND_API zend_result ZEND_FASTCALL is_not_identical_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL shift_right_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL boolean_xor_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL bitwise_not_function(zval *result, zval *op1)
ZEND_API zend_result ZEND_FASTCALL mod_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL mul_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL div_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL shift_left_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL is_equal_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL pow_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL add_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL sub_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL is_identical_function(zval *result, zval *op1, zval *op2)
ZEND_API zend_result ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2)
#define ALLOCA_FLAG(name)
#define ZEND_FALLTHROUGH
#define EXPECTED(condition)
#define do_alloca(p, use_heap)
#define ZEND_ASSERT(c)
#define ZEND_MAX_RESERVED_RESOURCES
#define ZEND_UNREACHABLE()
#define free_alloca(p, use_heap)
#define UNEXPECTED(condition)
struct _zend_class_entry zend_class_entry
ZEND_API void zend_sort(void *base, size_t nmemb, size_t siz, compare_func_t cmp, swap_func_t swp)
Definition zend_sort.c:248
int(* compare_func_t)(const void *, const void *)
Definition zend_types.h:104
#define Z_TYPE_P(zval_p)
Definition zend_types.h:660
#define Z_ISREF_P(zval_p)
Definition zend_types.h:954
#define ZEND_TYPE_NAME(t)
Definition zend_types.h:198
#define Z_CONSTANT_FLAGS(zval)
Definition zend_types.h:692
#define Z_ARRVAL_P(zval_p)
Definition zend_types.h:987
struct _zend_array HashTable
Definition zend_types.h:386
#define ZEND_TYPE_HAS_NAME(t)
Definition zend_types.h:174
#define Z_TYPE_INFO_P(zval_p)
Definition zend_types.h:669
#define Z_PTR_P(zval_p)
#define ZEND_TYPE_HAS_LIST(t)
Definition zend_types.h:180
#define ZEND_TYPE_LIST_FOREACH_END()
Definition zend_types.h:217
#define Z_AST(zval)
#define ZEND_TYPE_USES_ARENA(t)
Definition zend_types.h:192
void(* swap_func_t)(void *, void *)
Definition zend_types.h:105
#define IS_ALIAS_PTR
Definition zend_types.h:625
#define ZVAL_PTR(z, p)
#define Z_REF_P(zval_p)
#define Z_ASTVAL(zval)
#define IS_CONSTANT_AST
Definition zend_types.h:611
#define Z_CACHE_SLOT_P(zval_p)
Definition zend_types.h:675
#define ZEND_TYPE_LIST_FOREACH(list, type_ptr)
Definition zend_types.h:211
#define Z_TYPE(zval)
Definition zend_types.h:659
#define ZEND_TYPE_LIST(t)
Definition zend_types.h:204
#define Z_LVAL_P(zval_p)
Definition zend_types.h:966
ZEND_API void zval_internal_ptr_dtor(zval *zval_ptr)
#define ZEND_VM_SET_OPCODE_HANDLER(opline)
Definition zend_vm.h:44
zend_property_info * prop_info
zend_string * name
function(EX_VAR(opline->result.var))
zend_execute_data * call
#define ZEND_SL
#define ZEND_IS_IDENTICAL
#define ZEND_DECLARE_ANON_CLASS
#define ZEND_SWITCH_LONG
#define ZEND_EXT_FCALL_END
#define ZEND_BOOL_NOT
#define ZEND_RECV_INIT
#define ZEND_NEW
#define ZEND_FE_FETCH_RW
#define ZEND_VERIFY_RETURN_TYPE
#define ZEND_FETCH_LIST_R
#define ZEND_RETURN
#define ZEND_FE_RESET_RW
#define ZEND_FE_FETCH_R
#define ZEND_INIT_USER_CALL
#define ZEND_ROPE_INIT
#define ZEND_FETCH_LIST_W
#define ZEND_INIT_FCALL
#define ZEND_ASSERT_CHECK
#define ZEND_EXT_STMT
#define ZEND_OP_DATA
#define ZEND_RETURN_BY_REF
#define ZEND_SWITCH_STRING
#define ZEND_BOOL_XOR
#define ZEND_NOP
#define ZEND_JMPZ
#define ZEND_JMP_SET
#define ZEND_POW
#define ZEND_SUB
#define ZEND_JMPZ_EX
#define ZEND_IS_SMALLER
#define ZEND_BW_XOR
#define ZEND_IS_NOT_EQUAL
#define ZEND_IS_NOT_IDENTICAL
#define ZEND_DO_UCALL
#define ZEND_ROPE_ADD
#define ZEND_DIV
#define ZEND_CONCAT
#define ZEND_FAST_CONCAT
#define ZEND_MATCH
#define ZEND_BW_OR
#define ZEND_INIT_NS_FCALL_BY_NAME
#define ZEND_JMPNZ_EX
#define ZEND_DO_FCALL
#define ZEND_ADD_ARRAY_ELEMENT
#define ZEND_IS_EQUAL
#define ZEND_IS_SMALLER_OR_EQUAL
#define ZEND_BOOL
#define ZEND_INIT_FCALL_BY_NAME
#define ZEND_MUL
#define ZEND_CASE_STRICT
#define ZEND_FAST_CALL
#define ZEND_COPY_TMP
#define ZEND_BIND_LEXICAL
#define ZEND_FETCH_CLASS
#define ZEND_DO_ICALL
#define ZEND_JMP_NULL
#define ZEND_BW_NOT
#define ZEND_BIND_INIT_STATIC_OR_JMP
#define ZEND_BW_AND
#define ZEND_GENERATOR_RETURN
#define ZEND_ADD_ARRAY_UNPACK
#define ZEND_BEGIN_SILENCE
#define ZEND_JMP
#define ZEND_FREE
#define ZEND_FE_RESET_R
#define ZEND_JMP_FRAMELESS
#define ZEND_INIT_DYNAMIC_CALL
#define ZEND_SPACESHIP
#define ZEND_INIT_PARENT_PROPERTY_HOOK_CALL
#define ZEND_SR
#define ZEND_SEPARATE
#define ZEND_DO_FCALL_BY_NAME
#define ZEND_JMPNZ
#define ZEND_INIT_METHOD_CALL
#define ZEND_INIT_STATIC_METHOD_CALL
#define ZEND_MOD
#define ZEND_CATCH
#define ZEND_ADD
#define ZEND_COALESCE
#define ZEND_MATCH_ERROR
#define ZEND_CASE