Changeset 822
- Timestamp:
- 03/22/2012 05:22:37 PM (14 months ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
optimizer.c (modified) (1 diff)
-
processor/hashtable.m4 (modified) (1 diff)
-
processor/processor.m4 (modified) (10 diffs)
-
utils.c (modified) (8 diffs)
-
xcache.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/optimizer.c
r716 r822 19 19 #else 20 20 # define XCACHE_IS_CV 16 21 #endif 22 23 #ifdef ZEND_ENGINE_2_4 24 # undef Z_OP_CONSTANT 25 /* Z_OP_CONSTANT is used before pass_two is applied */ 26 # define Z_OP_CONSTANT(op) op_array->literals[op.constant].constant 21 27 #endif 22 28 -
trunk/processor/hashtable.m4
r721 r822 109 109 /* pnew into hash node chain */ 110 110 pnew->pLast = NULL; 111 if (dst->arBuckets[n]) {112 pnew->pNext = dst->arBuckets[n];111 pnew->pNext = dst->arBuckets[n]; 112 if (pnew->pNext) { 113 113 pnew->pNext->pLast = pnew; 114 }115 else {116 pnew->pNext = NULL;117 114 } 118 115 dst->arBuckets[n] = pnew; -
trunk/processor/processor.m4
r785 r822 486 486 undefine(`UNION_znode_op') 487 487 define(`UNION_znode_op', `dnl {{{ 488 switch ((src->$1_type & ~EXT_TYPE_UNUSED)) { 488 #ifndef NDEBUG 489 switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) { 489 490 case IS_CONST: 490 491 case IS_VAR: … … 497 498 assert(0); 498 499 } 500 #endif 499 501 500 502 dnl dirty dispatch 501 503 DISABLECHECK(` 502 switch ((src->$1_type & ~EXT_TYPE_UNUSED)) {504 switch ((src->$1_type ifelse($1, `result', & ~EXT_TYPE_UNUSED))) { 503 505 case IS_CONST: 504 dnl TODO: fix me, use literals 505 IFDASM(`{ 506 zval *zv; 507 ALLOC_INIT_ZVAL(zv); 508 *zv = ((zend_literal *) src->$1.ptr)->constant; 509 zval_copy_ctor(zv); 510 add_assoc_zval_ex(dst, ZEND_STRS("$1.constant"), zv); 506 ifelse($1, `result', ` 507 DISPATCH(zend_uint, $1.constant) 508 ', ` 509 IFDASM(`{ 510 zval *zv; 511 ALLOC_INIT_ZVAL(zv); 512 *zv = src->$1.literal->constant; 513 zval_copy_ctor(zv); 514 add_assoc_zval_ex(dst, ZEND_STRS("$1.constant"), zv); 511 515 } 512 ', ` 513 DISPATCH(zend_uint, $1.constant) 516 ', ` 517 IFCOPY(` 518 dst->$1 = src->$1; 519 ', ` 520 DISPATCH(zend_uint, $1.constant) 521 ') 522 ') 514 523 ') 515 524 break; … … 517 526 IFNOTMEMCPY(` 518 527 default: 519 *dst = *src;528 $1 = $2; 520 529 ') 521 530 ', ` … … 607 616 #endif 608 617 IFCOPY(` 618 pushdef(`UNION_znode_op_literal', ` 619 if (dst->$1_type == IS_CONST) { 620 IFSTORE(` 621 dst->$1.constant = src->$1.literal - processor->active_op_array_src->literals; 622 dst->$1.literal = &processor->active_op_array_dst->literals[dst->$1.constant]; 623 ') 624 } 625 ') 626 UNION_znode_op_literal(op1) 627 UNION_znode_op_literal(op2) 628 popdef(`UNION_znode_op_literal') 609 629 switch (src->opcode) { 610 630 #ifdef ZEND_GOTO … … 659 679 if (shallow_copy) { 660 680 zend_bool gc_arg_info = 0; 661 int gc_opcodes= 0;681 zend_bool gc_opcodes = 0; 662 682 /* really fast shallow copy */ 663 683 memcpy(dst, src, sizeof(src[0])); … … 669 689 gc_arg_info = 1; 670 690 #endif 671 IFRESTORE(`dst->filename = processor->entry_src->filepath;') 672 #ifndef ZEND_ENGINE_2_4 691 dst->filename = processor->entry_src->filepath; 692 #ifdef ZEND_ENGINE_2_4 693 if (src->literals /* || op_array_info->literalsinfo_cnt */) { 694 gc_opcodes = 1; 695 } 696 #else 673 697 if (op_array_info->oplineinfo_cnt) { 698 gc_opcodes = 1; 699 } 700 #endif 701 if (gc_opcodes) { 674 702 zend_op *opline, *end; 675 gc_opcodes = 1;676 703 COPY_N_EX(last, zend_op, opcodes) 677 704 678 705 for (opline = dst->opcodes, end = opline + src->last; opline < end; ++opline) { 706 #ifdef ZEND_ENGINE_2_4 707 pushdef(`UNION_znode_op_literal', ` 708 if (opline->$1_type == IS_CONST) { 709 opline->$1.constant = opline->$1.literal - src->literals; 710 opline->$1.literal = &dst->literals[opline->$1.constant]; 711 } 712 ') 713 UNION_znode_op_literal(op1) 714 UNION_znode_op_literal(op2) 715 popdef(`UNION_znode_op_literal') 716 #endif 717 679 718 switch (opline->opcode) { 680 719 #ifdef ZEND_GOTO … … 700 739 } 701 740 } 702 #endif703 741 if (gc_arg_info || gc_opcodes) { 704 742 xc_gc_op_array_t gc_op_array; … … 707 745 gc_op_array.arg_info = gc_arg_info ? dst->arg_info : NULL; 708 746 #endif 709 gc_op_array.last = gc_opcodes > 1 ? dst->last : 0;710 747 gc_op_array.opcodes = gc_opcodes ? dst->opcodes : NULL; 711 748 xc_gc_add_op_array(&gc_op_array TSRMLS_CC); … … 771 808 IFSTORE(`dst->refcount[0] = 1;') 772 809 810 #ifdef ZEND_ENGINE_2_4 811 dnl before copying opcodes 812 DISPATCH(int, last_literal) 813 STRUCT_ARRAY(last_literal, zend_literal, literals) 814 #endif 815 773 816 pushdef(`AFTER_ALLOC', `IFCOPY(` 774 817 #ifndef NDEBUG … … 857 900 #endif 858 901 #ifdef ZEND_ENGINE_2_4 859 DISPATCH(int, last_literal)860 IFRESTORE(`COPY(literals)', `STRUCT_ARRAY(last_literal, zend_literal, literals)')861 862 902 COPYNULL(run_time_cache) 863 903 COPYNULL(last_cache_slot) -
trunk/utils.c
r785 r822 19 19 #endif 20 20 21 #define OP_ZVAL_DTOR(op) do { \ 22 Z_UNSET_ISREF(Z_OP_CONSTANT(op)); \ 23 zval_dtor(&Z_OP_CONSTANT(op)); \ 24 } while(0) 21 #ifdef ZEND_ENGINE_2_4 22 # define OP_ZVAL_DTOR(op) do { } while(0) 23 #else 24 # define OP_ZVAL_DTOR(op) do { \ 25 Z_UNSET_ISREF(Z_OP_CONSTANT(op)); \ 26 zval_dtor(&Z_OP_CONSTANT(op)); \ 27 } while(0) 28 #endif 25 29 xc_compile_result_t *xc_compile_result_init(xc_compile_result_t *cr, /* {{{ */ 26 30 zend_op_array *op_array, … … 130 134 } 131 135 /* }}} */ 132 133 136 int xc_undo_pass_two(zend_op_array *op_array TSRMLS_DC) /* {{{ */ 134 137 { 135 138 zend_op *opline, *end; 136 139 137 #ifndef ZEND_ENGINE_2_4 140 #ifdef ZEND_ENGINE_2_4 141 if (!(op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO)) { 142 return 0; 143 } 144 #else 138 145 if (!op_array->done_pass_two) { 139 146 return 0; … … 144 151 end = opline + op_array->last; 145 152 while (opline < end) { 153 #ifdef ZEND_ENGINE_2_4 154 if (opline->op1_type == IS_CONST) { 155 opline->op1.constant = opline->op1.literal - op_array->literals; 156 } 157 if (opline->op2_type == IS_CONST) { 158 opline->op2.constant = opline->op2.literal - op_array->literals; 159 } 160 #endif 161 146 162 #ifdef ZEND_ENGINE_2_1 147 163 switch (opline->opcode) { … … 167 183 opline++; 168 184 } 169 #ifndef ZEND_ENGINE_2_4 185 #ifdef ZEND_ENGINE_2_4 186 op_array->fn_flags &= ~ZEND_ACC_DONE_PASS_TWO; 187 #else 170 188 op_array->done_pass_two = 0; 171 189 #endif … … 177 195 { 178 196 zend_op *opline, *end; 179 180 #ifndef ZEND_ENGINE_2_4 197 #ifdef ZEND_ENGINE_2_4 198 zend_literal *literal = op_array->literals; 199 #endif 200 201 #ifdef ZEND_ENGINE_2_4 202 if ((op_array->fn_flags & ZEND_ACC_DONE_PASS_TWO)) { 203 return 0; 204 } 205 #else 181 206 if (op_array->done_pass_two) { 182 207 return 0; … … 188 213 op_array->size = op_array->last; 189 214 */ 215 #ifdef ZEND_ENGINE_2_4 216 if (literal) { 217 zend_literal *end = literal + op_array->last_literal; 218 while (literal < end) { 219 Z_SET_ISREF(literal->constant); 220 Z_SET_REFCOUNT(literal->constant, 2); /* Make sure is_ref won't be reset */ 221 literal++; 222 } 223 } 224 #endif 190 225 191 226 opline = op_array->opcodes; 192 227 end = opline + op_array->last; 193 228 while (opline < end) { 229 #ifndef ZEND_ENGINE_2_4 194 230 if (Z_OP_TYPE(opline->op1) == IS_CONST) { 195 231 Z_SET_ISREF(Z_OP_CONSTANT(opline->op1)); 196 232 Z_SET_REFCOUNT(Z_OP_CONSTANT(opline->op1), 2); /* Make sure is_ref won't be reset */ 197 198 233 } 199 234 if (Z_OP_TYPE(opline->op2) == IS_CONST) { … … 201 236 Z_SET_REFCOUNT(Z_OP_CONSTANT(opline->op2), 2); 202 237 } 238 #endif 203 239 #ifdef ZEND_ENGINE_2_1 204 240 switch (opline->opcode) { … … 226 262 } 227 263 228 #ifndef ZEND_ENGINE_2_4 264 #ifdef ZEND_ENGINE_2_4 265 op_array->fn_flags |= ZEND_ACC_DONE_PASS_TWO; 266 #else 229 267 op_array->done_pass_two = 1; 230 268 #endif -
trunk/xcache.h
r798 r822 22 22 23 23 #define HAVE_INODE 24 #if !defined(ZEND_ENGINE_2_4) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 99|| PHP_MAJOR_VERSION > 5)24 #if !defined(ZEND_ENGINE_2_4) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 4 || PHP_MAJOR_VERSION > 5) 25 25 # define ZEND_ENGINE_2_4 26 26 #endif … … 450 450 zend_arg_info *arg_info; 451 451 #endif 452 zend_uint last;453 452 zend_op *opcodes; 454 453 } xc_gc_op_array_t;

