Ignore:
Timestamp:
01/20/10 15:58:03 (8 months ago)
Author:
hans
Message:
  • Some more work on delayed early binding. This fixes ticket #388
  • Some reformatting in ea_dasm.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • eaccelerator/trunk/ea_dasm.c

    r375 r377  
    44   +----------------------------------------------------------------------+ 
    55   | Copyright (c) 2004 - 2010 eAccelerator                               | 
    6    | http://eaccelerator.net                                                      | 
     6   | http://eaccelerator.net                                              | 
    77   +----------------------------------------------------------------------+ 
    88   | This program is free software; you can redistribute it and/or        | 
     
    3939/* {{{ static const char *extopnames_declare[] */ 
    4040static const char *extopnames_declare[] = { 
    41         "",                                                     /* 0 */ 
    42         "DECLARE_CLASS",                        /* 1 */ 
    43         "DECLARE_FUNCTION",                     /* 2 */ 
    44         "DECLARE_INHERITED_CLASS"       /* 3 */ 
     41    "",                         /* 0 */ 
     42    "DECLARE_CLASS",            /* 1 */ 
     43    "DECLARE_FUNCTION",         /* 2 */ 
     44    "DECLARE_INHERITED_CLASS"   /* 3 */ 
    4545}; 
    4646#define EXTOPNAMES_DECLARE_NUM 4 
     
    5050/* {{{ static const char *extopnames_cast[] */ 
    5151static const char *extopnames_cast[] = { 
    52         "IS_NULL",                                      /* 0 */ 
    53         "IS_LONG",                                      /* 1 */ 
    54         "IS_DOUBLE",                            /* 2 */ 
    55         "IS_BOOL",                              /* 3 */ 
    56         "IS_ARRAY",                                     /* 4 */ 
    57         "IS_OBJECT",                            /* 5 */ 
    58         "IS_STRING",                                    /* 6 */ 
    59         "IS_RESOURCE",                          /* 7 */ 
    60         "IS_CONSTANT",                          /* 8 */ 
    61         "IS_CONSTANT_ARRAY"                     /* 9 */ 
     52    "IS_NULL",                  /* 0 */ 
     53    "IS_LONG",                  /* 1 */ 
     54    "IS_DOUBLE",                /* 2 */ 
     55    "IS_BOOL",              /* 3 */ 
     56    "IS_ARRAY",                 /* 4 */ 
     57    "IS_OBJECT",                /* 5 */ 
     58    "IS_STRING",                    /* 6 */ 
     59    "IS_RESOURCE",              /* 7 */ 
     60    "IS_CONSTANT",              /* 8 */ 
     61    "IS_CONSTANT_ARRAY"         /* 9 */ 
    6262}; 
    6363#define EXTOPNAMES_CAST_NUM 10 
     
    6767/* {{{ static const char *extopnames_fetch[] */ 
    6868static const char *extopnames_fetch[] = { 
    69         "FETCH_STANDARD",                       /* 0 */ 
    70         "FETCH_ADD_LOCK",                       /* 1 */ 
    71         "FETCH_MAKE_REF"                        /* 2 */ 
     69    "FETCH_STANDARD",           /* 0 */ 
     70    "FETCH_ADD_LOCK",           /* 1 */ 
     71    "FETCH_MAKE_REF"            /* 2 */ 
    7272}; 
    7373#define EXTOPNAMES_FETCH_NUM 2 
     
    7777/* {{{ static const char *extopnames_fetch_class[] */ 
    7878static const char *extopnames_fetch_class[] = { 
    79         "FETCH_CLASS_DEFAULT",                  /* 0 */ 
    80         "FETCH_CLASS_SELF",                     /* 1 */ 
    81         "FETCH_CLASS_PARENT",                   /* 2 */ 
    82         "FETCH_CLASS_MAIN",                     /* 3 */ 
    83         "FETCH_CLASS_GLOBAL",                   /* 4 */ 
    84         "FETCH_CLASS_AUTO",                     /* 5 */ 
    85         "FETCH_CLASS_INTERFACE",                /* 6 */ 
    86         "FETCH_CLASS_STATIC",                   /* 7 */ 
     79    "FETCH_CLASS_DEFAULT",          /* 0 */ 
     80    "FETCH_CLASS_SELF",         /* 1 */ 
     81    "FETCH_CLASS_PARENT",           /* 2 */ 
     82    "FETCH_CLASS_MAIN",         /* 3 */ 
     83    "FETCH_CLASS_GLOBAL",           /* 4 */ 
     84    "FETCH_CLASS_AUTO",         /* 5 */ 
     85    "FETCH_CLASS_INTERFACE",        /* 6 */ 
     86    "FETCH_CLASS_STATIC",           /* 7 */ 
    8787}; 
    8888#define EXTOPNAMES_FETCH_CLASS_NUM 6 
     
    9292/* {{{ static const char *extopnames_init_fcall[] */ 
    9393static const char *extopnames_init_fcall[] = { 
    94         "",                                             /* 0 */ 
    95         "MEMBER_FUNC_CALL",                     /* 1 */ 
    96         "CTOR_CALL",                            /* 2 */ 
    97         "CTOR_CALL"                                     /* 3 */ 
     94    "",                         /* 0 */ 
     95    "MEMBER_FUNC_CALL",         /* 1 */ 
     96    "CTOR_CALL",                /* 2 */ 
     97    "CTOR_CALL"                 /* 3 */ 
    9898}; 
    9999#define EXTOPNAMES_INIT_FCALL_NUM 4 
     
    103103/* {{{ static const char *extopnames_sendnoref[] */ 
    104104static const char *extopnames_sendnoref[] = { 
    105         " ",                                       /* 0 */ 
    106         "ARG_SEND_BY_REF",                      /* 1 */ 
    107         "ARG_COMPILE_TIME_BOUND",       /* 2 */ 
    108         "ARG_SEND_BY_REF | ZEND_ARG_COMPILE_TIME_BOUND" /* 3 */ 
     105    " ",                   /* 0 */ 
     106    "ARG_SEND_BY_REF",          /* 1 */ 
     107    "ARG_COMPILE_TIME_BOUND",   /* 2 */ 
     108    "ARG_SEND_BY_REF | ZEND_ARG_COMPILE_TIME_BOUND" /* 3 */ 
    109109}; 
    110110#define EXTOPNAMES_SENDNOREF_NUM 4 
     
    114114/* {{{ static const char *fetchtypename[] */ 
    115115static const char *fetchtypename[] = { 
    116         "FETCH_GLOBAL",                         /* 0 */ 
    117         "FETCH_LOCAL",                          /* 1 */ 
    118         "FETCH_STATIC",                         /* 2 */ 
    119         "FETCH_STATIC_MEMBER",                  /* 3 */ 
    120         "FETCH_GLOBAL_LOCK",                    /* 4 */ 
    121         "FETCH_LEXICAL"                         /* 5 */ 
     116    "FETCH_GLOBAL",             /* 0 */ 
     117    "FETCH_LOCAL",              /* 1 */ 
     118    "FETCH_STATIC",             /* 2 */ 
     119    "FETCH_STATIC_MEMBER",          /* 3 */ 
     120    "FETCH_GLOBAL_LOCK",            /* 4 */ 
     121    "FETCH_LEXICAL"             /* 5 */ 
    122122}; 
    123123#define FETCHTYPENAME_NUM 5 
     
    127127/* {{{ static const char *extopnames_fe[] */ 
    128128static const char *extopnames_fe[] = { 
    129         "",                                                     /* 0 */ 
    130         "FE_FETCH_BYREF",                       /* 1 */ 
    131         "FE_FETCH_WITH_KEY"                     /* 2 */ 
     129    "",                         /* 0 */ 
     130    "FE_FETCH_BYREF",           /* 1 */ 
     131    "FE_FETCH_WITH_KEY"         /* 2 */ 
    132132}; 
    133133#define EXTOPNAMES_FE_NUM 3 
     
    204204 * array() { [0] .. [n] => 
    205205 *      array () { 
    206  *                      [lineno]                => // the line number in the source code 
     206 *          [lineno]        => // the line number in the source code 
    207207 *          [opcode]        => // the opcode 
    208208 *          [extended_value]=> // the extended value field 
     
    235235            array_init(el); 
    236236 
    237                         /* lineno */ 
    238                         add_assoc_long(el, "lineno", opline->lineno); 
     237            /* lineno */ 
     238            add_assoc_long(el, "lineno", opline->lineno); 
    239239            
    240240            /* opname */ 
     
    256256                strncpy(buf, get_opcode_dsc(opline->extended_value)->opname, sizeof(buf)); 
    257257            } else if ((op->ops & EXT_MASK) == EXT_CAST) { 
    258                                 const char *ptr = NULL; 
    259                                 GET_EXTOPNAMES_CAST(opline->extended_value, ptr); 
     258                const char *ptr = NULL; 
     259                GET_EXTOPNAMES_CAST(opline->extended_value, ptr); 
    260260                strncpy(buf, ptr, sizeof(buf)); 
    261261            } else if ((op->ops & EXT_MASK) == EXT_INIT_FCALL) { 
    262                                 const char *ptr = NULL; 
    263                                 GET_EXTOPNAMES_INIT_FCALL(opline->extended_value, ptr); 
    264                     strncpy(buf, ptr, sizeof(buf)); 
    265                     //snprintf(buf, sizeof(buf), "%d", opline->extended_value); 
     262                const char *ptr = NULL; 
     263                GET_EXTOPNAMES_INIT_FCALL(opline->extended_value, ptr); 
     264                strncpy(buf, ptr, sizeof(buf)); 
     265                //snprintf(buf, sizeof(buf), "%d", opline->extended_value); 
    266266            } else if ((op->ops & EXT_MASK) == EXT_FETCH) { 
    267                                 const char *ptr = NULL; 
    268                                 GET_EXTOPNAMES_FETCH(opline->extended_value, ptr); 
     267                const char *ptr = NULL; 
     268                GET_EXTOPNAMES_FETCH(opline->extended_value, ptr); 
    269269                strncpy(buf, ptr, sizeof(buf)); 
    270270            } else if ((op->ops & EXT_MASK) == EXT_FE) { 
    271                                 const char *ptr = NULL; 
    272                                 GET_EXTOPNAMES_FE(opline->extended_value, ptr); 
     271                const char *ptr = NULL; 
     272                GET_EXTOPNAMES_FE(opline->extended_value, ptr); 
    273273                strncpy(buf, ptr, sizeof(buf)); 
    274274            } else if ((op->ops & EXT_MASK) == EXT_DECLARE) { 
    275                                 const char *ptr = NULL; 
    276                                 GET_EXTOPNAMES_DECLARE(opline->extended_value, ptr); 
     275                const char *ptr = NULL; 
     276                GET_EXTOPNAMES_DECLARE(opline->extended_value, ptr); 
    277277                strncpy(buf, ptr, sizeof(buf)); 
    278278            } else if ((op->ops & EXT_MASK) == EXT_SEND_NOREF) { 
    279                                 const char *ptr = NULL; 
    280                                 GET_EXTOPNAMES_SENDNOREF(opline->extended_value, ptr); 
     279                const char *ptr = NULL; 
     280                GET_EXTOPNAMES_SENDNOREF(opline->extended_value, ptr); 
    281281                strncpy(buf, ptr, sizeof(buf)); 
    282282            } else if ((op->ops & EXT_MASK) == EXT_FCLASS) { 
    283                                 const char *ptr = NULL; 
    284                                 GET_EXTOPNAMES_FETCH_CLASS(opline->extended_value, ptr); 
     283                const char *ptr = NULL; 
     284                GET_EXTOPNAMES_FETCH_CLASS(opline->extended_value, ptr); 
    285285                snprintf(buf, sizeof(buf), "%s", ptr); 
    286286            } else if ((op->ops & EXT_MASK) == EXT_IFACE) { 
     
    300300                    snprintf(buf, sizeof(buf), "ZEND_ISEMPTY"); 
    301301                } else { 
    302                                         buf[0] = '\0'; 
     302                    buf[0] = '\0'; 
    303303                } 
    304304            } else if ((op->ops & EXT_MASK) == EXT_ASSIGN) { 
     
    308308                    snprintf(buf, sizeof(buf), "ZEND_ASSIGN_DIM"); 
    309309                } else { 
    310                                         buf[0] = '\0'; 
     310                    buf[0] = '\0'; 
    311311                } 
    312312            } else if (opline->extended_value != 0) { 
    313313                snprintf(buf, sizeof(buf), "%ld", opline->extended_value); 
    314314            } else { 
    315                                 buf[0] = '\0'; 
     315                buf[0] = '\0'; 
    316316            } 
    317317            add_assoc_string(el, "extended_value", buf, 1); 
     
    330330            } else if ((op->ops & OP1_MASK) == OP1_UCLASS) { 
    331331                if (opline->op1.op_type == IS_UNUSED) { 
    332                                         buf[0] = '\0'; 
     332                    buf[0] = '\0'; 
    333333                } else { 
    334334                    snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op1.u.var)); 
     
    344344                            goto brk_failed; 
    345345                        } 
    346                                                 jmp_to = &op_array->brk_cont_array[offset]; 
     346                        jmp_to = &op_array->brk_cont_array[offset]; 
    347347                        offset = jmp_to->parent; 
    348348                    } while (--level > 0); 
     
    384384                    snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op1.u.var)); 
    385385                } else if (opline->op1.op_type == IS_UNUSED) { 
    386                                         buf[0] = '\0'; 
     386                    buf[0] = '\0'; 
    387387                } else { 
    388388                    snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->op1.op_type); 
     
    398398                snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->op2.u.var, op_array->vars[opline->op2.u.var].name); 
    399399            } else if ((op->ops & OP2_MASK) == OP2_OPLINE) { 
    400                                 snprintf(buf, sizeof(buf), "opline(%d)", opline->op2.u.opline_num); 
    401                         } else if ((op->ops & OP2_MASK) == OP2_JMPADDR) { 
    402                                 snprintf(buf, sizeof(buf), "opline(%u)", (unsigned int) (opline->op2.u.jmp_addr - op_array->opcodes)); 
    403                         } else if ((op->ops & OP2_MASK) == OP2_CLASS) { 
    404                                 snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op2.u.var)); 
    405                         } else if ((op->ops & OP2_MASK) == OP2_VAR) { 
    406                                 snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op2.u.var)); 
    407                         } else if ((op->ops & OP2_MASK) == OP2_FETCH) { 
    408                                 const char *typename = NULL; 
    409                                 GET_FETCHTYPENAME(opline->op2.u.EA.type, typename); 
    410                                 if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { 
    411                                         snprintf(buf, sizeof(buf), "%s $class%u", typename, VAR_NUM(opline->op2.u.var)); 
    412                                 } else { 
    413                                         snprintf(buf, sizeof(buf), "%s", typename); 
    414                                 } 
    415                         } else if ((op->ops & OP2_MASK) == OP2_INCLUDE) { 
    416                                 if (opline->op2.u.constant.value.lval == ZEND_EVAL) { 
    417                                         snprintf(buf, sizeof(buf), "ZEND_EVAL"); 
    418                                 } else if (opline->op2.u.constant.value.lval == ZEND_INCLUDE) { 
     400                snprintf(buf, sizeof(buf), "opline(%d)", opline->op2.u.opline_num); 
     401            } else if ((op->ops & OP2_MASK) == OP2_JMPADDR) { 
     402                snprintf(buf, sizeof(buf), "opline(%u)", (unsigned int) (opline->op2.u.jmp_addr - op_array->opcodes)); 
     403            } else if ((op->ops & OP2_MASK) == OP2_CLASS) { 
     404                snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op2.u.var)); 
     405            } else if ((op->ops & OP2_MASK) == OP2_VAR) { 
     406                snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op2.u.var)); 
     407            } else if ((op->ops & OP2_MASK) == OP2_FETCH) { 
     408                const char *typename = NULL; 
     409                GET_FETCHTYPENAME(opline->op2.u.EA.type, typename); 
     410                if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { 
     411                    snprintf(buf, sizeof(buf), "%s $class%u", typename, VAR_NUM(opline->op2.u.var)); 
     412                } else { 
     413                    snprintf(buf, sizeof(buf), "%s", typename); 
     414                } 
     415            } else if ((op->ops & OP2_MASK) == OP2_INCLUDE) { 
     416                if (opline->op2.u.constant.value.lval == ZEND_EVAL) { 
     417                    snprintf(buf, sizeof(buf), "ZEND_EVAL"); 
     418                } else if (opline->op2.u.constant.value.lval == ZEND_INCLUDE) { 
    419419                    snprintf(buf, sizeof(buf), "ZEND_INCLUDE"); 
    420                                 } else if (opline->op2.u.constant.value.lval == ZEND_INCLUDE_ONCE) { 
    421                                         snprintf(buf, sizeof(buf), "ZEND_INCLUDE_ONCE"); 
    422                                 } else if (opline->op2.u.constant.value.lval == ZEND_REQUIRE) { 
    423                                     snprintf(buf, sizeof(buf), "ZEND_REQUIRE"); 
    424                                 } else if (opline->op2.u.constant.value.lval == ZEND_REQUIRE_ONCE) { 
    425                                         snprintf(buf, sizeof(buf), "ZEND_REQUIRE_ONCE"); 
    426                                 } else { 
    427                                         buf[0] = '\0'; 
    428                                 } 
    429                         } else if ((op->ops & OP2_MASK) == OP2_ARG) { 
    430                             snprintf(buf, sizeof(buf), "arg(%u)", opline->op2.u.opline_num); 
    431                         } else if ((op->ops & OP2_MASK) == OP2_ISSET) { 
    432                                 if (opline->op2.u.constant.value.lval == ZEND_ISSET) { 
    433                                         snprintf(buf, sizeof(buf), "ZEND_ISSET"); 
    434                                 } else if (opline->op2.u.constant.value.lval == ZEND_ISEMPTY) { 
    435                                         snprintf(buf, sizeof(buf), "ZEND_ISEMPTY"); 
    436                                 } else { 
    437                                         buf[0] = '\0'; 
    438                                 } 
    439                         } else { 
     420                } else if (opline->op2.u.constant.value.lval == ZEND_INCLUDE_ONCE) { 
     421                    snprintf(buf, sizeof(buf), "ZEND_INCLUDE_ONCE"); 
     422                } else if (opline->op2.u.constant.value.lval == ZEND_REQUIRE) { 
     423                    snprintf(buf, sizeof(buf), "ZEND_REQUIRE"); 
     424                } else if (opline->op2.u.constant.value.lval == ZEND_REQUIRE_ONCE) { 
     425                    snprintf(buf, sizeof(buf), "ZEND_REQUIRE_ONCE"); 
     426                } else { 
     427                    buf[0] = '\0'; 
     428                } 
     429            } else if ((op->ops & OP2_MASK) == OP2_ARG) { 
     430                snprintf(buf, sizeof(buf), "arg(%u)", opline->op2.u.opline_num); 
     431            } else if ((op->ops & OP2_MASK) == OP2_ISSET) { 
     432                if (opline->op2.u.constant.value.lval == ZEND_ISSET) { 
     433                    snprintf(buf, sizeof(buf), "ZEND_ISSET"); 
     434                } else if (opline->op2.u.constant.value.lval == ZEND_ISEMPTY) { 
     435                    snprintf(buf, sizeof(buf), "ZEND_ISEMPTY"); 
     436                } else { 
     437                    buf[0] = '\0'; 
     438                } 
     439            } else { 
    440440                if (opline->op2.op_type == IS_CONST) { 
    441441                    zval_used = 1; 
    442442                    add_assoc_string(el, "op2", get_zval(&opline->op2.u.constant), 0); 
    443443                } else if (opline->op2.op_type == IS_TMP_VAR) { 
    444                                         snprintf(buf, sizeof(buf), "$tmp%u", VAR_NUM(opline->op2.u.var)); 
    445                                 } else if (opline->op2.op_type == IS_VAR) { 
    446                                         snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op2.u.var)); 
    447                                 } else if (opline->op2.op_type == IS_UNUSED) { 
    448                                         buf[0] = '\0'; 
    449                                 } else { 
    450                                         snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->op2.op_type); 
    451                                 } 
    452                         } 
     444                    snprintf(buf, sizeof(buf), "$tmp%u", VAR_NUM(opline->op2.u.var)); 
     445                } else if (opline->op2.op_type == IS_VAR) { 
     446                    snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op2.u.var)); 
     447                } else if (opline->op2.op_type == IS_UNUSED) { 
     448                    buf[0] = '\0'; 
     449                } else { 
     450                    snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->op2.op_type); 
     451                } 
     452            } 
    453453            if (zval_used == 0) { 
    454454                add_assoc_string(el, "op2", buf, 1); 
     
    460460                snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->result.u.var, op_array->vars[opline->result.u.var].name); 
    461461            } else  
    462                         switch (op->ops & RES_MASK) { 
    463                             case RES_STD: 
    464                                 if (opline->result.op_type == IS_CONST) { 
     462            switch (op->ops & RES_MASK) { 
     463                case RES_STD: 
     464                    if (opline->result.op_type == IS_CONST) { 
    465465                        zval_used = 1; 
    466466                        add_assoc_string(el, "result", get_zval(&opline->result.u.constant), 0); 
    467                                 } else if (opline->result.op_type == IS_TMP_VAR) { 
    468                                         snprintf(buf, sizeof(buf), "$tmp%u", VAR_NUM(opline->result.u.var));  
     467                    } else if (opline->result.op_type == IS_TMP_VAR) { 
     468                        snprintf(buf, sizeof(buf), "$tmp%u", VAR_NUM(opline->result.u.var));  
    469469                    } else if (opline->result.op_type == IS_VAR) { 
    470                                         if ((opline->result.u.EA.type & EXT_TYPE_UNUSED) != 0) { 
    471                                                 snprintf(buf, sizeof(buf), "$var%u (unused)", VAR_NUM(opline->result.u.var)); 
     470                        if ((opline->result.u.EA.type & EXT_TYPE_UNUSED) != 0) { 
     471                            snprintf(buf, sizeof(buf), "$var%u (unused)", VAR_NUM(opline->result.u.var)); 
    472472                        } else { 
    473                                                 snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->result.u.var)); 
     473                            snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->result.u.var)); 
    474474                        } 
    475                                 } else if (opline->result.op_type == IS_UNUSED) { 
    476                                                 buf[0] = '\0'; 
    477                                 } else { 
    478                                         snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->result.op_type); 
    479                                 } 
    480                                 break; 
    481                         case RES_CLASS: 
    482                                 snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->result.u.var)); 
    483                                 break; 
    484                         case RES_TMP: 
    485                                 snprintf(buf, sizeof(buf), "$tmp%u", VAR_NUM(opline->result.u.var)); 
    486                                 break; 
    487                         case RES_VAR: 
    488                                 if ((opline->result.u.EA.type & EXT_TYPE_UNUSED) != 0) { 
    489                                         snprintf(buf, sizeof(buf), "$var%u (unused)", VAR_NUM(opline->result.u.var)); 
    490                                 } else { 
    491                                         snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->result.u.var)); 
    492                                 } 
    493                                 break; 
    494                         case RES_UNUSED: 
    495                                         buf[0] = '\0'; 
    496                                 break; 
    497                         default: 
    498                                 snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->result.op_type); 
    499                                 break; 
    500                         } 
     475                    } else if (opline->result.op_type == IS_UNUSED) { 
     476                        buf[0] = '\0'; 
     477                    } else { 
     478                        snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->result.op_type); 
     479                    } 
     480                    break; 
     481                case RES_CLASS: 
     482                    snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->result.u.var)); 
     483                    break; 
     484                case RES_TMP: 
     485                    snprintf(buf, sizeof(buf), "$tmp%u", VAR_NUM(opline->result.u.var)); 
     486                    break; 
     487                case RES_VAR: 
     488                    if ((opline->result.u.EA.type & EXT_TYPE_UNUSED) != 0) { 
     489                        snprintf(buf, sizeof(buf), "$var%u (unused)", VAR_NUM(opline->result.u.var)); 
     490                    } else { 
     491                        snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->result.u.var)); 
     492                    } 
     493                    break; 
     494                case RES_UNUSED: 
     495                    buf[0] = '\0'; 
     496                    break; 
     497                case RES_OPLINE: 
     498                    snprintf(buf, sizeof(buf), "opline(%d)", opline->result.u.opline_num); 
     499                    break; 
     500                default: 
     501                    snprintf(buf, sizeof(buf), "UNKNOWN NODE %d", opline->result.op_type); 
     502                    break; 
     503            } 
    501504            if (zval_used == 0) { 
    502505                add_assoc_string(el, "result", buf, 1); 
     
    516519    ea_cache_entry *result = NULL; 
    517520     
    518         if (file != NULL) { 
    519                 EACCELERATOR_UNPROTECT(); 
    520                 EACCELERATOR_LOCK_RD(); 
    521                 EACCELERATOR_PROTECT(); 
    522                 for (slot = 0; slot < EA_HASH_SIZE; slot++) { 
    523                         p = ea_mm_instance->hash[slot]; 
    524                         while (p != NULL) { 
    525                                 if (strcmp(p->realfilename, file) == 0) { 
    526                                         result = p; 
    527                                 } 
    528                                 p = p->next; 
    529                         } 
    530                 } 
    531             EACCELERATOR_UNPROTECT(); 
    532                 EACCELERATOR_UNLOCK_RD(); 
    533                 EACCELERATOR_PROTECT(); 
     521    if (file != NULL) { 
     522        EACCELERATOR_UNPROTECT(); 
     523        EACCELERATOR_LOCK_RD(); 
     524        EACCELERATOR_PROTECT(); 
     525        for (slot = 0; slot < EA_HASH_SIZE; slot++) { 
     526            p = ea_mm_instance->hash[slot]; 
     527            while (p != NULL) { 
     528                if (strcmp(p->realfilename, file) == 0) { 
     529                    result = p; 
     530                } 
     531                p = p->next; 
     532            } 
     533        } 
     534        EACCELERATOR_UNPROTECT(); 
     535        EACCELERATOR_UNLOCK_RD(); 
     536        EACCELERATOR_PROTECT(); 
    534537    } 
    535538    return result; 
     
    554557    const char *file; 
    555558    int file_len; 
    556         ea_cache_entry *p; 
     559    ea_cache_entry *p; 
    557560    ea_fc_entry *fc; 
    558561    zval *functions; 
     
    560563 
    561564    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &file, &file_len) == FAILURE) 
    562                 return; 
    563  
    564         if (ea_mm_instance == NULL || php_check_open_basedir(file TSRMLS_CC)) { 
    565                 RETURN_NULL(); 
    566         } 
     565        return; 
     566 
     567    if (ea_mm_instance == NULL || php_check_open_basedir(file TSRMLS_CC)) { 
     568        RETURN_NULL(); 
     569    } 
    567570 
    568571    p = get_cache_entry(file); 
     
    577580 
    578581    /* file functions */ 
    579         fc = p->f_head; 
     582    fc = p->f_head; 
    580583    MAKE_STD_ZVAL(functions); 
    581584    array_init(functions); 
    582         while (fc != NULL) { 
     585    while (fc != NULL) { 
    583586        add_assoc_zval(functions, fc->htabkey, get_op_array((ea_op_array *)fc->fc TSRMLS_CC)); 
    584                 fc = fc->next; 
    585         } 
     587        fc = fc->next; 
     588    } 
    586589    add_assoc_zval(return_value, "functions", functions); 
    587590 
    588591    /* file classes */ 
    589         fc = p->c_head; 
     592    fc = p->c_head; 
    590593    MAKE_STD_ZVAL(classes); 
    591594    array_init(classes); 
    592         if (fc != NULL) { 
    593                 while (fc != NULL) { 
    594                         ea_class_entry *c = (ea_class_entry *) fc->fc; 
     595    if (fc != NULL) { 
     596        while (fc != NULL) { 
     597            ea_class_entry *c = (ea_class_entry *) fc->fc; 
    595598            if (c->type == ZEND_USER_CLASS) { /* get methods */ 
    596599                zval *methods; 
     
    610613            } 
    611614            fc = fc->next; 
    612                 } 
    613         } 
     615        } 
     616    } 
    614617    add_assoc_zval(return_value, "classes", classes);  
    615618} 
Note: See TracChangeset for help on using the changeset viewer.