From c739023a50876e2a90588f915803b0140a95638e Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 2 Sep 2019 14:05:28 +0300 Subject: [PATCH] Free two bits in fn_flags by merging ZEND_ACC_HEAP_RT_CACHE/ZEND_ACC_USER_ARG_INFO and ZEND_ACC_DONE_PASS_TWO/ZEND_ACC_ARENA_ALLOCATED that may be used only for user/internal functions --- Zend/zend_closures.c | 3 ++- Zend/zend_compile.h | 9 +++++---- Zend/zend_extensions.h | 2 +- Zend/zend_modules.h | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index df6516a300..ae22ea3ecd 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -183,7 +183,8 @@ ZEND_METHOD(Closure, call) if (fci_cache.function_handler->common.fn_flags & ZEND_ACC_GENERATOR) { /* copied upon generator creation */ GC_DELREF(&closure->std); - } else if (fci_cache.function_handler->common.fn_flags & ZEND_ACC_HEAP_RT_CACHE) { + } else if (ZEND_USER_CODE(my_function.type) + && fci_cache.function_handler->common.fn_flags & ZEND_ACC_HEAP_RT_CACHE) { efree(ZEND_MAP_PTR(my_function.op_array.run_time_cache)); } } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 5f97bde9ec..3e2a9cbe96 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -278,7 +278,7 @@ typedef struct _zend_oparray_context { /* Class has unresolved variance obligations. | | | */ #define ZEND_ACC_UNRESOLVED_VARIANCE (1 << 21) /* X | | | */ /* | | | */ -/* Function Flags | | | */ +/* Function Flags (unused: 23, 26) | | | */ /* ============== | | | */ /* | | | */ /* deprecation flag | | | */ @@ -318,15 +318,16 @@ typedef struct _zend_oparray_context { /* run_time_cache allocated on heap (user only) | | | */ #define ZEND_ACC_HEAP_RT_CACHE (1 << 22) /* | X | | */ /* | | | */ -/* method flag used by Closure::__invoke() | | | */ -#define ZEND_ACC_USER_ARG_INFO (1 << 23) /* | X | | */ +/* method flag used by Closure::__invoke() (int only) | | | */ +#define ZEND_ACC_USER_ARG_INFO (1 << 22) /* | X | | */ /* | | | */ #define ZEND_ACC_GENERATOR (1 << 24) /* | X | | */ /* | | | */ +/* function was processed by pass two (user only) | | | */ #define ZEND_ACC_DONE_PASS_TWO (1 << 25) /* | X | | */ /* | | | */ /* internal function is allocated at arena (int only) | | | */ -#define ZEND_ACC_ARENA_ALLOCATED (1 << 26) /* | X | | */ +#define ZEND_ACC_ARENA_ALLOCATED (1 << 25) /* | X | | */ /* | | | */ /* op_array is a clone of trait method | | | */ #define ZEND_ACC_TRAIT_CLONE (1 << 27) /* | X | | */ diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index ec2984c325..19cbf557c5 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -44,7 +44,7 @@ You can use the following macro to check the extension API version for compatibi /* The first number is the engine version and the rest is the date (YYYYMMDD). * This way engine 2/3 API no. is always greater than engine 1 API no.. */ -#define ZEND_EXTENSION_API_NO 320190529 +#define ZEND_EXTENSION_API_NO 320190902 typedef struct _zend_extension_version_info { int zend_extension_api_no; diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 330932285a..908acd7d32 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -31,7 +31,7 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module -#define ZEND_MODULE_API_NO 20190529 +#define ZEND_MODULE_API_NO 20190902 #ifdef ZTS #define USING_ZTS 1 #else -- 2.40.0