Changeset 344 for eaccelerator/trunk/ea_store.c
- Timestamp:
- 06/19/08 18:01:31 (6 months ago)
- Files:
-
- eaccelerator/trunk/ea_store.c (modified) (30 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/ea_store.c
r336 r344 81 81 } 82 82 83 #ifdef ZEND_ENGINE_284 83 static size_t calc_property_info(zend_property_info * from TSRMLS_DC) 85 84 { … … 90 89 size += calc_string(from->name, from->name_length + 1 TSRMLS_CC); 91 90 #ifdef INCLUDE_DOC_COMMENTS 92 #ifdef ZEND_ENGINE_2_193 91 if (from->doc_comment != NULL) { 94 92 size += calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 95 93 } 96 94 #endif 97 #endif98 95 return size; 99 96 } 100 #endif101 97 102 98 /* Calculate the size of an HashTable */ … … 165 161 zend_bailout(); 166 162 } 167 #ifdef ZEND_ENGINE_2168 163 if (from->num_args > 0) { 169 164 zend_uint i; … … 178 173 } 179 174 } 180 #else181 if (from->arg_types != NULL) {182 size += calc_string((char *) from->arg_types, (from->arg_types[0] + 1) * sizeof(zend_uchar) TSRMLS_CC);183 }184 #endif185 175 if (from->function_name != NULL) { 186 176 size += calc_string(from->function_name, strlen(from->function_name) + 1 TSRMLS_CC); 187 177 } 188 #ifdef ZEND_ENGINE_2189 178 if (from->scope != NULL) { 190 179 // HOESH: the same problem? … … 198 187 } 199 188 } 200 #endif201 189 if (from->type == ZEND_INTERNAL_FUNCTION) { 202 190 return size; … … 222 210 ADDSIZE(size, sizeof(zend_brk_cont_element) * from->last_brk_cont); 223 211 } 224 #ifdef ZEND_ENGINE_2225 212 if (from->try_catch_array != NULL) { 226 213 ADDSIZE(size, sizeof(zend_try_catch_element) * from->last_try_catch); 227 214 } 228 #endif229 215 if (from->static_variables != NULL) { 230 216 ADDSIZE(size, sizeof(HashTable)); 231 217 size += calc_zval_hash(from->static_variables); 232 218 } 233 #ifdef ZEND_ENGINE_2_1234 219 if (from->vars != NULL) { 235 220 int i; … … 239 224 } 240 225 } 241 #endif242 226 if (from->filename != NULL) { 243 227 size += calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); 244 228 } 245 229 #ifdef INCLUDE_DOC_COMMENTS 246 #ifdef ZEND_ENGINE_2247 230 if (from->doc_comment != NULL) { 248 231 size += calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 249 232 } 250 #endif251 233 #endif 252 234 … … 270 252 size += calc_string(from->parent->name, from->parent->name_length + 1 TSRMLS_CC); 271 253 } 272 #ifdef ZEND_ENGINE_2273 254 if (from->filename != NULL) { 274 255 size += calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); … … 284 265 size += calc_hash(&from->properties_info, (calc_bucket_t) calc_property_info); 285 266 286 # ifdef ZEND_ENGINE_2_1287 267 size += calc_zval_hash(&from->default_static_members); 288 268 if ((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 289 # else290 if (from->static_members != NULL) {291 # endif292 269 ADDSIZE(size, sizeof(HashTable)); 293 270 size += calc_zval_hash(from->static_members); 294 271 } 295 #else296 size += calc_zval_hash(&from->default_properties);297 #endif298 272 size += calc_hash(&from->function_table, (calc_bucket_t) calc_op_array); 299 273 … … 331 305 } 332 306 while (c != NULL) { 333 #ifdef ZEND_ENGINE_2334 307 size += calc_class_entry(*(zend_class_entry **) c->pData TSRMLS_CC); 335 #else336 size += calc_class_entry((zend_class_entry *) c->pData TSRMLS_CC);337 #endif338 308 c = c->pListNext; 339 309 } … … 504 474 505 475 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 506 #ifdef ZEND_ENGINE_2507 476 DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n", 508 477 getpid(), from->function_name ? from->function_name : "(top)", … … 510 479 , from->type 511 480 )); 512 #else513 DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n",514 getpid(), from->function_name ? from->function_name : "(top)",515 "NULL"516 , from->type517 ));518 #endif519 481 520 482 if (from->type == ZEND_INTERNAL_FUNCTION) { … … 527 489 528 490 to->type = from->type; 529 #ifdef ZEND_ENGINE_2530 491 to->num_args = from->num_args; 531 492 to->required_num_args = from->required_num_args; … … 543 504 to->arg_info[i].class_name_len = from->arg_info[i].class_name_len; 544 505 } 545 # ifdef ZEND_ENGINE_2_1546 506 /* php 5.1 introduces this in zend_arg_info for array type hinting */ 547 507 to->arg_info[i].array_type_hint = from->arg_info[i].array_type_hint; 548 # endif549 508 to->arg_info[i].allow_null = from->arg_info[i].allow_null; 550 509 to->arg_info[i].pass_by_reference = from->arg_info[i].pass_by_reference; … … 553 512 } 554 513 to->pass_rest_by_reference = from->pass_rest_by_reference; 555 #else556 if (from->arg_types != NULL)557 to->arg_types = (unsigned char *)store_string(at, (char *)from->arg_types, (from->arg_types[0] + 1) * sizeof(zend_uchar) TSRMLS_CC);558 #endif559 514 if (from->function_name != NULL) 560 515 to->function_name = store_string(at, from->function_name, strlen(from->function_name) + 1 TSRMLS_CC); 561 #ifdef ZEND_ENGINE_2562 516 to->fn_flags = from->fn_flags; 563 517 to->scope_name = NULL; … … 585 539 } 586 540 } 587 #endif588 541 589 542 if (from->type == ZEND_INTERNAL_FUNCTION) { 590 #ifdef ZEND_ENGINE_2591 543 /* zend_internal_function also contains return_reference in ZE2 */ 592 544 to->return_reference = from->return_reference; 593 #endif 594 return to; 545 return to; 595 546 } 596 547 … … 600 551 to->brk_cont_array = from->brk_cont_array; 601 552 to->last_brk_cont = from->last_brk_cont; 602 #ifdef ZEND_ENGINE_2603 553 to->try_catch_array = from->try_catch_array; 604 554 to->last_try_catch = from->last_try_catch; … … 610 560 to->last_try_catch = 0; 611 561 } 612 #else613 to->uses_globals = from->uses_globals;614 #endif615 562 616 563 to->static_variables = from->static_variables; … … 632 579 store_zval(at, &opline->op2.u.constant TSRMLS_CC); 633 580 } 634 #ifdef ZEND_ENGINE_2635 581 switch (opline->opcode) { 636 582 case ZEND_JMP: … … 644 590 break; 645 591 } 646 #endif647 592 } 648 593 EAG(compress) = 1; … … 659 604 store_zval_hash(at, to->static_variables, from->static_variables); 660 605 } 661 #ifdef ZEND_ENGINE_2_1662 606 if (from->vars != NULL) { 663 607 int i; … … 674 618 to->line_start = from->line_start; 675 619 to->line_end = from->line_end; 676 # ifdef INCLUDE_DOC_COMMENTS620 #ifdef INCLUDE_DOC_COMMENTS 677 621 to->doc_comment_len = from->doc_comment_len; 678 622 if (from->doc_comment != NULL) { 679 623 to->doc_comment = store_string(at, from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 680 624 } 681 # endif682 625 #endif 683 626 … … 688 631 } 689 632 690 #ifdef ZEND_ENGINE_2691 633 static zend_property_info *store_property_info(char **at, zend_property_info * from TSRMLS_DC) 692 634 { … … 697 639 memcpy(to, from, sizeof(zend_property_info)); 698 640 to->name = store_string(at, from->name, from->name_length + 1 TSRMLS_CC); 699 #ifdef ZEND_ENGINE_2_1 700 # ifdef INCLUDE_DOC_COMMENTS 641 #ifdef INCLUDE_DOC_COMMENTS 701 642 to->doc_comment_len = from->doc_comment_len; 702 643 if (from->doc_comment != NULL) { 703 644 to->doc_comment = store_string(at, from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 704 645 } 705 # else646 #else 706 647 to->doc_comment_len = 0; 707 648 to->doc_comment = NULL; 708 #endif709 649 #endif 710 650 return to; … … 770 710 } 771 711 /* If the static member points to the same value in parent and child, remove for proper inheritance during restore */ 772 # ifdef ZEND_ENGINE_2_1773 712 if(zend_hash_quick_find(&parent->default_static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 774 # else775 if(zend_hash_quick_find(parent->static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) {776 # endif777 713 if(*pprop.v == *cprop.v) { 778 714 return ZEND_HASH_APPLY_REMOVE; … … 802 738 return ZEND_HASH_APPLY_REMOVE; 803 739 } 804 #endif805 740 806 741 static ea_class_entry *store_class_entry(char **at, zend_class_entry * from TSRMLS_DC) … … 831 766 } 832 767 833 #ifdef ZEND_ENGINE_2 /* php >= 5.0 */834 768 to->ce_flags = from->ce_flags; 835 769 to->static_members = NULL; … … 868 802 store_hash(at, &to->properties_info, &from->properties_info, (store_bucket_t) store_property_info, (check_bucket_t) store_property_access_check, from); 869 803 870 # ifdef ZEND_ENGINE_2_1 /* php >= 5.1 */871 804 if ((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 872 805 store_zval_hash(at, &to->default_static_members, &from->default_static_members); … … 879 812 to->static_members = &to->default_static_members; 880 813 } 881 # else /* php == 5.0 */882 if (from->static_members != NULL) {883 to->static_members = (HashTable *)ALLOCATE(at, sizeof(HashTable));884 885 store_hash(at, to->static_members, from->static_members, (store_bucket_t) store_zval_ptr, (check_bucket_t) store_static_member_access_check, from);886 }887 # endif888 814 store_hash(at, &to->function_table, &from->function_table, (store_bucket_t) store_op_array, (check_bucket_t) store_function_inheritance_check, from); 889 815 890 #else /* PHP 4 */891 store_zval_hash(at, &to->default_properties, &from->default_properties);892 store_hash(at, &to->function_table, &from->function_table, (store_bucket_t) store_op_array, NULL, NULL);893 #endif894 895 816 #ifdef DEBUG 896 817 EAG(xpad)--; … … 940 861 fc->htablen = c->nKeyLength; 941 862 fc->next = NULL; 942 #ifdef ZEND_ENGINE_2943 863 fc->fc = *(zend_class_entry **) c->pData; 944 #else945 fc->fc = c->pData;946 #endif947 864 c = c->pListNext; 948 865 x = fc->htabkey;