Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.c
| From: | Zeev Suraski | Date: | Sun, 08 Jun 2003 06:19:46 +0000 |
| Subject: | Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend.c | ||
| References: | 1 2 3 4 5 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-1347@lists.php.net to get a copy of this message | ||
At 10:24 06/06/2003, Thies C. Arntzen wrote:
On Thu, Jun 05, 2003 at 10:27:42PM +0300, Zeev Suraski wrote: The particular piece of code in zend.c is much trickier. We're initializing the infrastructure for making PHP in threaded environments tick, and since threaded environments are very different from multiprocess environments, there's some extra stuff we have to do. For example, here we don't just initialize the current thread's function table. We also initialize a process-wide function table, which serves as the read-only 'template' for creating new function tables every time a new thread gets started (we obviously don't need it in the Apache model, thanks to the wonders of fork()). This is something very much unique to zend.c (there are several cases of this happening there) - which is why you see this not-very-pleasant-looking piece of code. Have no worries though, as again, it's NOT growing :)Hrm no, but that's why I said that it looks like a voodoo fix.hmm - i have no worries;-) but:#ifdef ZTSzend_compiler_globals *compiler_globals; zend_executor_globals *executor_globals; void ***tsrm_ls;#ifdef ZTSextern ZEND_API ts_rsrc_id ini_scanner_globals_id; extern ZEND_API ts_rsrc_id language_scanner_globals_id;...might be a C&P thing - but it looks awful...GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable)); GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable)); GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));#ifdef ZTSGLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable));#endifsesame-street (do you get that in israel?) taught me how to "spot the differnce" but i see none between GLOBAL_FUNCTION_TABLE, GLOBAL_CLASS_TABLE, GLOBAL_AUTO_GLOBALS_TABLE and GLOBAL_CONSTANTS_TABLE, do you?
it might be clear to you as the architect of Zend, but for me it's not that
obvious, and if there is a good eplanation for this it would make sense to
name the variables "right"
I'm not saying it's an easy-to-understand piece of code - it's a fairly complicated piece of code. But it cannot be simplified, we're doing certain initializations in there in a certain order and using a certain methodology, that doesn't exist anywhere else in PHP.
Good :) Zeevbut -then again- i have no worries.