/src/php-src/Zend/Optimizer/zend_inference.h
Line | Count | Source |
1 | | /* |
2 | | +----------------------------------------------------------------------+ |
3 | | | Zend Engine, e-SSA based Type & Range Inference | |
4 | | +----------------------------------------------------------------------+ |
5 | | | Copyright (c) The PHP Group | |
6 | | +----------------------------------------------------------------------+ |
7 | | | This source file is subject to version 3.01 of the PHP 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 | | | https://www.php.net/license/3_01.txt | |
11 | | | If you did not receive a copy of the PHP license and are unable to | |
12 | | | obtain it through the world-wide-web, please send a note to | |
13 | | | license@php.net so we can mail you a copy immediately. | |
14 | | +----------------------------------------------------------------------+ |
15 | | | Authors: Dmitry Stogov <dmitry@php.net> | |
16 | | +----------------------------------------------------------------------+ |
17 | | */ |
18 | | |
19 | | #ifndef ZEND_INFERENCE_H |
20 | | #define ZEND_INFERENCE_H |
21 | | |
22 | | #include "zend_optimizer.h" |
23 | | #include "zend_ssa.h" |
24 | | #include "zend_bitset.h" |
25 | | |
26 | | /* Bitmask for type inference (zend_ssa_var_info.type) */ |
27 | | #include "zend_type_info.h" |
28 | | |
29 | | #include <stdint.h> |
30 | | |
31 | 0 | #define MAY_BE_PACKED_GUARD (1<<27) /* needs packed array guard */ |
32 | 0 | #define MAY_BE_CLASS_GUARD (1<<27) /* needs class guard */ |
33 | 0 | #define MAY_BE_GUARD (1<<28) /* needs type guard */ |
34 | | |
35 | | #define MAY_HAVE_DTOR \ |
36 | 0 | (MAY_BE_OBJECT|MAY_BE_RESOURCE \ |
37 | 0 | |MAY_BE_ARRAY_OF_ARRAY|MAY_BE_ARRAY_OF_OBJECT|MAY_BE_ARRAY_OF_RESOURCE) |
38 | | |
39 | | #define DEFINE_SSA_OP_HAS_RANGE(opN) \ |
40 | | static zend_always_inline bool _ssa_##opN##_has_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \ |
41 | 0 | { \ |
42 | 0 | if (opline->opN##_type == IS_CONST) { \ |
43 | 0 | zval *zv = CRT_CONSTANT(opline->opN); \ |
44 | 0 | return (Z_TYPE_P(zv) == IS_LONG); \ |
45 | 0 | } else { \ |
46 | 0 | return (opline->opN##_type != IS_UNUSED && \ |
47 | 0 | ssa->var_info && \ |
48 | 0 | ssa_op->opN##_use >= 0 && \ |
49 | 0 | ssa->var_info[ssa_op->opN##_use].has_range); \ |
50 | 0 | } \ |
51 | 0 | return 0; \ |
52 | 0 | } \ Unexecuted instantiation: zend_jit.c:_ssa_op1_has_range Unexecuted instantiation: zend_jit.c:_ssa_op2_has_range Unexecuted instantiation: dce.c:_ssa_op1_has_range Unexecuted instantiation: dce.c:_ssa_op2_has_range Unexecuted instantiation: dfa_pass.c:_ssa_op1_has_range Unexecuted instantiation: dfa_pass.c:_ssa_op2_has_range Unexecuted instantiation: escape_analysis.c:_ssa_op1_has_range Unexecuted instantiation: escape_analysis.c:_ssa_op2_has_range Unexecuted instantiation: sccp.c:_ssa_op1_has_range Unexecuted instantiation: sccp.c:_ssa_op2_has_range Unexecuted instantiation: zend_call_graph.c:_ssa_op1_has_range Unexecuted instantiation: zend_call_graph.c:_ssa_op2_has_range Unexecuted instantiation: zend_dump.c:_ssa_op1_has_range Unexecuted instantiation: zend_dump.c:_ssa_op2_has_range Unexecuted instantiation: zend_func_info.c:_ssa_op1_has_range Unexecuted instantiation: zend_func_info.c:_ssa_op2_has_range Unexecuted instantiation: zend_inference.c:_ssa_op1_has_range Unexecuted instantiation: zend_inference.c:_ssa_op2_has_range Unexecuted instantiation: zend_optimizer.c:_ssa_op1_has_range Unexecuted instantiation: zend_optimizer.c:_ssa_op2_has_range Unexecuted instantiation: zend_ssa.c:_ssa_op1_has_range Unexecuted instantiation: zend_ssa.c:_ssa_op2_has_range |
53 | | |
54 | | #define DEFINE_SSA_OP_MIN_RANGE(opN) \ |
55 | | static zend_always_inline zend_long _ssa_##opN##_min_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \ |
56 | 0 | { \ |
57 | 0 | if (opline->opN##_type == IS_CONST) { \ |
58 | 0 | zval *zv = CRT_CONSTANT(opline->opN); \ |
59 | 0 | if (Z_TYPE_P(zv) == IS_LONG) { \ |
60 | 0 | return Z_LVAL_P(zv); \ |
61 | 0 | } \ |
62 | 0 | } else if (opline->opN##_type != IS_UNUSED && \ |
63 | 0 | ssa->var_info && \ |
64 | 0 | ssa_op->opN##_use >= 0 && \ |
65 | 0 | ssa->var_info[ssa_op->opN##_use].has_range) { \ |
66 | 0 | return ssa->var_info[ssa_op->opN##_use].range.min; \ |
67 | 0 | } \ |
68 | 0 | return ZEND_LONG_MIN; \ |
69 | 0 | } \ Unexecuted instantiation: dce.c:_ssa_op1_min_range Unexecuted instantiation: dce.c:_ssa_op2_min_range Unexecuted instantiation: dfa_pass.c:_ssa_op1_min_range Unexecuted instantiation: dfa_pass.c:_ssa_op2_min_range Unexecuted instantiation: escape_analysis.c:_ssa_op1_min_range Unexecuted instantiation: escape_analysis.c:_ssa_op2_min_range Unexecuted instantiation: sccp.c:_ssa_op1_min_range Unexecuted instantiation: sccp.c:_ssa_op2_min_range Unexecuted instantiation: zend_call_graph.c:_ssa_op1_min_range Unexecuted instantiation: zend_call_graph.c:_ssa_op2_min_range Unexecuted instantiation: zend_dump.c:_ssa_op1_min_range Unexecuted instantiation: zend_dump.c:_ssa_op2_min_range Unexecuted instantiation: zend_func_info.c:_ssa_op1_min_range Unexecuted instantiation: zend_func_info.c:_ssa_op2_min_range Unexecuted instantiation: zend_optimizer.c:_ssa_op1_min_range Unexecuted instantiation: zend_optimizer.c:_ssa_op2_min_range Unexecuted instantiation: zend_ssa.c:_ssa_op1_min_range Unexecuted instantiation: zend_ssa.c:_ssa_op2_min_range |
70 | | |
71 | | #define DEFINE_SSA_OP_MAX_RANGE(opN) \ |
72 | | static zend_always_inline zend_long _ssa_##opN##_max_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \ |
73 | 0 | { \ |
74 | 0 | if (opline->opN##_type == IS_CONST) { \ |
75 | 0 | zval *zv = CRT_CONSTANT(opline->opN); \ |
76 | 0 | if (Z_TYPE_P(zv) == IS_LONG) { \ |
77 | 0 | return Z_LVAL_P(zv); \ |
78 | 0 | } \ |
79 | 0 | } else if (opline->opN##_type != IS_UNUSED && \ |
80 | 0 | ssa->var_info && \ |
81 | 0 | ssa_op->opN##_use >= 0 && \ |
82 | 0 | ssa->var_info[ssa_op->opN##_use].has_range) { \ |
83 | 0 | return ssa->var_info[ssa_op->opN##_use].range.max; \ |
84 | 0 | } \ |
85 | 0 | return ZEND_LONG_MAX; \ |
86 | 0 | } \ Unexecuted instantiation: dce.c:_ssa_op1_max_range Unexecuted instantiation: dce.c:_ssa_op2_max_range Unexecuted instantiation: dfa_pass.c:_ssa_op1_max_range Unexecuted instantiation: dfa_pass.c:_ssa_op2_max_range Unexecuted instantiation: escape_analysis.c:_ssa_op1_max_range Unexecuted instantiation: escape_analysis.c:_ssa_op2_max_range Unexecuted instantiation: sccp.c:_ssa_op1_max_range Unexecuted instantiation: sccp.c:_ssa_op2_max_range Unexecuted instantiation: zend_call_graph.c:_ssa_op1_max_range Unexecuted instantiation: zend_call_graph.c:_ssa_op2_max_range Unexecuted instantiation: zend_dump.c:_ssa_op1_max_range Unexecuted instantiation: zend_dump.c:_ssa_op2_max_range Unexecuted instantiation: zend_func_info.c:_ssa_op1_max_range Unexecuted instantiation: zend_func_info.c:_ssa_op2_max_range Unexecuted instantiation: zend_optimizer.c:_ssa_op1_max_range Unexecuted instantiation: zend_optimizer.c:_ssa_op2_max_range Unexecuted instantiation: zend_ssa.c:_ssa_op1_max_range Unexecuted instantiation: zend_ssa.c:_ssa_op2_max_range |
87 | | |
88 | | #define DEFINE_SSA_OP_RANGE_UNDERFLOW(opN) \ |
89 | | static zend_always_inline char _ssa_##opN##_range_underflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \ |
90 | 0 | { \ |
91 | 0 | if (opline->opN##_type == IS_CONST) { \ |
92 | 0 | zval *zv = CRT_CONSTANT(opline->opN); \ |
93 | 0 | if (Z_TYPE_P(zv) == IS_LONG) { \ |
94 | 0 | return 0; \ |
95 | 0 | } \ |
96 | 0 | } else if (opline->opN##_type != IS_UNUSED && \ |
97 | 0 | ssa->var_info && \ |
98 | 0 | ssa_op->opN##_use >= 0 && \ |
99 | 0 | ssa->var_info[ssa_op->opN##_use].has_range) { \ |
100 | 0 | return ssa->var_info[ssa_op->opN##_use].range.underflow; \ |
101 | 0 | } \ |
102 | 0 | return 1; \ |
103 | 0 | } \ Unexecuted instantiation: zend_jit.c:_ssa_op1_range_underflow Unexecuted instantiation: zend_jit.c:_ssa_op2_range_underflow Unexecuted instantiation: dce.c:_ssa_op1_range_underflow Unexecuted instantiation: dce.c:_ssa_op2_range_underflow Unexecuted instantiation: dfa_pass.c:_ssa_op1_range_underflow Unexecuted instantiation: dfa_pass.c:_ssa_op2_range_underflow Unexecuted instantiation: escape_analysis.c:_ssa_op1_range_underflow Unexecuted instantiation: escape_analysis.c:_ssa_op2_range_underflow Unexecuted instantiation: sccp.c:_ssa_op1_range_underflow Unexecuted instantiation: sccp.c:_ssa_op2_range_underflow Unexecuted instantiation: zend_call_graph.c:_ssa_op1_range_underflow Unexecuted instantiation: zend_call_graph.c:_ssa_op2_range_underflow Unexecuted instantiation: zend_dump.c:_ssa_op1_range_underflow Unexecuted instantiation: zend_dump.c:_ssa_op2_range_underflow Unexecuted instantiation: zend_func_info.c:_ssa_op1_range_underflow Unexecuted instantiation: zend_func_info.c:_ssa_op2_range_underflow Unexecuted instantiation: zend_inference.c:_ssa_op1_range_underflow Unexecuted instantiation: zend_inference.c:_ssa_op2_range_underflow Unexecuted instantiation: zend_optimizer.c:_ssa_op1_range_underflow Unexecuted instantiation: zend_optimizer.c:_ssa_op2_range_underflow Unexecuted instantiation: zend_ssa.c:_ssa_op1_range_underflow Unexecuted instantiation: zend_ssa.c:_ssa_op2_range_underflow |
104 | | |
105 | | #define DEFINE_SSA_OP_RANGE_OVERFLOW(opN) \ |
106 | | static zend_always_inline char _ssa_##opN##_range_overflow(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \ |
107 | 0 | { \ |
108 | 0 | if (opline->opN##_type == IS_CONST) { \ |
109 | 0 | zval *zv = CRT_CONSTANT(opline->opN); \ |
110 | 0 | if (Z_TYPE_P(zv) == IS_LONG) { \ |
111 | 0 | return 0; \ |
112 | 0 | } \ |
113 | 0 | } else if (opline->opN##_type != IS_UNUSED && \ |
114 | 0 | ssa->var_info && \ |
115 | 0 | ssa_op->opN##_use >= 0 && \ |
116 | 0 | ssa->var_info[ssa_op->opN##_use].has_range) { \ |
117 | 0 | return ssa->var_info[ssa_op->opN##_use].range.overflow; \ |
118 | 0 | } \ |
119 | 0 | return 1; \ |
120 | 0 | } \ Unexecuted instantiation: zend_jit.c:_ssa_op1_range_overflow Unexecuted instantiation: zend_jit.c:_ssa_op2_range_overflow Unexecuted instantiation: dce.c:_ssa_op1_range_overflow Unexecuted instantiation: dce.c:_ssa_op2_range_overflow Unexecuted instantiation: dfa_pass.c:_ssa_op1_range_overflow Unexecuted instantiation: dfa_pass.c:_ssa_op2_range_overflow Unexecuted instantiation: escape_analysis.c:_ssa_op1_range_overflow Unexecuted instantiation: escape_analysis.c:_ssa_op2_range_overflow Unexecuted instantiation: sccp.c:_ssa_op1_range_overflow Unexecuted instantiation: sccp.c:_ssa_op2_range_overflow Unexecuted instantiation: zend_call_graph.c:_ssa_op1_range_overflow Unexecuted instantiation: zend_call_graph.c:_ssa_op2_range_overflow Unexecuted instantiation: zend_dump.c:_ssa_op1_range_overflow Unexecuted instantiation: zend_dump.c:_ssa_op2_range_overflow Unexecuted instantiation: zend_func_info.c:_ssa_op1_range_overflow Unexecuted instantiation: zend_func_info.c:_ssa_op2_range_overflow Unexecuted instantiation: zend_inference.c:_ssa_op1_range_overflow Unexecuted instantiation: zend_inference.c:_ssa_op2_range_overflow Unexecuted instantiation: zend_optimizer.c:_ssa_op1_range_overflow Unexecuted instantiation: zend_optimizer.c:_ssa_op2_range_overflow Unexecuted instantiation: zend_ssa.c:_ssa_op1_range_overflow Unexecuted instantiation: zend_ssa.c:_ssa_op2_range_overflow |
121 | | |
122 | | DEFINE_SSA_OP_HAS_RANGE(op1) |
123 | 0 | DEFINE_SSA_OP_MIN_RANGE(op1) Unexecuted instantiation: zend_jit.c:_ssa_op1_min_range Unexecuted instantiation: zend_inference.c:_ssa_op1_min_range |
124 | 0 | DEFINE_SSA_OP_MAX_RANGE(op1) Unexecuted instantiation: zend_jit.c:_ssa_op1_max_range Unexecuted instantiation: zend_inference.c:_ssa_op1_max_range |
125 | | DEFINE_SSA_OP_RANGE_UNDERFLOW(op1) |
126 | | DEFINE_SSA_OP_RANGE_OVERFLOW(op1) |
127 | | DEFINE_SSA_OP_HAS_RANGE(op2) |
128 | 0 | DEFINE_SSA_OP_MIN_RANGE(op2) Unexecuted instantiation: zend_jit.c:_ssa_op2_min_range Unexecuted instantiation: zend_inference.c:_ssa_op2_min_range |
129 | 0 | DEFINE_SSA_OP_MAX_RANGE(op2) Unexecuted instantiation: zend_jit.c:_ssa_op2_max_range Unexecuted instantiation: zend_inference.c:_ssa_op2_max_range |
130 | | DEFINE_SSA_OP_RANGE_UNDERFLOW(op2) |
131 | | DEFINE_SSA_OP_RANGE_OVERFLOW(op2) |
132 | | |
133 | 0 | #define OP1_HAS_RANGE() (_ssa_op1_has_range (op_array, ssa, opline, ssa_op)) |
134 | 0 | #define OP1_MIN_RANGE() (_ssa_op1_min_range (op_array, ssa, opline, ssa_op)) |
135 | 0 | #define OP1_MAX_RANGE() (_ssa_op1_max_range (op_array, ssa, opline, ssa_op)) |
136 | 0 | #define OP1_RANGE_UNDERFLOW() (_ssa_op1_range_underflow (op_array, ssa, opline, ssa_op)) |
137 | 0 | #define OP1_RANGE_OVERFLOW() (_ssa_op1_range_overflow (op_array, ssa, opline, ssa_op)) |
138 | 0 | #define OP2_HAS_RANGE() (_ssa_op2_has_range (op_array, ssa, opline, ssa_op)) |
139 | 0 | #define OP2_MIN_RANGE() (_ssa_op2_min_range (op_array, ssa, opline, ssa_op)) |
140 | 0 | #define OP2_MAX_RANGE() (_ssa_op2_max_range (op_array, ssa, opline, ssa_op)) |
141 | 0 | #define OP2_RANGE_UNDERFLOW() (_ssa_op2_range_underflow (op_array, ssa, opline, ssa_op)) |
142 | 0 | #define OP2_RANGE_OVERFLOW() (_ssa_op2_range_overflow (op_array, ssa, opline, ssa_op)) |
143 | | |
144 | | BEGIN_EXTERN_C() |
145 | | ZEND_API uint32_t ZEND_FASTCALL zend_array_type_info(const zval *zv); |
146 | | END_EXTERN_C() |
147 | | |
148 | 0 | static zend_always_inline uint32_t _const_op_type(const zval *zv) { |
149 | 0 | if (Z_TYPE_P(zv) == IS_CONSTANT_AST) { |
150 | 0 | return MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY; |
151 | 0 | } else if (Z_TYPE_P(zv) == IS_ARRAY) { |
152 | 0 | return zend_array_type_info(zv); |
153 | 0 | } else { |
154 | 0 | uint32_t tmp = (1 << Z_TYPE_P(zv)); |
155 | |
|
156 | 0 | if (Z_REFCOUNTED_P(zv)) { |
157 | 0 | tmp |= MAY_BE_RC1 | MAY_BE_RCN; |
158 | 0 | } else if (Z_TYPE_P(zv) == IS_STRING) { |
159 | 0 | tmp |= MAY_BE_RCN; |
160 | 0 | } |
161 | 0 | return tmp; |
162 | 0 | } |
163 | 0 | } Unexecuted instantiation: zend_jit.c:_const_op_type Unexecuted instantiation: dce.c:_const_op_type Unexecuted instantiation: dfa_pass.c:_const_op_type Unexecuted instantiation: escape_analysis.c:_const_op_type Unexecuted instantiation: sccp.c:_const_op_type Unexecuted instantiation: zend_call_graph.c:_const_op_type Unexecuted instantiation: zend_dump.c:_const_op_type Unexecuted instantiation: zend_func_info.c:_const_op_type Unexecuted instantiation: zend_inference.c:_const_op_type Unexecuted instantiation: zend_optimizer.c:_const_op_type Unexecuted instantiation: zend_ssa.c:_const_op_type |
164 | | |
165 | | static zend_always_inline uint32_t get_ssa_var_info(const zend_ssa *ssa, int ssa_var_num) |
166 | 0 | { |
167 | 0 | if (ssa->var_info && ssa_var_num >= 0) { |
168 | 0 | return ssa->var_info[ssa_var_num].type; |
169 | 0 | } else { |
170 | 0 | return MAY_BE_UNDEF | MAY_BE_RC1 | MAY_BE_RCN | MAY_BE_REF | MAY_BE_INDIRECT | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF; |
171 | 0 | } |
172 | 0 | } Unexecuted instantiation: zend_jit.c:get_ssa_var_info Unexecuted instantiation: dce.c:get_ssa_var_info Unexecuted instantiation: dfa_pass.c:get_ssa_var_info Unexecuted instantiation: escape_analysis.c:get_ssa_var_info Unexecuted instantiation: sccp.c:get_ssa_var_info Unexecuted instantiation: zend_call_graph.c:get_ssa_var_info Unexecuted instantiation: zend_dump.c:get_ssa_var_info Unexecuted instantiation: zend_func_info.c:get_ssa_var_info Unexecuted instantiation: zend_inference.c:get_ssa_var_info Unexecuted instantiation: zend_optimizer.c:get_ssa_var_info Unexecuted instantiation: zend_ssa.c:get_ssa_var_info |
173 | | |
174 | | #define DEFINE_SSA_OP_INFO(opN) \ |
175 | | static zend_always_inline uint32_t _ssa_##opN##_info(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \ |
176 | 0 | { \ |
177 | 0 | if (opline->opN##_type == IS_CONST) { \ |
178 | 0 | return _const_op_type(CRT_CONSTANT(opline->opN)); \ |
179 | 0 | } else { \ |
180 | 0 | return get_ssa_var_info(ssa, ssa->var_info ? ssa_op->opN##_use : -1); \ |
181 | 0 | } \ |
182 | 0 | } \ Unexecuted instantiation: zend_jit.c:_ssa_op1_info Unexecuted instantiation: zend_jit.c:_ssa_op2_info Unexecuted instantiation: zend_jit.c:_ssa_result_info Unexecuted instantiation: dce.c:_ssa_op2_info Unexecuted instantiation: dce.c:_ssa_op1_info Unexecuted instantiation: dce.c:_ssa_result_info Unexecuted instantiation: dfa_pass.c:_ssa_op2_info Unexecuted instantiation: dfa_pass.c:_ssa_op1_info Unexecuted instantiation: dfa_pass.c:_ssa_result_info Unexecuted instantiation: escape_analysis.c:_ssa_op1_info Unexecuted instantiation: escape_analysis.c:_ssa_op2_info Unexecuted instantiation: escape_analysis.c:_ssa_result_info Unexecuted instantiation: sccp.c:_ssa_op1_info Unexecuted instantiation: sccp.c:_ssa_op2_info Unexecuted instantiation: sccp.c:_ssa_result_info Unexecuted instantiation: zend_call_graph.c:_ssa_op1_info Unexecuted instantiation: zend_call_graph.c:_ssa_op2_info Unexecuted instantiation: zend_call_graph.c:_ssa_result_info Unexecuted instantiation: zend_dump.c:_ssa_op1_info Unexecuted instantiation: zend_dump.c:_ssa_op2_info Unexecuted instantiation: zend_dump.c:_ssa_result_info Unexecuted instantiation: zend_func_info.c:_ssa_op1_info Unexecuted instantiation: zend_func_info.c:_ssa_op2_info Unexecuted instantiation: zend_func_info.c:_ssa_result_info Unexecuted instantiation: zend_inference.c:_ssa_result_info Unexecuted instantiation: zend_inference.c:_ssa_op1_info Unexecuted instantiation: zend_inference.c:_ssa_op2_info Unexecuted instantiation: zend_optimizer.c:_ssa_op1_info Unexecuted instantiation: zend_optimizer.c:_ssa_op2_info Unexecuted instantiation: zend_optimizer.c:_ssa_result_info Unexecuted instantiation: zend_ssa.c:_ssa_op1_info Unexecuted instantiation: zend_ssa.c:_ssa_op2_info Unexecuted instantiation: zend_ssa.c:_ssa_result_info |
183 | | |
184 | | #define DEFINE_SSA_OP_DEF_INFO(opN) \ |
185 | | static zend_always_inline uint32_t _ssa_##opN##_def_info(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op *ssa_op) \ |
186 | 0 | { \ |
187 | 0 | return get_ssa_var_info(ssa, ssa->var_info ? ssa_op->opN##_def : -1); \ |
188 | 0 | } \ Unexecuted instantiation: zend_jit.c:_ssa_result_def_info Unexecuted instantiation: zend_jit.c:_ssa_op1_def_info Unexecuted instantiation: zend_jit.c:_ssa_op2_def_info Unexecuted instantiation: dce.c:_ssa_op1_def_info Unexecuted instantiation: dce.c:_ssa_op2_def_info Unexecuted instantiation: dce.c:_ssa_result_def_info Unexecuted instantiation: dfa_pass.c:_ssa_op1_def_info Unexecuted instantiation: dfa_pass.c:_ssa_op2_def_info Unexecuted instantiation: dfa_pass.c:_ssa_result_def_info Unexecuted instantiation: escape_analysis.c:_ssa_op1_def_info Unexecuted instantiation: escape_analysis.c:_ssa_op2_def_info Unexecuted instantiation: escape_analysis.c:_ssa_result_def_info Unexecuted instantiation: sccp.c:_ssa_op1_def_info Unexecuted instantiation: sccp.c:_ssa_op2_def_info Unexecuted instantiation: sccp.c:_ssa_result_def_info Unexecuted instantiation: zend_call_graph.c:_ssa_op1_def_info Unexecuted instantiation: zend_call_graph.c:_ssa_op2_def_info Unexecuted instantiation: zend_call_graph.c:_ssa_result_def_info Unexecuted instantiation: zend_dump.c:_ssa_op1_def_info Unexecuted instantiation: zend_dump.c:_ssa_op2_def_info Unexecuted instantiation: zend_dump.c:_ssa_result_def_info Unexecuted instantiation: zend_func_info.c:_ssa_op1_def_info Unexecuted instantiation: zend_func_info.c:_ssa_op2_def_info Unexecuted instantiation: zend_func_info.c:_ssa_result_def_info Unexecuted instantiation: zend_inference.c:_ssa_op1_def_info Unexecuted instantiation: zend_inference.c:_ssa_op2_def_info Unexecuted instantiation: zend_inference.c:_ssa_result_def_info Unexecuted instantiation: zend_optimizer.c:_ssa_op1_def_info Unexecuted instantiation: zend_optimizer.c:_ssa_result_def_info Unexecuted instantiation: zend_optimizer.c:_ssa_op2_def_info Unexecuted instantiation: zend_ssa.c:_ssa_op1_def_info Unexecuted instantiation: zend_ssa.c:_ssa_op2_def_info Unexecuted instantiation: zend_ssa.c:_ssa_result_def_info |
189 | | |
190 | | |
191 | | DEFINE_SSA_OP_INFO(op1) |
192 | | DEFINE_SSA_OP_INFO(op2) |
193 | | DEFINE_SSA_OP_INFO(result) |
194 | | DEFINE_SSA_OP_DEF_INFO(op1) |
195 | | DEFINE_SSA_OP_DEF_INFO(op2) |
196 | | DEFINE_SSA_OP_DEF_INFO(result) |
197 | | |
198 | 0 | #define OP1_INFO() (_ssa_op1_info(op_array, ssa, opline, ssa_op)) |
199 | 0 | #define OP2_INFO() (_ssa_op2_info(op_array, ssa, opline, ssa_op)) |
200 | 0 | #define OP1_DATA_INFO() (_ssa_op1_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL)) |
201 | | #define OP2_DATA_INFO() (_ssa_op2_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL)) |
202 | 0 | #define RES_USE_INFO() (_ssa_result_info(op_array, ssa, opline, ssa_op)) |
203 | 0 | #define OP1_DEF_INFO() (_ssa_op1_def_info(op_array, ssa, opline, ssa_op)) |
204 | | #define OP2_DEF_INFO() (_ssa_op2_def_info(op_array, ssa, opline, ssa_op)) |
205 | | #define OP1_DATA_DEF_INFO() (_ssa_op1_def_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL)) |
206 | | #define OP2_DATA_DEF_INFO() (_ssa_op2_def_info(op_array, ssa, (opline+1), ssa_op ? (ssa_op+1) : NULL)) |
207 | 0 | #define RES_INFO() (_ssa_result_def_info(op_array, ssa, opline, ssa_op)) |
208 | | |
209 | 0 | static zend_always_inline bool zend_add_will_overflow(zend_long a, zend_long b) { |
210 | 0 | return (b > 0 && a > ZEND_LONG_MAX - b) |
211 | 0 | || (b < 0 && a < ZEND_LONG_MIN - b); |
212 | 0 | } Unexecuted instantiation: zend_jit.c:zend_add_will_overflow Unexecuted instantiation: dce.c:zend_add_will_overflow Unexecuted instantiation: dfa_pass.c:zend_add_will_overflow Unexecuted instantiation: escape_analysis.c:zend_add_will_overflow Unexecuted instantiation: sccp.c:zend_add_will_overflow Unexecuted instantiation: zend_call_graph.c:zend_add_will_overflow Unexecuted instantiation: zend_dump.c:zend_add_will_overflow Unexecuted instantiation: zend_func_info.c:zend_add_will_overflow Unexecuted instantiation: zend_inference.c:zend_add_will_overflow Unexecuted instantiation: zend_optimizer.c:zend_add_will_overflow Unexecuted instantiation: zend_ssa.c:zend_add_will_overflow |
213 | 0 | static zend_always_inline bool zend_sub_will_overflow(zend_long a, zend_long b) { |
214 | 0 | return (b > 0 && a < ZEND_LONG_MIN + b) |
215 | 0 | || (b < 0 && a > ZEND_LONG_MAX + b); |
216 | 0 | } Unexecuted instantiation: zend_jit.c:zend_sub_will_overflow Unexecuted instantiation: dce.c:zend_sub_will_overflow Unexecuted instantiation: dfa_pass.c:zend_sub_will_overflow Unexecuted instantiation: escape_analysis.c:zend_sub_will_overflow Unexecuted instantiation: sccp.c:zend_sub_will_overflow Unexecuted instantiation: zend_call_graph.c:zend_sub_will_overflow Unexecuted instantiation: zend_dump.c:zend_sub_will_overflow Unexecuted instantiation: zend_func_info.c:zend_sub_will_overflow Unexecuted instantiation: zend_inference.c:zend_sub_will_overflow Unexecuted instantiation: zend_optimizer.c:zend_sub_will_overflow Unexecuted instantiation: zend_ssa.c:zend_sub_will_overflow |
217 | | |
218 | | BEGIN_EXTERN_C() |
219 | | |
220 | | ZEND_API void zend_ssa_find_false_dependencies(const zend_op_array *op_array, const zend_ssa *ssa); |
221 | | ZEND_API void zend_ssa_find_sccs(const zend_op_array *op_array, zend_ssa *ssa); |
222 | | ZEND_API zend_result zend_ssa_inference(zend_arena **raena, const zend_op_array *op_array, const zend_script *script, zend_ssa *ssa, zend_long optimization_level); |
223 | | |
224 | | ZEND_API uint32_t zend_array_element_type(uint32_t t1, uint8_t op_type, bool write, bool insert); |
225 | | |
226 | | ZEND_API bool zend_inference_propagate_range(const zend_op_array *op_array, const zend_ssa *ssa, const zend_op *opline, const zend_ssa_op* ssa_op, int var, zend_ssa_range *tmp); |
227 | | |
228 | | ZEND_API uint32_t zend_fetch_arg_info_type( |
229 | | const zend_script *script, const zend_arg_info *arg_info, zend_class_entry **pce); |
230 | | ZEND_API void zend_init_func_return_info( |
231 | | const zend_op_array *op_array, const zend_script *script, zend_ssa_var_info *ret); |
232 | | uint32_t zend_get_return_info_from_signature_only( |
233 | | const zend_function *func, const zend_script *script, |
234 | | zend_class_entry **ce, bool *ce_is_instanceof, bool use_tentative_return_info); |
235 | | |
236 | | ZEND_API bool zend_may_throw_ex(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, const zend_ssa *ssa, uint32_t t1, uint32_t t2); |
237 | | ZEND_API bool zend_may_throw(const zend_op *opline, const zend_ssa_op *ssa_op, const zend_op_array *op_array, const zend_ssa *ssa); |
238 | | |
239 | | ZEND_API zend_result zend_update_type_info( |
240 | | const zend_op_array *op_array, zend_ssa *ssa, const zend_script *script, |
241 | | const zend_op *opline, zend_ssa_op *ssa_op, const zend_op **ssa_opcodes, |
242 | | zend_long optimization_level); |
243 | | |
244 | | END_EXTERN_C() |
245 | | |
246 | | #endif /* ZEND_INFERENCE_H */ |