summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-05-31 19:02:51 +0300
committerDmitry Stogov <dmitry@zend.com>2018-05-31 19:02:51 +0300
commit9e0f131d2b0e8bf98859c12104a7b0cd8951c135 (patch)
tree30c12745ef12642c7ae6f1c5d8e27b8519d89326 /ext/opcache
parent35302c22acc2d54354c7146347edcc826ce1effe (diff)
downloadphp-git-9e0f131d2b0e8bf98859c12104a7b0cd8951c135.tar.gz
Fixed ISSET/ISEMPTY bit meaning to simplify run-time checks
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/Optimizer/compact_literals.c16
-rw-r--r--ext/opcache/Optimizer/sccp.c10
-rw-r--r--ext/opcache/Optimizer/zend_dump.c2
-rw-r--r--ext/opcache/Optimizer/zend_optimizer.c8
4 files changed, 18 insertions, 18 deletions
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c
index d9e5f919e9..ecdbbd5574 100644
--- a/ext/opcache/Optimizer/compact_literals.c
+++ b/ext/opcache/Optimizer/compact_literals.c
@@ -536,12 +536,12 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
// op2 property
if (opline->op1_type == IS_UNUSED &&
property_slot[opline->op2.constant] >= 0) {
- opline->extended_value = property_slot[opline->op2.constant] | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = property_slot[opline->op2.constant] | (opline->extended_value & ZEND_ISEMPTY);
} else {
- opline->extended_value = cache_size | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = cache_size | (opline->extended_value & ZEND_ISEMPTY);
cache_size += 2 * sizeof(void *);
if (opline->op1_type == IS_UNUSED) {
- property_slot[opline->op2.constant] = opline->extended_value & ~ZEND_ISSET;
+ property_slot[opline->op2.constant] = opline->extended_value & ~ZEND_ISEMPTY;
}
}
}
@@ -668,19 +668,19 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx
opline->op2.constant,
opline->op1.constant,
LITERAL_STATIC_PROPERTY,
- &cache_size) | (opline->extended_value & ZEND_ISSET);
+ &cache_size) | (opline->extended_value & ZEND_ISEMPTY);
} else {
- opline->extended_value = cache_size | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = cache_size | (opline->extended_value & ZEND_ISEMPTY);
cache_size += 2 * sizeof(void *);
}
} else if (opline->op2_type == IS_CONST) {
// op2 class
if (class_slot[opline->op2.constant] >= 0) {
- opline->extended_value = class_slot[opline->op2.constant] | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = class_slot[opline->op2.constant] | (opline->extended_value & ZEND_ISEMPTY);
} else {
- opline->extended_value = cache_size | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = cache_size | (opline->extended_value & ZEND_ISEMPTY);
cache_size += sizeof(void *);
- class_slot[opline->op2.constant] = opline->extended_value & ~ZEND_ISSET;
+ class_slot[opline->op2.constant] = opline->extended_value & ~ZEND_ISEMPTY;
}
}
break;
diff --git a/ext/opcache/Optimizer/sccp.c b/ext/opcache/Optimizer/sccp.c
index 23c5d5ac53..5511313fae 100644
--- a/ext/opcache/Optimizer/sccp.c
+++ b/ext/opcache/Optimizer/sccp.c
@@ -428,7 +428,7 @@ static inline int ct_eval_isset_dim(zval *result, uint32_t extended_value, zval
if (IS_PARTIAL_ARRAY(op1) && (!value || IS_BOT(value))) {
return FAILURE;
}
- if (extended_value & ZEND_ISSET) {
+ if (!(extended_value & ZEND_ISEMPTY)) {
ZVAL_BOOL(result, value && Z_TYPE_P(value) != IS_NULL);
} else {
ZVAL_BOOL(result, !value || !zend_is_true(value));
@@ -438,7 +438,7 @@ static inline int ct_eval_isset_dim(zval *result, uint32_t extended_value, zval
// TODO
return FAILURE;
} else {
- ZVAL_BOOL(result, !(extended_value & ZEND_ISSET));
+ ZVAL_BOOL(result, (extended_value & ZEND_ISEMPTY));
return SUCCESS;
}
}
@@ -585,14 +585,14 @@ static inline int ct_eval_isset_obj(zval *result, uint32_t extended_value, zval
if (!value || IS_BOT(value)) {
return FAILURE;
}
- if (extended_value & ZEND_ISSET) {
+ if (!(extended_value & ZEND_ISEMPTY)) {
ZVAL_BOOL(result, value && Z_TYPE_P(value) != IS_NULL);
} else {
ZVAL_BOOL(result, !value || !zend_is_true(value));
}
return SUCCESS;
} else {
- ZVAL_BOOL(result, !(extended_value & ZEND_ISSET));
+ ZVAL_BOOL(result, (extended_value & ZEND_ISEMPTY));
return SUCCESS;
}
}
@@ -651,7 +651,7 @@ static inline int ct_eval_incdec(zval *result, zend_uchar opcode, zval *op1) {
}
static inline int ct_eval_isset_isempty(zval *result, uint32_t extended_value, zval *op1) {
- if (extended_value & ZEND_ISSET) {
+ if (!(extended_value & ZEND_ISEMPTY)) {
ZVAL_BOOL(result, Z_TYPE_P(op1) != IS_NULL);
} else {
ZVAL_BOOL(result, !zend_is_true(op1));
diff --git a/ext/opcache/Optimizer/zend_dump.c b/ext/opcache/Optimizer/zend_dump.c
index e4516b59cc..fea4595963 100644
--- a/ext/opcache/Optimizer/zend_dump.c
+++ b/ext/opcache/Optimizer/zend_dump.c
@@ -568,7 +568,7 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
}
}
if (ZEND_VM_EXT_ISSET & flags) {
- if (opline->extended_value & ZEND_ISSET) {
+ if (!(opline->extended_value & ZEND_ISEMPTY)) {
fprintf(stderr, " (isset)");
} else {
fprintf(stderr, " (empty)");
diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c
index ffc04854e2..89f57a029e 100644
--- a/ext/opcache/Optimizer/zend_optimizer.c
+++ b/ext/opcache/Optimizer/zend_optimizer.c
@@ -328,10 +328,10 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array,
case ZEND_ISSET_ISEMPTY_STATIC_PROP:
TO_STRING_NOWARN(val);
opline->op1.constant = zend_optimizer_add_literal(op_array, val);
- if (opline->op2_type == IS_CONST && (opline->extended_value & ~ZEND_ISSET) + sizeof(void*) == op_array->cache_size) {
+ if (opline->op2_type == IS_CONST && (opline->extended_value & ~ZEND_ISEMPTY) + sizeof(void*) == op_array->cache_size) {
op_array->cache_size += sizeof(void *);
} else {
- opline->extended_value = alloc_cache_slots(op_array, 2) | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = alloc_cache_slots(op_array, 2) | (opline->extended_value & ZEND_ISEMPTY);
}
break;
case ZEND_SEND_VAR:
@@ -426,7 +426,7 @@ int zend_optimizer_update_op2_const(zend_op_array *op_array,
opline->op2.constant = zend_optimizer_add_literal(op_array, val);
zend_optimizer_add_literal_string(op_array, zend_string_tolower(Z_STR_P(val)));
if (opline->op1_type != IS_CONST) {
- opline->extended_value = alloc_cache_slots(op_array, 1) | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = alloc_cache_slots(op_array, 1) | (opline->extended_value & ZEND_ISEMPTY);
}
break;
case ZEND_INIT_FCALL:
@@ -495,7 +495,7 @@ int zend_optimizer_update_op2_const(zend_op_array *op_array,
case ZEND_ISSET_ISEMPTY_PROP_OBJ:
TO_STRING_NOWARN(val);
opline->op2.constant = zend_optimizer_add_literal(op_array, val);
- opline->extended_value = alloc_cache_slots(op_array, 2) | (opline->extended_value & ZEND_ISSET);
+ opline->extended_value = alloc_cache_slots(op_array, 2) | (opline->extended_value & ZEND_ISEMPTY);
break;
case ZEND_ASSIGN_ADD:
case ZEND_ASSIGN_SUB: