Changeset 146
- Timestamp:
- 01/12/06 14:57:37 (3 years ago)
- Files:
-
- eaccelerator/branches/PHP_5_1/AUTHORS (modified) (1 diff)
- eaccelerator/branches/PHP_5_1/ChangeLog (modified) (1 diff)
- eaccelerator/branches/PHP_5_1/content.c (modified) (1 diff)
- eaccelerator/branches/PHP_5_1/ea_restore.c (modified) (11 diffs)
- eaccelerator/branches/PHP_5_1/ea_restore.h (modified) (1 diff)
- eaccelerator/branches/PHP_5_1/ea_store.c (modified) (7 diffs)
- eaccelerator/branches/PHP_5_1/eaccelerator.c (modified) (5 diffs)
- eaccelerator/branches/PHP_5_1/eaccelerator.h (modified) (4 diffs)
- eaccelerator/branches/PHP_5_1/loader.c (modified) (1 diff)
- eaccelerator/branches/PHP_5_1/opcodes.c (modified) (8 diffs)
- eaccelerator/branches/PHP_5_1/optimize.c (modified) (13 diffs)
- eaccelerator/branches/PHP_5_1/webui.c (modified) (12 diffs)
- eaccelerator/branches/PHP_5_1/win32/eAccelerator.dsp (modified) (1 diff)
- eaccelerator/branches/PHP_5_1/win32/eLoader.dsp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/branches/PHP_5_1/AUTHORS
r84 r146 4 4 - Bart Vanbrabant <zoeloelip at users.sourceforge.net> 5 5 - Shin Seung Woo <segv74 at users.sourceforge.net> 6 - Hans Rakers <hrak at users.sourceforge.net> 6 7 7 8 Inactive member(s) : eaccelerator/branches/PHP_5_1/ChangeLog
r142 r146 1 2006-01-12 Hans Rakers <hans at parse dot nl> 2 3 * First batch of PHP-5.1 related changes committed to the newly created 4 PHP_5_1 branch. This is a work in progress, so YMMV. 5 1 6 2006-01-10 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 2 7 eaccelerator/branches/PHP_5_1/content.c
r123 r146 594 594 eaccelerator_content_cache_place != eaccelerator_none) { 595 595 596 #ifndef ZEND_ENGINE_2_1 597 /* No worko on php >= 5.1.0 */ 596 598 /* clean garbage */ 597 599 while (EG(garbage_ptr)) { 598 600 zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]); 599 601 } 602 #endif 600 603 601 604 eaccelerator_put(key, key_len, return_value, ttl, eaccelerator_content_cache_place TSRMLS_CC); eaccelerator/branches/PHP_5_1/ea_restore.c
r127 r146 40 40 #include "zend_API.h" 41 41 #include "zend_extensions.h" 42 #ifdef ZEND_ENGINE_2_1 43 #include "zend_vm.h" 44 #endif 42 45 43 46 #ifndef INCOMPLETE_CLASS … … 70 73 71 74 zend_hash_destroy(&dummy_class_entry.default_properties); 75 zend_hash_destroy(&dummy_class_entry.function_table); 76 #ifdef ZEND_ENGINE_2 77 zend_hash_destroy(&dummy_class_entry.constants_table); 72 78 zend_hash_destroy(&dummy_class_entry.properties_info); 79 #endif 80 #if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_1) 73 81 zend_hash_destroy(dummy_class_entry.static_members); 74 zend_hash_destroy(&dummy_class_entry.function_table); 75 FREE_HASHTABLE(dummy_class_entry.static_members); 76 zend_hash_destroy(&dummy_class_entry.constants_table); 82 FREE_HASHTABLE(dummy_class_entry.static_members); 83 #endif 84 #ifdef ZEND_ENGINE_2_1 85 zend_hash_destroy(&dummy_class_entry.default_static_members); 86 #endif 77 87 78 88 return property_dtor; … … 93 103 { 94 104 FIXUP(from->name); 105 #ifdef ZEND_ENGINE_2_1 106 FIXUP(from->doc_comment); 107 #endif 95 108 } 96 109 #endif … … 222 235 break; 223 236 } 237 # ifdef ZEND_ENGINE_2_1 238 ZEND_VM_SET_OPCODE_HANDLER(opline); 239 # else 224 240 opline->handler = get_opcode_handler(opline->opcode TSRMLS_CC); 241 # endif 242 225 243 #endif 226 244 } … … 235 253 fixup_zval_hash(from->static_variables); 236 254 } 255 #ifdef ZEND_ENGINE_2_1 256 if (from->vars != NULL) { 257 zend_uint i; 258 FIXUP(from->vars); 259 for (i = 0; i < from->last_var; i++) { 260 FIXUP(from->vars[i].name); 261 } 262 } 263 #endif 237 264 FIXUP(from->filename); 238 265 #ifdef ZEND_ENGINE_2 … … 571 598 to->brk_cont_array = from->brk_cont_array; 572 599 to->last_brk_cont = from->last_brk_cont; 573 /*600 574 601 to->current_brk_cont = -1; 575 602 to->static_variables = from->static_variables; 576 to->start_op = to->opcodes; 603 /* to->start_op = to->opcodes; */ 577 604 to->backpatch_count = 0; 578 */605 579 606 to->return_reference = from->return_reference; 580 607 to->done_pass_two = 1; … … 613 640 } 614 641 642 #ifdef ZEND_ENGINE_2_1 643 to->vars = from->vars; 644 to->last_var = from->last_var; 645 to->size_var = 0; 646 if (to->vars) { 647 zend_uint i; 648 to->vars = (zend_compiled_variable*)emalloc(from->last_var*sizeof(zend_compiled_variable)); 649 memcpy(to->vars, from->vars, sizeof(zend_compiled_variable) * from->last_var); 650 for (i = 0; i < from->last_var; i ++) { 651 to->vars[i].name = estrndup(from->vars[i].name, from->vars[i].name_len); 652 } 653 } 654 #endif 655 615 656 /* disable deletion in destroy_op_array */ 616 657 ++EAG(refcount_helper); … … 634 675 to->name = emalloc(from->name_length + 1); 635 676 memcpy(to->name, from->name, from->name_length + 1); 677 #ifdef ZEND_ENGINE_2_1 678 if (from->doc_comment != NULL) { 679 to->doc_comment = emalloc(from->doc_comment_len+1); 680 memcpy(to->doc_comment, from->doc_comment, from->doc_comment_len+1); 681 } 682 #endif 636 683 return to; 637 684 } … … 661 708 to->__get = to->parent->__get; 662 709 to->__set = to->parent->__set; 710 # ifdef ZEND_ENGINE_2_1 711 to->__unset = to->parent->__unset; 712 to->__isset = to->parent->__isset; 713 # endif 663 714 to->__call = to->parent->__call; 664 715 to->create_object = to->parent->create_object; … … 709 760 memcmp(fname_lc, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) == 0) 710 761 to->__set = f; 762 # ifdef ZEND_ENGINE_2_1 763 else if (fname_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && 764 memcmp(fname_lc, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)) == 0) 765 to->__unset = f; 766 else if (fname_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 && 767 memcmp(fname_lc, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)) == 0) 768 to->__isset = f; 769 # endif 711 770 else if (fname_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && 712 771 memcmp(fname_lc, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) == 0) … … 814 873 to->properties_info.pDestructor = properties_info_dtor; 815 874 875 #ifdef ZEND_ENGINE_2_1 876 /* restore default_static_members */ 877 restore_zval_hash(&to->default_static_members, &from->default_static_members); 878 to->default_static_members.pDestructor = ZVAL_PTR_DTOR; 879 #endif 880 816 881 if (from->static_members != NULL) { 817 882 ALLOC_HASHTABLE(to->static_members); eaccelerator/branches/PHP_5_1/ea_restore.h
r124 r146 35 35 void fixup_class_entry (eaccelerator_class_entry * from TSRMLS_DC); 36 36 37 void restore_zval(zval * zv TSRMLS_DC); 37 38 void restore_class(mm_fc_entry *p TSRMLS_DC); 38 39 void restore_function(mm_fc_entry *p TSRMLS_DC); eaccelerator/branches/PHP_5_1/ea_store.c
r124 r146 83 83 EAG(mem) += sizeof(zend_property_info); 84 84 calc_string(from->name, from->name_length + 1 TSRMLS_CC); 85 #ifdef ZEND_ENGINE_2_1 86 if (from->doc_comment != NULL) { 87 calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 88 } 89 #endif 85 90 } 86 91 … … 247 252 calc_zval_hash(from->static_variables); 248 253 } 254 #ifdef ZEND_ENGINE_2_1 255 if (from->vars != NULL) { 256 zend_uint i; 257 EACCELERATOR_ALIGN(EAG(mem)); 258 EAG(mem) += sizeof(zend_compiled_variable) * from->last_var; 259 for (i = 0; i < from->last_var; i ++) { 260 calc_string(from->vars[i].name, from->vars[i].name_len+1 TSRMLS_CC); 261 } 262 } 263 #endif 249 264 if (from->filename != NULL) 250 265 calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); … … 286 301 calc_zval_hash(&from->constants_table); 287 302 calc_zval_hash(&from->default_properties); 303 304 #ifdef ZEND_ENGINE_2_1 305 calc_zval_hash(&from->default_static_members); 306 #endif 307 288 308 calc_hash(&from->properties_info, (calc_bucket_t) calc_property_info); 289 309 if (from->static_members != NULL) { … … 611 631 #endif 612 632 to->static_variables = from->static_variables; 633 #ifdef ZEND_ENGINE_2_1 634 to->vars = from->vars; 635 to->last_var = from->last_var; 636 #endif 613 637 to->return_reference = from->return_reference; 614 638 to->filename = from->filename; … … 672 696 store_zval_hash(to->static_variables, from->static_variables); 673 697 } 698 #ifdef ZEND_ENGINE_2_1 699 if (from->vars != NULL) { 700 zend_uint i; 701 EACCELERATOR_ALIGN(EAG(mem)); 702 to->last_var = from->last_var; 703 to->vars = (zend_compiled_variable*)EAG(mem); 704 EAG(mem) += sizeof(zend_compiled_variable) * from->last_var; 705 memcpy(to->vars, from->vars, sizeof(zend_compiled_variable) * from->last_var); 706 for (i = 0; i < from->last_var; i ++) { 707 to->vars[i].name = store_string(from->vars[i].name, from->vars[i].name_len+1 TSRMLS_CC); 708 } 709 } else { 710 to->last_var = 0; 711 to->vars = NULL; 712 } 713 #endif 674 714 if (from->filename != NULL) { 675 to->filename = store_string( to->filename, strlen(from->filename) + 1 TSRMLS_CC);715 to->filename = store_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); 676 716 } 677 717 #ifdef ZEND_ENGINE_2 … … 694 734 memcpy(to, from, sizeof(zend_property_info)); 695 735 to->name = store_string(from->name, from->name_length + 1 TSRMLS_CC); 736 #ifdef ZEND_ENGINE_2_1 737 to->doc_comment_len = from->doc_comment_len; 738 if (from->doc_comment != NULL) { 739 to->doc_comment = store_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 740 } 741 #endif 696 742 return to; 697 743 } … … 772 818 store_zval_hash(&to->default_properties, &from->default_properties); 773 819 #endif 820 821 #ifdef ZEND_ENGINE_2_1 822 store_zval_hash(&to->default_static_members, &from->default_static_members); //LYLE 823 #endif 824 774 825 store_hash(&to->function_table, &from->function_table, (store_bucket_t) store_op_array); 775 826 eaccelerator/branches/PHP_5_1/eaccelerator.c
r140 r146 110 110 /* saved original functions */ 111 111 static zend_op_array *(*mm_saved_zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); 112 113 #ifdef DEBUG 114 static void (*mm_saved_zend_execute)(zend_op_array *op_array TSRMLS_DC); 115 #endif 112 116 113 117 /* external declarations */ … … 843 847 while (q != NULL) { 844 848 #ifdef ZEND_ENGINE_2 845 q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC); 849 q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC); // hra: exactly the same?! 846 850 #else 847 851 q->fc = store_class_entry ((zend_class_entry *) q->fc TSRMLS_CC); … … 1562 1566 for (i=0;i<EAG(profile_level);i++) 1563 1567 ea_debug_put(EA_PROFILE_OPCODES, " "); 1564 ea_debug_printf(EA_PROFILE_OPCODES, "enter : %s:%s\n", op_array->filename, op_array->function_name);1568 ea_debug_printf(EA_PROFILE_OPCODES, "enter profile_execute: %s:%s\n", op_array->filename, op_array->function_name); 1565 1569 ea_debug_start_time(&tv_start); 1566 1570 EAG(self_time)[EAG(profile_level)] = 0; 1567 1571 EAG(profile_level)++; 1572 ea_debug_printf(EA_PROFILE_OPCODES, "About to enter zend_execute...\n"); 1568 1573 mm_saved_zend_execute(op_array TSRMLS_CC); 1574 ea_debug_printf(EA_PROFILE_OPCODES, "Finished zend_execute...\n"); 1569 1575 usec = ea_debug_elapsed_time(&tv_start); 1570 1576 EAG(profile_level)--; … … 1573 1579 for (i=0;i<EAG(profile_level);i++) 1574 1580 ea_debug_put(EA_PROFILE_OPCODES, " "); 1575 ea_debug_printf(EA_PROFILE_OPCODES, "leave : %s:%s (%ld,%ld)\n", op_array->filename, op_array->function_name, usec, usec-EAG(self_time)[EAG(profile_level)]);1581 ea_debug_printf(EA_PROFILE_OPCODES, "leave profile_execute: %s:%s (%ld,%ld)\n", op_array->filename, op_array->function_name, usec, usec-EAG(self_time)[EAG(profile_level)]); 1576 1582 } 1577 1583 … … 1590 1596 for (i=0;i<EAG(profile_level);i++) 1591 1597 ea_debug_put(EA_PROFILE_OPCODES, " "); 1592 ea_debug_printf(EA_DEBUG, " compile: %s (%ld)\n", file_handle->filename, usec);1598 ea_debug_printf(EA_DEBUG, "zend_op_array compile: %s (%ld)\n", file_handle->filename, usec); 1593 1599 return t; 1594 1600 } eaccelerator/branches/PHP_5_1/eaccelerator.h
r140 r146 43 43 # include "php_config.h" 44 44 # endif 45 #endif 46 47 #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1 48 # define ZEND_ENGINE_2_1 45 49 #endif 46 50 … … 200 204 zend_op *opcodes; 201 205 zend_uint last; 206 #ifdef ZEND_ENGINE_2_1 207 zend_compiled_variable *vars; 208 int last_var; 209 #endif 202 210 zend_uint T; 203 211 zend_brk_cont_element *brk_cont_array; … … 225 233 HashTable function_table; 226 234 HashTable default_properties; 235 #ifdef ZEND_ENGINE_2_1 236 HashTable default_static_members; 237 #endif 227 238 #ifdef ZEND_ENGINE_2 228 239 zend_uint ce_flags; … … 231 242 HashTable constants_table; 232 243 zend_uint num_interfaces; 244 233 245 char **interfaces; 234 246 zend_class_iterator_funcs iterator_funcs; eaccelerator/branches/PHP_5_1/loader.c
r127 r146 40 40 #include "ea_restore.h" 41 41 #include <math.h> 42 43 #ifdef HAVE_EACCELERATOR_STANDALONE_LOADER 44 zend_extension* ZendOptimizer = NULL; 45 #endif 42 46 43 47 typedef struct loader_data { eaccelerator/branches/PHP_5_1/opcodes.c
r102 r146 44 44 #endif 45 45 46 #ifdef ZEND_ENGINE_2 47 # define LAST_OPCODE 149 48 #else 49 # define LAST_OPCODE 106 50 #endif 46 #define LAST_OPCODE (sizeof(opcodes)/sizeof(opcodes[0])) 51 47 52 48 static const opcode_dsc opcodes[] = { … … 159 155 OPDEF("ADD_ARRAY_ELEMENT", EXT_BIT | OP1_STD | OP2_STD | RES_TMP), /* 72 */ 160 156 OPDEF("INCLUDE_OR_EVAL", EXT_UNUSED | OP1_STD | OP2_INCLUDE| RES_VAR), /* 73 */ 161 #ifdef ZEND_ENGINE_2 157 #ifdef ZEND_ENGINE_2_1 158 /* php 5.1 and up */ 162 159 OPDEF("UNSET_VAR", EXT_UNUSED | OP1_STD | OP2_FETCH | RES_UNUSED), /* 74 */ 163 OPDEF("UNSET_DIM_OBJ", EXT_STD | OP1_STD | OP2_STD | RES_UNUSED), /* 75 */ 164 OPDEF("ISSET_ISEMPTY", EXT_ISSET | OP1_VAR | OP2_UNUSED | RES_TMP), /* 76 */ 165 #else 160 OPDEF("UNSET_DIM", EXT_STD | OP1_STD | OP2_STD | RES_UNUSED), /* 75 */ 161 OPDEF("UNSET_OBJ", EXT_STD | OP1_STD | OP2_STD | RES_UNUSED), /* 76 */ 162 OPDEF("FE_RESET", EXT_BIT | OP1_STD | OP2_OPLINE | RES_VAR), /* 77 */ 163 #else 164 /* <= php 5.0 */ 165 /* though there is no ISSET_ISEMPTY in php 5.0 it's better to leave it here i guess */ 166 166 OPDEF("UNSET_VAR", EXT_UNUSED | OP1_STD | OP2_UNUSED | RES_UNUSED), /* 74 */ 167 167 OPDEF("UNSET_DIM_OBJ", EXT_UNUSED | OP1_VAR | OP2_STD | RES_UNUSED), /* 75 */ 168 168 OPDEF("ISSET_ISEMPTY", EXT_UNUSED | OP1_VAR | OP2_ISSET | RES_TMP), /* 76 */ 169 #endif170 169 OPDEF("FE_RESET", EXT_BIT | OP1_STD | OP2_UNUSED | RES_VAR), /* 77 */ 170 #endif 171 171 OPDEF("FE_FETCH", EXT_FE | OP1_STD | OP2_OPLINE | RES_TMP), /* 78 */ 172 172 OPDEF("EXIT", EXT_UNUSED | OP1_STD | OP2_UNUSED | RES_UNUSED), /* 79 */ … … 235 235 OPDEF("POST_DEC_OBJ", EXT_UNUSED | OP1_STD | OP2_STD | RES_TMP), /* 135 */ 236 236 OPDEF("ASSIGN_OBJ", EXT_UNUSED | OP1_STD | OP2_STD | RES_VAR), /* 136 */ 237 OPDEF("OP_DATA", EXT_UNUSED | OP1_STD | OP2_STD | RES_ UNUSED), /* 137 */237 OPDEF("OP_DATA", EXT_UNUSED | OP1_STD | OP2_STD | RES_STD), /* 137 */ 238 238 OPDEF("INSTANCEOF", EXT_UNUSED | OP1_STD | OP2_CLASS | RES_TMP), /* 138 */ 239 239 OPDEF("DECLARE_CLASS", EXT_UNUSED | OP1_STD | OP2_STD | RES_CLASS), /* 139 */ … … 246 246 OPDEF("VERIFY_ABSTRACT_CLASS", EXT_UNUSED | OP1_CLASS | OP2_UNUSED | RES_UNUSED), /* 146 */ 247 247 OPDEF("ASSIGN_DIM", EXT_UNUSED | OP1_STD | OP2_STD | RES_VAR), /* 147 */ 248 249 248 OPDEF("ISSET_ISEMPTY_PROP_OBJ", EXT_ISSET | OP1_STD | OP2_STD | RES_TMP), /* 148 */ 250 249 OPDEF("HANDLE_EXCEPTION", EXT_STD | OP1_UNUSED | OP2_UNUSED | RES_STD) /* 149 */ 250 # ifdef ZEND_ENGINE_2_1 251 , 252 OPDEF("USER_OPCODE", EXT_STD | OP1_UNUSED | OP2_UNUSED | RES_STD) /* 150 */ 253 # endif 251 254 #endif 252 255 }; 253 256 254 257 const opcode_dsc* get_opcode_dsc(unsigned int n) { 255 if (n < =LAST_OPCODE) {258 if (n < LAST_OPCODE) { 256 259 return &opcodes[n]; 257 260 } else { … … 262 265 263 266 #ifdef ZEND_ENGINE_2 264 static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE +1];267 static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE]; 265 268 static int handlers_retrived = 0; 266 269 … … 268 271 unsigned char i; 269 272 efree(op_array->opcodes); 270 op_array->opcodes = (zend_op*)emalloc(sizeof(zend_op)*(LAST_OPCODE +1));271 op_array->last = LAST_OPCODE +1;272 op_array->size = LAST_OPCODE +1;273 op_array->opcodes = (zend_op*)emalloc(sizeof(zend_op)*(LAST_OPCODE)); 274 op_array->last = LAST_OPCODE; 275 op_array->size = LAST_OPCODE; 273 276 op_array->T = 0; 274 for (i=0; i< =LAST_OPCODE; i++) {277 for (i=0; i<LAST_OPCODE; i++) { 275 278 op_array->opcodes[i].opcode = i; 276 279 op_array->opcodes[i].op1.op_type = IS_UNUSED; … … 299 302 p = compile_string(&str, empty_string TSRMLS_CC); 300 303 ext->op_array_handler = old; 301 if (p != NULL && p->last == LAST_OPCODE+1) {304 if (p != NULL && p->last == (LAST_OPCODE - 1)) { 302 305 int i = 0; 303 while (i < =LAST_OPCODE) {306 while (i < LAST_OPCODE) { 304 307 eaccelerator_opcode_handlers[p->opcodes[i].opcode] = p->opcodes[i].handler; 305 308 ++i; … … 319 322 } 320 323 } 321 if (opcode < =LAST_OPCODE) {324 if (opcode < LAST_OPCODE) { 322 325 return eaccelerator_opcode_handlers[opcode]; 323 326 } else { eaccelerator/branches/PHP_5_1/optimize.c
r133 r146 65 65 } BBlink; 66 66 67 #if 068 67 static void dump_bb(BB* bb, zend_op_array *op_array) { 69 68 BB* p = bb; … … 131 130 fflush(stdout); 132 131 } 133 #endif 132 133 static void dump_array(int nb,void *pos,char type) 134 { int j; 135 136 switch(type) { 137 case 'i': { 138 int *ptr=pos; 139 for (j=0;j<nb;j++) { 140 zend_printf("%d:%6d ",j,*ptr); 141 ptr++; 142 } 143 } 144 break; 145 case 'x': { 146 int *ptr=pos; 147 for (j=0;j<nb;j++) { 148 zend_printf("%d:%x ",j,*ptr); 149 ptr++; 150 } 151 } 152 break; 153 case 'c': { 154 unsigned char *ptr=pos; 155 for (j=0;j<nb;j++) { 156 /* if (*ptr>=32 && *ptr<128) zend_printf("%d:%c",j,*ptr); 157 else if (*ptr>=128) zend_printf("%d:%2x",j,*ptr); 158 else if (*ptr<16) zend_printf("%d:&%1x",j,*ptr); 159 else zend_printf("%d:$%1x",j,(*ptr)-16); */ 160 zend_printf("%d:%1x ",j,*ptr); 161 ptr++; 162 } 163 } 164 break; 165 default: 166 for (j=0;j<nb;j++) 167 zend_printf("# "); 168 } 169 zend_printf("<br>\n"); 170 } 134 171 135 172 #define SET_TO_NOP(op) \ … … 251 288 break; 252 289 case ZEND_UNSET_VAR: 290 #ifndef ZEND_ENGINE_2_1 291 /* Pre-PHP 5.1 only */ 253 292 case ZEND_UNSET_DIM_OBJ: 254 293 end->result.op_type = IS_UNUSED; 255 294 break; 295 #else 296 case ZEND_UNSET_DIM: 297 case ZEND_UNSET_OBJ: 298 end->result.op_type = IS_UNUSED; 299 break; 300 #endif 256 301 case ZEND_RECV: 257 302 case ZEND_RECV_INIT: 258 303 /*case ZEND_ADD_ARRAY_ELEMENT:*/ 259 304 case ZEND_INCLUDE_OR_EVAL: 305 #ifndef ZEND_ENGINE_2_1 306 /* Pre-PHP 5.1 only */ 260 307 case ZEND_JMP_NO_CTOR: 308 #else 309 case ZEND_NEW: 310 #endif 261 311 case ZEND_FE_FETCH: 262 312 #ifdef ZEND_ENGINE_2 … … 1280 1330 } 1281 1331 goto jmp_2; 1332 #ifndef ZEND_ENGINE_2_1 1333 /* Pre-PHP 5.1 only */ 1282 1334 case ZEND_JMP_NO_CTOR: 1335 #else 1336 case ZEND_NEW: 1337 #endif 1283 1338 case ZEND_FE_FETCH: 1284 1339 jmp_2: … … 1715 1770 } else 1716 1771 #endif 1772 1717 1773 if ((op->opcode == ZEND_ADD || 1718 1774 op->opcode == ZEND_SUB || … … 2444 2500 op->opcode == ZEND_POST_INC || 2445 2501 op->opcode == ZEND_POST_DEC || 2502 #ifndef ZEND_ENGINE_2_1 2503 /* Pre-PHP 5.1 only */ 2446 2504 op->opcode == ZEND_UNSET_DIM_OBJ || 2505 #else 2506 op->opcode == ZEND_UNSET_DIM || 2507 op->opcode == ZEND_UNSET_OBJ || 2508 #endif 2447 2509 op->opcode == ZEND_INCLUDE_OR_EVAL 2448 2510 #ifdef ZEND_ENGINE_2 … … 2722 2784 case ZEND_JMPZ_EX: 2723 2785 case ZEND_JMPNZ_EX: 2786 #ifndef ZEND_ENGINE_2_1 2787 /* Pre-PHP 5.1 only */ 2724 2788 case ZEND_JMP_NO_CTOR: 2789 #else 2790 case ZEND_NEW: 2791 case ZEND_FE_RESET: 2792 #endif 2725 2793 case ZEND_FE_FETCH: 2726 2794 bb[line_num+1].start = op+1; … … 2841 2909 #endif 2842 2910 case ZEND_UNSET_VAR: 2911 #ifndef ZEND_ENGINE_2_1 2912 /* Pre-PHP 5.1 only */ 2843 2913 case ZEND_UNSET_DIM_OBJ: 2844 2914 op->result.op_type = IS_UNUSED; 2845 2915 break; 2916 #else 2917 case ZEND_UNSET_DIM: 2918 op->result.op_type = IS_UNUSED; 2919 break; 2920 case ZEND_UNSET_OBJ: 2921 op->result.op_type = IS_UNUSED; 2922 break; 2923 #endif 2846 2924 default: 2847 2925 break; … … 2895 2973 case ZEND_JMPZ_EX: 2896 2974 case ZEND_JMPNZ_EX: 2975 #ifndef ZEND_ENGINE_2_1 2976 /* Pre-PHP 5.1 only */ 2897 2977 case ZEND_JMP_NO_CTOR: 2978 #else 2979 case ZEND_NEW: 2980 case ZEND_FE_RESET: 2981 #endif 2898 2982 case ZEND_FE_FETCH: 2899 2983 p->jmp_2 = &bb[op->op2.u.opline_num]; … … 3110 3194 while (start < op) { 3111 3195 --op; 3196 /* zend_printf("op=%d\n", op-op_array->opcodes); */ 3112 3197 #ifdef ZEND_ENGINE_2 3113 3198 op_data = NULL; … … 3151 3236 GET_REG(r); 3152 3237 op->extended_value = VAR_VAL(assigned[r]); 3153 }3154 if (op->opcode == ZEND_OP_DATA) {3155 op_data = op;3156 --op;3157 if (op->op1.op_type == IS_VAR || op->op1.op_type == IS_TMP_VAR) {3158 int r = VAR_NUM(op->op1.u.var);3159 GET_REG(r);3160 op->op1.u.var = VAR_VAL(assigned[r]);3161 }3162 if (op->op2.op_type == IS_VAR || op->op2.op_type == IS_TMP_VAR) {3163 int r = VAR_NUM(op->op2.u.var);3164 GET_REG(r);3165 op->op2.u.var = VAR_VAL(assigned[r]);3166 }3167 3238 } 3168 3239 #endif … … 3193 3264 } 3194 3265 } 3195 #ifdef ZEND_ENGINE_23196 if (op_data != NULL && op_data->op2.op_type == IS_VAR) {3197 FREE_REG(VAR_NUM(op_data->op2.u.var));3198 }3199 #endif3200 3266 } 3201 3267 } … … 3280 3346 emit_cfg(op_array, bb); 3281 3347 reassign_registers(op_array, bb, global); 3348 /* dump_bb(bb, op_array); */ 3282 3349 3283 3350 free_alloca(global); eaccelerator/branches/PHP_5_1/webui.c
r123 r146 264 264 goto string_dump; 265 265 case IS_CONSTANT_ARRAY: 266 ZEND_PUTS ("consta tnt_array(");266 ZEND_PUTS ("constant_array("); 267 267 goto array_dump; 268 268 default: … … 272 272 273 273 static const char *color_list[] = { 274 "#FF0000", 275 "#00FF00", 276 "#0000FF", 277 "#FFFF00", 278 "#00FFFF", 279 "#FF00FF", 280 "#800000", 281 "#008000", 282 "#000080", 283 "#808000", 284 "#008080", 285 "#800080" 274 /* color from irc */ 275 /* 0 // "#ffffff", white */ 276 /* 1 // "#000000", black */ 277 /* 4 */ "#ff0000", /* light red */ 278 /* 7 */ "#fc7f00", /* orange */ 279 /* 6 */ "#9c009c", /* magenta */ 280 /* 5 */ "#7f0000", /* red */ 281 /* 9 */ "#00fc00", /* light green (lime) */ 282 /* 10 */ "#009393", /* cyan */ 283 /* 12 */ "#0000fc", /* light blue */ 284 /* 13 */ "#ff00ff", /* light magenta (pink) */ 285 /* 2 */ "#00007f", /* blue */ 286 /* 3 */ "#009300", /* green */ 287 /* 8 // "#ffff00", yellow */ 288 /* 11 // "#00ffff", light cyan (aqua) */ 289 /* 14 */ "#7f7f7f", /* grey */ 290 /* 15 */ "#d2d2d2" /* light grey (silver) */ 286 291 }; 287 292 288 static c har const*color (int num)293 static const char *color (int num) 289 294 { 290 295 return color_list[num % (sizeof (color_list) / sizeof (char *))]; … … 323 328 if (*p == '\n') { 324 329 line--; 330 } else if (*p == '\r') { 331 line--; 332 if (p[1] == '\n') { 333 p++; 334 } 325 335 } else if (line == 1) { 326 336 if (*p == '<') … … 344 354 345 355 #ifdef ZEND_ENGINE_2 356 #ifdef ZEND_ENGINE_2_1 357 zend_printf ("last_var = %u, ", p->last_var); 358 #endif 346 359 zend_printf ("T = %u, size = %u\n, brk_count = %u, file = %s<br>\n", 347 360 p->T, p->last, p->last_brk_cont, p->filename); … … 368 381 q = q->pListNext; 369 382 } 370 ZEND_PUTS ("<tbody></table><br>\n"); 371 } 372 383 ZEND_PUTS ("</tbody></table><br>\n"); 384 } 385 #ifdef ZEND_ENGINE_2_1 386 if (p->last_var) { 387 int i; 388 389 ZEND_PUTS("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"600\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n"); 390 ZEND_PUTS("<thead valign=\"middle\" bgcolor=\"#9999cc\"><tr><th width=\"200\">Compiled variable</th><th width=\"200\">Len</th><th width=\"200\">Hash</th></tr></thead>\n"); 391 ZEND_PUTS("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all\">\n"); 392 393 for (i = 0; i < p->last_var; i ++) { 394 zend_printf ("<tr><td bgcolor=\"#ccccff\">$%s </td>", p->vars[i].name); 395 zend_printf ("<td bgcolor=\"#ccccff\">%u </td>", p->vars[i].name_len); 396 zend_printf ("<td bgcolor=\"#ccccff\">%u </td></tr>\n", p->vars[i].hash_value); 397 } 398 ZEND_PUTS ("</tbody></table><br>\n"); 399 } 400 #endif 401 373 402 if (p->opcodes) { 374 403 int n = 0; … … 378 407 filebuf = get_file_contents (p->filename); 379 408 380 ZEND_PUTS 381 ("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"900\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n"); 382 ZEND_PUTS 383 ("<thead valign=\"middle\" bgcolor=\"#9999cc\"><tr><th width=\"40\">N</th><th width=\"160\">OPCODE</th><th width=\"160\">EXTENDED_VALUE</th><th width=\"220\">OP1</th><th width=\"220\">OP2</th><th width=\"80\">RESULT</th></tr></thead>\n"); 384 ZEND_PUTS 385 ("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all; font-size: x-small\">\n"); 409 ZEND_PUTS("<table border=\"0\" cellpadding=\"3\" cellspacing=\"1\" width=\"900\" bgcolor=\"#000000\" align=\"center\" style=\"table-layout:fixed\">\n"); 410 ZEND_PUTS("<thead valign=\"middle\" bgcolor=\"#9999cc\"><tr><th width=\"40\">N</th><th width=\"160\">OPCODE</th><th width=\"160\">EXTENDED_VALUE</th><th width=\"220\">OP1</th><th width=\"220\">OP2</th><th width=\"80\">RESULT</th></tr></thead>\n"); 411 ZEND_PUTS("<tbody valign=\"top\" bgcolor=\"#cccccc\" style=\"word-break:break-all; font-size: x-small\">\n"); 412 386 413 for (; opline < end; opline++) { 387 414 const opcode_dsc *op = get_opcode_dsc (opline->opcode); 388 415 389 while (last_line < opline->lineno) { 390 last_line++; 391 zend_printf 392 ("<tr><td colspan=6 bgcolor=black><pre><font color=#80ff80>"); 393 print_file_line (filebuf, last_line); 416 if (last_line < opline->lineno) { 417 zend_printf("<tr><td colspan=6 bgcolor=black><pre><font color=#80ff80>"); 418 while (last_line < opline->lineno) { 419 last_line++; 420 print_file_line(filebuf, last_line); 421 ZEND_PUTS("\n"); 422 } 394 423 zend_printf ("</font></pre></td></tr>\n"); 395 424 } … … 460 489 ZEND_PUTS ("<td> </td>"); 461 490 } 491 #ifndef ZEND_ENGINE_2_1 462 492 } else if (opline->opcode == ZEND_UNSET_DIM_OBJ) { 463 493 if (opline->extended_value == ZEND_UNSET_DIM) { … … 469 499 } 470 500 #endif 501 #endif 471 502 } else if (opline->extended_value != 0) { 472 503 zend_printf ("<td>%ld </td>", opline->extended_value); … … 480 511 op = get_opcode_dsc (0); 481 512 } 482 513 #ifdef ZEND_ENGINE_2_1 514 if (opline->op1.op_type == IS_CV) { 515 zend_printf("<td><font color=%s>$cv%u(%s)</font> </td>", 516 color (opline->op1.u.var), opline->op1.u.var, 517 p->vars[opline->op1.u.var].name); 518 } else 519 #endif 483 520 if ((op->ops & OP1_MASK) == OP1_OPLINE) { 484 521 zend_printf … … 587 624 } 588 625 } 589 626 #ifdef ZEND_ENGINE_2_1 627 if (opline->op2.op_type == IS_CV) { 628 zend_printf("<td><font color=%s>$cv%u(%s)</font> </td>", 629 color (opline->op2.u.var), opline->op2.u.var, 630 p->vars[opline->op2.u.var].name); 631 } else 632 #endif 590 633 if ((op->ops & OP2_MASK) == OP2_OPLINE) { 591 634 zend_printf … … 675 718 } 676 719 } 677 720 #ifdef ZEND_ENGINE_2_1 721 if (opline->result.op_type == IS_CV) { 722 zend_printf("<td><font color=%s>$cv%u(%s)</font> </td>", 723 color (opline->result.u.var), opline->result.u.var, 724 p->vars[opline->result.u.var].name); 725 } else 726 #endif 727 678 728 switch (op->ops & RES_MASK) { 679 729 case RES_STD: … … 1834 1884 1835 1885 { 1836 char *s = php_get_uname ( );1886 char *s = php_get_uname ('a'); 1837 1887 zend_printf ("<nobr>%s</nobr>\n", s); 1838 1888 efree (s); eaccelerator/branches/PHP_5_1/win32/eAccelerator.dsp