PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - ext/opcache - zend_persist.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 237 455 52.1 %
Date: 2015-06-27 Functions: 11 14 78.6 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend OPcache                                                         |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2015 The PHP Group                                |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 3.01 of the PHP license,      |
       8             :    | that is bundled with this package in the file LICENSE, and is        |
       9             :    | available through the world-wide-web at the following url:           |
      10             :    | http://www.php.net/license/3_01.txt                                  |
      11             :    | If you did not receive a copy of the PHP license and are unable to   |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@php.net so we can mail you a copy immediately.               |
      14             :    +----------------------------------------------------------------------+
      15             :    | Authors: Andi Gutmans <andi@zend.com>                                |
      16             :    |          Zeev Suraski <zeev@zend.com>                                |
      17             :    |          Stanislav Malyshev <stas@zend.com>                          |
      18             :    |          Dmitry Stogov <dmitry@zend.com>                             |
      19             :    +----------------------------------------------------------------------+
      20             : */
      21             : 
      22             : #include "zend.h"
      23             : #include "ZendAccelerator.h"
      24             : #include "zend_persist.h"
      25             : #include "zend_extensions.h"
      26             : #include "zend_shared_alloc.h"
      27             : #include "zend_vm.h"
      28             : #include "zend_constants.h"
      29             : #include "zend_operators.h"
      30             : 
      31             : #define zend_accel_store(p, size) \
      32             :             (p = _zend_shared_memdup((void*)p, size, 1))
      33             : #define zend_accel_memdup(p, size) \
      34             :             _zend_shared_memdup((void*)p, size, 0)
      35             : 
      36             : #define zend_accel_store_string(str) do { \
      37             :                 zend_string *new_str = zend_shared_alloc_get_xlat_entry(str); \
      38             :                 if (new_str) { \
      39             :                         zend_string_release(str); \
      40             :                         str = new_str; \
      41             :                 } else { \
      42             :                 new_str = zend_accel_memdup((void*)str, _STR_HEADER_SIZE + (str)->len + 1); \
      43             :                         zend_string_release(str); \
      44             :                 str = new_str; \
      45             :                 zend_string_hash_val(str); \
      46             :                 GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \
      47             :                 } \
      48             :     } while (0)
      49             : #define zend_accel_memdup_string(str) do { \
      50             :                 str = zend_accel_memdup(str, _STR_HEADER_SIZE + (str)->len + 1); \
      51             :         zend_string_hash_val(str); \
      52             :                 GC_FLAGS(str) = IS_STR_INTERNED | IS_STR_PERMANENT; \
      53             :         } while (0)
      54             : #define zend_accel_store_interned_string(str) do { \
      55             :                 if (!IS_ACCEL_INTERNED(str)) { \
      56             :                         zend_accel_store_string(str); \
      57             :                 } \
      58             :         } while (0)
      59             : #define zend_accel_memdup_interned_string(str) do { \
      60             :                 if (!IS_ACCEL_INTERNED(str)) { \
      61             :                         zend_accel_memdup_string(str); \
      62             :                 } \
      63             :         } while (0)
      64             : 
      65             : typedef void (*zend_persist_func_t)(zval*);
      66             : 
      67             : static void zend_persist_zval(zval *z);
      68             : static void zend_persist_zval_const(zval *z);
      69             : 
      70             : static const uint32_t uninitialized_bucket[-HT_MIN_MASK] =
      71             :         {HT_INVALID_IDX, HT_INVALID_IDX};
      72             : 
      73         962 : static void zend_hash_persist(HashTable *ht, zend_persist_func_t pPersistElement)
      74             : {
      75             :         uint32_t idx, nIndex;
      76             :         Bucket *p;
      77             : 
      78         962 :         if (!(ht->u.flags & HASH_FLAG_INITIALIZED)) {
      79         466 :                 HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
      80         466 :                 return;
      81             :         }
      82         496 :         if (ht->u.flags & HASH_FLAG_PACKED) {
      83          12 :                 void *data = HT_GET_DATA_ADDR(ht);
      84          12 :                 zend_accel_store(data, HT_USED_SIZE(ht));
      85          12 :                 HT_SET_DATA_ADDR(ht, data);
      86         484 :         } else if (ht->nNumUsed < -(int32_t)ht->nTableMask / 2) {
      87             :                 /* compact table */
      88         480 :                 void *old_data = HT_GET_DATA_ADDR(ht);
      89         480 :                 Bucket *old_buckets = ht->arData;
      90         480 :                 int32_t hash_size = -(int32_t)ht->nTableMask;
      91             : 
      92        6160 :                 while (hash_size >> 1 > ht->nNumUsed) {
      93        5200 :                         hash_size >>= 1;
      94             :                 }
      95         480 :                 ht->nTableMask = -hash_size;
      96         480 :                 HT_SET_DATA_ADDR(ht, ZCG(mem));
      97         480 :                 ZCG(mem) = (void*)((char*)ZCG(mem) + ZEND_ALIGNED_SIZE((hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket))));
      98         480 :                 HT_HASH_RESET(ht);
      99         480 :                 memcpy(ht->arData, old_buckets, ht->nNumUsed * sizeof(Bucket));
     100         480 :                 efree(old_data);
     101             : 
     102         570 :                 for (idx = 0; idx < ht->nNumUsed; idx++) {
     103          90 :                         p = ht->arData + idx;
     104         180 :                         if (Z_TYPE(p->val) == IS_UNDEF) continue;
     105             : 
     106             :                         /* persist bucket and key */
     107          83 :                         if (p->key) {
     108          83 :                                 zend_accel_store_interned_string(p->key);
     109             :                         }
     110             : 
     111             :                         /* persist the data itself */
     112          83 :                         pPersistElement(&p->val);
     113             : 
     114          83 :                         nIndex = p->h | ht->nTableMask;
     115          83 :                         Z_NEXT(p->val) = HT_HASH(ht, nIndex);
     116          83 :                         HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
     117             :                 }
     118         480 :                 return;
     119             :         } else {
     120           4 :                 void *data = ZCG(mem);
     121           4 :                 void *old_data = HT_GET_DATA_ADDR(ht);
     122             : 
     123           4 :                 ZCG(mem) = (void*)((char*)data + HT_USED_SIZE(ht));
     124           4 :                 memcpy(data, old_data, HT_USED_SIZE(ht));
     125           4 :                 efree(old_data);
     126           4 :                 HT_SET_DATA_ADDR(ht, data);
     127             :         }
     128             : 
     129         111 :         for (idx = 0; idx < ht->nNumUsed; idx++) {
     130          95 :                 p = ht->arData + idx;
     131         190 :                 if (Z_TYPE(p->val) == IS_UNDEF) continue;
     132             : 
     133             :                 /* persist bucket and key */
     134          95 :                 if (p->key) {
     135          58 :                         zend_accel_store_interned_string(p->key);
     136             :                 }
     137             : 
     138             :                 /* persist the data itself */
     139          95 :                 pPersistElement(&p->val);
     140             :         }
     141             : }
     142             : 
     143           0 : static void zend_hash_persist_immutable(HashTable *ht)
     144             : {
     145             :         uint32_t idx, nIndex;
     146             :         Bucket *p;
     147             : 
     148           0 :         if (!(ht->u.flags & HASH_FLAG_INITIALIZED)) {
     149           0 :                 HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
     150           0 :                 return;
     151             :         }
     152           0 :         if (ht->u.flags & HASH_FLAG_PACKED) {
     153           0 :                 HT_SET_DATA_ADDR(ht, zend_accel_memdup(HT_GET_DATA_ADDR(ht), HT_USED_SIZE(ht)));
     154           0 :         } else if (ht->nNumUsed < -(int32_t)ht->nTableMask / 2) {
     155             :                 /* compact table */
     156           0 :                 void *old_data = HT_GET_DATA_ADDR(ht);
     157           0 :                 Bucket *old_buckets = ht->arData;
     158           0 :                 int32_t hash_size = -(int32_t)ht->nTableMask;
     159             : 
     160           0 :                 while (hash_size >> 1 > ht->nNumUsed) {
     161           0 :                         hash_size >>= 1;
     162             :                 }
     163           0 :                 ht->nTableMask = -hash_size;
     164           0 :                 HT_SET_DATA_ADDR(ht, ZCG(mem));
     165           0 :                 ZCG(mem) = (void*)((char*)ZCG(mem) + (hash_size * sizeof(uint32_t)) + (ht->nNumUsed * sizeof(Bucket)));
     166           0 :                 HT_HASH_RESET(ht);
     167           0 :                 memcpy(ht->arData, old_buckets, ht->nNumUsed * sizeof(Bucket));
     168           0 :                 efree(old_data);
     169             : 
     170           0 :                 for (idx = 0; idx < ht->nNumUsed; idx++) {
     171           0 :                         p = ht->arData + idx;
     172           0 :                         if (Z_TYPE(p->val) == IS_UNDEF) continue;
     173             : 
     174             :                         /* persist bucket and key */
     175           0 :                         if (p->key) {
     176           0 :                                 zend_accel_memdup_interned_string(p->key);
     177             :                         }
     178             : 
     179             :                         /* persist the data itself */
     180           0 :                         zend_persist_zval_const(&p->val);
     181             : 
     182           0 :                         nIndex = p->h | ht->nTableMask;
     183           0 :                         Z_NEXT(p->val) = HT_HASH(ht, nIndex);
     184           0 :                         HT_HASH(ht, nIndex) = HT_IDX_TO_HASH(idx);
     185             :                 }
     186           0 :                 return;
     187             :         } else {
     188           0 :                 void *data = ZCG(mem);
     189             : 
     190           0 :                 ZCG(mem) = (void*)((char*)data + HT_USED_SIZE(ht));
     191           0 :                 memcpy(data, HT_GET_DATA_ADDR(ht), HT_USED_SIZE(ht));
     192           0 :                 HT_SET_DATA_ADDR(ht, data);
     193             :         }
     194           0 :         for (idx = 0; idx < ht->nNumUsed; idx++) {
     195           0 :                 p = ht->arData + idx;
     196           0 :                 if (Z_TYPE(p->val) == IS_UNDEF) continue;
     197             : 
     198             :                 /* persist bucket and key */
     199           0 :                 if (p->key) {
     200           0 :                         zend_accel_memdup_interned_string(p->key);
     201             :                 }
     202             : 
     203             :                 /* persist the data itself */
     204           0 :                 zend_persist_zval_const(&p->val);
     205             :         }
     206             : }
     207             : 
     208           0 : static zend_ast *zend_persist_ast(zend_ast *ast)
     209             : {
     210             :         uint32_t i;
     211             :         zend_ast *node;
     212             : 
     213           0 :         if (ast->kind == ZEND_AST_ZVAL) {
     214           0 :                 zend_ast_zval *copy = zend_accel_memdup(ast, sizeof(zend_ast_zval));
     215           0 :                 zend_persist_zval(&copy->val);
     216           0 :                 node = (zend_ast *) copy;
     217             :         } else if (zend_ast_is_list(ast)) {
     218           0 :                 zend_ast_list *list = zend_ast_get_list(ast);
     219           0 :                 zend_ast_list *copy = zend_accel_memdup(ast,
     220             :                         sizeof(zend_ast_list) - sizeof(zend_ast *) + sizeof(zend_ast *) * list->children);
     221           0 :                 for (i = 0; i < list->children; i++) {
     222           0 :                         if (copy->child[i]) {
     223           0 :                                 copy->child[i] = zend_persist_ast(copy->child[i]);
     224             :                         }
     225             :                 }
     226           0 :                 node = (zend_ast *) copy;
     227             :         } else {
     228           0 :                 uint32_t children = zend_ast_get_num_children(ast);
     229           0 :                 node = zend_accel_memdup(ast, sizeof(zend_ast) - sizeof(zend_ast *) + sizeof(zend_ast *) * children);
     230           0 :                 for (i = 0; i < children; i++) {
     231           0 :                         if (node->child[i]) {
     232           0 :                                 node->child[i] = zend_persist_ast(node->child[i]);
     233             :                         }
     234             :                 }
     235             :         }
     236             : 
     237           0 :         efree(ast);
     238           0 :         return node;
     239             : }
     240             : 
     241        3126 : static void zend_persist_zval(zval *z)
     242             : {
     243             :         zend_uchar flags;
     244             :         void *new_ptr;
     245             : 
     246        3126 :         switch (Z_TYPE_P(z)) {
     247             :                 case IS_STRING:
     248             :                 case IS_CONSTANT:
     249        2424 :                         flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT);
     250        2424 :                         zend_accel_store_interned_string(Z_STR_P(z));
     251        2424 :                         Z_GC_FLAGS_P(z) |= flags;
     252        2424 :                         Z_TYPE_FLAGS_P(z) &= ~(IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
     253        2424 :                         break;
     254             :                 case IS_ARRAY:
     255          62 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_ARR_P(z));
     256          62 :                         if (new_ptr) {
     257           0 :                                 Z_ARR_P(z) = new_ptr;
     258           0 :                                 Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE;
     259             :                         } else {
     260          62 :                                 if (Z_IMMUTABLE_P(z)) {
     261           0 :                                         Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array));
     262           0 :                                         zend_hash_persist_immutable(Z_ARRVAL_P(z));
     263             :                                 } else {
     264          62 :                                         GC_REMOVE_FROM_BUFFER(Z_ARR_P(z));
     265          62 :                                         zend_accel_store(Z_ARR_P(z), sizeof(zend_array));
     266          62 :                                         zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval);
     267             :                                         /* make immutable array */
     268          62 :                                         Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE;
     269          62 :                                         GC_REFCOUNT(Z_COUNTED_P(z)) = 2;
     270          62 :                                         GC_FLAGS(Z_COUNTED_P(z)) |= IS_ARRAY_IMMUTABLE;
     271          62 :                                         Z_ARRVAL_P(z)->u.flags |= HASH_FLAG_STATIC_KEYS;
     272          62 :                                         Z_ARRVAL_P(z)->u.flags &= ~HASH_FLAG_APPLY_PROTECTION;
     273             :                                 }
     274             :                         }
     275          62 :                         break;
     276             :                 case IS_REFERENCE:
     277           0 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_REF_P(z));
     278           0 :                         if (new_ptr) {
     279           0 :                                 Z_REF_P(z) = new_ptr;
     280             :                         } else {
     281           0 :                                 zend_accel_store(Z_REF_P(z), sizeof(zend_reference));
     282           0 :                                 zend_persist_zval(Z_REFVAL_P(z));
     283             :                         }
     284           0 :                         break;
     285             :                 case IS_CONSTANT_AST:
     286           0 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_AST_P(z));
     287           0 :                         if (new_ptr) {
     288           0 :                                 Z_AST_P(z) = new_ptr;
     289             :                         } else {
     290           0 :                                 zend_accel_store(Z_AST_P(z), sizeof(zend_ast_ref));
     291           0 :                                 Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z));
     292             :                         }
     293             :                         break;
     294             :         }
     295        3126 : }
     296             : 
     297          13 : static void zend_persist_zval_static(zval *z)
     298             : {
     299             :         zend_uchar flags;
     300             :         void *new_ptr;
     301             : 
     302          13 :         switch (Z_TYPE_P(z)) {
     303             :                 case IS_STRING:
     304             :                 case IS_CONSTANT:
     305           0 :                         flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT);
     306           0 :                         zend_accel_store_interned_string(Z_STR_P(z));
     307           0 :                         Z_GC_FLAGS_P(z) |= flags;
     308           0 :                         Z_TYPE_FLAGS_P(z) &= ~(IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
     309           0 :                         break;
     310             :                 case IS_ARRAY:
     311          12 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_ARR_P(z));
     312          12 :                         if (new_ptr) {
     313           0 :                                 Z_ARR_P(z) = new_ptr;
     314           0 :                                 Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE;
     315             :                         } else {
     316          12 :                                 if (Z_IMMUTABLE_P(z)) {
     317           0 :                                         Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array));
     318           0 :                                         zend_hash_persist_immutable(Z_ARRVAL_P(z));
     319             :                                 } else {
     320          12 :                                         GC_REMOVE_FROM_BUFFER(Z_ARR_P(z));
     321          12 :                                         zend_accel_store(Z_ARR_P(z), sizeof(zend_array));
     322          12 :                                         zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval);
     323             :                                         /* make immutable array */
     324          12 :                                         Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE;
     325          12 :                                         GC_REFCOUNT(Z_COUNTED_P(z)) = 2;
     326          12 :                                         GC_FLAGS(Z_COUNTED_P(z)) |= IS_ARRAY_IMMUTABLE;
     327          12 :                                         Z_ARRVAL_P(z)->u.flags |= HASH_FLAG_STATIC_KEYS;
     328          12 :                                         Z_ARRVAL_P(z)->u.flags &= ~HASH_FLAG_APPLY_PROTECTION;
     329             :                                 }
     330             :                         }
     331          12 :                         break;
     332             :                 case IS_REFERENCE:
     333           0 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_REF_P(z));
     334           0 :                         if (new_ptr) {
     335           0 :                                 Z_REF_P(z) = new_ptr;
     336             :                         } else {
     337           0 :                                 zend_accel_store(Z_REF_P(z), sizeof(zend_reference));
     338           0 :                                 zend_persist_zval(Z_REFVAL_P(z));
     339             :                         }
     340           0 :                         break;
     341             :                 case IS_CONSTANT_AST:
     342           0 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_AST_P(z));
     343           0 :                         if (new_ptr) {
     344           0 :                                 Z_AST_P(z) = new_ptr;
     345           0 :                                 Z_TYPE_FLAGS_P(z) = IS_TYPE_CONSTANT | IS_TYPE_IMMUTABLE;
     346             :                         } else {
     347           0 :                                 zend_accel_store(Z_AST_P(z), sizeof(zend_ast_ref));
     348           0 :                                 Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z));
     349           0 :                                 Z_TYPE_FLAGS_P(z) = IS_TYPE_CONSTANT | IS_TYPE_IMMUTABLE;
     350           0 :                                 GC_REFCOUNT(Z_COUNTED_P(z)) = 2;
     351             :                         }
     352             :                         break;
     353             :         }
     354          13 : }
     355             : 
     356           0 : static void zend_persist_zval_const(zval *z)
     357             : {
     358             :         zend_uchar flags;
     359             :         void *new_ptr;
     360             : 
     361           0 :         switch (Z_TYPE_P(z)) {
     362             :                 case IS_STRING:
     363             :                 case IS_CONSTANT:
     364           0 :                         flags = Z_GC_FLAGS_P(z) & ~ (IS_STR_PERSISTENT | IS_STR_INTERNED | IS_STR_PERMANENT);
     365           0 :                         zend_accel_memdup_interned_string(Z_STR_P(z));
     366           0 :                         Z_GC_FLAGS_P(z) |= flags;
     367           0 :                         Z_TYPE_FLAGS_P(z) &= ~(IS_TYPE_REFCOUNTED | IS_TYPE_COPYABLE);
     368           0 :                         break;
     369             :                 case IS_ARRAY:
     370           0 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_ARR_P(z));
     371           0 :                         if (new_ptr) {
     372           0 :                                 Z_ARR_P(z) = new_ptr;
     373           0 :                                 Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE;
     374             :                         } else {
     375           0 :                                 if (Z_IMMUTABLE_P(z)) {
     376           0 :                                         Z_ARR_P(z) = zend_accel_memdup(Z_ARR_P(z), sizeof(zend_array));
     377           0 :                                         zend_hash_persist_immutable(Z_ARRVAL_P(z));
     378             :                                 } else {
     379           0 :                                         GC_REMOVE_FROM_BUFFER(Z_ARR_P(z));
     380           0 :                                         zend_accel_store(Z_ARR_P(z), sizeof(zend_array));
     381           0 :                                         zend_hash_persist(Z_ARRVAL_P(z), zend_persist_zval);
     382             :                                         /* make immutable array */
     383           0 :                                         Z_TYPE_FLAGS_P(z) = IS_TYPE_IMMUTABLE;
     384           0 :                                         GC_REFCOUNT(Z_COUNTED_P(z)) = 2;
     385           0 :                                         GC_FLAGS(Z_COUNTED_P(z)) |= IS_ARRAY_IMMUTABLE;
     386           0 :                                         Z_ARRVAL_P(z)->u.flags |= HASH_FLAG_STATIC_KEYS;
     387           0 :                                         Z_ARRVAL_P(z)->u.flags &= ~HASH_FLAG_APPLY_PROTECTION;
     388             :                                 }
     389             :                         }
     390           0 :                         break;
     391             :                 case IS_REFERENCE:
     392           0 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_REF_P(z));
     393           0 :                         if (new_ptr) {
     394           0 :                                 Z_REF_P(z) = new_ptr;
     395             :                         } else {
     396           0 :                                 zend_accel_store(Z_REF_P(z), sizeof(zend_reference));
     397           0 :                                 zend_persist_zval(Z_REFVAL_P(z));
     398             :                         }
     399           0 :                         break;
     400             :                 case IS_CONSTANT_AST:
     401           0 :                         new_ptr = zend_shared_alloc_get_xlat_entry(Z_AST_P(z));
     402           0 :                         if (new_ptr) {
     403           0 :                                 Z_AST_P(z) = new_ptr;
     404             :                         } else {
     405           0 :                                 zend_accel_store(Z_AST_P(z), sizeof(zend_ast_ref));
     406           0 :                                 Z_ASTVAL_P(z) = zend_persist_ast(Z_ASTVAL_P(z));
     407             :                         }
     408             :                         break;
     409             :         }
     410           0 : }
     411             : 
     412         460 : static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_script* main_persistent_script)
     413             : {
     414         460 :         int already_stored = 0;
     415             :         zend_op *persist_ptr;
     416         460 :         zval *orig_literals = NULL;
     417             : 
     418         460 :         if (op_array->type != ZEND_USER_FUNCTION) {
     419           0 :                 return;
     420             :         }
     421             : 
     422         460 :         if (op_array->refcount && --(*op_array->refcount) == 0) {
     423         460 :                 efree(op_array->refcount);
     424             :         }
     425         460 :         op_array->refcount = NULL;
     426             : 
     427         460 :         if (main_persistent_script) {
     428         427 :                 zend_execute_data *orig_execute_data = EG(current_execute_data);
     429             :                 zend_execute_data fake_execute_data;
     430             :                 zval *offset;
     431             : 
     432         427 :                 memset(&fake_execute_data, 0, sizeof(fake_execute_data));
     433         427 :                 fake_execute_data.func = (zend_function*)op_array;
     434         427 :                 EG(current_execute_data) = &fake_execute_data;
     435         427 :                 if ((offset = zend_get_constant_str("__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__") - 1)) != NULL) {
     436          95 :                         main_persistent_script->compiler_halt_offset = Z_LVAL_P(offset);
     437             :                 }
     438         427 :                 EG(current_execute_data) = orig_execute_data;
     439             :         }
     440             : 
     441         460 :         if (op_array->static_variables) {
     442          13 :                 HashTable *stored = zend_shared_alloc_get_xlat_entry(op_array->static_variables);
     443             : 
     444          13 :                 if (stored) {
     445           0 :                         op_array->static_variables = stored;
     446             :                 } else {
     447          13 :                         zend_hash_persist(op_array->static_variables, zend_persist_zval_static);
     448          13 :                         zend_accel_store(op_array->static_variables, sizeof(HashTable));
     449             :                         /* make immutable array */
     450          13 :                         GC_REFCOUNT(op_array->static_variables) = 2;
     451          13 :                         GC_TYPE_INFO(op_array->static_variables) = IS_ARRAY | (IS_ARRAY_IMMUTABLE << 8);
     452          13 :                         op_array->static_variables->u.flags |= HASH_FLAG_STATIC_KEYS;
     453          13 :                         op_array->static_variables->u.flags &= ~HASH_FLAG_APPLY_PROTECTION;
     454             :                 }
     455             :         }
     456             : 
     457         460 :         if (zend_shared_alloc_get_xlat_entry(op_array->opcodes)) {
     458           0 :                 already_stored = 1;
     459             :         }
     460             : 
     461         460 :         if (op_array->literals) {
     462         460 :                 if (already_stored) {
     463           0 :                         orig_literals = zend_shared_alloc_get_xlat_entry(op_array->literals);
     464             :                         ZEND_ASSERT(orig_literals != NULL);
     465           0 :                         op_array->literals = orig_literals;
     466             :                 } else {
     467         460 :                         zval *p = zend_accel_memdup(op_array->literals, sizeof(zval) * op_array->last_literal);
     468         460 :                         zval *end = p + op_array->last_literal;
     469         460 :                         orig_literals = op_array->literals;
     470         460 :                         op_array->literals = p;
     471        3921 :                         while (p < end) {
     472        3001 :                                 zend_persist_zval(p);
     473        3001 :                                 p++;
     474             :                         }
     475         460 :                         efree(orig_literals);
     476             :                 }
     477             :         }
     478             : 
     479         460 :         if (already_stored) {
     480           0 :                 persist_ptr = zend_shared_alloc_get_xlat_entry(op_array->opcodes);
     481             :                 ZEND_ASSERT(persist_ptr != NULL);
     482           0 :                 op_array->opcodes = persist_ptr;
     483             :         } else {
     484         460 :                 zend_op *new_opcodes = zend_accel_memdup(op_array->opcodes, sizeof(zend_op) * op_array->last);
     485             : #if ZEND_USE_ABS_CONST_ADDR || ZEND_USE_ABS_JMP_ADDR
     486             :                 zend_op *opline = new_opcodes;
     487             :                 zend_op *end = new_opcodes + op_array->last;
     488             :                 int offset = 0;
     489             : 
     490             :                 for (; opline < end ; opline++, offset++) {
     491             : # if ZEND_USE_ABS_CONST_ADDR
     492             :                         if (ZEND_OP1_TYPE(opline) == IS_CONST) {
     493             :                                 opline->op1.zv = (zval*)((char*)opline->op1.zv + ((char*)op_array->literals - (char*)orig_literals));
     494             :                         }
     495             :                         if (ZEND_OP2_TYPE(opline) == IS_CONST) {
     496             :                                 opline->op2.zv = (zval*)((char*)opline->op2.zv + ((char*)op_array->literals - (char*)orig_literals));
     497             :                         }
     498             : # endif
     499             : # if ZEND_USE_ABS_JMP_ADDR
     500             :                         if (ZEND_DONE_PASS_TWO(op_array)) {
     501             :                                 /* fix jumps to point to new array */
     502             :                                 switch (opline->opcode) {
     503             :                                         case ZEND_JMP:
     504             :                                         case ZEND_GOTO:
     505             :                                         case ZEND_FAST_CALL:
     506             :                                         case ZEND_DECLARE_ANON_CLASS:
     507             :                                         case ZEND_DECLARE_ANON_INHERITED_CLASS:
     508             :                                                 ZEND_OP1(opline).jmp_addr = &new_opcodes[ZEND_OP1(opline).jmp_addr - op_array->opcodes];
     509             :                                                 break;
     510             :                                         case ZEND_JMPZNZ:
     511             :                                                 /* relative extended_value don't have to be changed */
     512             :                                                 /* break omitted intentionally */
     513             :                                         case ZEND_JMPZ:
     514             :                                         case ZEND_JMPNZ:
     515             :                                         case ZEND_JMPZ_EX:
     516             :                                         case ZEND_JMPNZ_EX:
     517             :                                         case ZEND_JMP_SET:
     518             :                                         case ZEND_COALESCE:
     519             :                                         case ZEND_NEW:
     520             :                                         case ZEND_FE_RESET_R:
     521             :                                         case ZEND_FE_RESET_RW:
     522             :                                         case ZEND_ASSERT_CHECK:
     523             :                                                 ZEND_OP2(opline).jmp_addr = &new_opcodes[ZEND_OP2(opline).jmp_addr - op_array->opcodes];
     524             :                                                 break;
     525             :                                         case ZEND_FE_FETCH_R:
     526             :                                         case ZEND_FE_FETCH_RW:
     527             :                                                 /* relative extended_value don't have to be changed */
     528             :                                                 break;
     529             :                                 }
     530             :                         }
     531             : # endif
     532             :                 }
     533             : #endif
     534             : 
     535         460 :                 efree(op_array->opcodes);
     536         460 :                 op_array->opcodes = new_opcodes;
     537             : 
     538         460 :                 if (op_array->run_time_cache) {
     539           0 :                         efree(op_array->run_time_cache);
     540           0 :                         op_array->run_time_cache = NULL;
     541             :                 }
     542             :         }
     543             : 
     544         460 :         if (op_array->function_name && !IS_ACCEL_INTERNED(op_array->function_name)) {
     545             :                 zend_string *new_name;
     546           0 :                 if (already_stored) {
     547           0 :                         new_name = zend_shared_alloc_get_xlat_entry(op_array->function_name);
     548             :                         ZEND_ASSERT(new_name != NULL);
     549           0 :                         op_array->function_name = new_name;
     550             :                 } else {
     551           0 :                         zend_accel_store_string(op_array->function_name);
     552             :                 }
     553             :         }
     554             : 
     555         460 :         if (op_array->filename) {
     556             :                 /* do not free! PHP has centralized filename storage, compiler will free it */
     557         920 :                 zend_accel_memdup_string(op_array->filename);
     558             :         }
     559             : 
     560         460 :         if (op_array->arg_info) {
     561          29 :                 zend_arg_info *arg_info = op_array->arg_info;
     562          29 :                 uint32_t num_args = op_array->num_args;
     563             : 
     564          29 :                 if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
     565           4 :                         arg_info--;
     566           4 :                         num_args++;
     567             :                 }
     568          29 :                 if (already_stored) {
     569           0 :                         arg_info = zend_shared_alloc_get_xlat_entry(arg_info);
     570             :                         ZEND_ASSERT(arg_info != NULL);
     571             :                 } else {
     572             :                         uint32_t i;
     573             : 
     574          29 :                         if (op_array->fn_flags & ZEND_ACC_VARIADIC) {
     575           0 :                                 num_args++;
     576             :                         }
     577          29 :                         zend_accel_store(arg_info, sizeof(zend_arg_info) * num_args);
     578          63 :                         for (i = 0; i < num_args; i++) {
     579          34 :                                 if (arg_info[i].name) {
     580          30 :                                         zend_accel_store_interned_string(arg_info[i].name);
     581             :                                 }
     582          34 :                                 if (arg_info[i].class_name) {
     583           4 :                                         zend_accel_store_interned_string(arg_info[i].class_name);
     584             :                                 }
     585             :                         }
     586             :                 }
     587          29 :                 if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
     588           4 :                         arg_info++;
     589             :                 }
     590          29 :                 op_array->arg_info = arg_info;
     591             :         }
     592             : 
     593         460 :         if (op_array->brk_cont_array) {
     594          17 :                 zend_accel_store(op_array->brk_cont_array, sizeof(zend_brk_cont_element) * op_array->last_brk_cont);
     595             :         }
     596             : 
     597         460 :         if (op_array->scope) {
     598           9 :                 op_array->scope = zend_shared_alloc_get_xlat_entry(op_array->scope);
     599             :         }
     600             : 
     601         460 :         if (op_array->doc_comment) {
     602           0 :                 if (ZCG(accel_directives).save_comments) {
     603           0 :                         if (already_stored) {
     604           0 :                                 op_array->doc_comment = zend_shared_alloc_get_xlat_entry(op_array->doc_comment);
     605             :                                 ZEND_ASSERT(op_array->doc_comment != NULL);
     606             :                         } else {
     607           0 :                                 zend_accel_store_string(op_array->doc_comment);
     608             :                         }
     609             :                 } else {
     610           0 :                         if (!already_stored) {
     611           0 :                                 zend_string_release(op_array->doc_comment);
     612             :                         }
     613           0 :                         op_array->doc_comment = NULL;
     614             :                 }
     615             :         }
     616             : 
     617         460 :         if (op_array->try_catch_array) {
     618           8 :                 zend_accel_store(op_array->try_catch_array, sizeof(zend_try_catch_element) * op_array->last_try_catch);
     619             :         }
     620             : 
     621         460 :         if (op_array->vars) {
     622          72 :                 if (already_stored) {
     623           0 :                         persist_ptr = zend_shared_alloc_get_xlat_entry(op_array->vars);
     624             :                         ZEND_ASSERT(persist_ptr != NULL);
     625           0 :                         op_array->vars = (zend_string**)persist_ptr;
     626             :                 } else {
     627             :                         int i;
     628          72 :                         zend_accel_store(op_array->vars, sizeof(zend_string*) * op_array->last_var);
     629         241 :                         for (i = 0; i < op_array->last_var; i++) {
     630         169 :                                 zend_accel_store_interned_string(op_array->vars[i]);
     631             :                         }
     632             :                 }
     633             :         }
     634             : 
     635             :         /* "prototype" may be undefined if "scope" isn't set */
     636         462 :         if (op_array->scope && op_array->prototype) {
     637           2 :                 if ((persist_ptr = zend_shared_alloc_get_xlat_entry(op_array->prototype))) {
     638           2 :                         op_array->prototype = (union _zend_function*)persist_ptr;
     639             :                 }
     640             :         } else {
     641         458 :                 op_array->prototype = NULL;
     642             :         }
     643             : }
     644             : 
     645          33 : static void zend_persist_op_array(zval *zv)
     646             : {
     647          33 :         zend_op_array *op_array = Z_PTR_P(zv);
     648          33 :         zend_op_array *old_op_array = zend_shared_alloc_get_xlat_entry(op_array);
     649          33 :         if (old_op_array) {
     650           0 :                 Z_PTR_P(zv) = old_op_array;
     651           0 :                 if (op_array->refcount && --(*op_array->refcount) == 0) {
     652           0 :                         efree(op_array->refcount);
     653             :                 }
     654           0 :                 return;
     655             :         }
     656          33 :         memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_op_array));
     657          33 :         zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem));
     658          33 :         Z_PTR_P(zv) = ZCG(arena_mem);
     659          33 :         ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_op_array)));
     660          33 :         zend_persist_op_array_ex(Z_PTR_P(zv), NULL);
     661             : }
     662             : 
     663           2 : static void zend_persist_property_info(zval *zv)
     664             : {
     665           2 :         zend_property_info *prop = zend_shared_alloc_get_xlat_entry(Z_PTR_P(zv));
     666             : 
     667           2 :         if (prop) {
     668           0 :                 Z_PTR_P(zv) = prop;
     669           0 :                 return;
     670             :         }
     671           2 :         memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_property_info));
     672           2 :         zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem));
     673           2 :         prop = Z_PTR_P(zv) = ZCG(arena_mem);
     674           2 :         ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_property_info)));
     675           2 :         prop->ce = zend_shared_alloc_get_xlat_entry(prop->ce);
     676           2 :         zend_accel_store_interned_string(prop->name);
     677           2 :         if (prop->doc_comment) {
     678           0 :                 if (ZCG(accel_directives).save_comments) {
     679           0 :                         zend_accel_store_string(prop->doc_comment);
     680             :                 } else {
     681           0 :                         if (!zend_shared_alloc_get_xlat_entry(prop->doc_comment)) {
     682           0 :                                 zend_shared_alloc_register_xlat_entry(prop->doc_comment, prop->doc_comment);
     683             :                         }
     684           0 :                         zend_string_release(prop->doc_comment);
     685           0 :                         prop->doc_comment = NULL;
     686             :                 }
     687             :         }
     688             : }
     689             : 
     690           7 : static void zend_persist_class_entry(zval *zv)
     691             : {
     692           7 :         zend_class_entry *ce = Z_PTR_P(zv);
     693             : 
     694           7 :         if (ce->type == ZEND_USER_CLASS) {
     695           7 :                 memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_class_entry));
     696           7 :                 zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem));
     697           7 :                 ce = Z_PTR_P(zv) = ZCG(arena_mem);
     698           7 :                 ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_class_entry)));
     699           7 :                 zend_accel_store_interned_string(ce->name);
     700           7 :                 zend_hash_persist(&ce->function_table, zend_persist_op_array);
     701           7 :                 if (ce->default_properties_table) {
     702             :                     int i;
     703             : 
     704           0 :                         zend_accel_store(ce->default_properties_table, sizeof(zval) * ce->default_properties_count);
     705           0 :                         for (i = 0; i < ce->default_properties_count; i++) {
     706           0 :                                 zend_persist_zval(&ce->default_properties_table[i]);
     707             :                         }
     708             :                 }
     709           7 :                 if (ce->default_static_members_table) {
     710             :                     int i;
     711             : 
     712           1 :                         zend_accel_store(ce->default_static_members_table, sizeof(zval) * ce->default_static_members_count);
     713           3 :                         for (i = 0; i < ce->default_static_members_count; i++) {
     714           2 :                                 zend_persist_zval(&ce->default_static_members_table[i]);
     715             :                         }
     716             :                 }
     717           7 :                 ce->static_members_table = NULL;
     718             : 
     719           7 :                 zend_hash_persist(&ce->constants_table, zend_persist_zval);
     720             : 
     721           7 :                 if (ZEND_CE_FILENAME(ce)) {
     722             :                         /* do not free! PHP has centralized filename storage, compiler will free it */
     723          14 :                         zend_accel_memdup_string(ZEND_CE_FILENAME(ce));
     724             :                 }
     725           7 :                 if (ZEND_CE_DOC_COMMENT(ce)) {
     726           0 :                         if (ZCG(accel_directives).save_comments) {
     727           0 :                                 zend_accel_store_string(ZEND_CE_DOC_COMMENT(ce));
     728             :                         } else {
     729           0 :                                 if (!zend_shared_alloc_get_xlat_entry(ZEND_CE_DOC_COMMENT(ce))) {
     730           0 :                                         zend_shared_alloc_register_xlat_entry(ZEND_CE_DOC_COMMENT(ce), ZEND_CE_DOC_COMMENT(ce));
     731           0 :                                         zend_string_release(ZEND_CE_DOC_COMMENT(ce));
     732             :                                 }
     733           0 :                                 ZEND_CE_DOC_COMMENT(ce) = NULL;
     734             :                         }
     735             :                 }
     736           7 :                 zend_hash_persist(&ce->properties_info, zend_persist_property_info);
     737           7 :                 if (ce->num_interfaces && ce->interfaces) {
     738           0 :                         efree(ce->interfaces);
     739             :                 }
     740           7 :                 ce->interfaces = NULL; /* will be filled in on fetch */
     741             : 
     742           7 :                 if (ce->num_traits && ce->traits) {
     743           0 :                         efree(ce->traits);
     744             :                 }
     745           7 :                 ce->traits = NULL;
     746             : 
     747           7 :                 if (ce->trait_aliases) {
     748           0 :                         int i = 0;
     749           0 :                         while (ce->trait_aliases[i]) {
     750           0 :                                 if (ce->trait_aliases[i]->trait_method) {
     751           0 :                                         if (ce->trait_aliases[i]->trait_method->method_name) {
     752           0 :                                                 zend_accel_store_interned_string(ce->trait_aliases[i]->trait_method->method_name);
     753             :                                         }
     754           0 :                                         if (ce->trait_aliases[i]->trait_method->class_name) {
     755           0 :                                                 zend_accel_store_interned_string(ce->trait_aliases[i]->trait_method->class_name);
     756             :                                         }
     757           0 :                                         ce->trait_aliases[i]->trait_method->ce = NULL;
     758           0 :                                         zend_accel_store(ce->trait_aliases[i]->trait_method,
     759             :                                                 sizeof(zend_trait_method_reference));
     760             :                                 }
     761             : 
     762           0 :                                 if (ce->trait_aliases[i]->alias) {
     763           0 :                                         zend_accel_store_interned_string(ce->trait_aliases[i]->alias);
     764             :                                 }
     765             : 
     766           0 :                                 zend_accel_store(ce->trait_aliases[i], sizeof(zend_trait_alias));
     767           0 :                                 i++;
     768             :                         }
     769             : 
     770           0 :                         zend_accel_store(ce->trait_aliases, sizeof(zend_trait_alias*) * (i + 1));
     771             :                 }
     772             : 
     773           7 :                 if (ce->trait_precedences) {
     774           0 :                         int i = 0;
     775             : 
     776           0 :                         while (ce->trait_precedences[i]) {
     777           0 :                                 zend_accel_store_interned_string(ce->trait_precedences[i]->trait_method->method_name);
     778           0 :                                 zend_accel_store_interned_string(ce->trait_precedences[i]->trait_method->class_name);
     779           0 :                                 ce->trait_precedences[i]->trait_method->ce = NULL;
     780           0 :                                 zend_accel_store(ce->trait_precedences[i]->trait_method,
     781             :                                         sizeof(zend_trait_method_reference));
     782             : 
     783           0 :                                 if (ce->trait_precedences[i]->exclude_from_classes) {
     784           0 :                                         int j = 0;
     785             : 
     786           0 :                                         while (ce->trait_precedences[i]->exclude_from_classes[j].class_name) {
     787           0 :                                                 zend_accel_store_interned_string(ce->trait_precedences[i]->exclude_from_classes[j].class_name);
     788           0 :                                                 j++;
     789             :                                         }
     790           0 :                                         zend_accel_store(ce->trait_precedences[i]->exclude_from_classes,
     791             :                                                 sizeof(zend_class_entry*) * (j + 1));
     792             :                                 }
     793             : 
     794           0 :                                 zend_accel_store(ce->trait_precedences[i], sizeof(zend_trait_precedence));
     795           0 :                                 i++;
     796             :                         }
     797           0 :                         zend_accel_store(
     798             :                                 ce->trait_precedences, sizeof(zend_trait_precedence*) * (i + 1));
     799             :                 }
     800             :         }
     801           7 : }
     802             : 
     803             : //static int zend_update_property_info_ce(zval *zv)
     804             : //{
     805             : //      zend_property_info *prop = Z_PTR_P(zv);
     806             : //
     807             : //      prop->ce = zend_shared_alloc_get_xlat_entry(prop->ce);
     808             : //      return 0;
     809             : //}
     810             : 
     811           7 : static int zend_update_parent_ce(zval *zv)
     812             : {
     813           7 :         zend_class_entry *ce = Z_PTR_P(zv);
     814             : 
     815           7 :         if (ce->parent) {
     816           3 :                 ce->parent = zend_shared_alloc_get_xlat_entry(ce->parent);
     817             :         }
     818             : 
     819             :         /* update methods */
     820           7 :         if (ce->constructor) {
     821           0 :                 ce->constructor = zend_shared_alloc_get_xlat_entry(ce->constructor);
     822             :         }
     823           7 :         if (ce->destructor) {
     824           0 :                 ce->destructor = zend_shared_alloc_get_xlat_entry(ce->destructor);
     825             :         }
     826           7 :         if (ce->clone) {
     827           0 :                 ce->clone = zend_shared_alloc_get_xlat_entry(ce->clone);
     828             :         }
     829           7 :         if (ce->__get) {
     830           0 :                 ce->__get = zend_shared_alloc_get_xlat_entry(ce->__get);
     831             :         }
     832           7 :         if (ce->__set) {
     833           0 :                 ce->__set = zend_shared_alloc_get_xlat_entry(ce->__set);
     834             :         }
     835           7 :         if (ce->__call) {
     836           0 :                 ce->__call = zend_shared_alloc_get_xlat_entry(ce->__call);
     837             :         }
     838           7 :         if (ce->serialize_func) {
     839           0 :                 ce->serialize_func = zend_shared_alloc_get_xlat_entry(ce->serialize_func);
     840             :         }
     841           7 :         if (ce->unserialize_func) {
     842           0 :                 ce->unserialize_func = zend_shared_alloc_get_xlat_entry(ce->unserialize_func);
     843             :         }
     844           7 :         if (ce->__isset) {
     845           0 :                 ce->__isset = zend_shared_alloc_get_xlat_entry(ce->__isset);
     846             :         }
     847           7 :         if (ce->__unset) {
     848           0 :                 ce->__unset = zend_shared_alloc_get_xlat_entry(ce->__unset);
     849             :         }
     850           7 :         if (ce->__tostring) {
     851           0 :                 ce->__tostring = zend_shared_alloc_get_xlat_entry(ce->__tostring);
     852             :         }
     853           7 :         if (ce->__callstatic) {
     854           0 :                 ce->__callstatic = zend_shared_alloc_get_xlat_entry(ce->__callstatic);
     855             :         }
     856           7 :         if (ce->__debugInfo) {
     857           0 :                 ce->__debugInfo = zend_shared_alloc_get_xlat_entry(ce->__debugInfo);
     858             :         }
     859             : //      zend_hash_apply(&ce->properties_info, (apply_func_t) zend_update_property_info_ce);
     860           7 :         return 0;
     861             : }
     862             : 
     863         427 : static void zend_accel_persist_class_table(HashTable *class_table)
     864             : {
     865         427 :     zend_hash_persist(class_table, zend_persist_class_entry);
     866         427 :         zend_hash_apply(class_table, (apply_func_t) zend_update_parent_ce);
     867         427 : }
     868             : 
     869         427 : zend_persistent_script *zend_accel_script_persist(zend_persistent_script *script, char **key, unsigned int key_length)
     870             : {
     871         427 :         script->mem = ZCG(mem);
     872             : 
     873         427 :         zend_shared_alloc_clear_xlat_table();
     874             : 
     875         427 :         zend_accel_store(script, sizeof(zend_persistent_script));
     876         427 :         if (key && *key) {
     877         427 :                 *key = zend_accel_memdup(*key, key_length + 1);
     878             :         }
     879        1281 :         zend_accel_store_string(script->full_path);
     880             : 
     881             : #ifdef __SSE2__
     882             :         /* Align to 64-byte boundary */
     883         427 :         ZCG(mem) = (void*)(((zend_uintptr_t)ZCG(mem) + 63L) & ~63L);
     884             : #endif
     885             : 
     886         427 :         script->arena_mem = ZCG(arena_mem) = ZCG(mem);
     887         427 :         ZCG(mem) = (void*)((char*)ZCG(mem) + script->arena_size);
     888             : 
     889         427 :         zend_accel_persist_class_table(&script->class_table);
     890         427 :         zend_hash_persist(&script->function_table, zend_persist_op_array);
     891         427 :         zend_persist_op_array_ex(&script->main_op_array, script);
     892             : 
     893         427 :         return script;
     894             : }
     895             : 
     896         427 : int zend_accel_script_persistable(zend_persistent_script *script)
     897             : {
     898         427 :         return 1;
     899             : }

Generated by: LCOV version 1.10

Generated at Sat, 27 Jun 2015 09:41:13 +0000 (3 days ago)

Copyright © 2005-2015 The PHP Group
All rights reserved.