| 305 | | add_assoc_long_ex(ei, ZEND_STRS("device"), php->device); |
| 306 | | add_assoc_long_ex(ei, ZEND_STRS("inode"), php->inode); |
| 307 | | #endif |
| 308 | | add_assoc_long_ex(ei, ZEND_STRS("mtime"), php->mtime); |
| 309 | | |
| 310 | | add_assoc_long_ex(ei, ZEND_STRS("function_cnt"), php->funcinfo_cnt); |
| 311 | | add_assoc_long_ex(ei, ZEND_STRS("class_cnt"), php->classinfo_cnt); |
| | 305 | add_assoc_long_ex(ei, ZEND_STRS("device"), php->device); |
| | 306 | add_assoc_long_ex(ei, ZEND_STRS("inode"), php->inode); |
| | 307 | #endif |
| | 308 | add_assoc_long_ex(ei, ZEND_STRS("mtime"), php->mtime); |
| | 309 | |
| | 310 | #ifdef HAVE_XCACHE_CONSTANT |
| | 311 | add_assoc_long_ex(ei, ZEND_STRS("constinfo_cnt"), php->constinfo_cnt); |
| | 312 | #endif |
| | 313 | add_assoc_long_ex(ei, ZEND_STRS("function_cnt"), php->funcinfo_cnt); |
| | 314 | add_assoc_long_ex(ei, ZEND_STRS("class_cnt"), php->classinfo_cnt); |
| 705 | | php.funcinfo_cnt = zend_hash_num_elements(CG(function_table)); |
| 706 | | php.classinfo_cnt = zend_hash_num_elements(CG(class_table)); |
| 707 | | |
| 708 | | php.funcinfos = ECALLOC_N(php.funcinfos, php.funcinfo_cnt); |
| 709 | | if (!php.funcinfos) { |
| 710 | | goto err_func; |
| 711 | | } |
| 712 | | php.classinfos = ECALLOC_N(php.classinfos, php.classinfo_cnt); |
| 713 | | if (!php.classinfos) { |
| 714 | | goto err_class; |
| 715 | | } |
| | 722 | #ifdef HAVE_XCACHE_CONSTANT |
| | 723 | php.constinfo_cnt = zend_hash_num_elements(EG(zend_constants)) - old_constinfo_cnt; |
| | 724 | #endif |
| | 725 | php.funcinfo_cnt = zend_hash_num_elements(CG(function_table)) - old_funcinfo_cnt; |
| | 726 | php.classinfo_cnt = zend_hash_num_elements(CG(class_table)) - old_classinfo_cnt; |
| | 727 | |
| | 728 | #define X_ALLOC_N(var, cnt) do { \ |
| | 729 | if (php.cnt) { \ |
| | 730 | ECALLOC_N(php.var, php.cnt); \ |
| | 731 | if (!php.var) { \ |
| | 732 | goto err_##var; \ |
| | 733 | } \ |
| | 734 | } \ |
| | 735 | else { \ |
| | 736 | php.var = NULL; \ |
| | 737 | } \ |
| | 738 | } while (0) |
| | 739 | |
| | 740 | #ifdef HAVE_XCACHE_CONSTANT |
| | 741 | X_ALLOC_N(constinfos, constinfo_cnt); |
| | 742 | #endif |
| | 743 | X_ALLOC_N(funcinfos, funcinfo_cnt); |
| | 744 | X_ALLOC_N(classinfos, classinfo_cnt); |
| | 745 | #undef X_ALLOC |
| 721 | | b = CG(function_table)->pListHead; |
| 722 | | for (i = 0; b; i ++, b = b->pListNext) { |
| 723 | | xc_funcinfo_t *fi = &php.funcinfos[i]; |
| 724 | | |
| 725 | | assert(i < php.funcinfo_cnt); |
| 726 | | assert(b->pData); |
| 727 | | memcpy(&fi->func, b->pData, sizeof(zend_function)); |
| 728 | | UNISW(NOTHING, fi->type = b->key.type;) |
| 729 | | fi->key = BUCKET_KEY(b); |
| 730 | | fi->key_size = b->nKeyLength; |
| 731 | | } |
| 732 | | |
| 733 | | b = CG(class_table)->pListHead; |
| 734 | | for (i = 0; b; i ++, b = b->pListNext) { |
| 735 | | xc_classinfo_t *ci = &php.classinfos[i]; |
| 736 | | |
| 737 | | assert(i < php.classinfo_cnt); |
| 738 | | assert(b->pData); |
| 739 | | memcpy(&ci->cest, b->pData, sizeof(xc_cest_t)); |
| 740 | | UNISW(NOTHING, ci->type = b->key.type;) |
| 741 | | ci->key = BUCKET_KEY(b); |
| 742 | | ci->key_size = b->nKeyLength; |
| 743 | | /* need to fix inside store */ |
| 744 | | } |
| | 751 | #define COPY_H(vartype, var, cnt, name, datatype) do { \ |
| | 752 | for (i = 0; b; i ++, b = b->pListNext) { \ |
| | 753 | vartype *data = &php.var[i]; \ |
| | 754 | \ |
| | 755 | if (i < old_##cnt) { \ |
| | 756 | continue; \ |
| | 757 | } \ |
| | 758 | \ |
| | 759 | assert(i < old_##cnt + php.cnt); \ |
| | 760 | assert(b->pData); \ |
| | 761 | memcpy(&data->name, b->pData, sizeof(datatype)); \ |
| | 762 | UNISW(NOTHING, data->type = b->key.type;) \ |
| | 763 | data->key = BUCKET_KEY(b); \ |
| | 764 | data->key_size = b->nKeyLength; \ |
| | 765 | } \ |
| | 766 | } while(0) |
| | 767 | |
| | 768 | #ifdef HAVE_XCACHE_CONSTANT |
| | 769 | b = EG(zend_constants)->pListHead; COPY_H(xc_constinfo_t, constinfos, constinfo_cnt, constant, zend_constant); |
| | 770 | #endif |
| | 771 | b = CG(function_table)->pListHead; COPY_H(xc_funcinfo_t, funcinfos, funcinfo_cnt, func, zend_function); |
| | 772 | b = CG(class_table)->pListHead; COPY_H(xc_classinfo_t, classinfos, classinfo_cnt, cest, xc_cest_t); |
| | 773 | |
| | 774 | #undef COPY_H |
| | 775 | /* for ZE1, cest need to fix inside store */ |