if (op_array->refcount) {
(*op_array->refcount)++;
}
- if (op_array->static_variables) {
- if (!(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
- GC_ADDREF(op_array->static_variables);
- }
+ if (op_array->static_variables
+ && !(GC_FLAGS(op_array->static_variables) & IS_ARRAY_IMMUTABLE)) {
+ GC_ADDREF(op_array->static_variables);
}
- ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
- 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);
+
+ 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);
+ ZEND_MAP_PTR_NEW(op_array->static_variables_ptr);
+ } else {
+ ZEND_MAP_PTR_INIT(op_array->static_variables_ptr, &op_array->static_variables);
+ 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);
+ }
} else if (function->type == ZEND_INTERNAL_FUNCTION) {
if (function->common.function_name) {
zend_string_addref(function->common.function_name);