Changeset 162 for eaccelerator/trunk/opcodes.c
- Timestamp:
- 02/17/06 18:35:50 (3 years ago)
- Files:
-
- eaccelerator/trunk/opcodes.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/opcodes.c
r102 r162 44 44 #endif 45 45 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])) 51 47 52 48 static const opcode_dsc opcodes[] = { … … 159 155 OPDEF("ADD_ARRAY_ELEMENT", EXT_BIT | OP1_STD | OP2_STD | RES_TMP), /* 72 */ 160 156 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 */ 162 159 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 */ 166 166 OPDEF("UNSET_VAR", EXT_UNUSED | OP1_STD | OP2_UNUSED | RES_UNUSED), /* 74 */ 167 167 OPDEF("UNSET_DIM_OBJ", EXT_UNUSED | OP1_VAR | OP2_STD | RES_UNUSED), /* 75 */ 168 168 OPDEF("ISSET_ISEMPTY", EXT_UNUSED | OP1_VAR | OP2_ISSET | RES_TMP), /* 76 */ 169 #endif170 169 OPDEF("FE_RESET", EXT_BIT | OP1_STD | OP2_UNUSED | RES_VAR), /* 77 */ 170 #endif 171 171 OPDEF("FE_FETCH", EXT_FE | OP1_STD | OP2_OPLINE | RES_TMP), /* 78 */ 172 172 OPDEF("EXIT", EXT_UNUSED | OP1_STD | OP2_UNUSED | RES_UNUSED), /* 79 */ … … 210 210 OPDEF("CLONE", EXT_UNUSED | OP1_STD | OP2_UNUSED | RES_VAR), /* 110 */ 211 211 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 */ 213 213 OPDEF("INIT_STATIC_METHOD_CALL", EXT_UNUSED | OP1_UCLASS | OP2_STD | RES_UNUSED), /* 113 */ 214 214 OPDEF("ISSET_ISEMPTY_VAR", EXT_ISSET | OP1_STD | OP2_FETCH | RES_TMP), /* 114 */ … … 235 235 OPDEF("POST_DEC_OBJ", EXT_UNUSED | OP1_STD | OP2_STD | RES_TMP), /* 135 */ 236 236 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 */ 238 238 OPDEF("INSTANCEOF", EXT_UNUSED | OP1_STD | OP2_CLASS | RES_TMP), /* 138 */ 239 239 OPDEF("DECLARE_CLASS", EXT_UNUSED | OP1_STD | OP2_STD | RES_CLASS), /* 139 */ … … 246 246 OPDEF("VERIFY_ABSTRACT_CLASS", EXT_UNUSED | OP1_CLASS | OP2_UNUSED | RES_UNUSED), /* 146 */ 247 247 OPDEF("ASSIGN_DIM", EXT_UNUSED | OP1_STD | OP2_STD | RES_VAR), /* 147 */ 248 249 248 OPDEF("ISSET_ISEMPTY_PROP_OBJ", EXT_ISSET | OP1_STD | OP2_STD | RES_TMP), /* 148 */ 250 249 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 251 254 #endif 252 255 }; 253 256 254 257 const opcode_dsc* get_opcode_dsc(unsigned int n) { 255 if (n < =LAST_OPCODE) {258 if (n < LAST_OPCODE) { 256 259 return &opcodes[n]; 257 260 } else { … … 262 265 263 266 #ifdef ZEND_ENGINE_2 264 static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE +1];267 static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE]; 265 268 static int handlers_retrived = 0; 266 269 … … 268 271 unsigned char i; 269 272 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; 273 276 op_array->T = 0; 274 for (i=0; i< =LAST_OPCODE; i++) {277 for (i=0; i<LAST_OPCODE; i++) { 275 278 op_array->opcodes[i].opcode = i; 276 279 op_array->opcodes[i].op1.op_type = IS_UNUSED; … … 299 302 p = compile_string(&str, empty_string TSRMLS_CC); 300 303 ext->op_array_handler = old; 301 if (p != NULL && p->last == LAST_OPCODE+1) {304 if (p != NULL && p->last == (LAST_OPCODE - 1)) { 302 305 int i = 0; 303 while (i < =LAST_OPCODE) {306 while (i < LAST_OPCODE) { 304 307 eaccelerator_opcode_handlers[p->opcodes[i].opcode] = p->opcodes[i].handler; 305 308 ++i; … … 319 322 } 320 323 } 321 if (opcode < =LAST_OPCODE) {324 if (opcode < LAST_OPCODE) { 322 325 return eaccelerator_opcode_handlers[opcode]; 323 326 } else {