com php-src: Fixed file-cache (Zend/tests/unused_shared_s tatic_variables.phpt): ext/opcache/zend_file_cach e.c
[email protected] (Dmitry Stogov)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: 648b756f35fdfc1948126ce954a3f7d6bd479ba5 Author: Dmitry Stogov <[email protected]> Fri, 3 Mar 2017 16:10:46 +0300 Parents: c082c92b7e5a32686c1c085868e01ed1c09e9635 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=648b756f35fdfc1948126ce954a3f7d6bd479ba5 Log: Fixed file-cache (Zend/tests/unused_shared_static_variables.phpt) Changed paths: M ext/opcache/zend_file_cache.c Diff: diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index a271659..2b65685 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -359,6 +359,25 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval); } + if (op_array->scope && !IS_SERIALIZED(op_array->opcodes)) { + if (UNEXPECTED(zend_shared_alloc_get_xlat_entry(op_array->opcodes))) { + op_array->refcount = (uint32_t*)(intptr_t)-1; + SERIALIZE_PTR(op_array->literals); + SERIALIZE_PTR(op_array->opcodes); + SERIALIZE_PTR(op_array->arg_info); + SERIALIZE_PTR(op_array->vars); + SERIALIZE_STR(op_array->function_name); + SERIALIZE_STR(op_array->filename); + SERIALIZE_PTR(op_array->brk_cont_array); + SERIALIZE_PTR(op_array->scope); + SERIALIZE_STR(op_array->doc_comment); + SERIALIZE_PTR(op_array->try_catch_array); + SERIALIZE_PTR(op_array->prototype); + return; + } + zend_shared_alloc_register_xlat_entry(op_array->opcodes, op_array->opcodes); + } + if (op_array->literals && !IS_SERIALIZED(op_array->literals)) { zval *p, *end; @@ -919,6 +938,22 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR); } + if (op_array->refcount) { + op_array->refcount = NULL; + UNSERIALIZE_PTR(op_array->literals); + UNSERIALIZE_PTR(op_array->opcodes); + UNSERIALIZE_PTR(op_array->arg_info); + UNSERIALIZE_PTR(op_array->vars); + UNSERIALIZE_STR(op_array->function_name); + UNSERIALIZE_STR(op_array->filename); + UNSERIALIZE_PTR(op_array->brk_cont_array); + UNSERIALIZE_PTR(op_array->scope); + UNSERIALIZE_STR(op_array->doc_comment); + UNSERIALIZE_PTR(op_array->try_catch_array); + UNSERIALIZE_PTR(op_array->prototype); + return; + } + if (op_array->literals && !IS_UNSERIALIZED(op_array->literals)) { zval *p, *end;