From: Dmitry Stogov Date: Thu, 18 Feb 2021 12:46:48 +0000 (+0300) Subject: We don't need map_ptr slots for op_array.run_time_cache during preloading. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e988eaefb41e781f2e0c84e478e56e57d181908;p=php We don't need map_ptr slots for op_array.run_time_cache during preloading. --- diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d76b8f74ec..07c4e87621 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1046,13 +1046,8 @@ ZEND_API void function_add_ref(zend_function *function) /* {{{ */ (*op_array->refcount)++; } - if (CG(compiler_options) & ZEND_COMPILE_PRELOAD) { - ZEND_ASSERT(op_array->fn_flags & ZEND_ACC_PRELOADED); - ZEND_MAP_PTR_NEW(op_array->run_time_cache); - } else { - ZEND_MAP_PTR_INIT(op_array->run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void *))); - ZEND_MAP_PTR_SET(op_array->run_time_cache, NULL); - } + ZEND_MAP_PTR_INIT(op_array->run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void *))); + ZEND_MAP_PTR_SET(op_array->run_time_cache, NULL); zend_init_static_variables_map_ptr(op_array); } @@ -7024,12 +7019,11 @@ void zend_compile_func_decl(znode *result, zend_ast *ast, bool toplevel) /* {{{ if (CG(compiler_options) & ZEND_COMPILE_PRELOAD) { op_array->fn_flags |= ZEND_ACC_PRELOADED; - ZEND_MAP_PTR_NEW(op_array->run_time_cache); - } else { - ZEND_MAP_PTR_INIT(op_array->run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void *))); - ZEND_MAP_PTR_SET(op_array->run_time_cache, NULL); } + ZEND_MAP_PTR_INIT(op_array->run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void *))); + ZEND_MAP_PTR_SET(op_array->run_time_cache, NULL); + op_array->fn_flags |= (orig_op_array->fn_flags & ZEND_ACC_STRICT_TYPES); op_array->fn_flags |= decl->flags; op_array->line_start = decl->start_lineno;