Changeset 212 for trunk/xcache.c
- Timestamp:
- 10/04/2006 12:38:45 AM (2 years ago)
- Files:
-
- 1 modified
-
trunk/xcache.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r205 r212 66 66 } \ 67 67 } while(0) 68 69 #ifndef max 70 #define max(a, b) ((a) < (b) ? (b) : (a)) 71 #endif 68 72 69 73 /* }}} */ … … 542 546 #endif 543 547 548 CG(active_op_array) = p->op_array; 549 544 550 #ifdef HAVE_XCACHE_CONSTANT 545 551 /* install constant */ … … 571 577 new_cest_ptrs[i] = 572 578 #endif 573 xc_install_class(xce->name.str.val, &ci->cest, 579 xc_install_class(xce->name.str.val, &ci->cest, ci->oplineno, 574 580 UNISW(0, ci->type), ci->key, ci->key_size TSRMLS_CC); 575 581 } … … 771 777 xce->type = XC_TYPE_PHP; 772 778 return 1; 779 } 780 /* }}} */ 781 static void xc_cache_early_binding_class_cb(zend_op *opline, int oplineno, void *data TSRMLS_DC) /* {{{ */ 782 { 783 char *class_name; 784 int i, class_len; 785 xc_cest_t cest; 786 xc_entry_data_php_t *php = (xc_entry_data_php_t *) data; 787 788 class_name = opline->op1.u.constant.value.str.val; 789 class_len = opline->op1.u.constant.value.str.len; 790 if (zend_hash_find(CG(class_table), class_name, class_len, (void **) &cest) == FAILURE) { 791 assert(0); 792 } 793 #ifdef DEBUG 794 fprintf(stderr, "got ZEND_DECLARE_INHERITED_CLASS: %s\n", class_name + 1); 795 #endif 796 /* let's see which class */ 797 for (i = 0; i < php->classinfo_cnt; i ++) { 798 if (memcmp(ZSTR_S(php->classinfos[i].key), class_name, class_len) == 0) { 799 php->classinfos[i].oplineno = oplineno; 800 php->have_early_binding = 1; 801 break; 802 } 803 } 804 805 if (i == php->classinfo_cnt) { 806 assert(0); 807 } 773 808 } 774 809 /* }}} */ … … 785 820 char opened_path_buffer[MAXPATHLEN]; 786 821 int old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt; 822 int i; 787 823 788 824 if (!xc_initized) { … … 895 931 #ifdef HAVE_INODE 896 932 if (xce.data.php->inode) 897 #endif898 933 { 899 934 if (xce.name.str.val != filename) { … … 902 937 } 903 938 } 939 #endif 904 940 905 941 #ifdef HAVE_XCACHE_OPTIMIZER … … 908 944 } 909 945 #endif 910 946 /* }}} */ 947 /* {{{ prepare */ 911 948 php.op_array = op_array; 912 949 … … 972 1009 } 973 1010 /* }}} */ 1011 /* {{{ find inherited classes that should be early-binding */ 1012 php.have_early_binding = 0; 1013 for (i = 0; i < php.classinfo_cnt; i ++) { 1014 php.classinfos[i].oplineno = -1; 1015 } 1016 1017 xc_undo_pass_two(php.op_array TSRMLS_CC); 1018 xc_foreach_early_binding_class(php.op_array, xc_cache_early_binding_class_cb, (void *) &php TSRMLS_CC); 1019 xc_redo_pass_two(php.op_array TSRMLS_CC); 1020 /* }}} */ 974 1021 ENTER_LOCK_EX(cache) { /* {{{ store/add entry */ 975 1022 stored_xce = xc_entry_store_dmz(&xce TSRMLS_CC); … … 1001 1048 } 1002 1049 else { 1050 CG(active_op_array) = op_array; 1003 1051 xc_sandbox_free(&sandbox, 1 TSRMLS_CC); 1004 1052 }

