Changeset 116

Show
Ignore:
Timestamp:
07/07/05 14:05:26 (3 years ago)
Author:
zoeloelip
Message:

Code refactoring needed for the new encoder. Moved all store/calc

functions to ea_store.c and all restore/fixup functions to ea_restore.c

Files:

Legend:

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

    r115 r116  
     12005-07-07 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * Code refactoring needed for the new encoder. Moved all store/calc 
     4          functions to ea_store.c and all restore/fixup functions to ea_restore.c 
     5 
    162005-07-06 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     7 
    28        * A compile fix for zend engine 1. 
    39        * Documented namespace option 
     
    612 
    7132005-06-27 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     14 
    815        * Fixed a buffer overflow in eaccelerator.c and cache.c. A string longer 
    916          then 8 bytes was copied in a char array of length 8. This isn't a 
     
    1421 
    15222005-06-24 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     23 
    1624        * The future check is removed because mtime are only checked on changes 
    1725          so caching files from the future isn't a problem. 
  • eaccelerator/trunk/Makefile.in

    r64 r116  
    11LTLIBRARY_NAME        = libeaccelerator.la 
    2 LTLIBRARY_SOURCES     = eaccelerator.c optimize.c execute.c encoder.c loader.c opcodes.c content.c mm.c webui.c session.c shm.c debug.c cache.c 
     2LTLIBRARY_SOURCES     = eaccelerator.c optimize.c execute.c encoder.c loader.c opcodes.c content.c mm.c webui.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c 
    33LTLIBRARY_SHARED_NAME = eaccelerator.la 
    44 
  • eaccelerator/trunk/eaccelerator.c

    r114 r116  
    44   +----------------------------------------------------------------------+ 
    55   | Copyright (c) 2004 - 2005 eAccelerator                               | 
    6    | http://eaccelerator.net                                              | 
     6   | http://eaccelerator.net                                                     | 
    77   +----------------------------------------------------------------------+ 
    88   | This program is free software; you can redistribute it and/or        | 
     
    4747#include "content.h" 
    4848#include "cache.h" 
     49#include "ea_store.h" 
     50#include "ea_restore.h" 
    4951 
    5052#include <sys/types.h> 
     
    7375#include "ext/standard/md5.h" 
    7476 
    75 #ifndef INCOMPLETE_CLASS 
    76 #  define INCOMPLETE_CLASS "__PHP_Incomplete_Class" 
    77 #endif 
    78 #ifndef MAGIC_MEMBER 
    79 #  define MAGIC_MEMBER "__PHP_Incomplete_Class_Name" 
    80 #endif 
    81  
    8277#include "SAPI.h" 
    8378 
     
    9489extern long eaccelerator_debug; 
    9590static zend_bool eaccelerator_check_mtime = 1; 
    96 static zend_bool eaccelerator_scripts_shm_only = 0; 
     91zend_bool eaccelerator_scripts_shm_only = 0; 
    9792 
    9893eaccelerator_mm* eaccelerator_mm_instance = NULL; 
    9994static int eaccelerator_is_zend_extension = 0; 
    10095static int eaccelerator_is_extension      = 0; 
    101 static zend_extension* ZendOptimizer = NULL; 
     96zend_extension* ZendOptimizer = NULL; 
    10297 
    10398static HashTable eaccelerator_global_function_table; 
     
    110105#ifdef ZEND_ENGINE_2 
    111106/* pointer to the properties_info hashtable destructor */ 
    112 static dtor_func_t properties_info_dtor = NULL
     107extern dtor_func_t properties_info_dtor
    113108#endif 
    114109 
     
    126121 
    127122/******************************************************************************/ 
    128 /* hash mm functions                                                         */ 
     123/* hash mm functions                                                          */ 
    129124/******************************************************************************/ 
    130125 
     
    337332} 
    338333 
    339 /******************************************************************************/ 
    340 /* Prepare values to cache them                                               */ 
    341 /******************************************************************************/ 
    342  
    343 #define FIXUP(x) if((x)!=NULL) {(x) = (void*)(((char*)(x)) + ((long)(MMCG(mem))));} 
    344  
    345 typedef void (*fixup_bucket_t)(void* TSRMLS_DC); 
    346  
    347 #define fixup_zval_hash(from) \ 
    348   fixup_hash(from, (fixup_bucket_t)fixup_zval TSRMLS_CC) 
    349  
    350 #ifdef ZEND_ENGINE_2 
    351 static void fixup_property_info(zend_property_info* from TSRMLS_DC) { 
    352   FIXUP(from->name); 
    353 } 
    354 #endif 
    355  
    356 /* Prepare a zend HashTable for caching */ 
    357 static void fixup_hash(HashTable* source, fixup_bucket_t fixup_bucket TSRMLS_DC)  
    358 { 
    359   unsigned int i; 
    360   Bucket *p; 
    361  
    362   if (source->nNumOfElements > 0) { 
    363     if (!MMCG(compress)) { 
    364       if (source->arBuckets != NULL) { 
    365         FIXUP(source->arBuckets); 
    366         for (i = 0; i < source->nTableSize; i++) { 
    367           FIXUP(source->arBuckets[i]); 
    368         } 
    369       } 
    370     } 
    371     FIXUP(source->pListHead); 
    372     FIXUP(source->pListTail); 
    373  
    374     p = source->pListHead; 
    375     while (p) { 
    376       FIXUP(p->pNext); 
    377       FIXUP(p->pLast); 
    378       FIXUP(p->pData); 
    379       FIXUP(p->pDataPtr); 
    380       FIXUP(p->pListLast); 
    381       FIXUP(p->pListNext); 
    382       if (p->pDataPtr) { 
    383         fixup_bucket(p->pDataPtr TSRMLS_CC); 
    384         p->pData = &p->pDataPtr; 
    385       } else { 
    386         fixup_bucket(p->pData TSRMLS_CC); 
    387       } 
    388       p = p->pListNext; 
    389     } 
    390     source->pInternalPointer = source->pListHead; 
    391   } 
    392 } 
    393  
    394 /* Prepare a zval for caching */ 
    395 void fixup_zval(zval* zv TSRMLS_DC) { 
    396   switch (zv->type & ~IS_CONSTANT_INDEX) { 
    397     case IS_CONSTANT: 
    398     case IS_STRING: 
    399       if (zv->value.str.val == NULL || 
    400          zv->value.str.len == 0) { 
    401         zv->value.str.val = empty_string; 
    402         zv->value.str.len = 0; 
    403       } else { 
    404         FIXUP(zv->value.str.val); 
    405       } 
    406       break; 
    407     case IS_ARRAY: 
    408     case IS_CONSTANT_ARRAY: 
    409       if (zv->value.ht == NULL || zv->value.ht == &EG(symbol_table)) { 
    410       } else { 
    411         FIXUP(zv->value.ht); 
    412         fixup_zval_hash(zv->value.ht); 
    413       } 
    414       break; 
    415     case IS_OBJECT: 
    416       if (!MMCG(compress)) { 
    417         return; 
    418       } 
    419 #ifndef ZEND_ENGINE_2 
    420       FIXUP(zv->value.obj.ce); 
    421       if (zv->value.obj.properties != NULL) { 
    422         FIXUP(zv->value.obj.properties); 
    423         fixup_zval_hash(zv->value.obj.properties); 
    424       } 
    425 #endif 
    426     default: 
    427       break; 
    428   } 
    429 } 
    430  
    431 /* Prepare an opcode array for caching */ 
    432 static void fixup_op_array(eaccelerator_op_array* from TSRMLS_DC) { 
    433   zend_op *opline; 
    434   zend_op *end; 
    435  
    436 #ifdef ZEND_ENGINE_2 
    437   if (from->num_args > 0) { 
    438     zend_uint i; 
    439     FIXUP(from->arg_info); 
    440     for (i = 0; i < from->num_args; i++) { 
    441       FIXUP(from->arg_info[i].name); 
    442       FIXUP(from->arg_info[i].class_name); 
    443     } 
    444   } 
    445 #else 
    446   FIXUP(from->arg_types); 
    447 #endif 
    448   FIXUP(from->function_name); 
    449 #ifdef ZEND_ENGINE_2 
    450   FIXUP(from->scope_name); 
    451 #endif 
    452   if (from->type == ZEND_INTERNAL_FUNCTION) { 
    453     return; 
    454   } 
    455  
    456   if (from->opcodes != NULL) { 
    457     FIXUP(from->opcodes); 
    458  
    459     opline = from->opcodes; 
    460     end = opline + from->last; 
    461     MMCG(compress) = 0; 
    462     for (;opline < end; opline++) { 
    463 /* 
    464       if (opline->result.op_type == IS_CONST) fixup_zval(&opline->result.u.constant  TSRMLS_CC); 
    465 */ 
    466       if (opline->op1.op_type    == IS_CONST) fixup_zval(&opline->op1.u.constant TSRMLS_CC); 
    467       if (opline->op2.op_type    == IS_CONST) fixup_zval(&opline->op2.u.constant TSRMLS_CC); 
    468 #ifdef ZEND_ENGINE_2 
    469       switch (opline->opcode) { 
    470         case ZEND_JMP: 
    471           FIXUP(opline->op1.u.jmp_addr); 
    472           break; 
    473         case ZEND_JMPZ: 
    474         case ZEND_JMPNZ: 
    475         case ZEND_JMPZ_EX: 
    476         case ZEND_JMPNZ_EX: 
    477           FIXUP(opline->op2.u.jmp_addr); 
    478           break; 
    479       } 
    480       opline->handler = get_opcode_handler(opline->opcode TSRMLS_CC); 
    481 #endif 
    482     } 
    483     MMCG(compress) = 1; 
    484   } 
    485   FIXUP(from->brk_cont_array); 
    486 #ifdef ZEND_ENGINE_2 
    487   FIXUP(from->try_catch_array); 
    488 #endif 
    489   if (from->static_variables != NULL) { 
    490     FIXUP(from->static_variables); 
    491     fixup_zval_hash(from->static_variables); 
    492   } 
    493   FIXUP(from->filename); 
    494 #ifdef ZEND_ENGINE_2 
    495   FIXUP(from->doc_comment); 
    496 #endif 
    497 } 
    498  
    499 /* Prepare a class entry for caching */ 
    500 static void fixup_class_entry(eaccelerator_class_entry* from TSRMLS_DC) { 
    501   FIXUP(from->name); 
    502   FIXUP(from->parent); 
    503 #ifdef ZEND_ENGINE_2 
    504   FIXUP(from->filename); 
    505   FIXUP(from->doc_comment); 
    506   fixup_zval_hash(&from->constants_table); 
    507   fixup_zval_hash(&from->default_properties); 
    508   fixup_hash(&from->properties_info, (fixup_bucket_t)fixup_property_info TSRMLS_CC); 
    509   if (from->static_members != NULL) { 
    510     FIXUP(from->static_members); 
    511     fixup_zval_hash(from->static_members); 
    512   } 
    513 #else 
    514   fixup_zval_hash(&from->default_properties); 
    515 #endif 
    516   fixup_hash(&from->function_table, (fixup_bucket_t)fixup_op_array TSRMLS_CC); 
    517 } 
    518  
    519 /* Prepare a cache entry for caching */ 
    520 static void eaccelerator_fixup(mm_cache_entry *p TSRMLS_DC) { 
    521   mm_fc_entry* q; 
    522  
    523   MMCG(mem) = (char*)((long)p - (long)p->next); 
    524   MMCG(compress) = 1; 
    525   p->next        = NULL; 
    526   FIXUP(p->op_array); 
    527   FIXUP(p->f_head); 
    528   FIXUP(p->c_head); 
    529   fixup_op_array(p->op_array TSRMLS_CC); 
    530   q = p->f_head; 
    531   while (q != NULL) { 
    532     FIXUP(q->fc); 
    533     fixup_op_array((eaccelerator_op_array*)q->fc TSRMLS_CC); 
    534     FIXUP(q->next); 
    535     q = q->next; 
    536   } 
    537   q = p->c_head; 
    538   while (q != NULL) { 
    539     FIXUP(q->fc); 
    540     fixup_class_entry((eaccelerator_class_entry*)q->fc TSRMLS_CC); 
    541     FIXUP(q->next); 
    542     q = q->next; 
    543   } 
    544 } 
    545  
    546 /******************************************************************************/ 
    547334 
    548335static int encode_version(const char *s) { 
     
    920707} 
    921708 
    922 /******************************************************************************/ 
    923 /* Functions to calculate the size of different structure that a compiled php */ 
    924 /* script contains.                                                           */ 
    925 /******************************************************************************/ 
    926  
    927 #ifndef DEBUG 
    928 inline 
    929 #endif 
    930 static 
    931 void calc_string(char* str, int len TSRMLS_DC) { 
    932   if (len > MAX_DUP_STR_LEN || zend_hash_add(&MMCG(strings), str, len, &str, sizeof(char*), NULL) == SUCCESS) { 
    933     EACCELERATOR_ALIGN(MMCG(mem)); 
    934     MMCG(mem) += len; 
    935   } 
    936 
    937  
    938 static void calc_class_entry(zend_class_entry* from TSRMLS_DC); 
    939  
    940 typedef void (*calc_bucket_t)(void* TSRMLS_DC); 
    941  
    942 #define calc_hash_ex(from, start, calc_bucket) \ 
    943   calc_hash_int(from, start, calc_bucket TSRMLS_CC) 
    944  
    945 #define calc_hash(from, calc_bucket) \ 
    946   calc_hash_ex(from, (from)->pListHead, calc_bucket) 
    947  
    948 #define calc_zval_hash(from) \ 
    949   calc_hash(from, (calc_bucket_t)calc_zval_ptr) 
    950  
    951 #define calc_zval_hash_ex(from, start) \ 
    952   calc_hash_ex(from, start, (calc_bucket_t)calc_zval_ptr) 
    953  
    954  
    955 static void calc_zval_ptr(zval** from TSRMLS_DC) { 
    956   EACCELERATOR_ALIGN(MMCG(mem)); 
    957   MMCG(mem) += sizeof(zval); 
    958   calc_zval(*from TSRMLS_CC); 
    959 
    960  
    961 #ifdef ZEND_ENGINE_2 
    962 static void calc_property_info(zend_property_info* from TSRMLS_DC) { 
    963   EACCELERATOR_ALIGN(MMCG(mem)); 
    964   MMCG(mem) += sizeof(zend_property_info); 
    965   calc_string(from->name, from->name_length+1 TSRMLS_CC); 
    966 
    967  
    968 /* Calculate the size of a point to a class entry */ 
    969 static void calc_class_entry_ptr(zend_class_entry** from TSRMLS_DC) { 
    970   calc_class_entry(*from TSRMLS_CC); 
    971 
    972 #endif 
    973  
    974 /* Calculate the size of an HashTable */ 
    975 static void calc_hash_int(HashTable* source, Bucket* start, calc_bucket_t calc_bucket TSRMLS_DC) { 
    976   Bucket* p; 
    977  
    978   if (source->nNumOfElements > 0) { 
    979     if (!MMCG(compress)) { 
    980       EACCELERATOR_ALIGN(MMCG(mem)); 
    981       MMCG(mem) += source->nTableSize * sizeof(Bucket*); 
    982     } 
    983     p = start; 
    984     while (p) { 
    985       EACCELERATOR_ALIGN(MMCG(mem)); 
    986       MMCG(mem) += offsetof(Bucket,arKey)+p->nKeyLength; 
    987       calc_bucket(p->pData TSRMLS_CC); 
    988       p = p->pListNext; 
    989     } 
    990   } 
    991 
    992  
    993 void calc_zval(zval* zv TSRMLS_DC) { 
    994   switch (zv->type & ~IS_CONSTANT_INDEX) { 
    995     case IS_CONSTANT: 
    996     case IS_STRING: 
    997       if (zv->value.str.val == NULL || 
    998           zv->value.str.val == empty_string || 
    999           zv->value.str.len == 0) { 
    1000       } else { 
    1001         calc_string(zv->value.str.val, zv->value.str.len+1 TSRMLS_CC); 
    1002       } 
    1003       break; 
    1004     case IS_ARRAY: 
    1005     case IS_CONSTANT_ARRAY: 
    1006       if (zv->value.ht == NULL || zv->value.ht == &EG(symbol_table)) { 
    1007       } else { 
    1008         EACCELERATOR_ALIGN(MMCG(mem)); 
    1009         MMCG(mem) += sizeof(HashTable); 
    1010         calc_zval_hash(zv->value.ht); 
    1011       } 
    1012       break; 
    1013     case IS_OBJECT: 
    1014 #ifndef ZEND_ENGINE_2 
    1015       if (zv->value.obj.ce != NULL) { 
    1016         zend_class_entry *ce = zv->value.obj.ce; 
    1017         if (!MMCG(compress)) { 
    1018           ea_debug_error("[%d] EACCELERATOR can't cache objects\n", getpid()); 
    1019           zend_bailout(); 
    1020         } 
    1021         while (ce != NULL) { 
    1022           if (ce->type !=  ZEND_USER_CLASS && strcmp(ce->name,"stdClass") != 0) { 
    1023             ea_debug_error("[%d] EACCELERATOR can't cache objects\n", getpid()); 
    1024             zend_bailout(); 
    1025           } 
    1026           ce = ce->parent; 
    1027         } 
    1028         calc_string(zv->value.obj.ce->name, zv->value.obj.ce->name_length+1 TSRMLS_CC); 
    1029       } 
    1030       if (zv->value.obj.properties != NULL) { 
    1031         EACCELERATOR_ALIGN(MMCG(mem)); 
    1032         MMCG(mem) += sizeof(HashTable); 
    1033         calc_zval_hash(zv->value.obj.properties); 
    1034       } 
    1035 #endif 
    1036       return; 
    1037     case IS_RESOURCE: 
    1038       ea_debug_error("[%d] EACCELERATOR can't cache resources\n", getpid()); 
    1039       zend_bailout(); 
    1040     default: 
    1041       break; 
    1042   } 
    1043 
    1044  
    1045 /* Calculate the size of an op_array */ 
    1046 static void calc_op_array(zend_op_array* from TSRMLS_DC) { 
    1047   zend_op *opline; 
    1048   zend_op *end; 
    1049  
    1050   if (from->type == ZEND_INTERNAL_FUNCTION) { 
    1051     EACCELERATOR_ALIGN(MMCG(mem)); 
    1052     MMCG(mem) += sizeof(zend_internal_function); 
    1053   } else if (from->type == ZEND_USER_FUNCTION) { 
    1054     EACCELERATOR_ALIGN(MMCG(mem)); 
    1055     MMCG(mem) += sizeof(eaccelerator_op_array); 
    1056   } else { 
    1057     ea_debug_error("[%d] EACCELERATOR can't cache function \"%s\"\n", getpid(), from->function_name); 
    1058     zend_bailout(); 
    1059   } 
    1060 #ifdef ZEND_ENGINE_2 
    1061   if (from->num_args > 0) { 
    1062     zend_uint i; 
    1063     EACCELERATOR_ALIGN(MMCG(mem)); 
    1064     MMCG(mem) += from->num_args * sizeof(zend_arg_info); 
    1065     for (i = 0; i < from->num_args; i++) { 
    1066       if (from->arg_info[i].name) { 
    1067         calc_string(from->arg_info[i].name,from->arg_info[i].name_len+1 TSRMLS_CC); 
    1068       } 
    1069       if (from->arg_info[i].class_name) { 
    1070         calc_string(from->arg_info[i].class_name,from->arg_info[i].class_name_len+1 TSRMLS_CC); 
    1071       } 
    1072     } 
    1073   } 
    1074 #else 
    1075   if (from->arg_types != NULL) { 
    1076     calc_string((char*)from->arg_types, (from->arg_types[0]+1) * sizeof(zend_uchar) TSRMLS_CC); 
    1077   } 
    1078 #endif 
    1079   if (from->function_name != NULL) { 
    1080     calc_string(from->function_name, strlen(from->function_name)+1 TSRMLS_CC); 
    1081   } 
    1082 #ifdef ZEND_ENGINE_2 
    1083   if (from->scope != NULL) 
    1084   { 
    1085     // HOESH: the same problem? 
    1086     Bucket* q = CG(class_table)->pListHead; 
    1087     while (q != NULL) 
    1088         { 
    1089       if (*(zend_class_entry**)q->pData == from->scope) 
    1090           { 
    1091         calc_string(q->arKey, q->nKeyLength TSRMLS_CC); 
    1092         break; 
    1093       } 
    1094       q = q->pListNext; 
    1095     } 
    1096   } 
    1097 #endif 
    1098   if (from->type == ZEND_INTERNAL_FUNCTION) { 
    1099     return; 
    1100   } 
    1101  
    1102   if (from->opcodes != NULL) { 
    1103     EACCELERATOR_ALIGN(MMCG(mem)); 
    1104     MMCG(mem) += from->last * sizeof(zend_op); 
    1105  
    1106     opline = from->opcodes; 
    1107     end = opline + from->last; 
    1108     MMCG(compress) = 0; 
    1109     for (;opline < end; opline++) { 
    1110 /* 
    1111       if (opline->result.op_type == IS_CONST) calc_zval(&opline->result.u.constant  TSRMLS_CC); 
    1112 */ 
    1113       if (opline->op1.op_type    == IS_CONST) calc_zval(&opline->op1.u.constant TSRMLS_CC); 
    1114       if (opline->op2.op_type    == IS_CONST) calc_zval(&opline->op2.u.constant TSRMLS_CC); 
    1115     } 
    1116     MMCG(compress) = 1; 
    1117   } 
    1118   if (from->brk_cont_array != NULL) { 
    1119     EACCELERATOR_ALIGN(MMCG(mem)); 
    1120     MMCG(mem) += sizeof(zend_brk_cont_element) * from->last_brk_cont; 
    1121   } 
    1122 #ifdef ZEND_ENGINE_2 
    1123         /* HOESH: try & catch support */ 
    1124         if (from->try_catch_array != NULL) 
    1125         { 
    1126                 EACCELERATOR_ALIGN(MMCG(mem)); 
    1127                 MMCG(mem) += sizeof(zend_try_catch_element) * from->last_try_catch; 
    1128         } 
    1129 #endif 
    1130   if (from->static_variables != NULL) { 
    1131     EACCELERATOR_ALIGN(MMCG(mem)); 
    1132     MMCG(mem) += sizeof(HashTable); 
    1133     calc_zval_hash(from->static_variables); 
    1134   } 
    1135   if (from->filename != NULL) { 
    1136     calc_string(from->filename, strlen(from->filename)+1 TSRMLS_CC); 
    1137   } 
    1138 #ifdef ZEND_ENGINE_2 
    1139   if (from->doc_comment != NULL) { 
    1140     calc_string(from->doc_comment, from->doc_comment_len+1 TSRMLS_CC); 
    1141   } 
    1142 #endif 
    1143 
    1144  
    1145 /* Calculate the size of a class entry */ 
    1146 static void calc_class_entry(zend_class_entry* from TSRMLS_DC) { 
    1147   if (from->type != ZEND_USER_CLASS) { 
    1148     ea_debug_error("[%d] EACCELERATOR can't cache internal class \"%s\"\n", getpid(), from->name); 
    1149     zend_bailout(); 
    1150   } 
    1151   EACCELERATOR_ALIGN(MMCG(mem)); 
    1152   MMCG(mem) += sizeof(eaccelerator_class_entry); 
    1153  
    1154   if (from->name != NULL) { 
    1155     calc_string(from->name, from->name_length+1 TSRMLS_CC); 
    1156   } 
    1157   if (from->parent != NULL && from->parent->name) { 
    1158     calc_string(from->parent->name, from->parent->name_length + 1  TSRMLS_CC); 
    1159   } 
    1160 #ifdef ZEND_ENGINE_2 
    1161 #if 0 
    1162   // what's problem. why from->interfaces[i] == 0x5a5a5a5a ? 
    1163   for (i=0; i<from->num_interfaces; i++) { 
    1164     if (from->interfaces[i]) { 
    1165       calc_string(from->interfaces[i]->name, from->interfaces[i]->name_length); 
    1166     } 
    1167   } 
    1168 #endif 
    1169   if (from->filename != NULL) { 
    1170     calc_string(from->filename, strlen(from->filename)+1 TSRMLS_CC); 
    1171   } 
    1172   if (from->doc_comment != NULL) { 
    1173     calc_string(from->doc_comment, from->doc_comment_len+1 TSRMLS_CC); 
    1174   } 
    1175  
    1176   calc_zval_hash(&from->constants_table); 
    1177   calc_zval_hash(&from->default_properties); 
    1178   calc_hash(&from->properties_info, (calc_bucket_t)calc_property_info); 
    1179   if (from->static_members != NULL) { 
    1180     EACCELERATOR_ALIGN(MMCG(mem)); 
    1181     MMCG(mem) += sizeof(HashTable); 
    1182     calc_zval_hash(from->static_members); 
    1183   } 
    1184 #else 
    1185   calc_zval_hash(&from->default_properties); 
    1186 #endif 
    1187   calc_hash(&from->function_table, (calc_bucket_t)calc_op_array); 
    1188 
    1189  
    1190 /* Calculate the size of a cache entry with its given op_array and function and 
    1191    class bucket */ 
    1192 static int calc_size(char* key, zend_op_array* op_array, 
    1193                      Bucket* f, Bucket *c TSRMLS_DC) { 
    1194   Bucket *b; 
    1195   char   *x; 
    1196   int len = strlen(key); 
    1197   MMCG(compress) = 1; 
    1198   MMCG(mem) = NULL; 
    1199  
    1200   zend_hash_init(&MMCG(strings), 0, NULL, NULL, 0); 
    1201   MMCG(mem) += offsetof(mm_cache_entry,realfilename)+len+1; 
    1202   zend_hash_add(&MMCG(strings), key, len+1, &key, sizeof(char*), NULL); 
    1203   b = c; 
    1204   while (b != NULL) { 
    1205     EACCELERATOR_ALIGN(MMCG(mem)); 
    1206     MMCG(mem) += offsetof(mm_fc_entry,htabkey)+b->nKeyLength; 
    1207     x = b->arKey; 
    1208     zend_hash_add(&MMCG(strings), b->arKey, b->nKeyLength, &x, sizeof(char*), NULL); 
    1209     b = b->pListNext; 
    1210   } 
    1211   b = f; 
    1212   while (b != NULL) { 
    1213     EACCELERATOR_ALIGN(MMCG(mem)); 
    1214     MMCG(mem) += offsetof(mm_fc_entry,htabkey)+b->nKeyLength; 
    1215     x = b->arKey; 
    1216     zend_hash_add(&MMCG(strings), b->arKey, b->nKeyLength, &x, sizeof(char*), NULL); 
    1217     b = b->pListNext; 
    1218   } 
    1219   while (c != NULL) { 
    1220 #ifdef ZEND_ENGINE_2 
    1221     calc_class_entry(*(zend_class_entry**)c->pData TSRMLS_CC); 
    1222 #else 
    1223     calc_class_entry((zend_class_entry*)c->pData TSRMLS_CC); 
    1224 #endif 
    1225     c = c->pListNext; 
    1226   } 
    1227   while (f != NULL) { 
    1228     calc_op_array((zend_op_array*)f->pData TSRMLS_CC); 
    1229     f = f->pListNext; 
    1230   } 
    1231   calc_op_array(op_array TSRMLS_CC); 
    1232   EACCELERATOR_ALIGN(MMCG(mem)); 
    1233   zend_hash_destroy(&MMCG(strings)); 
    1234   return (long)MMCG(mem); 
    1235 
    1236  
    1237 /******************************************************************************/ 
    1238 /* Functions to store/cache data from the compiled script                                         */ 
    1239 /******************************************************************************/ 
    1240  
    1241 static inline char* store_string(char* str, int len TSRMLS_DC) { 
    1242   char *p; 
    1243   if (len > MAX_DUP_STR_LEN) { 
    1244     EACCELERATOR_ALIGN(MMCG(mem)); 
    1245     p = (char*)MMCG(mem); 
    1246     MMCG(mem) += len; 
    1247     memcpy(p, str, len); 
    1248   } else if (zend_hash_find(&MMCG(strings), str, len, (void*)&p) == SUCCESS) { 
    1249     p = *(char**)p; 
    1250   } else { 
    1251     EACCELERATOR_ALIGN(MMCG(mem)); 
    1252     p = (char*)MMCG(mem); 
    1253     MMCG(mem) += len; 
    1254     memcpy(p, str, len); 
    1255     zend_hash_add(&MMCG(strings), str, len, (void*)&p, sizeof(char*), NULL); 
    1256   } 
    1257   return p; 
    1258 
    1259  
    1260 static eaccelerator_class_entry* store_class_entry(zend_class_entry* from TSRMLS_DC); 
    1261  
    1262 typedef void* (*store_bucket_t)(void* TSRMLS_DC); 
    1263  
    1264 #define store_hash_ex(to, from, start, store_bucket) \ 
    1265   store_hash_int(to, from, start, store_bucket TSRMLS_CC) 
    1266  
    1267 #define store_hash(to, from, store_bucket) \ 
    1268   store_hash_ex(to, from, (from)->pListHead, store_bucket) 
    1269  
    1270 #define store_zval_hash(to, from) \ 
    1271   store_hash(to, from, (store_bucket_t)store_zval_ptr) 
    1272  
    1273 #define store_zval_hash_ex(to, from, start) \ 
    1274   store_hash_ex(to, from, start, (store_bucket_t)store_zval_ptr) 
    1275  
    1276 static zval* store_zval_ptr(zval* from TSRMLS_DC) { 
    1277   zval* to; 
    1278   EACCELERATOR_ALIGN(MMCG(mem)); 
    1279   to = (zval*)MMCG(mem); 
    1280   MMCG(mem) += sizeof(zval); 
    1281   memcpy(to, from, sizeof(zval)); 
    1282   store_zval(to TSRMLS_CC); 
    1283   return to; 
    1284 
    1285  
    1286 #ifdef ZEND_ENGINE_2 
    1287 static zend_property_info* store_property_info(zend_property_info* from TSRMLS_DC) { 
    1288   zend_property_info* to; 
    1289   EACCELERATOR_ALIGN(MMCG(mem)); 
    1290   to = (zend_property_info*)MMCG(mem); 
    1291   MMCG(mem) += sizeof(zend_property_info); 
    1292   memcpy(to, from, sizeof(zend_property_info)); 
    1293   to->name = store_string(from->name, from->name_length+1 TSRMLS_CC); 
    1294   return to; 
    1295 
    1296  
    1297 static eaccelerator_class_entry* store_class_entry_ptr(zend_class_entry** from TSRMLS_DC) { 
    1298   return store_class_entry(*from TSRMLS_CC); 
    1299 
    1300 #endif 
    1301  
    1302 static void store_hash_int(HashTable* target, HashTable* source, Bucket* start, store_bucket_t copy_bucket TSRMLS_DC) { 
    1303   Bucket *p, *np, *prev_p; 
    1304  
    1305   memcpy(target, source, sizeof(HashTable)); 
    1306  
    1307   if (source->nNumOfElements > 0) { 
    1308     if (!MMCG(compress)) { 
    1309       EACCELERATOR_ALIGN(MMCG(mem)); 
    1310       target->arBuckets = (Bucket **)MMCG(mem); 
    1311       MMCG(mem) += target->nTableSize * sizeof(Bucket*); 
    1312       memset(target->arBuckets, 0, target->nTableSize * sizeof(Bucket*)); 
    1313     } 
    1314  
    1315     target->pDestructor = NULL; 
    1316     target->persistent  = 1; 
    1317     target->pListHead   = NULL; 
    1318     target->pListTail   = NULL; 
    1319  
    1320     p = start; 
    1321     prev_p = NULL; 
    1322     np = NULL; 
    1323     while (p) { 
    1324       EACCELERATOR_ALIGN(MMCG(mem)); 
    1325       np = (Bucket*)MMCG(mem); 
    1326       MMCG(mem) += offsetof(Bucket,arKey)+p->nKeyLength; 
    1327  
    1328       if (!MMCG(compress)) { 
    1329         int nIndex = p->h % source->nTableSize; 
    1330         if(target->arBuckets[nIndex]) { 
    1331           np->pNext = target->arBuckets[nIndex]; 
    1332           np->pLast = NULL; 
    1333           np->pNext->pLast = np; 
    1334         } else { 
    1335           np->pNext = NULL; 
    1336           np->pLast = NULL; 
    1337         } 
    1338         target->arBuckets[nIndex] = np; 
    1339       } 
    1340       np->h = p->h; 
    1341       np->nKeyLength = p->nKeyLength; 
    1342  
    1343       if (p->pDataPtr == NULL) { 
    1344         np->pData    = copy_bucket(p->pData TSRMLS_CC); 
    1345         np->pDataPtr = NULL; 
    1346       } else { 
    1347         np->pDataPtr = copy_bucket(p->pDataPtr TSRMLS_CC); 
    1348         np->pData    = &np->pDataPtr; 
    1349       } 
    1350  
    1351       np->pListLast = prev_p; 
    1352       np->pListNext = NULL; 
    1353  
    1354       memcpy(np->arKey, p->arKey, p->nKeyLength); 
    1355  
    1356       if (prev_p) { 
    1357         prev_p->pListNext = np; 
    1358       } else { 
    1359         target->pListHead = np; 
    1360       } 
    1361       prev_p = np; 
    1362       p = p->pListNext; 
    1363     } 
    1364     target->pListTail = np; 
    1365     target->pInternalPointer = target->pListHead; 
    1366   } 
    1367 
    1368  
    1369 void store_zval(zval* zv TSRMLS_DC) { 
    1370   switch (zv->type & ~IS_CONSTANT_INDEX) { 
    1371     case IS_CONSTANT: 
    1372     case IS_STRING: 
    1373       if (zv->value.str.val == NULL || 
    1374           zv->value.str.val == empty_string || 
    1375           zv->value.str.len == 0) { 
    1376         zv->value.str.val = empty_string; 
    1377         zv->value.str.len = 0; 
    1378       } else { 
    1379         zv->value.str.val = store_string(zv->value.str.val, zv->value.str.len+1 TSRMLS_CC); 
    1380       } 
    1381       break; 
    1382     case IS_ARRAY: 
    1383     case IS_CONSTANT_ARRAY: 
    1384       if (zv->value.ht == NULL || zv->value.ht == &EG(symbol_table)) { 
    1385       } else { 
    1386         HashTable* p; 
    1387         EACCELERATOR_ALIGN(MMCG(mem)); 
    1388         p = (HashTable*)MMCG(mem); 
    1389         MMCG(mem) += sizeof(HashTable); 
    1390         store_zval_hash(p, zv->value.ht); 
    1391         zv->value.ht = p; 
    1392       } 
    1393       break; 
    1394     case IS_OBJECT: 
    1395       if (!MMCG(compress)) { 
    1396         return; 
    1397       } 
    1398 #ifndef ZEND_ENGINE_2 
    1399       if (zv->value.obj.ce != NULL) { 
    1400         char *s = store_string(zv->value.obj.ce->name, zv->value.obj.ce->name_length+1 TSRMLS_CC); 
    1401         zend_str_tolower(s, zv->value.obj.ce->name_length); 
    1402         zv->value.obj.ce = (zend_class_entry*)s; 
    1403       } 
    1404       if (zv->value.obj.properties != NULL) { 
    1405         HashTable* p; 
    1406         EACCELERATOR_ALIGN(MMCG(mem)); 
    1407         p = (HashTable*)MMCG(mem); 
    1408         MMCG(mem) += sizeof(HashTable); 
    1409         store_zval_hash(p, zv->value.obj.properties); 
    1410         zv->value.obj.properties = p; 
    1411       } 
    1412 #endif 
    1413     default: 
    1414       break; 
    1415   } 
    1416 
    1417  
    1418 static eaccelerator_op_array* store_op_array(zend_op_array* from TSRMLS_DC) { 
    1419   eaccelerator_op_array *to; 
    1420   zend_op *opline; 
    1421   zend_op *end; 
    1422  
    1423   ea_debug_pad(EA_DEBUG TSRMLS_C); 
    1424   ea_debug_printf(EA_DEBUG, "[%d] store_op_array: %s [scope=%s]\n", getpid(), 
    1425     from->function_name ? from->function_name : "(top)",  
    1426 #ifdef ZEND_ENGINE_2 
    1427     from->scope ? from->scope->name : "NULL"); 
    1428 #else 
    1429     "NULL"); 
    1430 #endif 
    1431  
    1432   if (from->type == ZEND_INTERNAL_FUNCTION) { 
    1433     EACCELERATOR_ALIGN(MMCG(mem)); 
    1434     to = (eaccelerator_op_array*)MMCG(mem); 
    1435     MMCG(mem) += offsetof(eaccelerator_op_array,opcodes); 
    1436   } else if (from->type == ZEND_USER_FUNCTION) { 
    1437     EACCELERATOR_ALIGN(MMCG(mem)); 
    1438     to = (eaccelerator_op_array*)MMCG(mem); 
    1439     MMCG(mem) += sizeof(eaccelerator_op_array); 
    1440   } else { 
    1441     return NULL; 
    1442   } 
    1443  
    1444   to->type = from->type; 
    1445 #ifdef ZEND_ENGINE_2 
    1446   to->num_args = from->num_args; 
    1447   to->required_num_args = from->required_num_args; 
    1448   if (from->num_args > 0) { 
    1449     zend_uint i; 
    1450     EACCELERATOR_ALIGN(MMCG(mem)); 
    1451     to->arg_info = (zend_arg_info*)MMCG(mem); 
    1452     MMCG(mem) += from->num_args * sizeof(zend_arg_info); 
    1453     for (i = 0; i < from->num_args; i++) { 
    1454       if (from->arg_info[i].name) { 
    1455         to->arg_info[i].name = store_string(from->arg_info[i].name,from->arg_info[i].name_len+1 TSRMLS_CC); 
    1456         to->arg_info[i].name_len = from->arg_info[i].name_len; 
    1457       } 
    1458       if (from->arg_info[i].class_name) { 
    1459         to->arg_info[i].class_name = store_string(from->arg_info[i].class_name,from->arg_info[i].class_name_len+1 TSRMLS_CC); 
    1460         to->arg_info[i].class_name_len = from->arg_info[i].class_name_len; 
    1461       } 
    1462       to->arg_info[i].allow_null        = from->arg_info[i].allow_null; 
    1463       to->arg_info[i].pass_by_reference = from->arg_info[i].pass_by_reference; 
    1464       to->arg_info[i].return_reference = from->arg_info[i].return_reference; 
    1465     } 
    1466   } 
    1467   to->pass_rest_by_reference = from->pass_rest_by_reference; 
    1468 #else 
    1469   if (from->arg_types != NULL) { 
    1470     to->arg_types = (unsigned char*) 
    1471       store_string((char*)from->arg_types, (from->arg_types[0]+1) * sizeof(zend_uchar) TSRMLS_CC); 
    1472   } 
    1473 #endif 
    1474   if (from->function_name != NULL) 
    1475   { 
    1476         /* 
    1477          * HOESH: converting to lowercase. this helps to find  
    1478          * class methods in function_table without each time tolower... 
    1479          */ 
    1480         to->function_name = store_string(from->function_name, strlen(from->function_name)+1  TSRMLS_CC); 
    1481         // XXX: revert 
    1482     // zend_str_tolower(to->function_name, strlen(from->function_name)); 
    1483   } 
    1484 #ifdef ZEND_ENGINE_2 
    1485   to->fn_flags         = from->fn_flags; 
    1486   to->scope_name = NULL; 
    1487   to->scope_name_len = 0; 
    1488   if (from->scope != NULL) 
    1489   { 
    1490         // HOESH: why? use from->scope->name & from->scope->name_len instead. 
    1491         // Keep internal class behavior on mind! 
    1492     Bucket* q = CG(class_table)->pListHead; 
    1493     while (q != NULL) 
    1494         { 
    1495       if (*(zend_class_entry**)q->pData == from->scope) 
    1496           { 
    1497         to->scope_name = store_string(q->arKey, q->nKeyLength TSRMLS_CC); 
    1498         to->scope_name_len = q->nKeyLength - 1; 
    1499  
    1500         ea_debug_pad(EA_DEBUG TSRMLS_C);  
    1501         ea_debug_printf(EA_DEBUG, "[%d]                 find scope '%s' in CG(class_table) save hashkey '%s' [%08x] as to->scope_name\n", 
    1502             getpid(), from->scope->name ? from->scope->name : "NULL", q->arKey, to->scope_name); 
    1503         break; 
    1504       } 
    1505       q = q->pListNext; 
    1506     } 
    1507     if (to->scope_name == NULL) 
    1508     { 
    1509       ea_debug_pad(EA_DEBUG TSRMLS_C);  
    1510       ea_debug_printf(EA_DEBUG, "[%d]                 could not find scope '%s' in CG(class_table), saving it to NULL\n",  
    1511           getpid(), from->scope->name ? from->scope->name : "NULL"); 
    1512     } 
    1513   } 
    1514 #endif 
    1515   if (from->type == ZEND_INTERNAL_FUNCTION) { 
    1516     return to; 
    1517   } 
    1518   to->opcodes          = from->opcodes; 
    1519   to->last             = from->last; 
    1520   to->T                = from->T; 
    1521   to->brk_cont_array   = from->brk_cont_array; 
    1522   to->last_brk_cont    = from->last_brk_cont; 
    1523 #ifdef ZEND_ENGINE_2 
    1524         /* HOESH: try & catch support */ 
    1525         to->try_catch_array   = from->try_catch_array; 
    1526         to->last_try_catch    = from->last_try_catch; 
    1527   to->uses_this        = from->uses_this; 
    1528 #else 
    1529   to->uses_globals     = from->uses_globals; 
    1530 #endif 
    1531   to->static_variables = from->static_variables; 
    1532   to->return_reference = from->return_reference; 
    1533   to->filename         = from->filename; 
    1534  
    1535   if (from->opcodes != NULL) { 
    1536     EACCELERATOR_ALIGN(MMCG(mem)); 
    1537     to->opcodes = (zend_op*)MMCG(mem); 
    1538     MMCG(mem) += from->last * sizeof(zend_op); 
    1539     memcpy(to->opcodes, from->opcodes, from->last * sizeof(zend_op)); 
    1540  
    1541     opline = to->opcodes; 
    1542     end = opline + to->last; 
    1543     MMCG(compress) = 0; 
    1544     for (;opline < end; opline++) { 
    1545 /* 
    1546       if (opline->result.op_type == IS_CONST) store_zval(&opline->result.u.constant  TSRMLS_CC); 
    1547 */ 
    1548       if (opline->op1.op_type    == IS_CONST) store_zval(&opline->op1.u.constant TSRMLS_CC); 
    1549       if (opline->op2.op_type    == IS_CONST) store_zval(&opline->op2.u.constant TSRMLS_CC); 
    1550 #ifdef ZEND_ENGINE_2 
    1551       switch (opline->opcode) { 
    1552         case ZEND_JMP: 
    1553           opline->op1.u.jmp_addr = to->opcodes + (opline->op1.u.jmp_addr - from->opcodes); 
    1554           break; 
    1555         case ZEND_JMPZ: 
    1556         case ZEND_JMPNZ: 
    1557         case ZEND_JMPZ_EX: 
    1558         case ZEND_JMPNZ_EX: 
    1559           opline->op2.u.jmp_addr = to->opcodes + (opline->op2.u.jmp_addr - from->opcodes); 
    1560           break; 
    1561       } 
    1562 #endif 
    1563     } 
    1564     MMCG(compress) = 1; 
    1565   } 
    1566   if (from->brk_cont_array != NULL) { 
    1567     EACCELERATOR_ALIGN(MMCG(mem)); 
    1568     to->brk_cont_array = (zend_brk_cont_element*)MMCG(mem); 
    1569     MMCG(mem) += sizeof(zend_brk_cont_element) * from->last_brk_cont; 
    1570     memcpy(to->brk_cont_array, from->brk_cont_array, 
    1571            sizeof(zend_brk_cont_element) * from->last_brk_cont); 
    1572   } else { 
    1573     to->last_brk_cont  = 0; 
    1574   } 
    1575 #ifdef ZEND_ENGINE_2 
    1576         /* HOESH: try & catch support */ 
    1577         if (from->try_catch_array != NULL) 
    1578         { 
    1579                 EACCELERATOR_ALIGN(MMCG(mem)); 
    1580                 to->try_catch_array = (zend_try_catch_element*)MMCG(mem); 
    1581                 MMCG(mem) += sizeof(zend_try_catch_element) * from->last_try_catch; 
    1582                 memcpy(to->try_catch_array, from->try_catch_array, 
    1583                         sizeof(zend_try_catch_element) * from->last_try_catch); 
    1584         } 
    1585         else 
    1586         { 
    1587                 to->last_try_catch  = 0; 
    1588         } 
    1589 #endif 
    1590   if (from->static_variables != NULL) { 
    1591     EACCELERATOR_ALIGN(MMCG(mem)); 
    1592     to->static_variables = (HashTable*)MMCG(mem); 
    1593     MMCG(mem) += sizeof(HashTable); 
    1594     store_zval_hash(to->static_variables, from->static_variables); 
    1595   } 
    1596   if (from->filename != NULL) { 
    1597     to->filename = 
    1598       store_string(to->filename, strlen(from->filename)+1 TSRMLS_CC); 
    1599   } 
    1600 #ifdef ZEND_ENGINE_2 
    1601   to->line_start      = from->line_start; 
    1602   to->line_end        = from->line_end; 
    1603   to->doc_comment_len = from->doc_comment_len; 
    1604   if (from->doc_comment != NULL) { 
    1605     to->doc_comment = store_string(from->doc_comment, from->doc_comment_len+1 TSRMLS_CC); 
    1606   } 
    1607 #endif 
    1608   return to; 
    1609 
    1610  
    1611 static eaccelerator_class_entry* store_class_entry(zend_class_entry* from TSRMLS_DC) { 
    1612   eaccelerator_class_entry *to; 
    1613   EACCELERATOR_ALIGN(MMCG(mem)); 
    1614   to = (eaccelerator_class_entry*)MMCG(mem); 
    1615   MMCG(mem) += sizeof(eaccelerator_class_entry); 
    1616   to->type        = from->type; 
    1617   to->name        = NULL; 
    1618   to->name_length = from->name_length; 
    1619   to->parent      = NULL; 
    1620 #ifdef ZEND_ENGINE_2 
    1621   to->ce_flags    = from->ce_flags; 
    1622   to->static_members = NULL; 
    1623   to->num_interfaces = from->num_interfaces; 
    1624  
    1625 #if 0 
    1626   // i need to check more. why this field is null. 
    1627   // 
    1628   for (i=0; i<from->num_interfaces; i++) { 
    1629     if (from->interfaces[i]) { 
    1630       to->interfaces[i] = store_string(from->interfaces[i]->name, from->interfaces[i]->name_length); 
    1631     } 
    1632   } 
    1633 #endif 
    1634  
    1635 #endif 
    1636  
    1637   ea_debug_pad(EA_DEBUG TSRMLS_C); 
    1638   ea_debug_printf(EA_DEBUG, "[%d] store_class_entry: %s parent was '%s'\n",  
    1639       getpid(), from->name? from->name : "(top)", from->parent ? from->parent->name : "NULL"); 
    1640 #ifdef DEBUG 
    1641   MMCG(xpad)++; 
    1642 #endif 
    1643  
    1644   if (from->name != NULL) { 
    1645     to->name = store_string(from->name, from->name_length+1 TSRMLS_CC); 
    1646         //XXX: revert 
    1647     // zend_str_tolower(to->name, from->name_length); 
    1648   } 
    1649   if (from->parent != NULL && from->parent->name) { 
    1650     to->parent = store_string(from->parent->name, from->parent->name_length+1 TSRMLS_CC); 
    1651     //XXX: revert 
    1652     // zend_str_tolower(to->parent, from->parent->name_length); 
    1653   } 
    1654  
    1655 /* 
    1656   if (!from->constants_updated) { 
    1657     zend_hash_apply_with_argument(&from->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); 
    1658     to->constants_updated = 1; 
    1659   } 
    1660 */ 
    1661 #ifdef ZEND_ENGINE_2 
    1662   to->line_start                 = from->line_start; 
    1663   to->line_end                   = from->line_end; 
    1664   to->doc_comment_len            = from->doc_comment_len; 
    1665   to->iterator_funcs             = from->iterator_funcs; 
    1666   to->create_object              = from->create_object; 
    1667   to->get_iterator               = from->get_iterator; 
    1668   to->interface_gets_implemented = from->interface_gets_implemented; 
    1669  
    1670   if (from->filename != NULL) { 
    1671     to->filename = store_string(from->filename, strlen(from->filename)+1 TSRMLS_CC); 
    1672   } 
    1673   if (from->doc_comment != NULL) { 
    1674     to->doc_comment = store_string(from->doc_comment, from->doc_comment_len+1 TSRMLS_CC); 
    1675   } 
    1676  
    1677   store_zval_hash(&to->constants_table, &from->constants_table); 
    1678   store_zval_hash(&to->default_properties, &from->default_properties); 
    1679   store_hash(&to->properties_info, &from->properties_info, (store_bucket_t)store_property_info); 
    1680   if (from->static_members != NULL) { 
    1681     EACCELERATOR_ALIGN(MMCG(mem)); 
    1682     to->static_members = (HashTable*)MMCG(mem); 
    1683     MMCG(mem) += sizeof(HashTable); 
    1684     store_zval_hash(to->static_members, from->static_members); 
    1685   } 
    1686 #else 
    1687   store_zval_hash(&to->default_properties, &from->default_properties); 
    1688 #endif 
    1689   store_hash(&to->function_table, &from->function_table, (store_bucket_t)store_op_array); 
    1690  
    1691 #ifdef DEBUG 
    1692   MMCG(xpad)--; 
    1693 #endif 
    1694  
    1695   return to; 
    1696 
    1697  
    1698 /* Create a cache entry from the given op_array, functions and classes of a  
     709/* Create a cache entry from the given op_array, functions and classes of a 
    1699710   script */ 
    1700 static mm_cache_entry* eaccelerator_store_int( 
    1701                          char* key, int len, 
    1702                          zend_op_array* op_array, 
    1703                          Bucket* f, Bucket *c TSRMLS_DC) { 
     711static mm_cache_entry *eaccelerator_store_int (char *key, int len,  
     712        zend_op_array * op_array, Bucket * f, Bucket * c TSRMLS_DC) 
     713
    1704714  mm_cache_entry *p; 
    1705   mm_fc_entry    *fc; 
    1706   mm_fc_entry    *q; 
     715  mm_fc_entry *fc; 
     716  mm_fc_entry *q; 
    1707717  char *x; 
    1708718 
    1709   ea_debug_pad(EA_DEBUG TSRMLS_C);  
    1710   ea_debug_printf(EA_DEBUG, "[%d] eaccelerator_store_int: key='%s'\n", getpid(), key); 
    1711  
    1712   MMCG(compress) = 1; 
    1713   zend_hash_init(&MMCG(strings), 0, NULL, NULL, 0); 
    1714   p = (mm_cache_entry*)MMCG(mem); 
    1715   MMCG(mem) += offsetof(mm_cache_entry,realfilename)+len+1; 
    1716  
    1717   p->nhits    = 0; 
    1718   p->use_cnt  = 0; 
    1719   p->removed  = 0; 
    1720   p->f_head   = NULL; 
    1721   p->c_head   = NULL; 
    1722   memcpy(p->realfilename, key, len+1); 
     719  ea_debug_pad (EA_DEBUG TSRMLS_C); 
     720  ea_debug_printf (EA_DEBUG, "[%d] eaccelerator_store_int: key='%s'\n",  
     721          getpid (), key); 
     722 
     723  MMCG (compress) = 1; 
     724  zend_hash_init (&MMCG (strings), 0, NULL, NULL, 0); 
     725  p = (mm_cache_entry *) MMCG (mem); 
     726  MMCG (mem) += offsetof (mm_cache_entry, realfilename) + len + 1; 
     727 
     728  p->nhits = 0; 
     729  p->use_cnt = 0; 
     730  p->removed = 0; 
     731  p->f_head = NULL; 
     732  p->c_head = NULL; 
     733  memcpy (p->realfilename, key, len + 1); 
    1723734  x = p->realfilename; 
    1724   zend_hash_add(&MMCG(strings), key, len+1, &x, sizeof(char*), NULL); 
     735  zend_hash_add (&MMCG (strings), key, len + 1, &x, sizeof (char *), NULL); 
    1725736