RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend.h zend_object_handlers.c zend_objects.c zend_reflection_api.c php-src NEWS
| From: | Dmitry Stogov | Date: | Wed, 16 Nov 2005 07:47:55 +0000 |
| Subject: | RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) / zend.h zend_object_handlers.c zend_objects.c zend_reflection_api.c php-src NEWS | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4342@lists.php.net to get a copy of this message | ||
Most objects don't have magic methods and they dob't need this "guards"
HashTable.
It will be allocated on te first call to __get(), __set(), ...
Also in case of HashTable we need initialize it for each object, however in
case of pointer only befor first call to __get()...
Call to __get() will probably mach take more time then HashTable allocation
and initialization.
So I assume usage "guards" as pointert to HashTable saves space and time.
Thanks. Dmitry.
> -----Original Message-----
> From: Marcus Boerger [mailto:helly@php.net]
> Sent: Tuesday, November 15, 2005 10:31 PM
> To: Dmitry Stogov
> Cc: zend-engine-cvs@lists.php.net
> Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_1) /
> zend.h zend_object_handlers.c zend_objects.c
> zend_reflection_api.c php-src NEWS
>
>
> Hello Dmitry,
>
> Tuesday, November 15, 2005, 2:35:25 PM, you wrote:
>
> >
>
> http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2027.2.189&r2=1.2027.2.1
> > 90&ty=u
> > Index: php-src/NEWS
> > diff -u php-src/NEWS:1.2027.2.189 php-src/NEWS:1.2027.2.190
> > --- php-src/NEWS:1.2027.2.189 Tue Nov 15 08:29:15 2005
> > +++ php-src/NEWS Tue Nov 15 08:35:20 2005
> > @@ -1,6 +1,7 @@
> > PHP
> NEWS
> >
> >
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> |||||||||||||||||
> > ?? Nov 2005, PHP 5.1
> > +- Allow recursive calls to __get/__set for different properties.
> > +(Dmitry)
> > - Upgraded PEAR to version 1.4.4. (Greg)
> > - Fixed bug in mysqli extension with unsigned int(11)
> being represented as
> > signed integer in PHP instead of string in 32bit
> systems. (Andrey)
> >
>
> http://cvs.php.net/diff.php/ZendEngine2/zend.h?r1=1.293.2.3&r2=1.293.2
> > .4&ty=u
> > Index: ZendEngine2/zend.h
> > diff -u ZendEngine2/zend.h:1.293.2.3 ZendEngine2/zend.h:1.293.2.4
> > --- ZendEngine2/zend.h:1.293.2.3 Thu Sep 1 06:05:30 2005
> > +++ ZendEngine2/zend.h Tue Nov 15 08:35:22 2005
> > @@ -17,7 +17,7 @@
> >
> >
> +-------------------------------------------------------------
> ---------+
> > */
> >
> > -/* $Id: zend.h,v 1.293.2.3 2005/09/01 10:05:30 dmitry Exp $ */
> > +/* $Id: zend.h,v 1.293.2.4 2005/11/15 13:35:22 dmitry Exp $ */
> >
> > #ifndef ZEND_H
> > #define ZEND_H
> > @@ -265,13 +265,18 @@
> > typedef struct _zval_struct zval;
> > typedef struct _zend_class_entry zend_class_entry;
> >
> > +typedef struct _zend_guard {
> > + zend_bool in_get;
> > + zend_bool in_set;
> > + zend_bool in_unset;
> > + zend_bool in_isset;
> > + zend_bool dummy; /* sizeof(zend_guard) must not be equal to
> > +sizeof(void*) */ } zend_guard;
> > +
> > typedef struct _zend_object {
> > zend_class_entry *ce;
> > HashTable *properties;
> > - unsigned int in_get:1;
> > - unsigned int in_set:1;
> > - unsigned int in_unset:1;
> > - unsigned int in_isset:1;
> > + HashTable *guards; /* protects from __get/__set ...
> recursion
> > + */
> > } zend_object;
> >
> [...]
>
> Wouldn't it be better to have the HashTables as members
> rather than pointers? It would prevent a malloc/free that is
> imo not necessaary at all.
>
> regards
> marcus
>
>