Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c

From: Date: Thu, 07 Aug 2003 07:59:32 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_execute_API.c
References: 1 2  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-1617@lists.php.net to get a copy of this message
At 10:41 07/08/2003, Marcus Börger wrote:
But object_pp can be taken from zend_fcall_info and then there are only two pointers left. Or to say it different: It's a bit weired that the cach info overwrites the object_pp in the zend_fcall_info struct.
Not really. The reason for that is the support for array($obj, $funcname). If we didn't cache the object pointer info (which in some cases will be identical to the fci->object_pp value, and in others will not) we would have to look into the function name every time, to see if it's an array, and start digging out information from it.
Also i think that checking function_handler!=NULL from the remaining would be enough because you don't do a partial initialization of the cache info and the function_handler is always needed. Having said this the following cut down would be enough: typedef struct _zend_fcall_info_cache {
        zend_function *function_handler;
        zend_class_entry *calling_scope;
} zend_fcall_info_cache; And this looks much like a nice function/method pointer.
Well, we can definitely not cut it down that much for the abovementioned reasons. The reason I added the initialized boolean is for clarity, and because it's not impossible that under some circumstances (in the future) the function handler pointer will not necessarily be initialized. Either way, the cache structure is supposed to be a black box for the caller, as its contents may change in the future without prior notice.
2) The zend_fcall_info struct only takes an argument function_name of type zval. For some things i have in mind this is overkill. A possibility to provide the function name in a char* would be much faster there. And since one could easily put the char* from the zval into the struct this is the much better approach from my point of view.
I don't think it would be faster at all, let alone much faster, but either way - a complete niet for that one. The typical use case is using zval's, which conveniently contain both the string and its length, or other types of calling (array(), possibly others in the futur). There aren't any real downsides to it, so that's what we should support. Zeev

« previous php.zend-engine.cvs (#1617) next »