summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/opcache/Optimizer/sccp.c17
-rw-r--r--ext/opcache/Optimizer/zend_dump.c36
-rw-r--r--ext/opcache/Optimizer/zend_ssa.c6
3 files changed, 44 insertions, 15 deletions
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 347e1cc77a..5580395f5a 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -613,12 +613,8 @@ static inline int ct_eval_isset_isempty(zval *result, uint32_t extended_value, z
return SUCCESS;
}
-static inline void ct_eval_type_check(zval *result, uint32_t type, zval *op1) {
- if (type == _IS_BOOL) {
- ZVAL_BOOL(result, Z_TYPE_P(op1) == IS_TRUE || Z_TYPE_P(op1) == IS_FALSE);
- } else {
- ZVAL_BOOL(result, Z_TYPE_P(op1) == type);
- }
+static inline void ct_eval_type_check(zval *result, uint32_t type_mask, zval *op1) {
+ ZVAL_BOOL(result, (1 << Z_TYPE_P(op1)) & type_mask);
}
static inline int ct_eval_in_array(zval *result, uint32_t extended_value, zval *op1, zval *op2) {
@@ -961,14 +957,13 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
* even if we don't know the precise value. */
if (!value_known(op1)) {
uint32_t type = ctx->scdf.ssa->var_info[ssa_op->op1_use].type;
- uint32_t expected_type = opline->extended_value == _IS_BOOL
- ? (MAY_BE_TRUE|MAY_BE_FALSE) : (1 << opline->extended_value);
- if (!(type & expected_type) && !(type & MAY_BE_UNDEF)) {
+ uint32_t expected_type_mask = opline->extended_value;
+ if (!(type & expected_type_mask) && !(type & MAY_BE_UNDEF)) {
ZVAL_FALSE(&zv);
SET_RESULT(result, &zv);
return;
- } else if (!(type & ((MAY_BE_ANY|MAY_BE_UNDEF) - expected_type))
- && opline->extended_value != IS_RESOURCE) {
+ } else if (!(type & ((MAY_BE_ANY|MAY_BE_UNDEF) - expected_type_mask))
+ && !(expected_type_mask & MAY_BE_RESOURCE)) {
ZVAL_TRUE(&zv);
SET_RESULT(result, &zv);
return;
diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c
index 3910631335..280a77034b 100644
--- a/ext/opcache/Optimizer/zend_dump.c
+++ b/ext/opcache/Optimizer/zend_dump.c
@@ -500,6 +500,42 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
fprintf(stderr, " (\?\?\?)");
break;
}
+ } else if (ZEND_VM_EXT_TYPE_MASK == (flags & ZEND_VM_EXT_MASK)) {
+ switch (opline->extended_value) {
+ case (1<<IS_NULL):
+ fprintf(stderr, " (null)");
+ break;
+ case (1<<IS_FALSE):
+ fprintf(stderr, " (false)");
+ break;
+ case (1<<IS_TRUE):
+ fprintf(stderr, " (true)");
+ break;
+ case (1<<IS_LONG):
+ fprintf(stderr, " (long)");
+ break;
+ case (1<<IS_DOUBLE):
+ fprintf(stderr, " (double)");
+ break;
+ case (1<<IS_STRING):
+ fprintf(stderr, " (string)");
+ break;
+ case (1<<IS_ARRAY):
+ fprintf(stderr, " (array)");
+ break;
+ case (1<<IS_OBJECT):
+ fprintf(stderr, " (object)");
+ break;
+ case (1<<IS_RESOURCE):
+ fprintf(stderr, " (resource)");
+ break;
+ case ((1<<IS_FALSE)||(1<<IS_TRUE)):
+ fprintf(stderr, " (bool)");
+ break;
+ default:
+ fprintf(stderr, " (\?\?\?)");
+ break;
+ }
} else if (ZEND_VM_EXT_EVAL == (flags & ZEND_VM_EXT_MASK)) {
switch (opline->extended_value) {
case ZEND_EVAL:
diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c
index 7eb1333eef..6dfb13886e 100644
--- a/ext/opcache/Optimizer/zend_ssa.c
+++ b/ext/opcache/Optimizer/zend_ssa.c
@@ -154,12 +154,10 @@ static inline void pi_not_type_mask(zend_ssa_phi *phi, uint32_t type_mask) {
pi_type_mask(phi, ~type_mask & relevant);
}
static inline uint32_t mask_for_type_check(uint32_t type) {
- if (type == _IS_BOOL) {
- return MAY_BE_TRUE|MAY_BE_FALSE;
- } else if (type == IS_ARRAY) {
+ if (type & MAY_BE_ARRAY) {
return MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_ANY|MAY_BE_ARRAY_OF_ANY|MAY_BE_ARRAY_OF_REF;
} else {
- return 1 << type;
+ return type;
}
}