summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-06 10:42:25 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-06 10:42:25 +0100
commit4f5f72c7afa18a036bcd2e510141853e9ef143fe (patch)
tree97e18f0fbaea5efc2f1ce8105ae0d308dc6b49f3
parentac89139773a456f70f460fcc5fefb90c6326b257 (diff)
downloadphp-git-4f5f72c7afa18a036bcd2e510141853e9ef143fe.tar.gz
Remove ZEND_ACC_INHERITED flag
It is equivalent to checking ce->parent != NULL. Just adds more state that needs to be kept in sync.
-rw-r--r--Zend/zend_compile.c1
-rw-r--r--Zend/zend_compile.h5
-rw-r--r--ext/opcache/Optimizer/escape_analysis.c9
-rw-r--r--ext/opcache/Optimizer/zend_inference.c3
-rw-r--r--ext/opcache/jit/zend_jit_x86.dasc37
5 files changed, 22 insertions, 33 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 5a705c1947..afdabbae85 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -6606,7 +6606,6 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
if (extends_ast) {
ce->parent_name =
zend_resolve_const_class_name_reference(extends_ast, "class name");
- ce->ce_flags |= ZEND_ACC_INHERITED;
}
CG(active_class_entry) = ce;
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index 3be4b80f24..8df711b2a7 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -229,7 +229,7 @@ typedef struct _zend_oparray_context {
/* op_array or class is preloaded | | | */
#define ZEND_ACC_PRELOADED (1 << 10) /* X | X | | */
/* | | | */
-/* Class Flags (unused: 24...) | | | */
+/* Class Flags (unused: 13, 24...) | | | */
/* =========== | | | */
/* | | | */
/* Special class types | | | */
@@ -251,9 +251,6 @@ typedef struct _zend_oparray_context {
/* Class constants updated | | | */
#define ZEND_ACC_CONSTANTS_UPDATED (1 << 12) /* X | | | */
/* | | | */
-/* Class extends another class | | | */
-#define ZEND_ACC_INHERITED (1 << 13) /* X | | | */
-/* | | | */
/* Class implements interface(s) | | | */
#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 14) /* X | | | */
/* | | | */
diff --git a/ext/opcache/Optimizer/escape_analysis.c b/ext/opcache/Optimizer/escape_analysis.c
index f50bc19b25..3b8733eaae 100644
--- a/ext/opcache/Optimizer/escape_analysis.c
+++ b/ext/opcache/Optimizer/escape_analysis.c
@@ -177,11 +177,11 @@ static int is_allocation_def(zend_op_array *op_array, zend_ssa *ssa, int def, in
/* objects with destructors should escape */
if (opline->op1_type == IS_CONST) {
zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
- uint32_t forbidden_flags = ZEND_ACC_INHERITED
+ uint32_t forbidden_flags =
/* These flags will always cause an exception */
- | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
+ ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS
| ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT;
- if (ce && !ce->create_object && !ce->constructor &&
+ if (ce && !ce->parent && !ce->create_object && !ce->constructor &&
!ce->destructor && !ce->__get && !ce->__set &&
!(ce->ce_flags & forbidden_flags) &&
(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
@@ -247,8 +247,7 @@ static int is_local_def(zend_op_array *op_array, zend_ssa *ssa, int def, int var
if (opline->op1_type == IS_CONST) {
zend_class_entry *ce = get_class_entry(script, Z_STR_P(CRT_CONSTANT(opline->op1)+1));
if (ce && !ce->create_object && !ce->constructor &&
- !ce->destructor && !ce->__get && !ce->__set &&
- !(ce->ce_flags & ZEND_ACC_INHERITED)) {
+ !ce->destructor && !ce->__get && !ce->__set && !ce->parent) {
return 1;
}
}
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 38124cb3d8..90273e2ffd 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -4538,8 +4538,7 @@ int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ss
zend_class_entry *ce = var_info->ce;
if (var_info->is_instanceof ||
- !ce || ce->create_object || ce->__get || ce->__set ||
- (ce->ce_flags & ZEND_ACC_INHERITED)) {
+ !ce || ce->create_object || ce->__get || ce->__set || ce->parent) {
return 1;
}
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index a748bb2599..2dd89885e0 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -8842,28 +8842,23 @@ static uint32_t zend_get_known_property_offset(zend_class_entry *ce, zend_string
return ZEND_WRONG_PROPERTY_OFFSET;
}
- if (ce->ce_flags & ZEND_ACC_INHERITED) {
- if (!ce->parent) {
- /* property offsets may be changed by inheritance */
- return ZEND_WRONG_PROPERTY_OFFSET;
- } else {
- zend_class_entry *parent = ce->parent;
+ if (ce->parent) {
+ zend_class_entry *parent = ce->parent;
- do {
- if (parent->type == ZEND_INTERNAL_CLASS) {
- break;
- } else if (parent->info.user.filename != filename) {
- /* some of parents class declarations might be changed infdependently */
- /* TODO: this check may be not enough, because even
- * in the same it's possible to conditionally define
- * few classes with the same name, and "parent" may
- * change from request to request.
- */
- return ZEND_WRONG_PROPERTY_OFFSET;
- }
- parent = parent->parent;
- } while (parent);
- }
+ do {
+ if (parent->type == ZEND_INTERNAL_CLASS) {
+ break;
+ } else if (parent->info.user.filename != filename) {
+ /* some of parents class declarations might be changed infdependently */
+ /* TODO: this check may be not enough, because even
+ * in the same it's possible to conditionally define
+ * few classes with the same name, and "parent" may
+ * change from request to request.
+ */
+ return ZEND_WRONG_PROPERTY_OFFSET;
+ }
+ parent = parent->parent;
+ } while (parent);
}
info = (zend_property_info*)zend_hash_find_ptr(&ce->properties_info, member);