Show
Ignore:
Timestamp:
02/17/06 18:35:50 (3 years ago)
Author:
zoeloelip
Message:

Merged PHP_5_1 branch with HEAD

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/opcodes.c

    r102 r162  
    4444#endif 
    4545 
    46 #ifdef ZEND_ENGINE_2 
    47 #  define LAST_OPCODE 149 
    48 #else 
    49 #  define LAST_OPCODE 106 
    50 #endif 
     46#define LAST_OPCODE (sizeof(opcodes)/sizeof(opcodes[0])) 
    5147 
    5248static const opcode_dsc opcodes[] = { 
     
    159155  OPDEF("ADD_ARRAY_ELEMENT",         EXT_BIT    | OP1_STD    | OP2_STD    | RES_TMP), /* 72 */ 
    160156  OPDEF("INCLUDE_OR_EVAL",           EXT_UNUSED | OP1_STD    | OP2_INCLUDE| RES_VAR), /* 73 */ 
    161 #ifdef ZEND_ENGINE_2 
     157#ifdef ZEND_ENGINE_2_1 
     158  /* php 5.1 and up */ 
    162159  OPDEF("UNSET_VAR",                 EXT_UNUSED | OP1_STD    | OP2_FETCH  | RES_UNUSED), /* 74 */ 
    163   OPDEF("UNSET_DIM_OBJ",             EXT_STD    | OP1_STD    | OP2_STD    | RES_UNUSED), /* 75 */ 
    164   OPDEF("ISSET_ISEMPTY",             EXT_ISSET  | OP1_VAR    | OP2_UNUSED | RES_TMP), /* 76 */ 
    165 #else 
     160  OPDEF("UNSET_DIM",                 EXT_STD    | OP1_STD    | OP2_STD    | RES_UNUSED), /* 75 */ 
     161  OPDEF("UNSET_OBJ",                 EXT_STD    | OP1_STD    | OP2_STD    | RES_UNUSED), /* 76 */ 
     162  OPDEF("FE_RESET",                  EXT_BIT    | OP1_STD    | OP2_OPLINE | RES_VAR), /* 77 */ 
     163#else 
     164  /* <= php 5.0 */ 
     165  /* though there is no ISSET_ISEMPTY in php 5.0 it's better to leave it here i guess */ 
    166166  OPDEF("UNSET_VAR",                 EXT_UNUSED | OP1_STD    | OP2_UNUSED | RES_UNUSED), /* 74 */ 
    167167  OPDEF("UNSET_DIM_OBJ",             EXT_UNUSED | OP1_VAR    | OP2_STD    | RES_UNUSED), /* 75 */ 
    168168  OPDEF("ISSET_ISEMPTY",             EXT_UNUSED | OP1_VAR    | OP2_ISSET  | RES_TMP), /* 76 */ 
    169 #endif 
    170169  OPDEF("FE_RESET",                  EXT_BIT    | OP1_STD    | OP2_UNUSED | RES_VAR), /* 77 */ 
     170#endif 
    171171  OPDEF("FE_FETCH",                  EXT_FE     | OP1_STD    | OP2_OPLINE | RES_TMP), /* 78 */ 
    172172  OPDEF("EXIT",                      EXT_UNUSED | OP1_STD    | OP2_UNUSED | RES_UNUSED), /* 79 */ 
     
    210210  OPDEF("CLONE",                     EXT_UNUSED | OP1_STD    | OP2_UNUSED | RES_VAR), /* 110 */ 
    211211  OPDEF("INIT_CTOR_CALL",            EXT_UNUSED | OP1_STD    | OP2_UNUSED | RES_UNUSED), /* 111 */ 
    212   OPDEF("INIT_METHOD_CALL",          EXT_UNUSED | OP1_STD    | OP2_STD    | RES_UNUSED), /* 112 */ 
     212  OPDEF("INIT_METHOD_CALL",          EXT_UNUSED | OP1_STD    | OP2_STD    | RES_VAR), /* 112 */ 
    213213  OPDEF("INIT_STATIC_METHOD_CALL",   EXT_UNUSED | OP1_UCLASS | OP2_STD    | RES_UNUSED), /* 113 */ 
    214214  OPDEF("ISSET_ISEMPTY_VAR",         EXT_ISSET  | OP1_STD    | OP2_FETCH  | RES_TMP), /* 114 */ 
     
    235235  OPDEF("POST_DEC_OBJ",              EXT_UNUSED | OP1_STD    | OP2_STD    | RES_TMP), /* 135 */ 
    236236  OPDEF("ASSIGN_OBJ",                EXT_UNUSED | OP1_STD    | OP2_STD    | RES_VAR), /* 136 */ 
    237   OPDEF("OP_DATA",                   EXT_UNUSED | OP1_STD    | OP2_STD    | RES_UNUSED), /* 137 */ 
     237  OPDEF("OP_DATA",                   EXT_UNUSED | OP1_STD    | OP2_STD    | RES_STD), /* 137 */ 
    238238  OPDEF("INSTANCEOF",                EXT_UNUSED | OP1_STD    | OP2_CLASS  | RES_TMP), /* 138 */ 
    239239  OPDEF("DECLARE_CLASS",             EXT_UNUSED | OP1_STD    | OP2_STD    | RES_CLASS), /* 139 */ 
     
    246246  OPDEF("VERIFY_ABSTRACT_CLASS",     EXT_UNUSED | OP1_CLASS  | OP2_UNUSED | RES_UNUSED), /* 146 */ 
    247247  OPDEF("ASSIGN_DIM",                EXT_UNUSED | OP1_STD    | OP2_STD    | RES_VAR),  /* 147 */ 
    248  
    249248  OPDEF("ISSET_ISEMPTY_PROP_OBJ",    EXT_ISSET  | OP1_STD    | OP2_STD    | RES_TMP), /* 148 */ 
    250249  OPDEF("HANDLE_EXCEPTION",          EXT_STD    | OP1_UNUSED | OP2_UNUSED | RES_STD)  /* 149 */ 
     250# ifdef ZEND_ENGINE_2_1 
     251  , 
     252  OPDEF("USER_OPCODE",               EXT_STD    | OP1_UNUSED | OP2_UNUSED | RES_STD)  /* 150 */ 
     253# endif     
    251254#endif 
    252255}; 
    253256 
    254257const opcode_dsc* get_opcode_dsc(unsigned int n) { 
    255   if (n <= LAST_OPCODE) { 
     258  if (n < LAST_OPCODE) { 
    256259    return &opcodes[n]; 
    257260  } else { 
     
    262265 
    263266#ifdef ZEND_ENGINE_2 
    264 static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE+1]; 
     267static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE]; 
    265268static int handlers_retrived = 0; 
    266269 
     
    268271  unsigned char i; 
    269272  efree(op_array->opcodes); 
    270   op_array->opcodes = (zend_op*)emalloc(sizeof(zend_op)*(LAST_OPCODE+1)); 
    271   op_array->last = LAST_OPCODE+1
    272   op_array->size = LAST_OPCODE+1
     273  op_array->opcodes = (zend_op*)emalloc(sizeof(zend_op)*(LAST_OPCODE)); 
     274  op_array->last = LAST_OPCODE
     275  op_array->size = LAST_OPCODE
    273276  op_array->T    = 0; 
    274   for (i=0; i<=LAST_OPCODE; i++) { 
     277  for (i=0; i<LAST_OPCODE; i++) { 
    275278    op_array->opcodes[i].opcode = i; 
    276279    op_array->opcodes[i].op1.op_type = IS_UNUSED; 
     
    299302    p = compile_string(&str, empty_string TSRMLS_CC); 
    300303    ext->op_array_handler = old; 
    301     if (p != NULL && p->last == LAST_OPCODE+1) { 
     304    if (p != NULL && p->last == (LAST_OPCODE - 1)) { 
    302305      int i = 0; 
    303       while (i <= LAST_OPCODE) { 
     306      while (i < LAST_OPCODE) { 
    304307         eaccelerator_opcode_handlers[p->opcodes[i].opcode] = p->opcodes[i].handler; 
    305308         ++i; 
     
    319322    } 
    320323  } 
    321   if (opcode <= LAST_OPCODE) { 
     324  if (opcode < LAST_OPCODE) { 
    322325    return eaccelerator_opcode_handlers[opcode]; 
    323326  } else {