com php-src: Also, use ZEND_ACC_PRELOADED for classes : Zend/zend_compile.h ext/opcache/ZendAccelerator.c
| From: | Dmitry Stogov | Date: | Mon, 29 Apr 2019 23:07:02 +0000 |
| Subject: | com php-src: Also, use ZEND_ACC_PRELOADED for classes : Zend/zend_compile.h ext/opcache/ZendAccelerator.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105984@lists.php.net to get a copy of this message | ||
Commit: 8cdd2158949994f110188818e84b54db9a0ed4d1
Author: Dmitry Stogov <dmitry@zend.com> Tue, 30 Apr 2019 02:07:02 +0300
Parents: ce65d2354c95069685136db409cb9d85ebd25328
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8cdd2158949994f110188818e84b54db9a0ed4d1
Log:
Also, use ZEND_ACC_PRELOADED for classes
Changed paths:
M Zend/zend_compile.h
M ext/opcache/ZendAccelerator.c
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 588022c..93cddfa 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -227,6 +227,9 @@ typedef struct _zend_oparray_context { /* Top-level class or function declaration | | | */ #define ZEND_ACC_TOP_LEVEL (1 << 9) /* X | X | | */ /* | | | */ +/* op_array or class is preloaded | | | */ +#define ZEND_ACC_PRELOADED (1 << 10) /* X | X | | */ +/* | | | */ /* Class Flags (unused: 16...) | | | */ /* =========== | | | */ /* | | | */ @@ -244,84 +247,81 @@ typedef struct _zend_oparray_context { /* | | | */ /* Class has magic methods __get/__set/__unset/ | | | */ /* __isset that use guards | | | */ -#define ZEND_ACC_USE_GUARDS (1 << 10) /* X | | | */ +#define ZEND_ACC_USE_GUARDS (1 << 11) /* X | | | */ /* | | | */ /* Class constants updated | | | */ -#define ZEND_ACC_CONSTANTS_UPDATED (1 << 11) /* X | | | */ +#define ZEND_ACC_CONSTANTS_UPDATED (1 << 12) /* X | | | */ /* | | | */ /* Class extends another class | | | */ -#define ZEND_ACC_INHERITED (1 << 12) /* X | | | */ +#define ZEND_ACC_INHERITED (1 << 13) /* X | | | */ /* | | | */ /* Class implements interface(s) | | | */ -#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 13) /* X | | | */ +#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 14) /* X | | | */ /* | | | */ /* Class uses trait(s) | | | */ -#define ZEND_ACC_IMPLEMENT_TRAITS (1 << 14) /* X | | | */ +#define ZEND_ACC_IMPLEMENT_TRAITS (1 << 15) /* X | | | */ /* | | | */ /* User class has methods with static variables | | | */ -#define ZEND_HAS_STATIC_IN_METHODS (1 << 15) /* X | | | */ +#define ZEND_HAS_STATIC_IN_METHODS (1 << 16) /* X | | | */ /* | | | */ /* Whether all property types are resolved to CEs | | | */ -#define ZEND_ACC_PROPERTY_TYPES_RESOLVED (1 << 16) /* X | | | */ +#define ZEND_ACC_PROPERTY_TYPES_RESOLVED (1 << 17) /* X | | | */ /* | | | */ /* Children must reuse parent get_iterator() | | | */ -#define ZEND_ACC_REUSE_GET_ITERATOR (1 << 17) /* X | | | */ +#define ZEND_ACC_REUSE_GET_ITERATOR (1 << 18) /* X | | | */ /* | | | */ /* Function Flags (unused: 28...30) | | | */ /* ============== | | | */ /* | | | */ /* deprecation flag | | | */ -#define ZEND_ACC_DEPRECATED (1 << 10) /* | X | | */ +#define ZEND_ACC_DEPRECATED (1 << 11) /* | X | | */ /* | | | */ /* Function returning by reference | | | */ -#define ZEND_ACC_RETURN_REFERENCE (1 << 11) /* | X | | */ +#define ZEND_ACC_RETURN_REFERENCE (1 << 12) /* | X | | */ /* | | | */ /* Function has a return type | | | */ -#define ZEND_ACC_HAS_RETURN_TYPE (1 << 12) /* | X | | */ +#define ZEND_ACC_HAS_RETURN_TYPE (1 << 13) /* | X | | */ /* | | | */ /* Function with variable number of arguments | | | */ -#define ZEND_ACC_VARIADIC (1 << 13) /* | X | | */ +#define ZEND_ACC_VARIADIC (1 << 14) /* | X | | */ /* | | | */ /* op_array has finally blocks (user only) | | | */ -#define ZEND_ACC_HAS_FINALLY_BLOCK (1 << 14) /* | X | | */ +#define ZEND_ACC_HAS_FINALLY_BLOCK (1 << 15) /* | X | | */ /* | | | */ /* "main" op_array with | | | */ /* ZEND_DECLARE_INHERITED_CLASS_DELAYED opcodes | | | */ -#define ZEND_ACC_EARLY_BINDING (1 << 15) /* | X | | */ +#define ZEND_ACC_EARLY_BINDING (1 << 16) /* | X | | */ /* | | | */ /* method flag (bc only), any method that has this | | | */ /* flag can be used statically and non statically. | | | */ -#define ZEND_ACC_ALLOW_STATIC (1 << 16) /* | X | | */ +#define ZEND_ACC_ALLOW_STATIC (1 << 17) /* | X | | */ /* | | | */ /* call through user function trampoline. e.g. | | | */ /* __call, __callstatic | | | */ -#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 17) /* | X | | */ +#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 18) /* | X | | */ /* | | | */ /* disable inline caching | | | */ -#define ZEND_ACC_NEVER_CACHE (1 << 18) /* | X | | */ +#define ZEND_ACC_NEVER_CACHE (1 << 19) /* | X | | */ /* | | | */ /* Closure related | | | */ -#define ZEND_ACC_CLOSURE (1 << 19) /* | X | | */ -#define ZEND_ACC_FAKE_CLOSURE (1 << 20) /* | X | | */ +#define ZEND_ACC_CLOSURE (1 << 20) /* | X | | */ +#define ZEND_ACC_FAKE_CLOSURE (1 << 21) /* | X | | */ /* | | | */ /* run_time_cache allocated on heap (user only) | | | */ -#define ZEND_ACC_HEAP_RT_CACHE (1 << 21) /* | X | | */ +#define ZEND_ACC_HEAP_RT_CACHE (1 << 22) /* | X | | */ /* | | | */ /* method flag used by Closure::__invoke() | | | */ -#define ZEND_ACC_USER_ARG_INFO (1 << 22) /* | X | | */ +#define ZEND_ACC_USER_ARG_INFO (1 << 23) /* | X | | */ /* | | | */ -#define ZEND_ACC_GENERATOR (1 << 23) /* | X | | */ +#define ZEND_ACC_GENERATOR (1 << 24) /* | X | | */ /* | | | */ -#define ZEND_ACC_DONE_PASS_TWO (1 << 24) /* | X | | */ +#define ZEND_ACC_DONE_PASS_TWO (1 << 25) /* | X | | */ /* | | | */ /* internal function is allocated at arena (int only) | | | */ -#define ZEND_ACC_ARENA_ALLOCATED (1 << 25) /* | X | | */ +#define ZEND_ACC_ARENA_ALLOCATED (1 << 26) /* | X | | */ /* | | | */ /* op_array is a clone of trait method | | | */ -#define ZEND_ACC_TRAIT_CLONE (1 << 26) /* | X | | */ -/* | | | */ -/* op_array is preloaded | | | */ -#define ZEND_ACC_PRELOADED (1 << 27) /* | X | | */ +#define ZEND_ACC_TRAIT_CLONE (1 << 27) /* | X | | */ /* | | | */ /* functions is a constructor | | | */ #define ZEND_ACC_CTOR (1 << 28) /* | X | | */ diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 44f91ca..7d578c0 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -3171,6 +3171,7 @@ static void preload_move_user_classes(HashTable *src, HashTable *dst) if (copy) { zend_function *function; + ce->ce_flags |= ZEND_ACC_PRELOADED; _zend_hash_append_ptr(dst, p->key, ce); ZEND_HASH_FOREACH_PTR(&ce->function_table, function) { if (EXPECTED(function->type == ZEND_USER_FUNCTION)) {
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 588022c..93cddfa 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -227,6 +227,9 @@ typedef struct _zend_oparray_context { /* Top-level class or function declaration | | | */ #define ZEND_ACC_TOP_LEVEL (1 << 9) /* X | X | | */ /* | | | */ +/* op_array or class is preloaded | | | */ +#define ZEND_ACC_PRELOADED (1 << 10) /* X | X | | */ +/* | | | */ /* Class Flags (unused: 16...) | | | */ /* =========== | | | */ /* | | | */ @@ -244,84 +247,81 @@ typedef struct _zend_oparray_context { /* | | | */ /* Class has magic methods __get/__set/__unset/ | | | */ /* __isset that use guards | | | */ -#define ZEND_ACC_USE_GUARDS (1 << 10) /* X | | | */ +#define ZEND_ACC_USE_GUARDS (1 << 11) /* X | | | */ /* | | | */ /* Class constants updated | | | */ -#define ZEND_ACC_CONSTANTS_UPDATED (1 << 11) /* X | | | */ +#define ZEND_ACC_CONSTANTS_UPDATED (1 << 12) /* X | | | */ /* | | | */ /* Class extends another class | | | */ -#define ZEND_ACC_INHERITED (1 << 12) /* X | | | */ +#define ZEND_ACC_INHERITED (1 << 13) /* X | | | */ /* | | | */ /* Class implements interface(s) | | | */ -#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 13) /* X | | | */ +#define ZEND_ACC_IMPLEMENT_INTERFACES (1 << 14) /* X | | | */ /* | | | */ /* Class uses trait(s) | | | */ -#define ZEND_ACC_IMPLEMENT_TRAITS (1 << 14) /* X | | | */ +#define ZEND_ACC_IMPLEMENT_TRAITS (1 << 15) /* X | | | */ /* | | | */ /* User class has methods with static variables | | | */ -#define ZEND_HAS_STATIC_IN_METHODS (1 << 15) /* X | | | */ +#define ZEND_HAS_STATIC_IN_METHODS (1 << 16) /* X | | | */ /* | | | */ /* Whether all property types are resolved to CEs | | | */ -#define ZEND_ACC_PROPERTY_TYPES_RESOLVED (1 << 16) /* X | | | */ +#define ZEND_ACC_PROPERTY_TYPES_RESOLVED (1 << 17) /* X | | | */ /* | | | */ /* Children must reuse parent get_iterator() | | | */ -#define ZEND_ACC_REUSE_GET_ITERATOR (1 << 17) /* X | | | */ +#define ZEND_ACC_REUSE_GET_ITERATOR (1 << 18) /* X | | | */ /* | | | */ /* Function Flags (unused: 28...30) | | | */ /* ============== | | | */ /* | | | */ /* deprecation flag | | | */ -#define ZEND_ACC_DEPRECATED (1 << 10) /* | X | | */ +#define ZEND_ACC_DEPRECATED (1 << 11) /* | X | | */ /* | | | */ /* Function returning by reference | | | */ -#define ZEND_ACC_RETURN_REFERENCE (1 << 11) /* | X | | */ +#define ZEND_ACC_RETURN_REFERENCE (1 << 12) /* | X | | */ /* | | | */ /* Function has a return type | | | */ -#define ZEND_ACC_HAS_RETURN_TYPE (1 << 12) /* | X | | */ +#define ZEND_ACC_HAS_RETURN_TYPE (1 << 13) /* | X | | */ /* | | | */ /* Function with variable number of arguments | | | */ -#define ZEND_ACC_VARIADIC (1 << 13) /* | X | | */ +#define ZEND_ACC_VARIADIC (1 << 14) /* | X | | */ /* | | | */ /* op_array has finally blocks (user only) | | | */ -#define ZEND_ACC_HAS_FINALLY_BLOCK (1 << 14) /* | X | | */ +#define ZEND_ACC_HAS_FINALLY_BLOCK (1 << 15) /* | X | | */ /* | | | */ /* "main" op_array with | | | */ /* ZEND_DECLARE_INHERITED_CLASS_DELAYED opcodes | | | */ -#define ZEND_ACC_EARLY_BINDING (1 << 15) /* | X | | */ +#define ZEND_ACC_EARLY_BINDING (1 << 16) /* | X | | */ /* | | | */ /* method flag (bc only), any method that has this | | | */ /* flag can be used statically and non statically. | | | */ -#define ZEND_ACC_ALLOW_STATIC (1 << 16) /* | X | | */ +#define ZEND_ACC_ALLOW_STATIC (1 << 17) /* | X | | */ /* | | | */ /* call through user function trampoline. e.g. | | | */ /* __call, __callstatic | | | */ -#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 17) /* | X | | */ +#define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 18) /* | X | | */ /* | | | */ /* disable inline caching | | | */ -#define ZEND_ACC_NEVER_CACHE (1 << 18) /* | X | | */ +#define ZEND_ACC_NEVER_CACHE (1 << 19) /* | X | | */ /* | | | */ /* Closure related | | | */ -#define ZEND_ACC_CLOSURE (1 << 19) /* | X | | */ -#define ZEND_ACC_FAKE_CLOSURE (1 << 20) /* | X | | */ +#define ZEND_ACC_CLOSURE (1 << 20) /* | X | | */ +#define ZEND_ACC_FAKE_CLOSURE (1 << 21) /* | X | | */ /* | | | */ /* run_time_cache allocated on heap (user only) | | | */ -#define ZEND_ACC_HEAP_RT_CACHE (1 << 21) /* | X | | */ +#define ZEND_ACC_HEAP_RT_CACHE (1 << 22) /* | X | | */ /* | | | */ /* method flag used by Closure::__invoke() | | | */ -#define ZEND_ACC_USER_ARG_INFO (1 << 22) /* | X | | */ +#define ZEND_ACC_USER_ARG_INFO (1 << 23) /* | X | | */ /* | | | */ -#define ZEND_ACC_GENERATOR (1 << 23) /* | X | | */ +#define ZEND_ACC_GENERATOR (1 << 24) /* | X | | */ /* | | | */ -#define ZEND_ACC_DONE_PASS_TWO (1 << 24) /* | X | | */ +#define ZEND_ACC_DONE_PASS_TWO (1 << 25) /* | X | | */ /* | | | */ /* internal function is allocated at arena (int only) | | | */ -#define ZEND_ACC_ARENA_ALLOCATED (1 << 25) /* | X | | */ +#define ZEND_ACC_ARENA_ALLOCATED (1 << 26) /* | X | | */ /* | | | */ /* op_array is a clone of trait method | | | */ -#define ZEND_ACC_TRAIT_CLONE (1 << 26) /* | X | | */ -/* | | | */ -/* op_array is preloaded | | | */ -#define ZEND_ACC_PRELOADED (1 << 27) /* | X | | */ +#define ZEND_ACC_TRAIT_CLONE (1 << 27) /* | X | | */ /* | | | */ /* functions is a constructor | | | */ #define ZEND_ACC_CTOR (1 << 28) /* | X | | */ diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 44f91ca..7d578c0 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -3171,6 +3171,7 @@ static void preload_move_user_classes(HashTable *src, HashTable *dst) if (copy) { zend_function *function; + ce->ce_flags |= ZEND_ACC_PRELOADED; _zend_hash_append_ptr(dst, p->key, ce); ZEND_HASH_FOREACH_PTR(&ce->function_table, function) { if (EXPECTED(function->type == ZEND_USER_FUNCTION)) {