Changeset 344
- Timestamp:
- 06/19/08 18:01:31 (7 months ago)
- Files:
-
- eaccelerator/trunk/ChangeLog (modified) (1 diff)
- eaccelerator/trunk/NEWS (modified) (1 diff)
- eaccelerator/trunk/content.c (modified) (1 diff)
- eaccelerator/trunk/debug.c (modified) (4 diffs)
- eaccelerator/trunk/ea_dasm.c (modified) (8 diffs)
- eaccelerator/trunk/ea_restore.c (modified) (33 diffs)
- eaccelerator/trunk/ea_store.c (modified) (30 diffs)
- eaccelerator/trunk/eaccelerator.c (modified) (14 diffs)
- eaccelerator/trunk/eaccelerator.h (modified) (5 diffs)
- eaccelerator/trunk/opcodes.c (modified) (9 diffs)
- eaccelerator/trunk/optimize.c (modified) (42 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/ChangeLog
r342 r344 1 2008-05-18 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 2 3 * Remove support for all php versions older than php 5.1 4 1 5 2008-05-18 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 2 6 eaccelerator/trunk/NEWS
r278 r344 1 May 18, 2008 - Bart Vanbrabant 2 ------------------------------ 3 * Released 0.9.5.3 4 An other 0.9.5 maintenance release 5 Changes in this version (from 0.9.5.2) 6 - Remove an unlock statement that shouldn't be there. This should 7 fix the problems reported in #232 and a lot of related bugs. 8 Thanks to Terry Duncan for the fix! 9 10 September 03, 2007 - Bart Vanbrabant 11 ------------------------------------ 12 * Released 0.9.5.2 13 Changes in this version (from 0.9.5.1) 14 - This release fixes the optimizer bugs with php 5.2 that caused 15 exception handlers to be optimized out. 16 17 May 06, 2007 - Bart Vanbrabant 18 ---------------------------------- 19 20 * Released 0.9.5.1 21 Changes in this version (from 0.9.5) 22 - Fix bug that causes problems with protected attributes and php 5.2 23 - Fix ttl bug in list_keys 24 Known issues: 25 Exceptions aren't catched by try catch due to optimizer bug, see 26 bugreport #242. 27 1 28 Oct 11, 2006 - Bart Vanbrabant 2 29 ---------------------------------- eaccelerator/trunk/content.c
r286 r344 588 588 if (zend_eval_string(code, return_value, eval_name TSRMLS_CC) == SUCCESS && 589 589 eaccelerator_content_cache_place != ea_none) { 590 591 #ifndef ZEND_ENGINE_2_1592 /* Doesn't work with php >= 5.1.0 */593 /* clean garbage */594 while (EG(garbage_ptr)) {595 zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]);596 }597 #endif598 599 590 eaccelerator_put(key, key_len, return_value, ttl, eaccelerator_content_cache_place TSRMLS_CC); 600 591 } eaccelerator/trunk/debug.c
r297 r344 269 269 fprintf(F_fp, "\tfunction_table: %u entries\n", ce->function_table.nNumOfElements); 270 270 fprintf(F_fp, "\tdefault_properties: %u entries\n", ce->default_properties.nNumOfElements); 271 #ifdef ZEND_ENGINE_2272 271 fprintf(F_fp, "\tproperties_info: %u entries\n", ce->properties_info.nNumOfElements); 273 # ifdef ZEND_ENGINE_2_1274 272 fprintf(F_fp, "\tdefault_static_members: %u entries\n", ce->default_static_members.nNumOfElements); 275 # endif276 273 fprintf(F_fp, "\tstatic_members: %u entries\n", ce->static_members->nNumOfElements); 277 274 fprintf(F_fp, "\tconstants_Table: %u entries\n", ce->constants_table.nNumOfElements); … … 285 282 fprintf(F_fp, "\tdoc_comment_len: %u\n", ce->doc_comment_len); 286 283 # endif 287 #endif288 284 fflush(F_fp); 289 285 } … … 299 295 fprintf(F_fp, "\tfunction_table: %u entries\n", ce->function_table.nNumOfElements); 300 296 fprintf(F_fp, "\tdefault_properties: %u entries\n", ce->default_properties.nNumOfElements); 301 #ifdef ZEND_ENGINE_2302 297 fprintf(F_fp, "\tproperties_info: %u entries\n", ce->properties_info.nNumOfElements); 303 # ifdef ZEND_ENGINE_2_1304 298 fprintf(F_fp, "\tdefault_static_members: %u entries\n", ce->default_static_members.nNumOfElements); 305 # endif306 299 fprintf(F_fp, "\tstatic_members: %u entries\n", ce->static_members->nNumOfElements); 307 300 fprintf(F_fp, "\tconstants_Table: %u entries\n", ce->constants_table.nNumOfElements); … … 315 308 fprintf(F_fp, "\tdoc_comment_len: %u\n", ce->doc_comment_len); 316 309 # endif 317 #endif318 310 fflush(F_fp); 319 311 } eaccelerator/trunk/ea_dasm.c
r286 r344 99 99 "FETCH_GLOBAL", /* 0 */ 100 100 "FETCH_LOCAL", /* 1 */ 101 "FETCH_STATIC" /* 2 */ 102 #ifdef ZEND_ENGINE_2 103 , 104 "FETCH_STATIC_MEMBER" /* 3 */ 105 #ifdef ZEND_ENGINE_2_1 106 , 101 "FETCH_STATIC", /* 2 */ 102 "FETCH_STATIC_MEMBER", /* 3 */ 107 103 "UNKNOWN 1" /* 4 */ 108 #endif109 #endif110 104 }; 111 105 /* }}} */ … … 272 266 buf[0] = '\0'; 273 267 } 274 #ifdef ZEND_ENGINE_2275 268 } else if ((op->ops & EXT_MASK) == EXT_ASSIGN) { 276 269 if (opline->extended_value == ZEND_ASSIGN_OBJ) { … … 281 274 buf[0] = '\0'; 282 275 } 283 #ifndef ZEND_ENGINE_2_1284 } else if (opline->opcode == ZEND_UNSET_DIM_OBJ) {285 if (opline->extended_value == ZEND_UNSET_DIM) {286 snprintf(buf, sizeof(buf), "ZEND_UNSET_DIM");287 } else if (opline->extended_value == ZEND_UNSET_OBJ) {288 snprintf(buf, sizeof(buf), "ZEND_UNSET_OBJ");289 } else {290 buf[0] = '\0';291 }292 #endif293 #endif294 276 } else if (opline->extended_value != 0) { 295 277 snprintf(buf, sizeof(buf), "%ld", opline->extended_value); … … 301 283 /* op1 */ 302 284 zval_used = 0; 303 #ifdef ZEND_ENGINE_2_1304 285 if (opline->op1.op_type == IS_CV) { 305 286 snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->op1.u.var, op_array->vars[opline->op1.u.var].name); 306 } else 307 #endif 308 if ((op->ops & OP1_MASK) == OP1_OPLINE) { 287 } else if ((op->ops & OP1_MASK) == OP1_OPLINE) { 309 288 snprintf(buf, sizeof(buf), "opline(%d)", opline->op1.u.opline_num); 310 #ifdef ZEND_ENGINE_2311 289 } else if ((op->ops & OP1_MASK) == OP1_JMPADDR) { 312 290 snprintf(buf, sizeof(buf), "opline(%u)", (unsigned int)(opline->op1.u.jmp_addr - op_array->opcodes)); … … 319 297 snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op1.u.var)); 320 298 } 321 #endif322 299 } else if ((op->ops & OP1_MASK) == OP1_BRK) { 323 300 if (opline->op1.u.opline_num != -1 && opline->op2.op_type == IS_CONST && opline->op2.u.constant.type == IS_LONG) { … … 380 357 /* op2 */ 381 358 zval_used = 0; 382 #ifdef ZEND_ENGINE_2_1383 359 if (opline->op2.op_type == IS_CV) { 384 360 snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->op2.u.var, op_array->vars[opline->op2.u.var].name); 385 } else 386 #endif 387 if ((op->ops & OP2_MASK) == OP2_OPLINE) { 361 } else if ((op->ops & OP2_MASK) == OP2_OPLINE) { 388 362 snprintf(buf, sizeof(buf), "opline(%d)", opline->op2.u.opline_num); 389 #ifdef ZEND_ENGINE_2390 363 } else if ((op->ops & OP2_MASK) == OP2_JMPADDR) { 391 364 snprintf(buf, sizeof(buf), "opline(%u)", (unsigned int) (opline->op2.u.jmp_addr - op_array->opcodes)); 392 365 } else if ((op->ops & OP2_MASK) == OP2_CLASS) { 393 366 snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op2.u.var)); 394 #endif395 367 } else if ((op->ops & OP2_MASK) == OP2_VAR) { 396 368 snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op2.u.var)); 397 369 } else if ((op->ops & OP2_MASK) == OP2_FETCH) { 398 #ifdef ZEND_ENGINE_2399 370 if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { 400 371 snprintf(buf, sizeof(buf), "%s $class%u", fetchtypename[opline->op2.u.EA.type], VAR_NUM(opline->op2.u.var)); … … 402 373 snprintf(buf, sizeof(buf), "%s", fetchtypename[opline->op2.u.EA.type]); 403 374 } 404 #else405 strncpy(buf, fetchtypename[opline->op2.u.fetch_type], sizeof(buf));406 #endif407 375 } else if ((op->ops & OP2_MASK) == OP2_INCLUDE) { 408 376 if (opline->op2.u.constant.value.lval == ZEND_EVAL) { … … 449 417 /* result */ 450 418 zval_used = 0; 451 #ifdef ZEND_ENGINE_2_1452 419 if (opline->result.op_type == IS_CV) { 453 420 snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->result.u.var, op_array->vars[opline->result.u.var].name); 454 421 } else 455 #endif456 422 switch (op->ops & RES_MASK) { 457 423 case RES_STD: eaccelerator/trunk/ea_restore.c
r331 r344 36 36 #include "zend_API.h" 37 37 #include "zend_extensions.h" 38 #ifdef ZEND_ENGINE_2_139 38 #include "zend_vm.h" 40 #endif41 39 42 40 #ifndef INCOMPLETE_CLASS … … 52 50 #endif 53 51 54 #ifdef ZEND_ENGINE_255 52 /* pointer to the properties_info hashtable destructor */ 56 53 dtor_func_t properties_info_dtor = NULL; … … 72 69 zend_hash_destroy(&dummy_class_entry.constants_table); 73 70 zend_hash_destroy(&dummy_class_entry.properties_info); 74 # ifdef ZEND_ENGINE_2_175 71 zend_hash_destroy(&dummy_class_entry.default_static_members); 76 # endif77 # if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_1)78 zend_hash_destroy(dummy_class_entry.static_members);79 FREE_HASHTABLE(dummy_class_entry.static_members);80 # endif81 72 return property_dtor; 82 73 } 83 #endif84 74 85 75 /******************************************************************************/ … … 92 82 fixup_hash(base, from, (fixup_bucket_t)fixup_zval TSRMLS_CC) 93 83 94 #ifdef ZEND_ENGINE_295 84 static void fixup_property_info(char *base, zend_property_info * from TSRMLS_DC) 96 85 { 97 86 FIXUP(base, from->name); 98 #ifdef ZEND_ENGINE_2_199 87 FIXUP(base, from->doc_comment); 100 #endif 101 } 102 #endif 88 } 103 89 104 90 static void fixup_hash(char *base, HashTable * source, … … 165 151 zend_op *end; 166 152 167 #ifdef ZEND_ENGINE_2168 153 if (from->num_args > 0) { 169 154 zend_uint i; … … 174 159 } 175 160 } 176 #else177 FIXUP(base, from->arg_types);178 #endif179 161 FIXUP(base, from->function_name); 180 #ifdef ZEND_ENGINE_2181 162 FIXUP(base, from->scope_name); 182 #endif183 163 if (from->type == ZEND_INTERNAL_FUNCTION) { 184 164 return; … … 200 180 if (opline->op2.op_type == IS_CONST) 201 181 fixup_zval(base, &opline->op2.u.constant TSRMLS_CC); 202 #ifdef ZEND_ENGINE_2203 182 switch (opline->opcode) { 204 183 case ZEND_JMP: … … 212 191 break; 213 192 } 214 # ifdef ZEND_ENGINE_2_1215 193 ZEND_VM_SET_OPCODE_HANDLER(opline); 216 # elif defined(ZEND_ENGINE_2)217 opline->handler = zend_opcode_handlers[opline->opcode];218 # else219 opline->handler = get_opcode_handler(opline->opcode TSRMLS_CC);220 # endif221 222 #endif223 194 } 224 195 EAG(compress) = 1; 225 196 } 226 197 FIXUP(base, from->brk_cont_array); 227 #ifdef ZEND_ENGINE_2228 198 FIXUP(base, from->try_catch_array); 229 #endif230 199 if (from->static_variables != NULL) { 231 200 FIXUP(base, from->static_variables); 232 201 fixup_zval_hash(base, from->static_variables); 233 202 } 234 #ifdef ZEND_ENGINE_2_1235 203 if (from->vars != NULL) { 236 204 int i; … … 240 208 } 241 209 } 242 #endif243 210 FIXUP(base, from->filename); 244 211 #ifdef INCLUDE_DOC_COMMENTS 245 #ifdef ZEND_ENGINE_2246 212 FIXUP(base, from->doc_comment); 247 #endif248 213 #endif 249 214 } … … 253 218 FIXUP(base, from->name); 254 219 FIXUP(base, from->parent); 255 #ifdef ZEND_ENGINE_2256 220 FIXUP(base, from->filename); 257 221 fixup_zval_hash(base, &from->constants_table); … … 259 223 fixup_hash(base, &from->properties_info, 260 224 (fixup_bucket_t) fixup_property_info TSRMLS_CC); 261 # ifdef ZEND_ENGINE_2_1262 225 fixup_zval_hash(base, &from->default_static_members); 263 226 if (from->static_members != NULL) { … … 267 230 } 268 231 } 269 # else270 if (from->static_members != NULL) {271 FIXUP(base, from->static_members);272 fixup_zval_hash(base, from->static_members);273 }274 # endif275 #else276 fixup_zval_hash(base, &from->default_properties);277 #endif278 232 fixup_hash(base, &from->function_table,(fixup_bucket_t) fixup_op_array TSRMLS_CC); 279 233 } … … 433 387 void *ptr; 434 388 } function; 435 #ifdef ZEND_ENGINE_2436 389 int fname_len = 0; 437 390 char *fname_lc = NULL; 438 #endif439 391 440 392 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); … … 458 410 } 459 411 to->type = from->type; 460 #ifdef ZEND_ENGINE_2461 412 to->num_args = from->num_args; 462 413 to->required_num_args = from->required_num_args; 463 414 to->arg_info = from->arg_info; 464 415 to->pass_rest_by_reference = from->pass_rest_by_reference; 465 #else466 to->arg_types = from->arg_types;467 #endif468 416 to->function_name = from->function_name; 469 417 470 #ifdef ZEND_ENGINE_2471 418 if (to->function_name) { 472 419 fname_len = strlen(to->function_name); … … 538 485 DBG(ea_debug_printf, (EA_DEBUG, "[%d] %s's scope is '%s'\n", getpid(), 539 486 from->function_name ? from->function_name : "(top)", to->scope ? to->scope->name : "NULL")); 540 #endif541 487 if (from->type == ZEND_INTERNAL_FUNCTION) { 542 488 zend_class_entry *class_entry = EAG(class_entry); … … 551 497 if (class_entry != NULL && class_entry->parent != NULL && 552 498 zend_hash_find(&class_entry->parent->function_table, 553 #ifdef ZEND_ENGINE_2554 499 fname_lc, fname_len + 1, 555 #else556 to->function_name, strlen(to->function_name) + 1,557 #endif558 500 &function.ptr) == SUCCESS && function.v->type == ZEND_INTERNAL_FUNCTION) { 559 501 DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); … … 567 509 DBG(ea_debug_printf, (EA_DEBUG, "[%d] can't find\n", getpid())); 568 510 } 569 #ifdef ZEND_ENGINE_2570 511 /* hrak: slight memleak here. dont forget to free the lowercase function name! */ 571 512 if (fname_lc != NULL) { … … 576 517 /* this gets set by zend_do_inheritance */ 577 518 to->prototype = NULL; 578 #endif579 519 return to; 580 520 } 581 #ifdef ZEND_ENGINE_2582 521 /* hrak: slight memleak here. dont forget to free the lowercase function name! */ 583 522 if (fname_lc != NULL) { 584 523 efree(fname_lc); 585 524 } 586 #endif587 525 to->opcodes = from->opcodes; 588 526 to->last = to->size = from->last; … … 599 537 to->filename = from->filename; 600 538 601 #ifdef ZEND_ENGINE_2602 539 to->try_catch_array = from->try_catch_array; 603 540 to->last_try_catch = from->last_try_catch; … … 613 550 to->doc_comment = NULL; 614 551 #endif 615 #else616 to->uses_globals = from->uses_globals;617 #endif618 552 if (from->static_variables) { 619 553 to->static_variables = restore_zval_hash(NULL, from->static_variables); 620 554 to->static_variables->pDestructor = ZVAL_PTR_DTOR; 621 #ifndef ZEND_ENGINE_2622 555 if (EAG(class_entry) != NULL) { 623 556 Bucket *p = to->static_variables->pListHead; … … 627 560 } 628 561 } 629 #endif 630 } 631 632 #ifdef ZEND_ENGINE_2_1 562 } 563 633 564 to->vars = from->vars; 634 565 to->last_var = from->last_var; 635 566 to->size_var = 0; 636 #endif637 567 638 568 /* disable deletion in destroy_op_array */ … … 648 578 } 649 579 650 #ifdef ZEND_ENGINE_2651 580 static zend_property_info *restore_property_info(zend_property_info * 652 581 from TSRMLS_DC) … … 656 585 to->name = emalloc(from->name_length + 1); 657 586 memcpy(to->name, from->name, from->name_length + 1); 658 # ifdef ZEND_ENGINE_2_1 659 # ifdef INCLUDE_DOC_COMMENTS 587 #ifdef INCLUDE_DOC_COMMENTS 660 588 if (from->doc_comment != NULL) { 661 589 to->doc_comment = emalloc(from->doc_comment_len + 1); 662 590 memcpy(to->doc_comment, from->doc_comment, from->doc_comment_len + 1); 663 591 } 664 # else 665 to->doc_comment_len = 0; 666 to->doc_comment = NULL; 667 # endif 668 # ifdef ZEND_ENGINE_2_2 592 # ifdef ZEND_ENGINE_2_2 669 593 to->ce = EAG(class_entry); 670 # endif671 # endif594 # endif 595 #endif 672 596 return to; 673 597 } 674 #endif675 598 676 599 /* restore the parent class with the given name for the given class */ 677 600 static void restore_class_parent(char *parent, int len, zend_class_entry * to TSRMLS_DC) 678 601 { 679 #ifdef ZEND_ENGINE_2680 602 zend_class_entry** parent_ptr = NULL; 681 603 if (zend_lookup_class(parent, len, &parent_ptr TSRMLS_CC) != SUCCESS) 682 #else683 char *name_lc = estrndup(parent, len);684 zend_str_tolower(name_lc, len);685 if (zend_hash_find(CG(class_table), (void *) name_lc, len + 1, (void **) &to->parent) != SUCCESS)686 #endif687 604 { 688 605 ea_debug_error("[%d] EACCELERATOR can't restore parent class \"%s\" of class \"%s\"\n", getpid(), (char *) parent, to->name); … … 690 607 } else { 691 608 /* parent found */ 692 #ifdef ZEND_ENGINE_2693 609 to->parent = *parent_ptr; 694 #endif695 610 DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: found parent %s..\n", to->parent->name)); 696 611 DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: parent type=%d child type=%d\n", to->parent->type, to->type)); 697 612 } 698 #ifndef ZEND_ENGINE_2 699 efree(name_lc); 700 #endif 701 } 702 703 #ifdef ZEND_ENGINE_2 613 } 614 704 615 static void restore_class_methods(zend_class_entry * to TSRMLS_DC) 705 616 { … … 738 649 memcmp(fname_lc, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) == 0) 739 650 to->__set = f; 740 # ifdef ZEND_ENGINE_2_1741 651 else if (fname_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && 742 652 memcmp(fname_lc, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)) == 0) … … 745 655 memcmp(fname_lc, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)) == 0) 746 656 to->__isset = f; 747 # endif748 657 else if (fname_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && 749 658 memcmp(fname_lc, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) == 0) … … 766 675 efree(cname_lc); 767 676 } 768 #endif769 677 770 678 static zend_class_entry *restore_class_entry(zend_class_entry * to, ea_class_entry * from TSRMLS_DC) … … 792 700 EAG(class_entry) = to; 793 701 794 #ifdef ZEND_ENGINE_2795 702 to->ce_flags = from->ce_flags; 796 703 to->num_interfaces = from->num_interfaces; … … 828 735 to->properties_info.pDestructor = properties_info_dtor; 829 736 830 # ifdef ZEND_ENGINE_2_1831 737 /* restore default_static_members */ 832 738 restore_zval_hash(&to->default_static_members, &from->default_static_members); … … 840 746 to->static_members = &(to->default_static_members); 841 747 } 842 # else843 if (from->static_members != NULL) {844 ALLOC_HASHTABLE(to->static_members);845 restore_zval_hash(to->static_members, from->static_members);846 to->static_members->pDestructor = ZVAL_PTR_DTOR;847 }848 # endif849 #else850 to->refcount = emalloc(sizeof(*to->refcount));851 *to->refcount = 1;852 853 restore_zval_hash(&to->default_properties, &from->default_properties);854 to->default_properties.pDestructor = ZVAL_PTR_DTOR;855 /* Clearing references */856 {857 Bucket *p = to->default_properties.pListHead;858 while (p != NULL) {859 ((zval *) (p->pDataPtr))->refcount = 1;860 p = p->pListNext;861 }862 }863 #endif864 748 865 749 if (from->parent != NULL) { … … 874 758 to->function_table.pDestructor = ZEND_FUNCTION_DTOR; 875 759 876 #ifdef ZEND_ENGINE_2877 760 restore_class_methods(to TSRMLS_CC); 878 #endif879 761 880 762 if (to->parent) { 881 #ifdef ZEND_ENGINE_2882 763 zend_do_inheritance(to, to->parent TSRMLS_CC); 883 #else884 zend_do_inheritance(to, to->parent);885 #endif886 764 } 887 765 EAG(class_entry) = old; … … 904 782 CG(in_compilation) = 1; 905 783 CG(compiled_filename) = EAG(mem); 906 #ifdef ZEND_ENGINE_2907 784 CG(zend_lineno) = op_array.line_start; 908 #else909 CG(zend_lineno) = op_array.opcodes[0].lineno;910 #endif911 785 zend_error(E_ERROR, "Cannot redeclare %s()", p->htabkey); 912 786 } … … 919 793 void restore_class(ea_fc_entry * p TSRMLS_DC) 920 794 { 921 #ifdef ZEND_ENGINE_2922 795 zend_class_entry *ce; 923 #else924 zend_class_entry ce;925 #endif926 796 927 797 if ((p->htabkey[0] == '\000') && zend_hash_exists(CG(class_table), p->htabkey, p->htablen)) { 928 798 return; 929 799 } 930 #ifdef ZEND_ENGINE_2931 800 ce = restore_class_entry(NULL, (ea_class_entry *) p->fc TSRMLS_CC); 932 801 if (ce != NULL) 933 #else934 if (restore_class_entry(&ce, (ea_class_entry *) p->fc TSRMLS_CC) != NULL)935 #endif936 802 { 937 #ifdef ZEND_ENGINE_2938 803 if (zend_hash_add(CG(class_table), p->htabkey, p->htablen, &ce, sizeof(zend_class_entry *), NULL) == FAILURE) 939 #else940 if (zend_hash_add(CG(class_table), p->htabkey, p->htablen, &ce, sizeof(zend_class_entry), NULL) == FAILURE)941 #endif942 804 { 943 805 CG(in_compilation) = 1; 944 806 CG(compiled_filename) = EAG(mem); 945 #ifdef ZEND_ENGINE_2946 807 CG(zend_lineno) = ce->line_start; 947 #else948 CG(zend_lineno) = 0;949 #endif950 808 zend_error(E_ERROR, "Cannot redeclare class %s", p->htabkey); 951 809 } 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; eaccelerator/trunk/eaccelerator.c
r342 r344 102 102 int binary_zend_version[2]; 103 103 104 #ifdef ZEND_ENGINE_2105 104 /* pointer to the properties_info hashtable destructor */ 106 105 extern dtor_func_t properties_info_dtor; 107 #endif108 106 109 107 /* saved original functions */ … … 1166 1164 // segv74: really cheap work around to auto_global problem. 1167 1165 // it makes just in time to every time. 1168 #ifdef ZEND_ENGINE_21169 1166 zend_is_auto_global("_GET", sizeof("_GET")-1 TSRMLS_CC); 1170 1167 zend_is_auto_global("_POST", sizeof("_POST")-1 TSRMLS_CC); … … 1174 1171 zend_is_auto_global("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC); 1175 1172 zend_is_auto_global("_FILES", sizeof("_FILES")-1 TSRMLS_CC); 1176 #endif1177 1173 1178 1174 if (t != NULL) { // restore from cache … … 1184 1180 1185 1181 zend_llist_add_element(&CG(open_files), file_handle); 1186 #ifdef ZEND_ENGINE_21187 1182 if (file_handle->opened_path == NULL &&a