Lines Matching refs:op_array

214 void zend_optimizer_convert_to_free_op1(zend_op_array *op_array, zend_op *opline)  in zend_optimizer_convert_to_free_op1()  argument
233 int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv) in zend_optimizer_add_literal() argument
235 int i = op_array->last_literal; in zend_optimizer_add_literal()
236 op_array->last_literal++; in zend_optimizer_add_literal()
237 op_array->literals = (zval*)erealloc(op_array->literals, op_array->last_literal * sizeof(zval)); in zend_optimizer_add_literal()
238 ZVAL_COPY_VALUE(&op_array->literals[i], zv); in zend_optimizer_add_literal()
239 Z_EXTRA(op_array->literals[i]) = 0; in zend_optimizer_add_literal()
243 static inline int zend_optimizer_add_literal_string(zend_op_array *op_array, zend_string *str) { in zend_optimizer_add_literal_string() argument
247 return zend_optimizer_add_literal(op_array, &zv); in zend_optimizer_add_literal_string()
258 static inline uint32_t alloc_cache_slots(zend_op_array *op_array, uint32_t num) { in alloc_cache_slots() argument
259 uint32_t ret = op_array->cache_size; in alloc_cache_slots()
260 op_array->cache_size += num * sizeof(void *); in alloc_cache_slots()
277 bool zend_optimizer_update_op1_const(zend_op_array *op_array, in zend_optimizer_update_op1_const() argument
288 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
313 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
314 …opline->extended_value = alloc_cache_slots(op_array, 1) | (opline->extended_value & ZEND_LAST_CATC… in zend_optimizer_update_op1_const()
315 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op1_const()
320 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
321 opline->extended_value = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op1_const()
322 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op1_const()
327 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
328 opline->op2.num = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op1_const()
329 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op1_const()
334 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
336 opline->result.num = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op1_const()
338 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op1_const()
343 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
345 opline->extended_value = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op1_const()
347 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op1_const()
369 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
370 …ONST && (opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS) + sizeof(void*) == op_array->cache_size) { in zend_optimizer_update_op1_const()
371 op_array->cache_size += sizeof(void *); in zend_optimizer_update_op1_const()
373 …opline->extended_value = alloc_cache_slots(op_array, 3) | (opline->extended_value & ZEND_FETCH_OBJ… in zend_optimizer_update_op1_const()
378 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
382 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
386 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
402 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
427 opline->op1.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op1_const()
438 bool zend_optimizer_update_op2_const(zend_op_array *op_array, in zend_optimizer_update_op2_const() argument
452 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
453 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op2_const()
454 opline->extended_value = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op2_const()
459 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
460 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op2_const()
461 opline->result.num = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op2_const()
480 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
481 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op2_const()
483 …opline->extended_value = alloc_cache_slots(op_array, 1) | (opline->extended_value & (ZEND_RETURNS_… in zend_optimizer_update_op2_const()
495 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
496 opline->result.num = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op2_const()
512 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
513 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op2_const()
514 opline->result.num = alloc_cache_slots(op_array, 1); in zend_optimizer_update_op2_const()
516 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
521 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
522 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op2_const()
523 opline->result.num = alloc_cache_slots(op_array, 2); in zend_optimizer_update_op2_const()
527 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
528 zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val))); in zend_optimizer_update_op2_const()
530 opline->result.num = alloc_cache_slots(op_array, 2); in zend_optimizer_update_op2_const()
547 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
548 opline->extended_value = alloc_cache_slots(op_array, 3); in zend_optimizer_update_op2_const()
552 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
554 (opline + 1)->extended_value = alloc_cache_slots(op_array, 3); in zend_optimizer_update_op2_const()
558 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
559 … opline->extended_value = alloc_cache_slots(op_array, 3) | (opline->extended_value & ZEND_ISEMPTY); in zend_optimizer_update_op2_const()
578 opline->op2.constant = zend_optimizer_add_literal(op_array, &tmp); in zend_optimizer_update_op2_const()
580 zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
581 Z_EXTRA(op_array->literals[opline->op2.constant]) = ZEND_EXTRA_VALUE; in zend_optimizer_update_op2_const()
585 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
596 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
609 opline->op2.constant = zend_optimizer_add_literal(op_array, val); in zend_optimizer_update_op2_const()
620 bool zend_optimizer_replace_by_const(zend_op_array *op_array, in zend_optimizer_replace_by_const() argument
626 zend_op *end = op_array->opcodes + op_array->last; in zend_optimizer_replace_by_const()
644 zend_op *end = op_array->opcodes + op_array->last; in zend_optimizer_replace_by_const()
660 if (!zend_optimizer_update_op1_const(op_array, opline, val)) { in zend_optimizer_replace_by_const()
674 zend_arg_info *ret_info = op_array->arg_info - 1; in zend_optimizer_replace_by_const()
676 || (op_array->fn_flags & ZEND_ACC_RETURN_REFERENCE)) { in zend_optimizer_replace_by_const()
692 return zend_optimizer_update_op1_const(op_array, opline, val); in zend_optimizer_replace_by_const()
697 return zend_optimizer_update_op2_const(op_array, opline, val); in zend_optimizer_replace_by_const()
706 void zend_optimizer_migrate_jump(zend_op_array *op_array, zend_op *new_opline, zend_op *opline) { in zend_optimizer_migrate_jump() argument
728 …ine->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, new_opline, ZEND_OFFSET_TO_OPLINE_NUM(op… in zend_optimizer_migrate_jump()
742 …Z_LVAL_P(zv) = ZEND_OPLINE_NUM_TO_OFFSET(op_array, new_opline, ZEND_OFFSET_TO_OPLINE_NUM(op_array,… in zend_optimizer_migrate_jump()
744 …ine->extended_value = ZEND_OPLINE_NUM_TO_OFFSET(op_array, new_opline, ZEND_OFFSET_TO_OPLINE_NUM(op… in zend_optimizer_migrate_jump()
751 void zend_optimizer_shift_jump(zend_op_array *op_array, zend_op *opline, uint32_t *shiftlist) { in zend_optimizer_shift_jump() argument
755 …opline->op1, ZEND_OP1_JMP_ADDR(opline) - shiftlist[ZEND_OP1_JMP_ADDR(opline) - op_array->opcodes]); in zend_optimizer_shift_jump()
769 …opline->op2, ZEND_OP2_JMP_ADDR(opline) - shiftlist[ZEND_OP2_JMP_ADDR(opline) - op_array->opcodes]); in zend_optimizer_shift_jump()
773 …opline->op2, ZEND_OP2_JMP_ADDR(opline) - shiftlist[ZEND_OP2_JMP_ADDR(opline) - op_array->opcodes]); in zend_optimizer_shift_jump()
778 …TO_OFFSET(op_array, opline, ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) - … in zend_optimizer_shift_jump()
787 …_NUM_TO_OFFSET(op_array, opline, ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, Z_LVAL_P(zv)) - shift… in zend_optimizer_shift_jump()
789 …TO_OFFSET(op_array, opline, ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, opline->extended_value) - … in zend_optimizer_shift_jump()
817 if (fbc->op_array.fn_flags & ZEND_ACC_PRELOADED) { in zend_optimizer_ignore_function()
824 return !fbc->op_array.filename || fbc->op_array.filename != filename; in zend_optimizer_ignore_function()
832 const zend_script *script, const zend_op_array *op_array, zend_string *lcname) { in zend_optimizer_get_class_entry() argument
839 if (ce_zv && !zend_optimizer_ignore_class(ce_zv, op_array ? op_array->filename : NULL)) { in zend_optimizer_get_class_entry()
843 if (op_array && op_array->scope && zend_string_equals_ci(op_array->scope->name, lcname)) { in zend_optimizer_get_class_entry()
844 return op_array->scope; in zend_optimizer_get_class_entry()
851 const zend_script *script, const zend_op_array *op_array, const zend_op *opline) { in zend_optimizer_get_class_entry_from_op1() argument
855 return zend_optimizer_get_class_entry(script, op_array, Z_STR_P(op1 + 1)); in zend_optimizer_get_class_entry_from_op1()
857 } else if (opline->op1_type == IS_UNUSED && op_array->scope in zend_optimizer_get_class_entry_from_op1()
858 && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT) in zend_optimizer_get_class_entry_from_op1()
861 && (op_array->scope->ce_flags & ZEND_ACC_FINAL)))) { in zend_optimizer_get_class_entry_from_op1()
862 return op_array->scope; in zend_optimizer_get_class_entry_from_op1()
868 …const zend_script *script, const zend_op_array *op_array, const zend_op *opline, bool *is_prototyp… in zend_fetch_class_const_info() argument
872 …if (!opline || !op_array || opline->op2_type != IS_CONST || Z_TYPE_P(CRT_CONSTANT(opline->op2)) !=… in zend_fetch_class_const_info()
879 ce = zend_optimizer_get_class_entry(script, op_array, Z_STR_P(op1 + 1)); in zend_fetch_class_const_info()
882 if (ce_zv && !zend_optimizer_ignore_class(ce_zv, op_array->filename)) { in zend_fetch_class_const_info()
888 && op_array->scope && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT) in zend_fetch_class_const_info()
889 && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) { in zend_fetch_class_const_info()
892 ce = op_array->scope; in zend_fetch_class_const_info()
894 ce = op_array->scope; in zend_fetch_class_const_info()
897 if (op_array->scope->ce_flags & ZEND_ACC_LINKED) { in zend_fetch_class_const_info()
898 ce = op_array->scope->parent; in zend_fetch_class_const_info()
910 …_FLAGS(const_info) & ZEND_ACC_PPP_MASK) != ZEND_ACC_PUBLIC && const_info->ce != op_array->scope)) { in zend_fetch_class_const_info()
920 zend_script *script, zend_op_array *op_array, zend_op *opline, bool *is_prototype) in zend_optimizer_get_called_func() argument
932 if (!zend_optimizer_ignore_function(func_zv, op_array->filename)) { in zend_optimizer_get_called_func()
947 if (!zend_optimizer_ignore_function(func_zv, op_array->filename)) { in zend_optimizer_get_called_func()
956 script, op_array, opline); in zend_optimizer_get_called_func()
962 bool same_scope = fbc->common.scope == op_array->scope; in zend_optimizer_get_called_func()
973 && op_array->scope in zend_optimizer_get_called_func()
974 && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE) in zend_optimizer_get_called_func()
975 && !(op_array->scope->ce_flags & ZEND_ACC_TRAIT)) { in zend_optimizer_get_called_func()
978 &op_array->scope->function_table, method_name); in zend_optimizer_get_called_func()
984 bool same_scope = fbc->common.scope == op_array->scope; in zend_optimizer_get_called_func()
999 zend_class_entry *scope = op_array->scope; in zend_optimizer_get_called_func()
1023 script, op_array, opline); in zend_optimizer_get_called_func()
1053 zend_op *zend_optimizer_get_loop_var_def(const zend_op_array *op_array, zend_op *free_opline) { in zend_optimizer_get_loop_var_def() argument
1057 while (--free_opline >= op_array->opcodes) { in zend_optimizer_get_loop_var_def()
1065 static void zend_optimize(zend_op_array *op_array, in zend_optimize() argument
1068 if (op_array->type == ZEND_EVAL_CODE) { in zend_optimize()
1073 zend_dump_op_array(op_array, ZEND_DUMP_LIVE_RANGES, "before optimizer", NULL); in zend_optimize()
1085 zend_optimizer_pass1(op_array, ctx); in zend_optimize()
1087 zend_dump_op_array(op_array, 0, "after pass 1", NULL); in zend_optimize()
1095 zend_optimizer_pass3(op_array, ctx); in zend_optimize()
1097 zend_dump_op_array(op_array, 0, "after pass 3", NULL); in zend_optimize()
1105 zend_optimize_func_calls(op_array, ctx); in zend_optimize()
1107 zend_dump_op_array(op_array, 0, "after pass 4", NULL); in zend_optimize()
1115 zend_optimize_cfg(op_array, ctx); in zend_optimize()
1117 zend_dump_op_array(op_array, 0, "after pass 5", NULL); in zend_optimize()
1126 zend_optimize_dfa(op_array, ctx); in zend_optimize()
1128 zend_dump_op_array(op_array, 0, "after pass 6", NULL); in zend_optimize()
1137 zend_optimize_temporary_variables(op_array, ctx); in zend_optimize()
1139 zend_dump_op_array(op_array, 0, "after pass 9", NULL); in zend_optimize()
1147 zend_optimizer_nop_removal(op_array, ctx); in zend_optimize()
1149 zend_dump_op_array(op_array, 0, "after pass 10", NULL); in zend_optimize()
1159 zend_optimizer_compact_literals(op_array, ctx); in zend_optimize()
1161 zend_dump_op_array(op_array, 0, "after pass 11", NULL); in zend_optimize()
1168 zend_optimizer_compact_vars(op_array); in zend_optimize()
1170 zend_dump_op_array(op_array, 0, "after pass 13", NULL); in zend_optimize()
1179 zend_dump_op_array(op_array, 0, "after optimizer", NULL); in zend_optimize()
1183 static void zend_revert_pass_two(zend_op_array *op_array) in zend_revert_pass_two() argument
1187 ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) != 0); in zend_revert_pass_two()
1189 opline = op_array->opcodes; in zend_revert_pass_two()
1190 end = opline + op_array->last; in zend_revert_pass_two()
1193 ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op1); in zend_revert_pass_two()
1196 ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op2); in zend_revert_pass_two()
1203 if (op_array->literals) { in zend_revert_pass_two()
1204 zval *literals = emalloc(sizeof(zval) * op_array->last_literal); in zend_revert_pass_two()
1205 memcpy(literals, op_array->literals, sizeof(zval) * op_array->last_literal); in zend_revert_pass_two()
1206 op_array->literals = literals; in zend_revert_pass_two()
1210 op_array->fn_flags &= ~ZEND_ACC_DONE_PASS_TWO; in zend_revert_pass_two()
1213 static void zend_redo_pass_two(zend_op_array *op_array) in zend_redo_pass_two() argument
1217 zend_op *old_opcodes = op_array->opcodes; in zend_redo_pass_two()
1220 ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) == 0); in zend_redo_pass_two()
1223 if (op_array->last_literal) { in zend_redo_pass_two()
1224 op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, in zend_redo_pass_two()
1225 ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) * op_array->last, 16) + in zend_redo_pass_two()
1226 sizeof(zval) * op_array->last_literal); in zend_redo_pass_two()
1227 memcpy(((char*)op_array->opcodes) + ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) * op_array->last, 16), in zend_redo_pass_two()
1228 op_array->literals, sizeof(zval) * op_array->last_literal); in zend_redo_pass_two()
1229 efree(op_array->literals); in zend_redo_pass_two()
1230op_array->literals = (zval*)(((char*)op_array->opcodes) + ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) … in zend_redo_pass_two()
1232 if (op_array->literals) { in zend_redo_pass_two()
1233 efree(op_array->literals); in zend_redo_pass_two()
1235 op_array->literals = NULL; in zend_redo_pass_two()
1239 opline = op_array->opcodes; in zend_redo_pass_two()
1240 end = opline + op_array->last; in zend_redo_pass_two()
1243 ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op1); in zend_redo_pass_two()
1246 ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op2); in zend_redo_pass_two()
1253 opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes]; in zend_redo_pass_two()
1267 opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes]; in zend_redo_pass_two()
1271 opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes]; in zend_redo_pass_two()
1320 op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO; in zend_redo_pass_two()
1323 static void zend_redo_pass_two_ex(zend_op_array *op_array, zend_ssa *ssa) in zend_redo_pass_two_ex() argument
1327 zend_op *old_opcodes = op_array->opcodes; in zend_redo_pass_two_ex()
1330 ZEND_ASSERT((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO) == 0); in zend_redo_pass_two_ex()
1333 if (op_array->last_literal) { in zend_redo_pass_two_ex()
1334 op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, in zend_redo_pass_two_ex()
1335 ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) * op_array->last, 16) + in zend_redo_pass_two_ex()
1336 sizeof(zval) * op_array->last_literal); in zend_redo_pass_two_ex()
1337 memcpy(((char*)op_array->opcodes) + ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) * op_array->last, 16), in zend_redo_pass_two_ex()
1338 op_array->literals, sizeof(zval) * op_array->last_literal); in zend_redo_pass_two_ex()
1339 efree(op_array->literals); in zend_redo_pass_two_ex()
1340op_array->literals = (zval*)(((char*)op_array->opcodes) + ZEND_MM_ALIGNED_SIZE_EX(sizeof(zend_op) … in zend_redo_pass_two_ex()
1342 if (op_array->literals) { in zend_redo_pass_two_ex()
1343 efree(op_array->literals); in zend_redo_pass_two_ex()
1345 op_array->literals = NULL; in zend_redo_pass_two_ex()
1349 opline = op_array->opcodes; in zend_redo_pass_two_ex()
1350 end = opline + op_array->last; in zend_redo_pass_two_ex()
1352 zend_ssa_op *ssa_op = &ssa->ops[opline - op_array->opcodes]; in zend_redo_pass_two_ex()
1360 …((ssa->ops[opline - op_array->opcodes].op1_def >= 0) ? (OP1_DEF_INFO() & (MAY_BE_UNDEF|MAY_BE_ANY|… in zend_redo_pass_two_ex()
1364 ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op1); in zend_redo_pass_two_ex()
1367 ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, opline, opline->op2); in zend_redo_pass_two_ex()
1375 opline->op1.jmp_addr = &op_array->opcodes[opline->op1.jmp_addr - old_opcodes]; in zend_redo_pass_two_ex()
1389 opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes]; in zend_redo_pass_two_ex()
1393 opline->op2.jmp_addr = &op_array->opcodes[opline->op2.jmp_addr - old_opcodes]; in zend_redo_pass_two_ex()
1462 op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO; in zend_redo_pass_two_ex()
1465 static void zend_optimize_op_array(zend_op_array *op_array, in zend_optimize_op_array() argument
1469 zend_revert_pass_two(op_array); in zend_optimize_op_array()
1472 zend_optimize(op_array, ctx); in zend_optimize_op_array()
1475 zend_redo_pass_two(op_array); in zend_optimize_op_array()
1477 if (op_array->live_range) { in zend_optimize_op_array()
1478 zend_recalc_live_ranges(op_array, NULL); in zend_optimize_op_array()
1482 static void zend_adjust_fcall_stack_size(zend_op_array *op_array, zend_optimizer_ctx *ctx) in zend_adjust_fcall_stack_size() argument
1487 opline = op_array->opcodes; in zend_adjust_fcall_stack_size()
1488 end = opline + op_array->last; in zend_adjust_fcall_stack_size()
1502 static void zend_adjust_fcall_stack_size_graph(zend_op_array *op_array) in zend_adjust_fcall_stack_size_graph() argument
1504 zend_func_info *func_info = ZEND_FUNC_INFO(op_array); in zend_adjust_fcall_stack_size_graph()
1521 static bool needs_live_range(zend_op_array *op_array, zend_op *def_opline) { in needs_live_range() argument
1522 zend_func_info *func_info = ZEND_FUNC_INFO(op_array); in needs_live_range()
1523 zend_ssa_op *ssa_op = &func_info->ssa.ops[def_opline - op_array->opcodes]; in needs_live_range()
1542 zend_op_array *op_array, zend_op_array_func_t func, void *context) { in zend_foreach_op_array_helper() argument
1543 func(op_array, context); in zend_foreach_op_array_helper()
1544 for (uint32_t i = 0; i < op_array->num_dynamic_func_defs; i++) { in zend_foreach_op_array_helper()
1545 zend_foreach_op_array_helper(op_array->dynamic_func_defs[i], func, context); in zend_foreach_op_array_helper()
1552 zend_op_array *op_array; in zend_foreach_op_array() local
1556 ZEND_HASH_MAP_FOREACH_PTR(&script->function_table, op_array) { in zend_foreach_op_array()
1557 zend_foreach_op_array_helper(op_array, func, context); in zend_foreach_op_array()
1565 ZEND_HASH_MAP_FOREACH_PTR(&ce->function_table, op_array) { in zend_foreach_op_array()
1566 if (op_array->scope == ce in zend_foreach_op_array()
1567 && op_array->type == ZEND_USER_FUNCTION in zend_foreach_op_array()
1568 && !(op_array->fn_flags & ZEND_ACC_ABSTRACT) in zend_foreach_op_array()
1569 && !(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) { in zend_foreach_op_array()
1570 zend_foreach_op_array_helper(op_array, func, context); in zend_foreach_op_array()
1581 zend_foreach_op_array_helper(&hooks[i]->op_array, func, context); in zend_foreach_op_array()
1589 static void step_optimize_op_array(zend_op_array *op_array, void *context) { in step_optimize_op_array() argument
1590 zend_optimize_op_array(op_array, (zend_optimizer_ctx *) context); in step_optimize_op_array()
1593 static void step_adjust_fcall_stack_size(zend_op_array *op_array, void *context) { in step_adjust_fcall_stack_size() argument
1594 zend_adjust_fcall_stack_size(op_array, (zend_optimizer_ctx *) context); in step_adjust_fcall_stack_size()
1597 static void step_dump_after_optimizer(zend_op_array *op_array, void *context) { in step_dump_after_optimizer() argument
1598 zend_dump_op_array(op_array, ZEND_DUMP_LIVE_RANGES, "after optimizer", NULL); in step_dump_after_optimizer()
1613 zend_op_array *op_array; in zend_optimize_script() local
1709 op_array = call_graph.op_arrays[i]; in zend_optimize_script()
1710 func_info = ZEND_FUNC_INFO(op_array); in zend_optimize_script()
1712 zend_redo_pass_two_ex(op_array, &func_info->ssa); in zend_optimize_script()
1713 if (op_array->live_range) { in zend_optimize_script()
1714 zend_recalc_live_ranges(op_array, needs_live_range); in zend_optimize_script()
1717 zend_redo_pass_two(op_array); in zend_optimize_script()
1718 if (op_array->live_range) { in zend_optimize_script()
1719 zend_recalc_live_ranges(op_array, NULL); in zend_optimize_script()
1740 ZEND_HASH_MAP_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) { in zend_optimize_script()
1741 if (op_array->scope != ce && op_array->type == ZEND_USER_FUNCTION) { in zend_optimize_script()
1743 zend_hash_find_ptr(&op_array->scope->function_table, name); in zend_optimize_script()
1746 if (orig_op_array != op_array) { in zend_optimize_script()
1747 uint32_t fn_flags = op_array->fn_flags; in zend_optimize_script()
1748 zend_function *prototype = op_array->prototype; in zend_optimize_script()
1749 HashTable *ht = op_array->static_variables; in zend_optimize_script()
1751 *op_array = *orig_op_array; in zend_optimize_script()
1752 op_array->fn_flags = fn_flags; in zend_optimize_script()
1753 op_array->prototype = prototype; in zend_optimize_script()
1754 op_array->static_variables = ht; in zend_optimize_script()