Changeset 255
- Timestamp:
- 07/29/06 13:04:04 (4 years ago)
- Location:
- eaccelerator/trunk
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
ea_restore.c (modified) (6 diffs)
-
ea_restore.h (modified) (2 diffs)
-
ea_store.c (modified) (8 diffs)
-
ea_store.h (modified) (1 diff)
-
eaccelerator.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eaccelerator/trunk/ChangeLog
r254 r255 5 5 * Don't compile the user cache code one no feature is being compiled. 6 6 * A big cleanup in struct naming 7 * Move some functions around to make more of them static, this reduces 8 the binary size and load times. 7 9 8 10 2006-07-29 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> -
eaccelerator/trunk/ea_restore.c
r254 r255 158 158 } 159 159 160 void fixup_op_array(ea_op_array * from TSRMLS_DC)160 static void fixup_op_array(ea_op_array * from TSRMLS_DC) 161 161 { 162 162 zend_op *opline; … … 242 242 } 243 243 244 void fixup_class_entry(ea_class_entry *from TSRMLS_DC)244 static void fixup_class_entry(ea_class_entry *from TSRMLS_DC) 245 245 { 246 246 FIXUP(from->name); … … 271 271 fixup_hash(&from->function_table, 272 272 (fixup_bucket_t) fixup_op_array TSRMLS_CC); 273 } 274 275 void eaccelerator_fixup (ea_cache_entry *p TSRMLS_DC) 276 { 277 ea_fc_entry *q; 278 279 EAG (mem) = (char *) ((long) p - (long) p->next); 280 EAG (compress) = 1; 281 p->next = NULL; 282 FIXUP (p->op_array); 283 FIXUP (p->f_head); 284 FIXUP (p->c_head); 285 fixup_op_array (p->op_array TSRMLS_CC); 286 q = p->f_head; 287 while (q != NULL) { 288 FIXUP (q->fc); 289 fixup_op_array ((ea_op_array *) q->fc TSRMLS_CC); 290 FIXUP (q->next); 291 q = q->next; 292 } 293 q = p->c_head; 294 while (q != NULL) { 295 FIXUP (q->fc); 296 fixup_class_entry ((ea_class_entry *) q->fc TSRMLS_CC); 297 FIXUP (q->next); 298 q = q->next; 299 } 273 300 } 274 301 … … 642 669 643 670 /* restore the parent class with the given name for the given class */ 644 void restore_class_parent(char *parent, int len, 645 zend_class_entry * to TSRMLS_DC) 671 static void restore_class_parent(char *parent, int len, zend_class_entry * to TSRMLS_DC) 646 672 { 647 673 #ifdef ZEND_ENGINE_2 … … 671 697 672 698 #ifdef ZEND_ENGINE_2 673 void restore_class_methods(zend_class_entry * to TSRMLS_DC)699 static void restore_class_methods(zend_class_entry * to TSRMLS_DC) 674 700 { 675 701 int cname_len = to->name_length; … … 733 759 #endif 734 760 735 zend_class_entry *restore_class_entry(zend_class_entry * to, ea_class_entry * from TSRMLS_DC)761 static zend_class_entry *restore_class_entry(zend_class_entry * to, ea_class_entry * from TSRMLS_DC) 736 762 { 737 763 zend_class_entry *old; -
eaccelerator/trunk/ea_restore.h
r254 r255 30 30 31 31 #define FIXUP(x) if((x)!=NULL) {(x) = (void*)(((char*)(x)) + ((long)(EAG(mem))));} 32 void fixup_op_array(ea_op_array *from TSRMLS_DC);33 void fixup_class_entry(ea_class_entry *from TSRMLS_DC);34 32 void fixup_zval(zval *z TSRMLS_DC); 33 void eaccelerator_fixup (ea_cache_entry * p TSRMLS_DC); 35 34 36 35 void restore_zval(zval *zv TSRMLS_DC); … … 38 37 void restore_function(ea_fc_entry *p TSRMLS_DC); 39 38 zend_op_array* restore_op_array(zend_op_array *to, ea_op_array *from TSRMLS_DC); 40 zend_class_entry *restore_class_entry(zend_class_entry *to, ea_class_entry *from TSRMLS_DC);41 void restore_class_parent(char *parent, int len, zend_class_entry *to TSRMLS_DC);42 #ifdef ZEND_ENGINE_243 void restore_class_methods(zend_class_entry *to TSRMLS_DC);44 #endif45 39 46 40 dtor_func_t get_zend_destroy_property_info(TSRMLS_D); -
eaccelerator/trunk/ea_store.c
r254 r255 79 79 calc_string(from->name, from->name_length + 1 TSRMLS_CC); 80 80 } 81 82 83 /* Calculate the size of a point to a class entry */84 /* not used85 static void calc_class_entry_ptr(zend_class_entry ** from TSRMLS_DC)86 {87 calc_class_entry(*from TSRMLS_CC);88 }89 */90 81 #endif 91 82 … … 136 127 137 128 /* Calculate the size of an op_array */ 138 void calc_op_array(zend_op_array * from TSRMLS_DC)129 static void calc_op_array(zend_op_array * from TSRMLS_DC) 139 130 { 140 131 zend_op *opline; … … 234 225 235 226 /* Calculate the size of a class entry */ 236 void calc_class_entry(zend_class_entry * from TSRMLS_DC)227 static void calc_class_entry(zend_class_entry * from TSRMLS_DC) 237 228 { 238 229 if (from->type != ZEND_USER_CLASS) { … … 274 265 /* Calculate the size of a cache entry with its given op_array and function and 275 266 class bucket */ 276 int calc_size(char *key, zend_op_array * op_array, 277 Bucket * f, Bucket * c TSRMLS_DC) 267 int calc_size(char *key, zend_op_array * op_array, Bucket * f, Bucket * c TSRMLS_DC) 278 268 { 279 269 Bucket *b; … … 366 356 } 367 357 368 static void store_hash_int(HashTable * target, HashTable * source, 358 static void store_hash_int(HashTable * target, HashTable * source, 369 359 Bucket * start, store_bucket_t copy_bucket, 370 360 check_bucket_t check_bucket, … … 473 463 } 474 464 475 ea_op_array *store_op_array(zend_op_array * from TSRMLS_DC)465 static ea_op_array *store_op_array(zend_op_array * from TSRMLS_DC) 476 466 { 477 467 ea_op_array *to; … … 785 775 #endif 786 776 787 ea_class_entry *store_class_entry(zend_class_entry * from TSRMLS_DC)777 static ea_class_entry *store_class_entry(zend_class_entry * from TSRMLS_DC) 788 778 { 789 779 ea_class_entry *to; … … 883 873 } 884 874 875 /* Create a cache entry from the given op_array, functions and classes of a 876 script */ 877 ea_cache_entry *eaccelerator_store_int (char *key, int len, 878 zend_op_array *op_array, Bucket *f, Bucket *c TSRMLS_DC) 879 { 880 ea_cache_entry *p; 881 ea_fc_entry *fc; 882 ea_fc_entry *q; 883 char *x; 884 885 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 886 DBG(ea_debug_printf, (EA_DEBUG, "[%d] eaccelerator_store_int: key='%s'\n", 887 getpid (), key)); 888 889 EAG (compress) = 1; 890 zend_hash_init (&EAG (strings), 0, NULL, NULL, 0); 891 p = (ea_cache_entry *) EAG (mem); 892 EAG (mem) += offsetof (ea_cache_entry, realfilename) + len + 1; 893 894 p->nhits = 0; 895 p->use_cnt = 0; 896 p->removed = 0; 897 p->f_head = NULL; 898 p->c_head = NULL; 899 memcpy (p->realfilename, key, len + 1); 900 x = p->realfilename; 901 zend_hash_add (&EAG (strings), key, len + 1, &x, sizeof (char *), NULL); 902 903 q = NULL; 904 while (c != NULL) { 905 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 906 DBG(ea_debug_printf, (EA_DEBUG, 907 "[%d] eaccelerator_store_int: class hashkey=", getpid ())); 908 DBG(ea_debug_binary_print, (EA_DEBUG, c->arKey, c->nKeyLength)); 909 910 EACCELERATOR_ALIGN (EAG (mem)); 911 fc = (ea_fc_entry *) EAG (mem); 912 EAG (mem) += offsetof (ea_fc_entry, htabkey) + c->nKeyLength; 913 memcpy (fc->htabkey, c->arKey, c->nKeyLength); 914 fc->htablen = c->nKeyLength; 915 fc->next = NULL; 916 #ifdef ZEND_ENGINE_2 917 fc->fc = *(zend_class_entry **) c->pData; 918 #else 919 fc->fc = c->pData; 920 #endif 921 c = c->pListNext; 922 x = fc->htabkey; 923 zend_hash_add (&EAG (strings), fc->htabkey, fc->htablen, &x, 924 sizeof (char *), NULL); 925 if (q == NULL) { 926 p->c_head = fc; 927 } else { 928 q->next = fc; 929 } 930 q = fc; 931 } 932 933 q = NULL; 934 while (f != NULL) { 935 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 936 DBG(ea_debug_printf, (EA_DEBUG, 937 "[%d] eaccelerator_store_int: function hashkey='%s'\n", getpid (), f->arKey)); 938 939 EACCELERATOR_ALIGN (EAG (mem)); 940 fc = (ea_fc_entry *) EAG (mem); 941 EAG (mem) += offsetof (ea_fc_entry, htabkey) + f->nKeyLength; 942 memcpy (fc->htabkey, f->arKey, f->nKeyLength); 943 fc->htablen = f->nKeyLength; 944 fc->next = NULL; 945 fc->fc = f->pData; 946 f = f->pListNext; 947 x = fc->htabkey; 948 zend_hash_add (&EAG (strings), fc->htabkey, fc->htablen, &x, 949 sizeof (char *), NULL); 950 if (q == NULL) { 951 p->f_head = fc; 952 } else { 953 q->next = fc; 954 } 955 q = fc; 956 } 957 958 q = p->c_head; 959 while (q != NULL) { 960 q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC); 961 q = q->next; 962 } 963 964 q = p->f_head; 965 while (q != NULL) { 966 q->fc = store_op_array ((zend_op_array *) q->fc TSRMLS_CC); 967 q = q->next; 968 } 969 p->op_array = store_op_array (op_array TSRMLS_CC); 970 971 zend_hash_destroy (&EAG (strings)); 972 return p; 973 } 974 885 975 #endif /* HAVE_EACCELERATOR */ -
eaccelerator/trunk/ea_store.h
r254 r255 31 31 void calc_zval(zval *z TSRMLS_DC); 32 32 int calc_size(char *key, zend_op_array *op_array, Bucket *f, Bucket *c TSRMLS_DC); 33 void calc_op_array(zend_op_array *from TSRMLS_DC);34 void calc_class_entry(zend_class_entry *from TSRMLS_DC);35 33 36 34 void store_zval(zval *z TSRMLS_DC); 37 ea_op_array *store_op_array(zend_op_array *from TSRMLS_DC); 38 ea_class_entry *store_class_entry_ptr(zend_class_entry **from TSRMLS_DC); 39 ea_class_entry *store_class_entry(zend_class_entry *from TSRMLS_DC); 35 ea_cache_entry *eaccelerator_store_int (char *key, int len, zend_op_array *op_array, Bucket *f, Bucket *c TSRMLS_DC); 40 36 41 37 #endif /* EA_STORE_H */ -
eaccelerator/trunk/eaccelerator.c
r254 r255 564 564 } 565 565 566 void eaccelerator_fixup (ea_cache_entry * p TSRMLS_DC)567 {568 ea_fc_entry *q;569 570 EAG (mem) = (char *) ((long) p - (long) p->next);571 EAG (compress) = 1;572 p->next = NULL;573 FIXUP (p->op_array);574 FIXUP (p->f_head);575 FIXUP (p->c_head);576 fixup_op_array (p->op_array TSRMLS_CC);577 q = p->f_head;578 while (q != NULL) {579 FIXUP (q->fc);580 fixup_op_array ((ea_op_array *) q->fc TSRMLS_CC);581 FIXUP (q->next);582 q = q->next;583 }584 q = p->c_head;585 while (q != NULL) {586 FIXUP (q->fc);587 fixup_class_entry ((ea_class_entry *) q->fc TSRMLS_CC);588 FIXUP (q->next);589 q = q->next;590 }591 }592 593 566 /******************************************************************************/ 594 /* Cache file functions. */567 /* Cache file functions. */ 595 568 /******************************************************************************/ 596 569 597 570 /* Retrieve a cache entry from the cache directory */ 598 static ea_cache_entry* hash_find_file(const char *key, 599 struct stat *buf TSRMLS_DC) { 571 static ea_cache_entry* hash_find_file(const char *key, struct stat *buf TSRMLS_DC) { 600 572 int f; 601 573 char s[MAXPATHLEN]; … … 737 709 } 738 710 return ret; 739 }740 741 /* Create a cache entry from the given op_array, functions and classes of a742 script */743 static ea_cache_entry *eaccelerator_store_int (char *key, int len,744 zend_op_array * op_array, Bucket * f, Bucket * c TSRMLS_DC)745 {746 ea_cache_entry *p;747 ea_fc_entry *fc;748 ea_fc_entry *q;749 char *x;750 751 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC));752 DBG(ea_debug_printf, (EA_DEBUG, "[%d] eaccelerator_store_int: key='%s'\n",753 getpid (), key));754 755 EAG (compress) = 1;756 zend_hash_init (&EAG (strings), 0, NULL, NULL, 0);757 p = (ea_cache_entry *) EAG (mem);758 EAG (mem) += offsetof (ea_cache_entry, realfilename) + len + 1;759 760 p->nhits = 0;761 p->use_cnt = 0;762 p->removed = 0;763 p->f_head = NULL;764 p->c_head = NULL;765 memcpy (p->realfilename, key, len + 1);766 x = p->realfilename;767 zend_hash_add (&EAG (strings), key, len + 1, &x, sizeof (char *), NULL);768 769 q = NULL;770 while (c != NULL) {771 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC));772 DBG(ea_debug_printf, (EA_DEBUG,773 "[%d] eaccelerator_store_int: class hashkey=", getpid ()));774 DBG(ea_debug_binary_print, (EA_DEBUG, c->arKey, c->nKeyLength));775 776 EACCELERATOR_ALIGN (EAG (mem));777 fc = (ea_fc_entry *) EAG (mem);778 EAG (mem) += offsetof (ea_fc_entry, htabkey) + c->nKeyLength;779 memcpy (fc->htabkey, c->arKey, c->nKeyLength);780 fc->htablen = c->nKeyLength;781 fc->next = NULL;782 #ifdef ZEND_ENGINE_2783 fc->fc = *(zend_class_entry **) c->pData;784 #else785 fc->fc = c->pData;786 #endif787 c = c->pListNext;788 x = fc->htabkey;789 zend_hash_add (&EAG (strings), fc->htabkey, fc->htablen, &x,790 sizeof (char *), NULL);791 if (q == NULL) {792 p->c_head = fc;793 } else {794 q->next = fc;795 }796 q = fc;797 }798 799 q = NULL;800 while (f != NULL) {801 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC));802 DBG(ea_debug_printf, (EA_DEBUG,803 "[%d] eaccelerator_store_int: function hashkey='%s'\n", getpid (), f->arKey));804 805 EACCELERATOR_ALIGN (EAG (mem));806 fc = (ea_fc_entry *) EAG (mem);807 EAG (mem) += offsetof (ea_fc_entry, htabkey) + f->nKeyLength;808 memcpy (fc->htabkey, f->arKey, f->nKeyLength);809 fc->htablen = f->nKeyLength;810 fc->next = NULL;811 fc->fc = f->pData;812 f = f->pListNext;813 x = fc->htabkey;814 zend_hash_add (&EAG (strings), fc->htabkey, fc->htablen, &x,815 sizeof (char *), NULL);816 if (q == NULL) {817 p->f_head = fc;818 } else {819 q->next = fc;820 }821 q = fc;822 }823 824 q = p->c_head;825 while (q != NULL) {826 q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC);827 q = q->next;828 }829 830 q = p->f_head;831 while (q != NULL) {832 q->fc = store_op_array ((zend_op_array *) q->fc TSRMLS_CC);833 q = q->next;834 }835 p->op_array = store_op_array (op_array TSRMLS_CC);836 837 zend_hash_destroy (&EAG (strings));838 return p;839 711 } 840 712
Note: See TracChangeset
for help on using the changeset viewer.