Lines Matching refs:op_array

64 static int zend_optimizer_lookup_cv(zend_op_array *op_array, char* name, int name_len)  in zend_optimizer_lookup_cv()  argument
69 while (i < op_array->last_var) { in zend_optimizer_lookup_cv()
70 if (op_array->vars[i].name == name || in zend_optimizer_lookup_cv()
71 (op_array->vars[i].hash_value == hash_value && in zend_optimizer_lookup_cv()
72 op_array->vars[i].name_len == name_len && in zend_optimizer_lookup_cv()
73 memcmp(op_array->vars[i].name, name, name_len) == 0)) { in zend_optimizer_lookup_cv()
78 i = op_array->last_var; in zend_optimizer_lookup_cv()
79 op_array->last_var++; in zend_optimizer_lookup_cv()
80 op_array->vars = erealloc(op_array->vars, op_array->last_var * sizeof(zend_compiled_variable)); in zend_optimizer_lookup_cv()
82 op_array->vars[i].name = name; in zend_optimizer_lookup_cv()
84 op_array->vars[i].name = estrndup(name, name_len); in zend_optimizer_lookup_cv()
86 op_array->vars[i].name_len = name_len; in zend_optimizer_lookup_cv()
87 op_array->vars[i].hash_value = hash_value; in zend_optimizer_lookup_cv()
93 int zend_optimizer_add_literal(zend_op_array *op_array, const zval *zv TSRMLS_DC) in zend_optimizer_add_literal() argument
95 int i = op_array->last_literal; in zend_optimizer_add_literal()
96 op_array->last_literal++; in zend_optimizer_add_literal()
97op_array->literals = (zend_literal*)erealloc(op_array->literals, op_array->last_literal * sizeof(z… in zend_optimizer_add_literal()
98 op_array->literals[i].constant = *zv; in zend_optimizer_add_literal()
99 op_array->literals[i].hash_value = 0; in zend_optimizer_add_literal()
100 op_array->literals[i].cache_slot = -1; in zend_optimizer_add_literal()
101 Z_SET_REFCOUNT(op_array->literals[i].constant, 2); in zend_optimizer_add_literal()
102 Z_SET_ISREF(op_array->literals[i].constant); in zend_optimizer_add_literal()
109 op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \
115 op.constant = zend_optimizer_add_literal(op_array, &_c TSRMLS_CC); \
142 static void update_op1_const(zend_op_array *op_array, in update_op1_const() argument
157 opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op1_const()
159 op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++; in update_op1_const()
161 zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op1_const()
162op_array->literals[opline->op1.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals… in update_op1_const()
166 opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op1_const()
168 op_array->literals[opline->op1.constant].cache_slot = op_array->last_cache_slot++; in update_op1_const()
171 opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op1_const()
176 opline->op1.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op1_const()
184 static void update_op2_const(zend_op_array *op_array, in update_op2_const() argument
190 opline->op2.constant = zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op2_const()
207 op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot++; in update_op2_const()
209 zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op2_const()
210op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals… in update_op2_const()
215 zend_optimizer_add_literal(op_array, val TSRMLS_CC); in update_op2_const()
216op_array->literals[opline->op2.constant+1].hash_value = zend_hash_func(Z_STRVAL(op_array->literals… in update_op2_const()
232 op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot; in update_op2_const()
233 op_array->last_cache_slot += 2; in update_op2_const()
247 op_array->literals[opline->op2.constant].cache_slot = op_array->last_cache_slot; in update_op2_const()
248 op_array->last_cache_slot += 2; in update_op2_const()
290 op_array->literals[opline->op2.constant].constant = *val; in update_op2_const()
304 static int replace_var_by_const(zend_op_array *op_array, in replace_var_by_const() argument
309 zend_op *end = op_array->opcodes + op_array->last; in replace_var_by_const()
338 int brk = op_array->last_brk_cont; in replace_var_by_const()
340 if (op_array->brk_cont_array[brk].start <= (opline - op_array->opcodes) && in replace_var_by_const()
341 op_array->brk_cont_array[brk].brk > (opline - op_array->opcodes)) { in replace_var_by_const()
346 n = op_array->opcodes + op_array->brk_cont_array[brk].brk + 1; in replace_var_by_const()
354 update_op1_const(op_array, m, val TSRMLS_CC); in replace_var_by_const()
374 update_op1_const(op_array, opline, val TSRMLS_CC); in replace_var_by_const()
386 update_op2_const(op_array, opline, val TSRMLS_CC); in replace_var_by_const()
395 static void replace_tmp_by_const(zend_op_array *op_array, in replace_tmp_by_const() argument
401 zend_op *end = op_array->opcodes + op_array->last; in replace_tmp_by_const()
415 int brk = op_array->last_brk_cont; in replace_tmp_by_const()
418 if (op_array->brk_cont_array[brk].start <= (opline - op_array->opcodes) && in replace_tmp_by_const()
419 op_array->brk_cont_array[brk].brk > (opline - op_array->opcodes)) { in replace_tmp_by_const()
432 n = op_array->opcodes + op_array->brk_cont_array[brk].brk + 1; in replace_tmp_by_const()
440 update_op1_const(op_array, m, val TSRMLS_CC); in replace_tmp_by_const()
453 update_op1_const(op_array, opline, val TSRMLS_CC); in replace_tmp_by_const()
461 update_op2_const(op_array, opline, val TSRMLS_CC); in replace_tmp_by_const()
475 static void zend_optimize(zend_op_array *op_array, in zend_optimize() argument
479 if (op_array->type == ZEND_EVAL_CODE || in zend_optimize()
480 (op_array->fn_flags & ZEND_ACC_INTERACTIVE)) { in zend_optimize()
512 optimize_func_calls(op_array, script TSRMLS_CC); in zend_optimize()
536 optimizer_compact_literals(op_array TSRMLS_CC); in zend_optimize()
541 static void zend_accel_optimize(zend_op_array *op_array, in zend_accel_optimize() argument
548 opline = op_array->opcodes; in zend_accel_optimize()
549 end = opline + op_array->last; in zend_accel_optimize()
553 opline->op1.constant = opline->op1.literal - op_array->literals; in zend_accel_optimize()
556 opline->op2.constant = opline->op2.literal - op_array->literals; in zend_accel_optimize()
567 ZEND_OP1(opline).opline_num = ZEND_OP1(opline).jmp_addr - op_array->opcodes; in zend_accel_optimize()
579 ZEND_OP2(opline).opline_num = ZEND_OP2(opline).jmp_addr - op_array->opcodes; in zend_accel_optimize()
586 zend_optimize(op_array, script, constants TSRMLS_CC); in zend_accel_optimize()
589 opline = op_array->opcodes; in zend_accel_optimize()
590 end = opline + op_array->last; in zend_accel_optimize()
594 opline->op1.zv = &op_array->literals[opline->op1.constant].constant; in zend_accel_optimize()
597 opline->op2.zv = &op_array->literals[opline->op2.constant].constant; in zend_accel_optimize()
608 ZEND_OP1(opline).jmp_addr = &op_array->opcodes[ZEND_OP1(opline).opline_num]; in zend_accel_optimize()
620 ZEND_OP2(opline).jmp_addr = &op_array->opcodes[ZEND_OP2(opline).opline_num]; in zend_accel_optimize()
637 zend_op_array *op_array = (zend_op_array*)p->pData; in zend_accel_script_optimize() local
638 zend_accel_optimize(op_array, script, &constants TSRMLS_CC); in zend_accel_script_optimize()
647 zend_op_array *op_array = (zend_op_array*)q->pData; in zend_accel_script_optimize() local
648 if (op_array->scope == ce) { in zend_accel_script_optimize()
649 zend_accel_optimize(op_array, script, &constants TSRMLS_CC); in zend_accel_script_optimize()
650 } else if (op_array->type == ZEND_USER_FUNCTION) { in zend_accel_script_optimize()
652 …if (zend_hash_find(&op_array->scope->function_table, q->arKey, q->nKeyLength, (void**)&orig_op_arr… in zend_accel_script_optimize()
653 HashTable *ht = op_array->static_variables; in zend_accel_script_optimize()
654 *op_array = *orig_op_array; in zend_accel_script_optimize()
655 op_array->static_variables = ht; in zend_accel_script_optimize()