Changeset 148

Show
Ignore:
Timestamp:
02/06/06 17:39:11 (2 years ago)
Author:
hrak
Message:

PHP_5_1: Quite some major changes, including but probably not limited to:
-Fixed numerous memory leaks
-Fixed the handling of empty string variables (as in ""), causing "String is not zero-terminated" warnings when PHP is compiled with --enable-debug
-More fixes to the handling of static properties (access checking/inheritance)
-Inheritance on restore is now handled by zend_do_inheritance
-Fixed handling of ZEND_OP_DATA and ZEND_INIT_METHOD_CALL by the optimizer
-Cosmetic fixes (spelling etc.)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/branches/PHP_5_1/ChangeLog

    r147 r148  
     12006-02-06  Hans Rakers <hans at parse dot nl> 
     2 
     3        * PHP_5_1: Quite some major changes, including but probably not limited to: 
     4          -Fixed numerous memory leaks 
     5          -Fixed the handling of empty string variables (as in ""), causing "String is not zero-terminated" warnings when PHP is compiled with --enable-debug 
     6          -More fixes to the handling of static properties (access checking/inheritance) 
     7          -Inheritance on restore is now handled by zend_do_inheritance 
     8          -Fixed handling of ZEND_OP_DATA and ZEND_INIT_METHOD_CALL by the optimizer 
     9          -Cosmetic fixes (spelling etc.) 
     10 
    1112006-01-16  Hans Rakers <hans at parse dot nl> 
    212 
  • eaccelerator/branches/PHP_5_1/debug.c

    r142 r148  
    247247} 
    248248 
     249/* 
     250 * This dumps a HashTable to debug output. Taken from zend_hash.c and slightly adapted. 
     251 */ 
     252void ea_debug_hash_display(HashTable * ht) 
     253{ 
     254        Bucket *p; 
     255        uint i; 
     256 
     257        fprintf(F_fp, "ht->nTableSize: %d\n", ht->nTableSize); 
     258        fprintf(F_fp, "ht->nNumOfElements: %d\n", ht->nNumOfElements); 
     259 
     260        for (i = 0; i < ht->nTableSize; i++) { 
     261                p = ht->arBuckets[i]; 
     262                while (p != NULL) { 
     263                        fprintf(F_fp, "%s <==> 0x%lX\n", p->arKey, p->h); 
     264                        p = p->pNext; 
     265                } 
     266        } 
     267 
     268        p = ht->pListTail; 
     269        while (p != NULL) { 
     270                fprintf(F_fp, "%s <==> 0x%lX\n", p->arKey, p->h); 
     271                p = p->pListLast; 
     272        } 
     273        fflush(F_fp); 
     274} 
     275 
    249276#endif /* #ifdef HAVE_EACCELERATOR */ 
  • eaccelerator/branches/PHP_5_1/debug.h

    r122 r148  
    7272long ea_debug_elapsed_time (struct timeval *tvstart); 
    7373 
     74void ea_debug_hash_display(HashTable * ht); 
     75 
    7476#endif /* INCLUDED_DEBUG_H */ 
  • eaccelerator/branches/PHP_5_1/ea_restore.c

    r147 r148  
    276276        fixup_hash(&from->properties_info, 
    277277                           (fixup_bucket_t) fixup_property_info TSRMLS_CC); 
     278#  ifdef ZEND_ENGINE_2_1 
     279        fixup_zval_hash(&from->default_static_members); 
     280        if (from->static_members != NULL) { 
     281                FIXUP(from->static_members); 
     282                if (from->static_members != &from->default_static_members) { 
     283                        fixup_zval_hash(from->static_members); 
     284                } 
     285        } 
     286#  else 
    278287        if (from->static_members != NULL) { 
    279288                FIXUP(from->static_members); 
    280289                fixup_zval_hash(from->static_members); 
    281290        } 
    282 #  ifdef ZEND_ENGINE_2_1 
    283         fixup_zval_hash(&from->default_static_members); 
    284291#  endif 
    285292#else 
     
    305312        memcpy(p, from, sizeof(zval)); 
    306313        restore_zval(p TSRMLS_CC); 
     314        /* hrak: reset refcount to make sure there is one reference to this val, and prevent memleaks */ 
     315        p->refcount = 1; 
    307316        return p; 
    308317} 
     
    379388        case IS_STRING: 
    380389                if (zv->value.str.val == NULL ||  
    381                 zv->value.str.val == empty_string || zv->value.str.len == 0) { 
     390                zv->value.str.val == "" || zv->value.str.len == 0) { 
    382391                        zv->value.str.val = empty_string; 
    383392                        return; 
     
    526535         */ 
    527536        if (from->scope_name != NULL) { 
    528                 char *from_scope_lc = zend_str_tolower_dup(from->scope_name, from->scope_name_len); 
    529                 if (zend_hash_find (CG(class_table), (void *) from_scope_lc,  
    530                     from->scope_name_len + 1, (void **) &to->scope) != SUCCESS) { 
     537                zend_class_entry** scope_ptr = NULL; 
     538                if (zend_lookup_class(from->scope_name, from->scope_name_len, &scope_ptr TSRMLS_CC) != SUCCESS) { 
    531539                        ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    532                         ea_debug_printf(EA_DEBUG, "[%d]                   can't find '%s' in hash. use EAG(class_entry).\n", getpid(), from_scope_lc); 
     540                        ea_debug_printf(EA_DEBUG, "[%d]                   can't find '%s' in class_table. use EAG(class_entry).\n", getpid(), from->scope_name); 
    533541                        to->scope = EAG(class_entry); 
    534542                } else { 
    535543                        ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    536                         ea_debug_printf(EA_DEBUG, "[%d]                   found '%s' in hash\n", getpid(), from_scope_lc); 
    537                         to->scope = *(zend_class_entry **) to->scope; 
    538                 } 
    539                 efree(from_scope_lc); 
     544                        ea_debug_printf(EA_DEBUG, "[%d]                   found '%s' in hash\n", getpid(), from->scope_name); 
     545                        to->scope = *scope_ptr; 
     546                } 
    540547        } else {                                        // zoeloelip: is this needed? scope is always stored 
    541548                ea_debug_pad(EA_DEBUG TSRMLS_CC); 
     
    590597                        ea_debug_pad(EA_DEBUG TSRMLS_CC); 
    591598                        ea_debug_printf(EA_DEBUG, "[%d]                                       can't find\n", getpid()); 
    592                 } 
     599                }               
    593600                return to; 
    594601        } 
     602#ifdef ZEND_ENGINE_2 
     603        /* hrak: slight memleak here. dont forget to free the lowercase function name! */ 
     604        if (fname_lc != NULL) { 
     605                efree(fname_lc); 
     606        } 
     607#endif 
    595608        to->opcodes = from->opcodes; 
    596609        to->last = to->size = from->last; 
     
    607620        to->done_pass_two = 1; 
    608621        to->filename = from->filename; 
     622/*      if (from->filename != NULL) { 
     623                size_t len = strlen(from->filename) + 1; 
     624                to->filename = emalloc(len); 
     625                memcpy(to->filename, from->filename, len); 
     626        }*/ 
     627 
    609628#ifdef ZEND_ENGINE_2 
    610629        /* HOESH: try & catch support */ 
     
    644663        to->last_var         = from->last_var; 
    645664        to->size_var         = 0; 
    646         if (to->vars) {          
     665/*      if (from->vars) { 
    647666                zend_uint i; 
    648667                to->vars = (zend_compiled_variable*)emalloc(from->last_var*sizeof(zend_compiled_variable));              
     
    651670                        to->vars[i].name = estrndup(from->vars[i].name, from->vars[i].name_len); 
    652671                } 
    653         } 
     672        }*/ 
    654673#endif 
    655674 
     
    689708                                                  zend_class_entry * to TSRMLS_DC) 
    690709{ 
    691 #ifdef ZEND_ENGINE_2 
    692         char *name_lc = zend_str_tolower_dup(parent, len); 
    693         if (zend_hash_find(CG(class_table), (void *) name_lc, len + 1, (void **) &to->parent) != SUCCESS) 
     710        ea_debug_printf(EA_DEBUG, "restore_class_parent: restoring parent class %s of class %s\n", (char *) parent, to->name); 
     711#ifdef ZEND_ENGINE_2 
     712/*      char *name_lc = zend_str_tolower_dup(parent, len); 
     713        if (zend_hash_find(CG(class_table), (void *) name_lc, len + 1, (void **) &to->parent) != SUCCESS)*/ 
     714        zend_class_entry** parent_ptr = NULL; 
     715        if (zend_lookup_class(parent, len, &parent_ptr TSRMLS_CC) != SUCCESS) 
    694716#else 
    695717        if (zend_hash_find(CG(class_table), (void *) parent, len + 1, (void **) &to->parent) != SUCCESS) 
     
    702724#ifdef ZEND_ENGINE_2 
    703725                /* inherit parent methods */ 
    704                 to->parent = *(zend_class_entry **) to->parent; 
    705                 to->constructor = to->parent->constructor; 
     726                to->parent = *parent_ptr; 
     727                ea_debug_printf(EA_DEBUG, "restore_class_parent: found parent %s..\n", to->parent->name); 
     728                ea_debug_printf(EA_DEBUG, "restore_class_parent: parent type=%d child type=%d waa=%x\n", to->parent->type, to->type, CE_STATIC_MEMBERS(*parent_ptr)); 
     729                zend_do_inheritance(to, to->parent TSRMLS_CC); 
     730                to->parent->refcount++; 
     731/*              to->constructor = to->parent->constructor; 
    706732                to->destructor = to->parent->destructor; 
    707733                to->clone = to->parent->clone; 
     
    719745                to->handle_property_get = to->parent->handle_property_get; 
    720746                to->handle_property_set = to->parent->handle_property_set; 
    721                 to->handle_function_call = to->parent->handle_function_call; 
    722 #endif 
    723         } 
    724 #ifdef ZEND_ENGINE_2 
    725         efree(name_lc); 
     747                to->handle_function_call = to->parent->handle_function_call;*/ 
     748#endif 
     749        } 
     750#ifdef ZEND_ENGINE_2 
     751        /*efree(name_lc);*/ 
    726752#endif 
    727753} 
     
    742768                fname_len = strlen(f->common.function_name); 
    743769                fname_lc = zend_str_tolower_dup(f->common.function_name, fname_len); 
     770                ea_debug_printf(EA_DEBUG, "restore_class_methods: restoring function:%s scope:%s parent=%x scope=%x\n", fname_lc, ZEND_FN_SCOPE_NAME(f), to->parent, f->common.scope); 
    744771 
    745772                if (fname_len == cname_len && !memcmp(fname_lc, cname_lc, fname_len) &&  
     
    786813        zend_class_entry *old; 
    787814        zend_function *f = NULL; 
    788         int fname_len = 0; 
    789         char *fname_lc = NULL; 
    790 #ifdef ZEND_ENGINE_2 
    791         int cname_len; 
    792         char *cname_lc; 
     815/*      int fname_len = 0;              hrak: seems rather unused 
     816        char *fname_lc = NULL; */ 
     817#ifdef ZEND_ENGINE_2 
     818/*      int cname_len;                  hrak: same here 
     819        char *cname_lc; */ 
    793820        Bucket *p; 
    794821        union _zend_function *old_ctor; 
     
    815842        to->num_interfaces = from->num_interfaces; 
    816843        if (to->num_interfaces > 0) { 
     844                /* hrak: Allocate the slots which will later be populated by ZEND_ADD_INTERFACE */ 
    817845                to->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *) * to->num_interfaces); 
    818                 // should find out class entry. what the hell !!! 
    819846                memset(to->interfaces, 0, sizeof(zend_class_entry *) * to->num_interfaces); 
    820847        } else { 
     
    834861        } 
    835862 
    836       if (from->parent != NULL) { 
     863/*    if (from->parent != NULL) { 
    837864                restore_class_parent(from->parent, strlen(from->parent), to TSRMLS_CC); 
    838865        } else { 
     
    840867                ea_debug_printf(EA_DEBUG, "[%d] parent = NULL\n", getpid()); 
    841868                to->parent = NULL; 
    842         } 
     869        }*/ 
    843870 
    844871        old = EAG(class_entry); 
     
    850877        to->line_start = from->line_start; 
    851878        to->line_end = from->line_end; 
     879        ea_debug_printf(EA_DEBUG, "restore_class_entry: line_start=%d, line_end=%d", to->line_start, to->line_end); 
    852880        to->doc_comment_len = from->doc_comment_len; 
    853       if (from->filename != NULL) { 
     881/*    if (from->filename != NULL) { 
    854882                size_t len = strlen(from->filename) + 1; 
    855883                to->filename = emalloc(len); 
    856884                memcpy(to->filename, from->filename, len); 
    857         } 
     885        }*/ 
     886        to->filename = from->filename; 
    858887        if (from->doc_comment != NULL) { 
    859888                to->doc_comment = emalloc(from->doc_comment_len + 1); 
     
    877906        to->default_static_members.pDestructor = ZVAL_PTR_DTOR; 
    878907         
    879         to->static_members = (from->type == ZEND_INTERNAL_CLASS) ? NULL : &to->default_static_members; 
     908        ea_debug_printf(EA_DEBUG, "restore_class_entry: static_members=%x, default_static_members=%x", from->static_members, &from->default_static_members); 
     909        if (from->static_members != &(from->default_static_members)) { 
     910                ALLOC_HASHTABLE(to->static_members); 
     911                restore_zval_hash(to->static_members, from->static_members); 
     912                to->static_members->pDestructor = ZVAL_PTR_DTOR; 
     913        } else { 
     914                to->static_members = &(to->default_static_members); 
     915        } 
     916        ea_debug_printf(EA_DEBUG, "restore_class_entry: to->static_members=%x, to->default_static_members=%x", to->static_members, &to->default_static_members); 
    880917#  else 
    881918        if (from->static_members != NULL) { 
     
    904941        to->function_table.pDestructor = ZEND_FUNCTION_DTOR; 
    905942 
     943        if (from->parent != NULL) { 
     944                restore_class_parent(from->parent, strlen(from->parent), to TSRMLS_CC); 
     945        } else { 
     946                ea_debug_pad(EA_DEBUG TSRMLS_CC); 
     947                ea_debug_printf(EA_DEBUG, "[%d] parent = NULL\n", getpid()); 
     948                to->parent = NULL; 
     949        } 
     950 
    906951#ifdef ZEND_ENGINE_2 
    907952        restore_class_methods(to TSRMLS_CC); 
  • eaccelerator/branches/PHP_5_1/ea_store.c

    r147 r148  
    123123        case IS_CONSTANT: 
    124124        case IS_STRING: 
    125                if (zv->value.str.val == NULL || zv->value.str.val == empty_string || zv->value.str.len == 0) { 
    126                 } else { 
     125/*             if (zv->value.str.val == NULL || zv->value.str.len == 0) { 
     126                } else {*/ 
    127127                        calc_string(zv->value.str.val, zv->value.str.len + 1 TSRMLS_CC); 
    128                 } 
     128/*              }*/ 
    129129                break; 
    130130        case IS_ARRAY: 
     
    285285                calc_string(from->parent->name, from->parent->name_length + 1 TSRMLS_CC); 
    286286#ifdef ZEND_ENGINE_2 
    287 #if 0 
    288         // what's problem. why from->interfaces[i] == 0x5a5a5a5a ? 
    289         for (i = 0; i < from->num_interfaces; i++) { 
    290                 if (from->interfaces[i]) { 
    291                         calc_string(from->interfaces[i]->name, 
    292                                                 from->interfaces[i]->name_length); 
    293                 } 
    294         } 
    295 #endif 
    296287        if (from->filename != NULL) 
    297288                calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); 
     
    302293        calc_zval_hash(&from->default_properties); 
    303294 
    304 #ifdef ZEND_ENGINE_2_1 
     295        calc_hash(&from->properties_info, (calc_bucket_t) calc_property_info); 
     296 
     297#  ifdef ZEND_ENGINE_2_1 
    305298        calc_zval_hash(&from->default_static_members); 
    306 #endif 
    307          
    308         calc_hash(&from->properties_info, (calc_bucket_t) calc_property_info); 
     299        if ((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 
     300#  else 
    309301        if (from->static_members != NULL) { 
     302#  endif 
    310303                EACCELERATOR_ALIGN(EAG(mem)); 
    311304                EAG(mem) += sizeof(HashTable); 
     
    388381 
    389382typedef void *(*store_bucket_t) (void *TSRMLS_DC); 
    390  
    391 #define store_hash_ex(to, from, start, store_bucket) \ 
    392   store_hash_int(to, from, start, store_bucket TSRMLS_CC) 
    393  
    394 #define store_hash(to, from, store_bucket) \ 
    395   store_hash_ex(to, from, (from)->pListHead, store_bucket) 
     383typedef void *(*check_bucket_t) (Bucket*, va_list); 
     384 
     385#define store_hash_ex(to, from, start, store_bucket, check_bucket, ...) \ 
     386  store_hash_int(to, from, start, store_bucket, check_bucket, __VA_ARGS__) 
     387 
     388#define store_hash(to, from, store_bucket, check_bucket, ...) \ 
     389  store_hash_ex(to, from, (from)->pListHead, store_bucket, check_bucket, __VA_ARGS__) 
    396390 
    397391#define store_zval_hash(to, from) \ 
    398   store_hash(to, from, (store_bucket_t)store_zval_ptr
     392  store_hash(to, from, (store_bucket_t)store_zval_ptr, NULL, NULL
    399393 
    400394#define store_zval_hash_ex(to, from, start) \ 
    401   store_hash_ex(to, from, start, (store_bucket_t)store_zval_ptr
     395  store_hash_ex(to, from, start, (store_bucket_t)store_zval_ptr, NULL
    402396 
    403397static zval *store_zval_ptr(zval * from TSRMLS_DC) 
     
    413407 
    414408static void store_hash_int(HashTable * target, HashTable * source, 
    415                                                    Bucket * start, store_bucket_t copy_bucket TSRMLS_DC) 
     409                                                   Bucket * start, store_bucket_t copy_bucket, 
     410                                                                   check_bucket_t check_bucket, ...) 
    416411{ 
    417412        Bucket *p, *np, *prev_p; 
     
    436431                np = NULL; 
    437432                while (p) { 
     433                        /* If a check function has been defined, run it */ 
     434                        if (check_bucket) { 
     435                                va_list args; 
     436                                va_start(args, check_bucket); 
     437 
     438                                /* If the check function returns ZEND_HASH_APPLY_REMOVE, don't store this record, skip over it */ 
     439                                if(check_bucket(p, args)) { 
     440                                        p = p->pListNext; 
     441                                        target->nNumOfElements--; 
     442                                        /* skip to next itteration */ 
     443                                        continue; 
     444                                } 
     445                                va_end(args); 
     446                        } 
     447 
    438448                        EACCELERATOR_ALIGN(EAG(mem)); 
    439449                        np = (Bucket *) EAG(mem); 
     
    486496        case IS_CONSTANT: 
    487497        case IS_STRING: 
    488                 if (zv->value.str.val == NULL || 
    489                         zv->value.str.val == empty_string || zv->value.str.len == 0) { 
    490                         zv->value.str.val = empty_string; 
    491                         zv->value.str.len = 0; 
    492                 } else { 
    493                         zv->value.str.val = store_string(zv->value.str.val, zv->value.str.len + 1 TSRMLS_CC); 
    494                 } 
     498                zv->value.str.val = store_string(zv->value.str.val, zv->value.str.len + 1 TSRMLS_CC); 
    495499                break; 
    496500        case IS_ARRAY: 
     
    631635#endif 
    632636        to->static_variables = from->static_variables; 
    633 #ifdef ZEND_ENGINE_2_1 
    634         to->vars             = from->vars; 
    635         to->last_var         = from->last_var; 
    636 #endif 
    637637        to->return_reference = from->return_reference; 
    638638        to->filename = from->filename; 
     
    742742        return to; 
    743743} 
     744 
     745/*  
     746 * The following two functions handle access checking of properties (public/private/protected)  
     747 * and control proper inheritance during copying of the properties_info and (default_)static_members hashes 
     748 * 
     749 * Both functions return ZEND_HASH_APPLY_REMOVE if the property to be copied needs to be skipped, or 
     750 * ZEND_HASH_APPLY_KEEP if the property needs to be copied over into the cache. 
     751 *   
     752 * If the property is skipped due to access restrictions, or it needs inheritance of its value from the 
     753 * parent, the restore phase will take care of that. 
     754 * 
     755 * Most of the logic behind all this can be found in zend_compile.c, functions zend_do_inheritance and 
     756 * zend_do_inherit_property_access_check 
     757*/ 
     758static int store_property_access_check(Bucket * p, va_list args) 
     759{ 
     760        zend_class_entry *from = va_arg(args, zend_class_entry*); 
     761        zend_class_entry *parent = from->parent; 
     762         
     763        ea_debug_printf(EA_DEBUG, "[%d] store_property_access_check enter. from=%x parent=%x arKey=%s\n", getpid(), from, parent, p->arKey); 
     764         
     765        if (parent) { 
     766                // hra: TODO - do some usefull stuff :) 
     767                // check for ACC_PRIVATE etc. 
     768                // for now, just return keep 
     769        } 
     770        ea_debug_printf(EA_DEBUG, "[%d] store_property_access_check result: keep\n", getpid()); 
     771        return ZEND_HASH_APPLY_KEEP; 
     772} 
     773 
     774static int store_static_member_access_check(Bucket * p, va_list args) 
     775{ 
     776        zend_class_entry *from = va_arg(args, zend_class_entry*); 
     777        zend_class_entry *parent = from->parent; 
     778        zend_property_info *pinfo, *cinfo = NULL; 
     779        zval **pprop = NULL; 
     780        zval **cprop = p->pData; 
     781        char *mname, *cname = NULL; 
     782 
     783        /* Check if this is a parent class. If so, copy unconditionally */ 
     784        if (parent) { 
     785                /* unpack the \0classname\0membername\0 style property name to seperate vars */ 
     786                zend_unmangle_property_name(p->arKey, &cname, &mname); 
     787                ea_debug_printf(EA_DEBUG, "[%d] store_static_member_access_check: cname=%s, mname=%s\n", getpid(), cname, mname); 
     788         
     789                /* lookup the member's info in parent and child */ 
     790                if((zend_hash_find(&parent->properties_info, mname, strlen(mname)+1, (void**)&pinfo) == SUCCESS) && 
     791                        (zend_hash_find(&from->properties_info, mname, strlen(mname)+1, (void**)&cinfo) == SUCCESS)) { 
     792                        /* don't copy this static property if protected in parent and static public in child. 
     793                           inheritance will handle this properly on restore */ 
     794                        if(cinfo->flags & ZEND_ACC_STATIC && (pinfo->flags & ZEND_ACC_PROTECTED && cinfo->flags & ZEND_ACC_PUBLIC)) { 
     795                                ea_debug_printf(EA_DEBUG, "[%d] store_static_member_access_check: child static public, parent protected, result: skip\n", getpid()); 
     796                                return ZEND_HASH_APPLY_REMOVE; 
     797                        } 
     798                        /* If the static member points to the same value in parent and child, remove for proper inheritance during restore */ 
     799                        if(zend_hash_quick_find(&parent->default_static_members, p->arKey, p->nKeyLength, p->h, (void**)&pprop) == SUCCESS) { 
     800                                ea_debug_printf(EA_DEBUG, "[%d] store_static_member_access_check: SUCCESS looking up arKey\n",getpid()); 
     801                                ea_debug_printf(EA_DEBUG, "[%d] store_static_member_access_check: pprop=%x cprop=%x\n",getpid(), *pprop, *cprop); 
     802                                if(*pprop == *cprop) { 
     803                                        ea_debug_printf(EA_DEBUG, "[%d] store_static_member_access_check: pprop == cprop, result: skip\n",getpid()); 
     804                                        return ZEND_HASH_APPLY_REMOVE; 
     805                                } 
     806                        } 
     807                } 
     808        } 
     809        ea_debug_printf(EA_DEBUG, "[%d] store_static_member_access_check: result: keep\n",getpid()); 
     810        return ZEND_HASH_APPLY_KEEP; 
     811} 
     812 
    744813#endif 
    745814 
     
    751820        EAG(mem) += sizeof(eaccelerator_class_entry); 
    752821        to->type = from->type; 
     822        ea_debug_printf(EA_DEBUG, "[%d] store_class_entry: class type=%d\n", getpid(), from->type); 
    753823        to->name = NULL; 
    754824        to->name_length = from->name_length; 
     
    758828        to->static_members = NULL; 
    759829        to->num_interfaces = from->num_interfaces; 
    760  
    761 #if 0 
    762         // i need to check more. why this field is null. 
    763         // 
    764         for (i = 0; i < from->num_interfaces; i++) { 
    765                 if (from->interfaces[i]) { 
    766                         to->interfaces[i] = 
    767                                 store_string(from->interfaces[i]->name, 
    768                                                          from->interfaces[i]->name_length); 
    769                 } 
    770         } 
    771 #endif 
    772  
     830        /* hrak: no need to really store the interfaces since these get populated 
     831         * at/after restore by zend_do_inheritance and ZEND_ADD_INTERFACE */ 
     832        to->interfaces = NULL; 
    773833#endif 
    774834 
     
    786846                to->parent = store_string(from->parent->name, from->parent->name_length + 1 TSRMLS_CC); 
    787847 
    788 /* 
    789   if (!from->constants_updated) { 
    790     zend_hash_apply_with_argument(&from->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC); 
    791     to->constants_updated = 1; 
    792   } 
    793 */ 
    794848#ifdef ZEND_ENGINE_2 
    795849        to->line_start = from->line_start; 
     
    808862        store_zval_hash(&to->constants_table, &from->constants_table); 
    809863        store_zval_hash(&to->default_properties, &from->default_properties); 
    810         store_hash(&to->properties_info, &from->properties_info, (store_bucket_t) store_property_info); 
     864        //store_hash(&to->properties_info, &from->properties_info, (store_bucket_t) store_property_info, NULL, NULL); 
     865        store_hash(&to->properties_info, &from->properties_info, (store_bucket_t) store_property_info, (check_bucket_t) store_property_access_check, from); 
     866#  ifdef ZEND_ENGINE_2_1 
     867        if((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 
     868                store_zval_hash(&to->default_static_members, &from->default_static_members); 
     869                EACCELERATOR_ALIGN(EAG(mem)); 
     870                to->static_members = (HashTable *) EAG(mem); 
     871                EAG(mem) += sizeof(HashTable); 
     872                store_hash(to->static_members, from->static_members, (store_bucket_t) store_zval_ptr, (check_bucket_t) store_static_member_access_check, from); 
     873        } else { 
     874                /*EACCELERATOR_ALIGN(EAG(mem)); 
     875                to->static_members = (HashTable *) EAG(mem); 
     876                EAG(mem) += sizeof(HashTable);*/ 
     877                store_hash(&to->default_static_members, &from->default_static_members, (store_bucket_t) store_zval_ptr, (check_bucket_t) store_static_member_access_check, from); 
     878                to->static_members = &to->default_static_members; 
     879        } 
     880        ea_debug_printf(EA_DEBUG, "[%d] store_class_entry: to->static_members(%x), to->default_static_members(%x)\n", getpid(), to->static_members, &to->default_static_members); 
     881#  else 
    811882        if (from->static_members != NULL) { 
    812883                EACCELERATOR_ALIGN(EAG(mem)); 
     
    815886                store_zval_hash(to->static_members, from->static_members); 
    816887        } 
     888#  endif 
    817889#else 
    818890        store_zval_hash(&to->default_properties, &from->default_properties); 
    819891#endif 
    820  
    821 #ifdef ZEND_ENGINE_2_1 
    822         store_zval_hash(&to->default_static_members, &from->default_static_members); 
    823 #endif 
    824         store_hash(&to->function_table, &from->function_table, (store_bucket_t) store_op_array); 
     892        store_hash(&to->function_table, &from->function_table, (store_bucket_t) store_op_array, NULL, NULL); 
    825893 
    826894#ifdef DEBUG 
  • eaccelerator/branches/PHP_5_1/eaccelerator.c

    r146 r148  
    884884    return 0; 
    885885  } 
     886  ea_debug_printf (EA_DEBUG, "[%d] eaccelerator_store: calc_size returned %d, mm=%x", getpid(), size, eaccelerator_mm_instance->mm); 
    886887  EACCELERATOR_UNPROTECT(); 
    887888  EAG(mem) = eaccelerator_malloc(size); 
     
    14741475              (nreloads == 1) ? "cached" : "re-cached", file_handle->opened_path); 
    14751476      } else { 
    1476         ea_debug_log("[%d] EACCELERATOR cann't cache: \"%s\"\n", getpid(), file_handle->opened_path); 
     1477        ea_debug_log("[%d] EACCELERATOR can't cache: \"%s\"\n", getpid(), file_handle->opened_path); 
    14771478      } 
    14781479    } else { 
  • eaccelerator/branches/PHP_5_1/opcodes.c

    r146 r148  
    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 */ 
  • eaccelerator/branches/PHP_5_1/optimize.c

    r146 r148  
    311311             case ZEND_FE_FETCH: 
    312312#ifdef ZEND_ENGINE_2 
     313             case ZEND_INIT_METHOD_CALL: 
     314             case ZEND_INIT_STATIC_METHOD_CALL: 
    313315             case ZEND_ASSIGN_DIM: 
    314316             case ZEND_DECLARE_CLASS: