Changeset 331
- Timestamp:
- 2006-12-16T14:14:15+01:00 (7 years ago)
- File:
-
- 1 edited
-
trunk/optimizer.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/optimizer.c
r330 r331 1 #if 01 #if 1 2 2 #define DEBUG 3 3 #endif … … 11 11 # include "processor.h" 12 12 # include "const_string.h" 13 # include "ext/standard/php_var.h" 14 #endif 15 16 #ifdef IS_CV 17 # define XCACHE_IS_CV IS_CV 18 #else 19 # define XCACHE_IS_CV 16 13 20 #endif 14 21 … … 170 177 } 171 178 /* }}} */ 179 #ifdef DEBUG 180 static void op_snprint(char *buf, int size, znode *op) /* {{{ */ 181 { 182 switch (op->op_type) { 183 case IS_CONST: 184 { 185 zval result; 186 zval *zv = &op->u.constant; 187 TSRMLS_FETCH(); 188 189 php_start_ob_buffer(NULL, 0, 1 TSRMLS_CC); 190 php_var_export(&zv, 1 TSRMLS_CC); 191 192 php_ob_get_buffer(&result TSRMLS_CC); 193 php_end_ob_buffer(0, 0 TSRMLS_CC); 194 snprintf(buf, size, Z_STRVAL(result)); 195 zval_dtor(&result); 196 } 197 break; 198 199 case IS_TMP_VAR: 200 snprintf(buf, size, "t@%d", op->u.var); 201 break; 202 203 case XCACHE_IS_CV: 204 case IS_VAR: 205 snprintf(buf, size, "v@%d", op->u.var); 206 break; 207 208 case IS_UNUSED: 209 if (op->u.opline_num) { 210 snprintf(buf, size, "u#%d", op->u.opline_num); 211 } 212 else { 213 snprintf(buf, size, "-"); 214 } 215 break; 216 217 default: 218 snprintf(buf, size, "%d %d", op->op_type, op->u.var); 219 } 220 } 221 /* }}} */ 222 static void op_print(int line, zend_op *first, zend_op *end) /* {{{ */ 223 { 224 zend_op *opline; 225 for (opline = first; opline < end; opline ++) { 226 char buf_r[20]; 227 char buf_1[20]; 228 char buf_2[20]; 229 op_snprint(buf_r, sizeof(buf_r), &opline->result); 230 op_snprint(buf_1, sizeof(buf_1), &opline->op1); 231 op_snprint(buf_2, sizeof(buf_2), &opline->op2); 232 fprintf(stderr, "%3d %-15s%-5s%-20s%-20s\r\n", opline - first + line, xc_get_opcode(opline->opcode), buf_r, buf_1, buf_2); 233 } 234 } 235 /* }}} */ 236 #endif 172 237 173 238 /* … … 208 273 static void bb_print(bb_t *bb, zend_op *opcodes) /* {{{ */ 209 274 { 275 int line = bb->opcodes - opcodes; 210 276 op_flowinfo_t fi; 211 277 zend_op *last = bb->opcodes + bb->count - 1; … … 214 280 215 281 fprintf(stderr, 216 " %3d %3d %3d"282 "#%-3d cnt:%-3d lno:%-3d" 217 283 " %c%c" 218 " %3d %3d %3d %3d %3d %s\r\n"219 , bb->id, bb->count, bb->alloc ? -1 : bb->opcodes - opcodes284 " op1:%-3d op2:%-3d ext:%-3d fal:%-3d cat:%-3d %s\r\n" 285 , bb->id, bb->count, bb->alloc ? -1 : line 220 286 , bb->used ? 'U' : ' ', bb->alloc ? 'A' : ' ' 221 287 , fi.jmpout_op1, fi.jmpout_op2, fi.jmpout_ext, bb->fall, bb->catch, xc_get_opcode(last->opcode) 222 288 ); 289 op_print(line, bb->opcodes, last + 1); 223 290 } 224 291 /* }}} */ … … 249 316 { 250 317 int i; 251 fprintf(stderr,252 " id cnt lno"253 " UA"254 " op1 op2 ext fal cat opcode\r\n"255 );256 318 for (i = 0; i < xc_stack_count(bbs); i ++) { 257 319 bb_print(bbs_get(bbs, i), opcodes); … … 395 457 break; 396 458 } 397 start = i +1;459 start = i - 1; 398 460 id = bbids[i]; 399 461 } … … 468 530 xc_dprint_zend_op_array(op_array, 0 TSRMLS_CC); 469 531 # endif 532 op_print(0, op_array->opcodes, op_array->opcodes + op_array->last); 470 533 #endif 471 534
Note: See TracChangeset
for help on using the changeset viewer.

