Changeset 241

Show
Ignore:
Timestamp:
07/25/06 14:31:24 (2 years ago)
Author:
bart
Message:

Fix restoring of opcode handler for php 5.0.5 when files are loaded

from disk cache. This fixes bug #147

Some update in the release notes for the upcoming rc1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r239 r241  
     12006-07-25  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * Fix restoring of opcode handler for php 5.0.5 when files are loaded 
     4          from disk cache. This fixes bug #147 
     5        * Some update in the release notes for the upcoming rc1 
     6 
    172006-07-24  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    28 
  • eaccelerator/trunk/NEWS

    r240 r241  
    1919        - Memory footprint should be reduced because redundant information in 
    2020          the cached scripts is no longer stored. 
     21        - File hashing in the cache directory to improve performance with a  
     22          big amount of cache files. 
    2123    WARNING: The encoder and loader DO not support php 5.1 nor php 5.0 and contain 
    2224    a lot of bug for php 4. This is the last release the encoder/loader  
    2325    functionality will be available. Maybe later a new encoder/loader will be  
    2426    included but there aren't any plans for that. 
     27    As always all patches and help are more then welcome. 
    2528     
    2629 
  • eaccelerator/trunk/ea_restore.c

    r236 r241  
    222222#  ifdef ZEND_ENGINE_2_1 
    223223                        ZEND_VM_SET_OPCODE_HANDLER(opline); 
     224#  elif defined(ZEND_ENGINE_2) 
     225            opline->handler = zend_opcode_handlers[opline->opcode]; 
    224226#  else 
    225227                        opline->handler = get_opcode_handler(opline->opcode TSRMLS_CC); 
  • eaccelerator/trunk/opcodes.c

    r228 r241  
    261261} 
    262262#endif 
    263  
    264 #ifdef ZEND_ENGINE_2 
    265 static opcode_handler_t eaccelerator_opcode_handlers[LAST_OPCODE]; 
    266 static int handlers_retrived = 0; 
    267  
    268 ZEND_DLEXPORT void retrive_opcode_handlers_handler(zend_op_array *op_array) { 
    269   unsigned char i; 
    270   efree(op_array->opcodes); 
    271   op_array->opcodes = (zend_op*)emalloc(sizeof(zend_op)*(LAST_OPCODE)); 
    272   op_array->last = LAST_OPCODE; 
    273   op_array->size = LAST_OPCODE; 
    274   op_array->T    = 0; 
    275   for (i=0; i<LAST_OPCODE; i++) { 
    276     op_array->opcodes[i].opcode = i; 
    277     op_array->opcodes[i].op1.op_type = IS_UNUSED; 
    278     op_array->opcodes[i].op1.u.opline_num = i; 
    279     op_array->opcodes[i].op2.op_type = IS_UNUSED; 
    280     op_array->opcodes[i].op2.u.opline_num = i; 
    281     op_array->opcodes[i].result.op_type = IS_UNUSED; 
    282   } 
    283 } 
    284  
    285 static int retrive_opcode_handlers(TSRMLS_D) { 
    286   zend_extension* ext; 
    287  
    288   if ((ext = zend_get_extension(EACCELERATOR_EXTENSION_NAME)) != NULL) { 
    289     zend_op_array* p; 
    290     zval str; 
    291     void (*old)(zend_op_array *o_a); 
    292  
    293     str.type = IS_STRING; 
    294     str.is_ref = 1; 
    295     str.refcount = 2; 
    296  
    297     Z_STRVAL(str) = "return 1;"; 
    298     Z_STRLEN(str) = 9; 
    299     old = ext->op_array_handler; 
    300     ext->op_array_handler = retrive_opcode_handlers_handler; 
    301     p = compile_string(&str, empty_string TSRMLS_CC); 
    302     ext->op_array_handler = old; 
    303     if (p != NULL && p->last == (LAST_OPCODE - 1)) { 
    304       int i = 0; 
    305       while (i < LAST_OPCODE) { 
    306          eaccelerator_opcode_handlers[p->opcodes[i].opcode] = p->opcodes[i].handler; 
    307          ++i; 
    308       } 
    309       return 1; 
    310     } 
    311   } 
    312   return 0; 
    313 } 
    314  
    315 opcode_handler_t get_opcode_handler(zend_uchar opcode TSRMLS_DC) { 
    316   if (!handlers_retrived) { 
    317     if (retrive_opcode_handlers(TSRMLS_C)) { 
    318       handlers_retrived = 1; 
    319     } else { 
    320       return NULL; 
    321     } 
    322   } 
    323   if (opcode < LAST_OPCODE) { 
    324     return eaccelerator_opcode_handlers[opcode]; 
    325   } else { 
    326     return (opcode_handler_t) NULL; 
    327   } 
    328 } 
    329 #endif