Changeset 716
- Timestamp:
- 2011-04-09T09:07:48+02:00 (2 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
Decompiler.class.php (modified) (35 diffs)
-
NEWS (modified) (1 diff)
-
coverager.c (modified) (2 diffs)
-
optimizer.c (modified) (10 diffs)
-
processor/processor.m4 (modified) (18 diffs)
-
utils.c (modified) (19 diffs)
-
xcache.c (modified) (12 diffs)
-
xcache.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r714 r716 12 12 1.3.2 2011-??-?? 13 13 ======== 14 * PHP_6: initial catch up with php 6 literals and trait 14 15 * disassembler: DECLARE_INHERITED_CLASS/DELAYED class not found 15 16 * disassembler: don't dump builtin functions -
trunk/Decompiler.class.php
r714 r716 28 28 29 29 if (is_array($src)) { 30 die_error('array str');30 exit('array str'); 31 31 $src = new Decompiler_Array($src, $indent); 32 32 return $src->__toString(); … … 36 36 if (!method_exists($src, '__toString')) { 37 37 var_dump($src); 38 die_error('no __toString');38 exit('no __toString'); 39 39 } 40 40 return $src->__toString(); … … 426 426 switch ($op['op_type']) { 427 427 case XC_IS_CONST: 428 return str(value($op[' u.constant']));428 return str(value($op['constant'])); 429 429 430 430 case XC_IS_VAR: 431 431 case XC_IS_TMP_VAR: 432 432 $T = &$EX['Ts']; 433 $ret = $T[$op[' u.var']];433 $ret = $T[$op['var']]; 434 434 if ($tostr) { 435 435 $ret = str($ret, $EX); 436 436 } 437 437 if ($free) { 438 unset($T[$op[' u.var']]);438 unset($T[$op['var']]); 439 439 } 440 440 return $ret; 441 441 442 442 case XC_IS_CV: 443 $var = $op[' u.var'];443 $var = $op['var']; 444 444 $var = $EX['op_array']['vars'][$var]; 445 445 return '$' . $var['name']; … … 448 448 return null; 449 449 } 450 } 451 // }}} 452 function removeKeyPrefix($array, $prefix) // {{{ 453 { 454 $prefixLen = strlen($prefix); 455 $ret = array(); 456 foreach ($array as $key => $value) { 457 if (substr($key, 0, $prefixLen) == $prefix) { 458 $key = substr($key, $prefixLen); 459 } 460 $ret[$key] = $value; 461 } 462 return $ret; 450 463 } 451 464 // }}} … … 458 471 } 459 472 $EX['indent'] = ''; 460 //for ($i = 0, $cnt = count($opcodes); $i < $cnt; $i ++) { 461 // $opcodes[$i]['opcode'] = xcache_get_fixed_opcode($opcodes[$i]['opcode'], $i); 462 //} 473 for ($i = 0, $cnt = count($opcodes); $i < $cnt; $i ++) { 474 if (function_exists('xcache_get_fixed_opcode')) { 475 $opcodes[$i]['opcode'] = xcache_get_fixed_opcode($opcodes[$i]['opcode'], $i); 476 } 477 if (isset($opcodes[$i]['op1'])) { 478 $opcodes[$i]['op1'] = $this->removeKeyPrefix($opcodes[$i]['op1'], 'u.'); 479 $opcodes[$i]['op2'] = $this->removeKeyPrefix($opcodes[$i]['op2'], 'u.'); 480 $opcodes[$i]['result'] = $this->removeKeyPrefix($opcodes[$i]['result'], 'u.'); 481 } 482 else { 483 $op = array( 484 'op1' => array(), 485 'op2' => array(), 486 'op3' => array(), 487 ); 488 foreach ($opcodes[$i] as $name => $value) { 489 if (preg_match('!^(op1|op2|result)\\.(.*)!', $name, $m)) { 490 list(, $which, $field) = $m; 491 $op[$which][$field] = $value; 492 } 493 else if (preg_match('!^(op1|op2|result)_type$!', $name, $m)) { 494 list(, $which) = $m; 495 $op[$which]['op_type'] = $value; 496 } 497 else { 498 $op[$name] = $value; 499 } 500 } 501 $opcodes[$i] = $op; 502 } 503 } 463 504 // {{{ build jmp array 464 505 for ($i = 0, $cnt = count($opcodes); $i < $cnt; $i ++) { … … 474 515 switch ($op['opcode']) { 475 516 case XC_JMP: 476 $target = $op['op1'][' u.var'];517 $target = $op['op1']['var']; 477 518 $op['jmpouts'] = array($target); 478 519 $opcodes[$target]['jmpins'][] = $i; … … 480 521 481 522 case XC_JMPZNZ: 482 $jmpz = $op['op2'][' u.opline_num'];523 $jmpz = $op['op2']['opline_num']; 483 524 $jmpnz = $op['extended_value']; 484 525 $op['jmpouts'] = array($jmpz, $jmpnz); … … 494 535 case XC_FE_FETCH: 495 536 // case XC_JMP_NO_CTOR: 496 $target = $op['op2'][' u.opline_num'];537 $target = $op['op2']['opline_num']; 497 538 //if (!isset($target)) { 498 539 // $this->dumpop($op, $EX); … … 581 622 if ($op['opcode'] == XC_FE_FETCH) { 582 623 $opline = $next; 583 $next = $op['op2'][' u.opline_num'];624 $next = $op['op2']['opline_num']; 584 625 $end = $next - 1; 585 626 … … 600 641 /* 601 642 if ($op['opcode'] == XC_JMPZ) { 602 $target = $op2[' u.opline_num'];643 $target = $op2['opline_num']; 603 644 if ($line + 1) { 604 645 $nextblock = $EX['nextbbs'][$next]; 605 646 $jmpop = end($nextblock); 606 647 if ($jmpop['opcode'] == XC_JMP) { 607 $ifendline = $op2[' u.opline_num'];648 $ifendline = $op2['opline_num']; 608 649 if ($ifendline >= $line) { 609 650 $cond = $op['cond']; … … 650 691 } 651 692 652 $var = $fromop['result'][' u.var'];693 $var = $fromop['result']['var']; 653 694 var_dump($EX['Ts'][$var]); 654 695 $EX['Ts'][$var] = '(' . $fromop['and_or'] . " $opstr " . $EX['Ts'][$var] . ')'; … … 712 753 713 754 $resvar = null; 714 if ( ($res['u.EA.type'] & EXT_TYPE_UNUSED) || $res['op_type'] == XC_IS_UNUSED) {755 if (isset($res['EA.type']) && ($res['EA.type'] & EXT_TYPE_UNUSED) || $res['op_type'] == XC_IS_UNUSED) { 715 756 $istmpres = false; 716 757 } … … 743 784 case XC_NEW: // {{{ 744 785 array_push($EX['arg_types_stack'], array($EX['object'], $EX['fbc'])); 745 $EX['object'] = (int) $res[' u.var'];786 $EX['object'] = (int) $res['var']; 746 787 $EX['fbc'] = 'new ' . $this->unquoteName($this->getOpVal($op1, $EX)); 747 788 if (PHP_VERSION < 5) { … … 761 802 } 762 803 else { 763 $class = $op2[' u.constant'];804 $class = $op2['constant']; 764 805 if (is_object($class)) { 765 806 $class = get_class($class); … … 771 812 case XC_FETCH_CONSTANT: // {{{ 772 813 if ($op1['op_type'] == XC_IS_CONST) { 773 $resvar = $op1[' u.constant'];814 $resvar = $op1['constant']; 774 815 } 775 816 else if ($op1['op_type'] == XC_IS_UNUSED) { 776 $resvar = $op2[' u.constant'];817 $resvar = $op2['constant']; 777 818 } 778 819 else { 779 $class = $T[$op1[' u.var']];820 $class = $T[$op1['var']]; 780 821 assert($class[0] == 'class'); 781 $resvar = $class[1] . '::' . $op2[' u.constant'];822 $resvar = $class[1] . '::' . $op2['constant']; 782 823 } 783 824 break; … … 792 833 case XC_UNSET_VAR: 793 834 $rvalue = $this->getOpVal($op1, $EX); 794 $fetchtype = $op2[PHP_VERSION < 5 ? ' u.fetch_type' : 'u.EA.type'];835 $fetchtype = $op2[PHP_VERSION < 5 ? 'fetch_type' : 'EA.type']; 795 836 switch ($fetchtype) { 796 837 case ZEND_FETCH_STATIC_MEMBER: … … 838 879 839 880 $src = new Decompiler_ListBox($list); 840 if (!isset($op1[' u.var'])) {881 if (!isset($op1['var'])) { 841 882 $this->dumpop($op, $EX); 842 883 var_dump($op); 843 die('missing u.var');884 die('missing var'); 844 885 } 845 $T[$op1[' u.var']] = $src;886 $T[$op1['var']] = $src; 846 887 unset($list); 847 888 } … … 883 924 $type = $rvalue->iskey ? 'fe_key' : 'fe_as'; 884 925 $rvalue->obj[$type] = $lvalue; 885 unset($T[$op2[' u.var']]);926 unset($T[$op2['var']]); 886 927 break; 887 928 } … … 969 1010 $rvalue = "${" . $rvalue . "}"; 970 1011 } 971 if ($op2[' u.EA.type'] == ZEND_FETCH_STATIC_MEMBER) {1012 if ($op2['EA.type'] == ZEND_FETCH_STATIC_MEMBER) { 972 1013 $class = $this->getOpVal($op2, $EX); 973 1014 $rvalue = $class . '::' . $rvalue; … … 983 1024 } 984 1025 985 switch ( PHP_VERSION < 5 ? $op['op2']['u.var'] /* u.constant */ : $ext) {1026 switch ((PHP_VERSION < 5 ? $op['op2']['var'] /* constant */ : $ext) & (ZEND_ISSET|ZEND_ISEMPTY)) { 986 1027 case ZEND_ISSET: 987 1028 $rvalue = "isset($rvalue)"; … … 990 1031 $rvalue = "empty($rvalue)"; 991 1032 break; 992 default:993 $this->dumpop($op, $EX);994 die_error('1');995 1033 } 996 1034 $resvar = $rvalue; … … 1027 1065 1028 1066 if ($opc == XC_INIT_FCALL_BY_FUNC) { 1029 $which = $op1[' u.var'];1067 $which = $op1['var']; 1030 1068 $EX['fbc'] = $EX['op_array']['funcs'][$which]['name']; 1031 1069 } … … 1036 1074 // }}} 1037 1075 case XC_DO_FCALL_BY_FUNC: 1038 $which = $op1[' u.var'];1076 $which = $op1['var']; 1039 1077 $fname = $EX['op_array']['funcs'][$which]['name']; 1040 1078 $args = $this->popargs($EX, $ext); … … 1069 1107 // }}} 1070 1108 case XC_VERIFY_ABSTRACT_CLASS: // {{{ 1071 //unset($T[$op1[' u.var']]);1109 //unset($T[$op1['var']]); 1072 1110 break; 1073 1111 // }}} … … 1075 1113 case XC_DECLARE_INHERITED_CLASS: 1076 1114 case XC_DECLARE_INHERITED_CLASS_DELAYED: // {{{ 1077 $key = $op1[' u.constant'];1115 $key = $op1['constant']; 1078 1116 if (!isset($this->dc['class_table'][$key])) { 1079 1117 echo 'class not found: ', $key, 'existing classes are:', "\n"; … … 1094 1132 while ($i + 2 < $ic 1095 1133 && $opcodes[$i + 2]['opcode'] == XC_ADD_INTERFACE 1096 && $opcodes[$i + 2]['op1'][' u.var'] == $res['u.var']1134 && $opcodes[$i + 2]['op1']['var'] == $res['var'] 1097 1135 && $opcodes[$i + 1]['opcode'] == XC_FETCH_CLASS) { 1098 1136 $fetchop = &$opcodes[$i + 1]; … … 1160 1198 $offset = $this->getOpVal($op2, $EX); 1161 1199 if (isset($offset)) { 1162 $T[$res[' u.var']]->value[$offset] = $rvalue;1200 $T[$res['var']]->value[$offset] = $rvalue; 1163 1201 } 1164 1202 else { 1165 $T[$res[' u.var']]->value[] = $rvalue;1203 $T[$res['var']]->value[] = $rvalue; 1166 1204 } 1167 1205 } … … 1197 1235 // }}} 1198 1236 case XC_INCLUDE_OR_EVAL: // {{{ 1199 $type = $op2[' u.var']; // hack1237 $type = $op2['var']; // hack 1200 1238 $keyword = $this->includeTypes[$type]; 1201 1239 $resvar = "$keyword(" . $this->getOpVal($op1, $EX) . ")"; … … 1210 1248 $fe = new Decompiler_ForeachBox($op); 1211 1249 $fe->iskey = false; 1212 $T[$res[' u.var']] = $fe;1250 $T[$res['var']] = $fe; 1213 1251 1214 1252 ++ $i; … … 1218 1256 1219 1257 $res = $opcodes[$i]['result']; 1220 $T[$res[' u.var']] = $fe;1258 $T[$res['var']] = $fe; 1221 1259 } 1222 1260 break; 1223 1261 // }}} 1224 1262 case XC_SWITCH_FREE: // {{{ 1225 // unset($T[$op1[' u.var']]);1263 // unset($T[$op1['var']]); 1226 1264 break; 1227 1265 // }}} 1228 1266 case XC_FREE: // {{{ 1229 $free = $T[$op1[' u.var']];1267 $free = $T[$op1['var']]; 1230 1268 if (!is_a($free, 'Decompiler_Array') && !is_a($free, 'Decompiler_Box')) { 1231 1269 $op['php'] = is_object($free) ? $free : $this->unquote($free, '(', ')'); 1232 1270 $lastphpop = &$op; 1233 1271 } 1234 unset($T[$op1[' u.var']], $free);1272 unset($T[$op1['var']], $free); 1235 1273 break; 1236 1274 // }}} … … 1258 1296 } 1259 1297 if ($opc == XC_JMPZ_EX || $opc == XC_JMPNZ_EX || $opc == XC_JMPZ) { 1260 $targetop = &$EX['opcodes'][$op2[' u.opline_num']];1298 $targetop = &$EX['opcodes'][$op2['opline_num']]; 1261 1299 if ($opc == XC_JMPNZ_EX) { 1262 1300 $targetop['cond_true'][] = str($rvalue); … … 1286 1324 $lvalue = $this->getOpVal($op['result'], $EX); 1287 1325 if ($opc == XC_RECV_INIT) { 1288 $default = value($op['op2'][' u.constant']);1326 $default = value($op['op2']['constant']); 1289 1327 } 1290 1328 else { … … 1372 1410 if (isset($resvar)) { 1373 1411 if ($istmpres) { 1374 $T[$res[' u.var']] = $resvar;1375 $lastresvar = &$T[$res[' u.var']];1412 $T[$res['var']] = $resvar; 1413 $lastresvar = &$T[$res['var']]; 1376 1414 } 1377 1415 else { … … 1419 1457 switch ($op[$k]['op_type']) { 1420 1458 case XC_IS_UNUSED: 1421 $d[$kk] = '*UNUSED* ' . $op[$k][' u.opline_num'];1459 $d[$kk] = '*UNUSED* ' . $op[$k]['opline_num']; 1422 1460 break; 1423 1461 1424 1462 case XC_IS_VAR: 1425 $d[$kk] = '$' . $op[$k][' u.var'];1463 $d[$kk] = '$' . $op[$k]['var']; 1426 1464 if ($kk != 'res') { 1427 1465 $d[$kk] .= ':' . $this->getOpVal($op[$k], $EX); … … 1430 1468 1431 1469 case XC_IS_TMP_VAR: 1432 $d[$kk] = '#' . $op[$k][' u.var'];1470 $d[$kk] = '#' . $op[$k]['var']; 1433 1471 if ($kk != 'res') { 1434 1472 $d[$kk] .= ':' . $this->getOpVal($op[$k], $EX); -
trunk/NEWS
r714 r716 4 4 1.3.2 2011-??-?? 5 5 ======== 6 * PHP_6: catch up with php 6 devel 6 7 * memory leak on recompile 7 8 * disassembler fixes and updates for new PHP -
trunk/coverager.c
r554 r716 379 379 static int xc_coverager_get_op_array_size_no_tail(zend_op_array *op_array) /* {{{ */ 380 380 { 381 zend_uint size; 382 383 size = op_array->size; 381 zend_uint last = op_array->last; 384 382 do { 385 383 next_op: 386 if ( size== 0) {384 if (last == 0) { 387 385 break; 388 386 } 389 switch (op_array->opcodes[ size- 1].opcode) {387 switch (op_array->opcodes[last - 1].opcode) { 390 388 #ifdef ZEND_HANDLE_EXCEPTION 391 389 case ZEND_HANDLE_EXCEPTION: … … 393 391 case ZEND_RETURN: 394 392 case ZEND_EXT_STMT: 395 size --;393 --last; 396 394 goto next_op; 397 395 } 398 396 } while (0); 399 return size;397 return last; 400 398 } 401 399 /* }}} */ -
trunk/optimizer.c
r657 r716 64 64 continue; 65 65 } 66 if ( opline->op2.op_type!= IS_CONST67 || opline->op2.u.constant.type != IS_LONG) {66 if (Z_OP_TYPE(opline->op2) != IS_CONST 67 || Z_OP_CONSTANT(opline->op2).type != IS_LONG) { 68 68 return FAILURE; 69 69 } 70 70 71 nest_levels = opline->op2.u.constant.value.lval;71 nest_levels = Z_OP_CONSTANT(opline->op2).value.lval; 72 72 original_nest_levels = nest_levels; 73 73 74 array_offset = opline->op1.u.opline_num;74 array_offset = Z_OP(opline->op1).opline_num; 75 75 do { 76 76 if (array_offset == -1) { … … 96 96 /* rewrite to jmp */ 97 97 if (opline->opcode == ZEND_BRK) { 98 opline->op1.u.opline_num = jmp_to->brk;98 Z_OP(opline->op1).opline_num = jmp_to->brk; 99 99 } 100 100 else { 101 opline->op1.u.opline_num = jmp_to->cont;102 } 103 opline->op2.op_type= IS_UNUSED;101 Z_OP(opline->op1).opline_num = jmp_to->cont; 102 } 103 Z_OP_TYPE(opline->op2) = IS_UNUSED; 104 104 opline->opcode = ZEND_JMP; 105 105 } … … 143 143 144 144 case ZEND_JMP: 145 fi->jmpout_op1 = opline->op1.u.opline_num;145 fi->jmpout_op1 = Z_OP(opline->op1).opline_num; 146 146 return SUCCESS; /* no fall */ 147 147 148 148 case ZEND_JMPZNZ: 149 fi->jmpout_op2 = opline->op2.u.opline_num;149 fi->jmpout_op2 = Z_OP(opline->op2).opline_num; 150 150 fi->jmpout_ext = (int) opline->extended_value; 151 151 return SUCCESS; /* no fall */ … … 168 168 #endif 169 169 case ZEND_FE_FETCH: 170 fi->jmpout_op2 = opline->op2.u.opline_num;170 fi->jmpout_op2 = Z_OP(opline->op2).opline_num; 171 171 break; 172 172 … … 186 186 /* }}} */ 187 187 #ifdef XCACHE_DEBUG 188 static void op_snprint(char *buf, int size, z node*op) /* {{{ */189 { 190 switch (op ->op_type) {188 static void op_snprint(char *buf, int size, zend_uchar op_type, znode_op *op) /* {{{ */ 189 { 190 switch (op_type) { 191 191 case IS_CONST: 192 192 { 193 193 zval result; 194 zval *zv = & op->u.constant;194 zval *zv = &Z_OP_CONSTANT(*op); 195 195 TSRMLS_FETCH(); 196 196 197 /* TODO: update for PHP 6 */ 197 198 php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); 198 199 php_var_export(&zv, 1 TSRMLS_CC); … … 206 207 207 208 case IS_TMP_VAR: 208 snprintf(buf, size, "t@%d", op->u.var);209 snprintf(buf, size, "t@%d", Z_OP(*op).var); 209 210 break; 210 211 211 212 case XCACHE_IS_CV: 212 213 case IS_VAR: 213 snprintf(buf, size, "v@%d", op->u.var);214 snprintf(buf, size, "v@%d", Z_OP(*op).var); 214 215 break; 215 216 216 217 case IS_UNUSED: 217 if ( op->u.opline_num) {218 snprintf(buf, size, "u#%d", op->u.opline_num);218 if (Z_OP(*op).opline_num) { 219 snprintf(buf, size, "u#%d", Z_OP(op).opline_num); 219 220 } 220 221 else { … … 224 225 225 226 default: 226 snprintf(buf, size, "%d %d", op->op_type, op->u.var);227 snprintf(buf, size, "%d %d", op->op_type, Z_OP(op).var); 227 228 } 228 229 } … … 235 236 char buf_1[20]; 236 237 char buf_2[20]; 237 op_snprint(buf_r, sizeof(buf_r), &opline->result);238 op_snprint(buf_1, sizeof(buf_1), &opline->op1);239 op_snprint(buf_2, sizeof(buf_2), &opline->op2);238 op_snprint(buf_r, sizeof(buf_r), Z_OP_TYPE(opline->result), &opline->result); 239 op_snprint(buf_1, sizeof(buf_1), Z_OP_TYPE(opline->op1), &opline->op1); 240 op_snprint(buf_2, sizeof(buf_2), Z_OP_TYPE(opline->op2), &opline->op2); 240 241 fprintf(stderr, 241 242 "%3d %3d" … … 451 452 if (op_get_flowinfo(&fi, opline) == SUCCESS) { 452 453 if (fi.jmpout_op1 != XC_OPNUM_INVALID) { 453 opline->op1.u.opline_num = bbids[fi.jmpout_op1];454 assert( opline->op1.u.opline_num != BBID_INVALID);454 Z_OP(opline->op1).opline_num = bbids[fi.jmpout_op1]; 455 assert(Z_OP(opline->op1).opline_num != BBID_INVALID); 455 456 } 456 457 if (fi.jmpout_op2 != XC_OPNUM_INVALID) { 457 opline->op2.u.opline_num = bbids[fi.jmpout_op2];458 assert( opline->op2.u.opline_num != BBID_INVALID);458 Z_OP(opline->op2).opline_num = bbids[fi.jmpout_op2]; 459 assert(Z_OP(opline->op2).opline_num != BBID_INVALID); 459 460 } 460 461 if (fi.jmpout_ext != XC_OPNUM_INVALID) { … … 499 500 if (op_get_flowinfo(&fi, last) == SUCCESS) { 500 501 if (fi.jmpout_op1 != XC_OPNUM_INVALID) { 501 last->op1.u.opline_num = bbs_get(bbs, fi.jmpout_op1)->opnum;502 assert( last->op1.u.opline_num != BBID_INVALID);502 Z_OP(last->op1).opline_num = bbs_get(bbs, fi.jmpout_op1)->opnum; 503 assert(Z_OP(last->op1).opline_num != BBID_INVALID); 503 504 } 504 505 if (fi.jmpout_op2 != XC_OPNUM_INVALID) { 505 last->op2.u.opline_num = bbs_get(bbs, fi.jmpout_op2)->opnum;506 assert( last->op2.u.opline_num != BBID_INVALID);506 Z_OP(last->op2).opline_num = bbs_get(bbs, fi.jmpout_op2)->opnum; 507 assert(Z_OP(last->op2).opline_num != BBID_INVALID); 507 508 } 508 509 if (fi.jmpout_ext != XC_OPNUM_INVALID) { -
trunk/processor/processor.m4
r713 r716 223 223 DISPATCH(zend_uint, class_name_len) 224 224 PROC_ZSTRING_L(, class_name, class_name_len) 225 #ifdef ZEND_ENGINE_2_4 226 DISPATCH(zend_uchar, type_hint) 227 #else 225 228 DISPATCH(zend_bool, array_type_hint) 229 #endif 226 230 DISPATCH(zend_bool, allow_null) 227 231 DISPATCH(zend_bool, pass_by_reference) 232 #ifndef ZEND_ENGINE_2_4 228 233 DISPATCH(zend_bool, return_reference) 229 234 DISPATCH(int, required_num_args) 235 #endif 230 236 ') 231 237 #endif … … 273 279 PROC_ZSTRING_L(, name, name_length) 274 280 DISPATCH(ulong, h) 281 #ifdef ZEND_ENGINE_2_4 282 DISPATCH(int, offset) 283 #endif 275 284 #ifdef ZEND_ENGINE_2_1 276 285 DISPATCH(int, doc_comment_len) … … 307 316 STRUCT_P(int, refcount) 308 317 #endif 318 #ifndef ZEND_ENGINE_2_4 309 319 DISPATCH(zend_bool, constants_updated) 320 #endif 310 321 #ifdef ZEND_ENGINE_2 311 322 DISPATCH(zend_uint, ce_flags) 312 323 #endif 313 324 314 STRUCT(HashTable, default_properties, HashTable_zval_ptr) 325 #ifdef ZEND_ENGINE_2_4 326 DISPATCH(int, default_properties_count) 327 STRUCT_ARRAY(default_properties_count, zval, default_properties_table) 328 DISPATCH(int, default_static_members_count) 329 STRUCT_ARRAY(default_static_members_count, zval, default_static_members_table) 330 IFCOPY(`dst->static_members_table = &dst->default_static_members_table;') 331 DONE(static_members_table) 332 #else 315 333 IFCOPY(`dst->builtin_functions = src->builtin_functions;') 316 334 DONE(builtin_functions) 317 #ifdef ZEND_ENGINE_2 335 STRUCT(HashTable, default_properties, HashTable_zval_ptr) 336 # ifdef ZEND_ENGINE_2 318 337 STRUCT(HashTable, properties_info, HashTable_zend_property_info) 319 # ifdef ZEND_ENGINE_2_1338 # ifdef ZEND_ENGINE_2_1 320 339 STRUCT(HashTable, default_static_members, HashTable_zval_ptr) 321 340 IFCOPY(`dst->static_members = &dst->default_static_members;') 322 341 DONE(static_members) 323 # else342 # else 324 343 STRUCT_P(HashTable, static_members, HashTable_zval_ptr) 325 # endif 344 # endif 345 # endif 346 #endif /* ZEND_ENGINE_2_4 */ 347 348 #ifdef ZEND_ENGINE_2 326 349 STRUCT(HashTable, constants_table, HashTable_zval_ptr) 327 350 328 351 dnl runtime binding: ADD_INTERFACE will deal with it 352 dnl runtime binding: ADD_TRAIT will deal with it 329 353 IFRESTORE(` 330 354 if (src->num_interfaces) { 331 355 CALLOC(dst->interfaces, zend_class_entry*, src->num_interfaces) 332 356 DONE(`interfaces') 357 # ifdef ZEND_ENGINE_2_4 358 CALLOC(dst->traits, zend_class_entry*, src->num_traits) 359 DONE(`traits') 360 DONE(`trait_aliases') 361 DONE(`trait_precedences') 362 # endif 333 363 } 334 364 else { 335 COPYNULL(interfaces) 365 COPYNULL(`interfaces') 366 # ifdef ZEND_ENGINE_2_4 367 COPYNULL(`traits') 368 COPYNULL(`trait_aliases') 369 COPYNULL(`trait_precedences') 370 # endif 336 371 } 337 372 ') … … 351 386 */ 352 387 DONE(`interfaces') 388 # ifdef ZEND_ENGINE_2_4 389 DONE(`traits') 390 DONE(`trait_aliases') 391 DONE(`trait_precedences') 392 # endif 353 393 } 354 394 else { 355 COPYNULL(interfaces) 395 COPYNULL(`interfaces') 396 # ifdef ZEND_ENGINE_2_4 397 COPYNULL(`traits') 398 COPYNULL(`trait_aliases') 399 COPYNULL(`trait_precedences') 400 # endif 356 401 } 357 402 ') … … 359 404 IFDASM(`', ` 360 405 DONE(`interfaces') 406 # ifdef ZEND_ENGINE_2_4 407 DONE(`traits') 408 DONE(`trait_aliases') 409 DONE(`trait_precedences') 410 # endif 361 411 ') 362 412 ') 363 413 DISPATCH(zend_uint, num_interfaces) 364 414 # ifdef ZEND_ENGINE_2_4 415 DISPATCH(zend_uint, num_traits) 416 # endif 417 418 # ifdef ZEND_ENGINE_2_4 419 DISABLECHECK(` 420 IFRESTORE(`dst->info.user.filename = processor->entry_src->filepath;', `PROC_STRING(info.user.filename)') 421 DISPATCH(zend_uint, info.user.line_start) 422 DISPATCH(zend_uint, info.user.line_end) 423 DISPATCH(zend_uint, info.user.doc_comment_len) 424 PROC_ZSTRING_L(, info.user.doc_comment, info.user.doc_comment_len) 425 ') 426 DONE(info) 427 # else 365 428 IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)') 366 429 DISPATCH(zend_uint, line_start) 367 430 DISPATCH(zend_uint, line_end) 368 # ifdef ZEND_ENGINE_2_1431 # ifdef ZEND_ENGINE_2_1 369 432 DISPATCH(zend_uint, doc_comment_len) 370 433 PROC_ZSTRING_L(, doc_comment, doc_comment_len) 371 #endif 434 # endif 435 # endif 436 372 437 /* # NOT DONE */ 373 438 COPY(serialize_func) … … 377 442 COPY(get_iterator) 378 443 COPY(interface_gets_implemented) 379 # ifdef ZEND_ENGINE_2_3444 # ifdef ZEND_ENGINE_2_3 380 445 COPY(get_static_method) 381 # endif446 # endif 382 447 COPY(serialize) 383 448 COPY(unserialize) … … 389 454 COPY(__set) 390 455 /* should be >5.1 */ 391 # ifdef ZEND_ENGINE_2_1456 # ifdef ZEND_ENGINE_2_1 392 457 COPY(__unset) 393 458 COPY(__isset) 394 # if defined(ZEND_ENGINE_2_2) || PHP_MAJOR_VERSION >= 6459 # if defined(ZEND_ENGINE_2_2) || PHP_MAJOR_VERSION >= 6 395 460 COPY(__tostring) 396 # endif397 # endif461 # endif 462 # endif 398 463 COPY(__call) 399 # ifdef ZEND_CALLSTATIC_FUNC_NAME464 # ifdef ZEND_CALLSTATIC_FUNC_NAME 400 465 COPY(__callstatic) 401 #endif 466 # endif 467 # ifndef ZEND_ENGINE_2_4 402 468 /* # NOT DONE */ 403 469 COPY(module) 404 #else 470 # endif 471 #else /* ZEND_ENGINE_2 */ 405 472 COPY(handle_function_call) 406 473 COPY(handle_property_get) … … 416 483 ') 417 484 dnl }}} 485 #ifdef ZEND_ENGINE_2_4 486 undefine(`UNION_znode_op') 487 define(`UNION_znode_op', `dnl {{{ 488 assert(src->$1_type == IS_CONST || 489 src->$1_type == IS_VAR || 490 src->$1_type == IS_CV || 491 src->$1_type == IS_TMP_VAR || 492 src->$1_type == IS_UNUSED); 493 dnl dirty dispatch 494 DISABLECHECK(` 495 switch (src->$1_type) { 496 case IS_CONST: 497 dnl TODO: fix me, use literals 498 IFDASM(`{ 499 zval *zv; 500 ALLOC_INIT_ZVAL(zv); 501 *zv = ((zend_literal *) src->$1.ptr)->constant; 502 zval_copy_ctor(zv); 503 add_assoc_zval_ex(dst, ZEND_STRS("$1.constant"), zv); 504 } 505 ', ` 506 DISPATCH(zend_uint, $1.constant) 507 ') 508 break; 509 IFCOPY(` 510 IFNOTMEMCPY(` 511 default: 512 *dst = *src; 513 ') 514 ', ` 515 case IS_VAR: 516 case IS_TMP_VAR: 517 case IS_CV: 518 DISPATCH(zend_uint, $1.var) 519 break; 520 case IS_UNUSED: 521 IFDASM(`DISPATCH(zend_uint, $1.var)') 522 DISPATCH(zend_uint, $1.opline_num) 523 break; 524 ') 525 } 526 ') 527 DONE($1) 528 ') 529 dnl }}} 530 #else 418 531 DEF_STRUCT_P_FUNC(`znode', , `dnl {{{ 419 532 DISPATCH(int, op_type) … … 460 573 ') 461 574 DONE(u) 575 #if 0 576 DONE(EA) 577 #endif 462 578 #undef XCACHE_IS_CV 463 579 ') 464 580 dnl }}} 581 #endif 465 582 DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{ 466 583 DISPATCH(zend_uchar, opcode) 584 #ifdef ZEND_ENGINE_2_4 585 UNION_znode_op(result) 586 UNION_znode_op(op1) 587 UNION_znode_op(op2) 588 #else 467 589 STRUCT(znode, result) 468 590 STRUCT(znode, op1) 469 591 STRUCT(znode, op2) 592 #endif 470 593 DISPATCH(ulong, extended_value) 471 594 DISPATCH(uint, lineno) 472 595 #ifdef ZEND_ENGINE_2_1 596 #ifdef ZEND_ENGINE_2_4 597 DISPATCH(zend_uchar, op1_type) 598 DISPATCH(zend_uchar, op2_type) 599 DISPATCH(zend_uchar, result_type) 600 #endif 473 601 IFCOPY(` 474 602 switch (src->opcode) { … … 477 605 #endif 478 606 case ZEND_JMP: 479 dst->op1.u.jmp_addr = processor->active_opcodes_dst + (src->op1.u.jmp_addr - processor->active_opcodes_src);607 Z_OP(dst->op1).jmp_addr = processor->active_opcodes_dst + (Z_OP(src->op1).jmp_addr - processor->active_opcodes_src); 480 608 break; 481 609 … … 487 615 case ZEND_JMP_SET: 488 616 #endif 489 dst->op2.u.jmp_addr = processor->active_opcodes_dst + (src->op2.u.jmp_addr - processor->active_opcodes_src);617 Z_OP(dst->op2).jmp_addr = processor->active_opcodes_dst + (Z_OP(src->op2).jmp_addr - processor->active_opcodes_src); 490 618 break; 491 619 … … 498 626 ') 499 627 dnl }}} 628 #ifdef ZEND_ENGINE_2_4 629 DEF_STRUCT_P_FUNC(`zend_literal', , `dnl {{{ 630 STRUCT(zval, constant) 631 DISPATCH(zend_ulong, hash_value) 632 DISPATCH(zend_uint, cache_slot) 633 ') 634 dnl }}} 635 #endif 500 636 DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{ 501 637 IFRESTORE(` … … 552 688 DISPATCH(zend_uint, num_args) 553 689 DISPATCH(zend_uint, required_num_args) 690 # ifndef ZEND_ENGINE_2_4 554 691 DISPATCH(zend_bool, pass_rest_by_reference) 692 # endif 555 693 #else 556 694 if (src->arg_types) { … … 583 721 } 584 722 #endif 723 #ifndef ZEND_ENGINE_2_4 585 724 DISPATCH(unsigned char, return_reference) 725 #endif 586 726 /* END of common elements */ 587 727 #ifdef IS_UNICODE … … 600 740 popdef(`AFTER_ALLOC') 601 741 DISPATCH(zend_uint, last) 742 #ifndef ZEND_ENGINE_2_4 602 743 IFCOPY(`dst->size = src->last;DONE(size)', `DISPATCH(zend_uint, size)') 744 #endif 603 745 604 746 #ifdef IS_CV 605 747 STRUCT_ARRAY(last_var, zend_compiled_variable, vars) 606 748 DISPATCH(int, last_var) 749 # ifndef ZEND_ENGINE_2_4 607 750 IFCOPY(`dst->size_var = src->last_var;DONE(size_var)', `DISPATCH(zend_uint, size_var)') 751 # endif 608 752 #else 609 753 dnl zend_cv.m4 is illegal to be made public, don not ask me for it … … 617 761 STRUCT_ARRAY(last_brk_cont, zend_brk_cont_element, brk_cont_array) 618 762 DISPATCH(zend_uint, last_brk_cont) 763 #ifndef ZEND_ENGINE_2_4 619 764 DISPATCH(zend_uint, current_brk_cont) 765 #endif 620 766 #ifndef ZEND_ENGINE_2 621 767 DISPATCH(zend_bool, uses_globals) … … 629 775 STRUCT_P(HashTable, static_variables, HashTable_zval_ptr) 630 776 777 #ifndef ZEND_ENGINE_2_4 631 778 COPY(start_op) 632 779 DISPATCH(int, backpatch_count) 780 #endif 633 781 #ifdef ZEND_ENGINE_2_3 634 782 DISPATCH(zend_uint, this_var) 635 783 #endif 636 784 785 #ifndef ZEND_ENGINE_2_4 637 786 DISPATCH(zend_bool, done_pass_two) 787 #endif 638 788 /* 5.0 <= ver < 5.3 */ 639 789 #if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_3) … … 697 847 ') 698 848 ') 849 #ifdef ZEND_ENGINE_2_4 850 DISPATCH(int, last_literal) 851 IFRESTORE(`COPY(literals)', `STRUCT_ARRAY(last_literal, zend_literal, literals)') 852 853 COPYNULL(run_time_cache) 854 COPYNULL(last_cache_slot) 855 #endif 856 699 857 #endif 700 858 -
trunk/utils.c
r705 r716 20 20 21 21 #define OP_ZVAL_DTOR(op) do { \ 22 Z_UNSET_ISREF( (op).u.constant); \23 zval_dtor(& (op).u.constant); \22 Z_UNSET_ISREF(Z_OP_CONSTANT(op)); \ 23 zval_dtor(&Z_OP_CONSTANT(op)); \ 24 24 } while(0) 25 25 xc_compile_result_t *xc_compile_result_init(xc_compile_result_t *cr, /* {{{ */ … … 135 135 zend_op *opline, *end; 136 136 137 #ifndef ZEND_ENGINE_2_4 137 138 if (!op_array->done_pass_two) { 138 139 return 0; 139 140 } 141 #endif 140 142 141 143 opline = op_array->opcodes; … … 148 150 #endif 149 151 case ZEND_JMP: 150 opline->op1.u.opline_num = opline->op1.u.jmp_addr - op_array->opcodes;151 assert( opline->op1.u.opline_num < op_array->last);152 Z_OP(opline->op1).opline_num = Z_OP(opline->op1).jmp_addr - op_array->opcodes; 153 assert(Z_OP(opline->op1).opline_num < op_array->last); 152 154 break; 153 155 case ZEND_JMPZ: … … 158 160 case ZEND_JMP_SET: 159 161 #endif 160 opline->op2.u.opline_num = opline->op2.u.jmp_addr - op_array->opcodes;161 assert( opline->op2.u.opline_num < op_array->last);162 Z_OP(opline->op2).opline_num = Z_OP(opline->op2).jmp_addr - op_array->opcodes; 163 assert(Z_OP(opline->op2).opline_num < op_array->last); 162 164 break; 163 165 } … … 165 167 opline++; 166 168 } 169 #ifndef ZEND_ENGINE_2_4 167 170 op_array->done_pass_two = 0; 171 #endif 168 172 169 173 return 0; … … 174 178 zend_op *opline, *end; 175 179 180 #ifndef ZEND_ENGINE_2_4 176 181 if (op_array->done_pass_two) { 177 182 return 0; 178 183 } 184 #endif 179 185 180 186 /* … … 186 192 end = opline + op_array->last; 187 193 while (opline < end) { 188 if ( opline->op1.op_type== IS_CONST) {189 Z_SET_ISREF( opline->op1.u.constant);190 Z_SET_REFCOUNT( opline->op1.u.constant, 2); /* Make sure is_ref won't be reset */191 192 } 193 if ( opline->op2.op_type== IS_CONST) {194 Z_SET_ISREF( opline->op2.u.constant);195 Z_SET_REFCOUNT( opline->op2.u.constant, 2);194 if (Z_OP_TYPE(opline->op1) == IS_CONST) { 195 Z_SET_ISREF(Z_OP_CONSTANT(opline->op1)); 196 Z_SET_REFCOUNT(Z_OP_CONSTANT(opline->op1), 2); /* Make sure is_ref won't be reset */ 197 198 } 199 if (Z_OP_TYPE(opline->op2) == IS_CONST) { 200 Z_SET_ISREF(Z_OP_CONSTANT(opline->op2)); 201 Z_SET_REFCOUNT(Z_OP_CONSTANT(opline->op2), 2); 196 202 } 197 203 #ifdef ZEND_ENGINE_2_1 … … 201 207 #endif 202 208 case ZEND_JMP: 203 assert( opline->op1.u.opline_num < op_array->last);204 opline->op1.u.jmp_addr = op_array->opcodes + opline->op1.u.opline_num;209 assert(Z_OP(opline->op1).opline_num < op_array->last); 210 Z_OP(opline->op1).jmp_addr = op_array->opcodes + Z_OP(opline->op1).opline_num; 205 211 break; 206 212 case ZEND_JMPZ: … … 211 217 case ZEND_JMP_SET: 212 218 #endif 213 assert( opline->op2.u.opline_num < op_array->last);214 opline->op2.u.jmp_addr = op_array->opcodes + opline->op2.u.opline_num;219 assert(Z_OP(opline->op2).opline_num < op_array->last); 220 Z_OP(opline->op2).jmp_addr = op_array->opcodes + Z_OP(opline->op2).opline_num; 215 221 break; 216 222 } … … 220 226 } 221 227 228 #ifndef ZEND_ENGINE_2_4 222 229 op_array->done_pass_two = 1; 230 #endif 223 231 return 0; 224 232 } … … 226 234 227 235 #ifdef HAVE_XCACHE_OPCODE_SPEC_DEF 228 static void xc_fix_opcode_ex_znode(int tofix, xc_op_spec_t spec, z node *znode, int type TSRMLS_DC) /* {{{ */236 static void xc_fix_opcode_ex_znode(int tofix, xc_op_spec_t spec, zend_uchar *op_type, znode_op *op, int type TSRMLS_DC) /* {{{ */ 229 237 { 230 238 #ifdef ZEND_ENGINE_2 231 if (( znode->op_type != IS_UNUSED && (spec == OPSPEC_UCLASS || spec == OPSPEC_CLASS)) ||239 if ((*op_type != IS_UNUSED && (spec == OPSPEC_UCLASS || spec == OPSPEC_CLASS)) || 232 240 spec == OPSPEC_FETCH) { 233 241 if (tofix) { 234 switch ( znode->op_type) {242 switch (*op_type) { 235 243 case IS_VAR: 236 244 case IS_TMP_VAR: … … 239 247 default: 240 248 /* TODO: data lost, find a way to keep it */ 241 /* assert( znode->op_type == IS_CONST); */242 znode->op_type = IS_TMP_VAR;249 /* assert(*op_type == IS_CONST); */ 250 *op_type = IS_TMP_VAR; 243 251 } 244 252 } 245 253 } 246 switch ( znode->op_type) {254 switch (*op_type) { 247 255 case IS_TMP_VAR: 248 256 case IS_VAR: 249 257 if (tofix) { 250 znode->u.var /= sizeof(temp_variable);258 Z_OP(*op).var /= sizeof(temp_variable); 251 259 } 252 260 else { 253 znode->u.var *= sizeof(temp_variable);261 Z_OP(*op).var *= sizeof(temp_variable); 254 262 } 255 263 } … … 270 278 spec = xc_get_opcode_spec(opline->opcode); 271 279 272 xc_fix_opcode_ex_znode(tofix, spec->op1, & opline->op1, 0 TSRMLS_CC);273 xc_fix_opcode_ex_znode(tofix, spec->op2, & opline->op2, 1 TSRMLS_CC);274 xc_fix_opcode_ex_znode(tofix, spec->res, & opline->result, 2 TSRMLS_CC);280 xc_fix_opcode_ex_znode(tofix, spec->op1, &Z_OP_TYPE(opline->op1), &opline->op1, 0 TSRMLS_CC); 281 xc_fix_opcode_ex_znode(tofix, spec->op2, &Z_OP_TYPE(opline->op2), &opline->op2, 1 TSRMLS_CC); 282 xc_fix_opcode_ex_znode(tofix, spec->res, &Z_OP_TYPE(opline->result), &opline->result, 2 TSRMLS_CC); 275 283 } 276 284 } … … 304 312 #endif 305 313 case ZEND_JMP: 306 next = begin + opline->op1.u.opline_num;314 next = begin + Z_OP(opline->op1).opline_num; 307 315 break; 308 316 309 317 case ZEND_JMPZNZ: 310 next = begin + max( opline->op2.u.opline_num, opline->extended_value);318 next = begin + max(Z_OP(opline->op2).opline_num, opline->extended_value); 311 319 break; 312 320 … … 318 326 case ZEND_JMP_SET: 319 327 #endif 320 next = begin + opline->op2.u.opline_num;328 next = begin + Z_OP(opline->op2).opline_num; 321 329 break; 322 330 … … 371 379 } 372 380 373 parent_name = &( opline - 1)->op2.u.constant;381 parent_name = &(Z_OP_CONSTANT((opline - 1)->op2)); 374 382 TRACE("binding with parent %s", Z_STRVAL_P(parent_name)); 375 383 if (zend_lookup_class(Z_STRVAL_P(parent_name), Z_STRLEN_P(parent_name), &pce TSRMLS_CC) == FAILURE) { … … 387 395 zend_op *fetch_class_opline = opline - 1; 388 396 389 TRACE("%s %p", Z_STRVAL( fetch_class_opline->op2.u.constant), Z_STRVAL(fetch_class_opline->op2.u.constant));397 TRACE("%s %p", Z_STRVAL(Z_OP_CONSTANT(fetch_class_opline->op2)), Z_STRVAL(Z_OP_CONSTANT(fetch_class_opline->op2))); 390 398 OP_ZVAL_DTOR(fetch_class_opline->op2); 391 399 fetch_class_opline->opcode = ZEND_NOP; … … 421 429 } 422 430 423 zend_hash_del(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len);431 zend_hash_del(class_table, Z_OP_CONSTANT(opline->op1).value.str.val, Z_OP_CONSTANT(opline->op1).value.str.len); 424 432 OP_ZVAL_DTOR(opline->op1); 425 433 OP_ZVAL_DTOR(opline->op2); … … 512 520 ZESW(&stored_ce_ptr, NULL) 513 521 ) == FAILURE) { 514 CG(zend_lineno) = ZESW(0, cep->line_start);522 CG(zend_lineno) = ZESW(0, Z_CLASS_INFO(*cep).line_start); 515 523 #ifdef IS_UNICODE 516 524 zend_error(E_ERROR, "Cannot redeclare class %R", type, cep->name); -
trunk/xcache.c
r713 r716 1154 1154 xc_entry_data_php_t *php = (xc_entry_data_php_t *) data; 1155 1155 1156 class_name = opline->op1.u.constant.value.str.val;1157 class_len = opline->op1.u.constant.value.str.len;1156 class_name = Z_OP_CONSTANT(opline->op1).value.str.val; 1157 class_len = Z_OP_CONSTANT(opline->op1).value.str.len; 1158 1158 if (zend_hash_find(CG(class_table), class_name, class_len, (void **) &cest) == FAILURE) { 1159 1159 assert(0); … … 1196 1196 1197 1197 #define XCACHE_CHECK_OP(type, op) \ 1198 if (zend_binary_strcmp(Z_STRVAL( opline->op.u.constant), Z_STRLEN(opline->op.u.constant), xce->type##path, xce->type##path_len) == 0) { \1198 if (zend_binary_strcmp(Z_STRVAL(Z_OP_CONSTANT(opline->op)), Z_STRLEN(Z_OP_CONSTANT(opline->op)), xce->type##path, xce->type##path_len) == 0) { \ 1199 1199 usage->type##path_used = 1; \ 1200 1200 oplineinfo |= xcache_##op##_is_##type; \ … … 1202 1202 1203 1203 #define XCACHE_U_CHECK_OP(type, op) \ 1204 if (zend_u_##binary_strcmp(Z_USTRVAL( opline->op.u.constant), Z_USTRLEN(opline->op.u.constant), xce->u##type##path, xce->u##type##path_len) == 0) { \1204 if (zend_u_##binary_strcmp(Z_USTRVAL(Z_OP_CONSTANT(opline->op)), Z_USTRLEN(Z_OP_CONSTANT(opline->op)), xce->u##type##path, xce->u##type##path_len) == 0) { \ 1205 1205 usage->u##type##path_used = 1; \ 1206 1206 oplineinfo |= xcache_##op##_is_##type; \ … … 1210 1210 zend_op *opline = &op_array->opcodes[oplineno]; 1211 1211 int oplineinfo = 0; 1212 if ( opline->op1.op_type== IS_CONST) {1213 if (Z_TYPE( opline->op1.u.constant) == IS_STRING) {1212 if (Z_OP_TYPE(opline->op1) == IS_CONST) { 1213 if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) { 1214 1214 XCACHE_CHECK_OP(file, op1) 1215 1215 else XCACHE_CHECK_OP(dir, op1) … … 1217 1217 1218 1218 #ifdef IS_UNICODE 1219 else if (Z_TYPE( opline->op1.u.constant) == IS_UNICODE) {1219 else if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_UNICODE) { 1220 1220 XCACHE_U_CHECK_OP(file, op1) 1221 1221 else XCACHE_U_CHECK_OP(dir, op1) … … 1223 1223 #endif 1224 1224 } 1225 if ( opline->op2.op_type== IS_CONST) {1226 if (Z_TYPE( opline->op2.u.constant) == IS_STRING) {1225 if (Z_OP_TYPE(opline->op2) == IS_CONST) { 1226 if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_STRING) { 1227 1227 XCACHE_CHECK_OP(file, op2) 1228 1228 else XCACHE_CHECK_OP(dir, op2) … … 1230 1230 1231 1231 #ifdef IS_UNICODE 1232 else if (Z_TYPE( opline->op2.u.constant) == IS_UNICODE) {1232 else if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_UNICODE) { 1233 1233 XCACHE_U_CHECK_OP(file, op2) 1234 1234 else XCACHE_U_CHECK_OP(dir, op2) … … 1259 1259 zend_op *opline = &op_array->opcodes[oplineno]; 1260 1260 if ((oplineinfo & xcache_op1_is_file)) { 1261 assert( opline->op1.op_type== IS_CONST);1261 assert(Z_OP_TYPE(opline->op1) == IS_CONST); 1262 1262 if (copy) { 1263 efree(Z_STRVAL( opline->op1.u.constant));1264 } 1265 if (Z_TYPE( opline->op1.u.constant) == IS_STRING) {1263 efree(Z_STRVAL(Z_OP_CONSTANT(opline->op1))); 1264 } 1265 if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) { 1266 1266 assert(xce->filepath); 1267 ZVAL_STRINGL(& opline->op1.u.constant, xce->filepath, xce->filepath_len, copy);1267 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), xce->filepath, xce->filepath_len, copy); 1268 1268 TRACE("fixing op1 to %s", xce->filepath); 1269 1269 } 1270 1270 #ifdef IS_UNICODE 1271 else if (Z_TYPE( opline->op1.u.constant) == IS_UNICODE) {1271 else if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_UNICODE) { 1272 1272 assert(xce->ufilepath); 1273 ZVAL_UNICODEL(& opline->op1.u.constant, xce->ufilepath, xce->ufilepath_len, copy);1273 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), xce->ufilepath, xce->ufilepath_len, copy); 1274 1274 } 1275 1275 #endif … … 1279 1279 } 1280 1280 else if ((oplineinfo & xcache_op1_is_dir)) { 1281 assert( opline->op1.op_type== IS_CONST);1281 assert(Z_OP_TYPE(opline->op1) == IS_CONST); 1282 1282 if (copy) { 1283 efree(Z_STRVAL( opline->op1.u.constant));1284 } 1285 if (Z_TYPE( opline->op1.u.constant) == IS_STRING) {1283 efree(Z_STRVAL(Z_OP_CONSTANT(opline->op1))); 1284 } 1285 if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) { 1286 1286 assert(xce->dirpath); 1287 1287 TRACE("fixing op1 to %s", xce->dirpath); 1288 ZVAL_STRINGL(& opline->op1.u.constant, xce->dirpath, xce->dirpath_len, copy);1288 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), xce->dirpath, xce->dirpath_len, copy); 1289 1289 } 1290 1290 #ifdef IS_UNICODE 1291 else if (Z_TYPE( opline->op1.u.constant) == IS_UNICODE) {1291 else if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_UNICODE) { 1292 1292 assert(!xce->udirpath); 1293 ZVAL_UNICODEL(& opline->op1.u.constant, xce->udirpath, xce->udirpath_len, copy);1293 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), xce->udirpath, xce->udirpath_len, copy); 1294 1294 } 1295 1295 #endif … … 1300 1300 1301 1301 if ((oplineinfo & xcache_op2_is_file)) { 1302 assert( opline->op2.op_type== IS_CONST);1302 assert(Z_OP_TYPE(opline->op2) == IS_CONST); 1303 1303 if (copy) { 1304 efree(Z_STRVAL( opline->op2.u.constant));1305 } 1306 if (Z_TYPE( opline->op2.u.constant) == IS_STRING) {1304 efree(Z_STRVAL(Z_OP_CONSTANT(opline->op2))); 1305 } 1306 if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_STRING) { 1307 1307 assert(xce->filepath); 1308 1308 TRACE("fixing op2 to %s", xce->filepath); 1309 ZVAL_STRINGL(& opline->op2.u.constant, xce->filepath, xce->filepath_len, copy);1309 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), xce->filepath, xce->filepath_len, copy); 1310 1310 } 1311 1311 #ifdef IS_UNICODE 1312 else if (Z_TYPE( opline->op2.u.constant) == IS_UNICODE) {1312 else if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_UNICODE) { 1313 1313 assert(xce->ufilepath); 1314 ZVAL_UNICODEL(& opline->op2.u.constant, xce->ufilepath, xce->ufilepath_len, copy);1314 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), xce->ufilepath, xce->ufilepath_len, copy); 1315 1315 } 1316 1316 #endif … … 1320 1320 } 1321 1321 else if ((oplineinfo & xcache_op2_is_dir)) { 1322 assert( opline->op2.op_type== IS_CONST);1322 assert(Z_OP_TYPE(opline->op2) == IS_CONST); 1323 1323 if (copy) { 1324 efree(Z_STRVAL( opline->op2.u.constant));1325 } 1326 if (Z_TYPE( opline->op2.u.constant) == IS_STRING) {1324 efree(Z_STRVAL(Z_OP_CONSTANT(opline->op2))); 1325 } 1326 if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_STRING) { 1327 1327 assert(!xce->dirpath); 1328 1328 TRACE("fixing op2 to %s", xce->dirpath); 1329 ZVAL_STRINGL(& opline->op2.u.constant, xce->dirpath, xce->dirpath_len, copy);1329 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), xce->dirpath, xce->dirpath_len, copy); 1330 1330 } 1331 1331 #ifdef IS_UNICODE 1332 else if (Z_TYPE( opline->op2.u.constant) == IS_UNICODE) {1332 else if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_UNICODE) { 1333 1333 assert(!xce->udirpath); 1334 ZVAL_UNICODEL(& opline->op2.u.constant, xce->udirpath, xce->udirpath_len, copy);1334 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), xce->udirpath, xce->udirpath_len, copy); 1335 1335 } 1336 1336 #endif … … 3055 3055 } 3056 3056 /* }}} */ 3057 static function_entry xcache_functions[] = /* {{{ */3057 static zend_function_entry xcache_functions[] = /* {{{ */ 3058 3058 { 3059 3059 PHP_FE(xcache_count, NULL) -
trunk/xcache.h
r684 r716 22 22 23 23 #define HAVE_INODE 24 #if !defined(ZEND_ENGINE_2_1) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1 || PHP_MAJOR_VERSION > 5) 24 #if !defined(ZEND_ENGINE_2_4) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 && PHP_RELEASE_VERSION >= 99 || PHP_MAJOR_VERSION > 5) 25 # define ZEND_ENGINE_2_4 26 #endif 27 #if !defined(ZEND_ENGINE_2_3) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 3 || defined(ZEND_ENGINE_2_4)) 28 # define ZEND_ENGINE_2_3 29 #endif 30 #if !defined(ZEND_ENGINE_2_2) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2 || defined(ZEND_ENGINE_2_3)) 31 # define ZEND_ENGINE_2_2 32 #endif 33 #if !defined(ZEND_ENGINE_2_1) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 || defined(ZEND_ENGINE_2_2)) 25 34 # define ZEND_ENGINE_2_1 26 #endif27 #if !defined(ZEND_ENGINE_2_2) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 2 || PHP_MAJOR_VERSION > 5)28 # define ZEND_ENGINE_2_229 #endif30 #if !defined(ZEND_ENGINE_2_3) && (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3 || PHP_MAJOR_VERSION > 5)31 # define ZEND_ENGINE_2_332 35 #endif 33 36 … … 89 92 # define add_assoc_null_ex my_add_assoc_null_ex 90 93 #endif 94 95 #ifdef ZEND_ENGINE_2_4 96 # define Z_OP(op) (op) 97 # define Z_OP_CONSTANT(op) (op).literal->constant 98 # define Z_OP_TYPE(op) op##_##type 99 100 # define Z_CLASS_INFO(className) (className).info.user 101 #else 102 # define Z_OP(op) (op).u 103 # define Z_OP_CONSTANT(op) (op).u.constant 104 # define Z_OP_TYPE(op) (op).op_type 105 typedef znode znode_op; 106 107 # define Z_CLASS_INFO(className) (className) 108 #endif 109 91 110 /* }}} */ 92 111
Note: See TracChangeset
for help on using the changeset viewer.

