Re: Compiled variables and backpatching

From: Date: Thu, 27 Sep 2007 00:49:50 +0000
Subject: Re: Compiled variables and backpatching
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-32460@lists.php.net to get a copy of this message
OK, so its a bit of caching. So it sounds like it stores a pointer into the symbol table, so that if $a is redefined it will still be correct. What happens if the symbol table must be rehashed? Does it still work, or does it look it up again?
I think rehashing doesn't matter since hash table has pointers, not actual zvals, and so does CV - so rehashing just moved pointers around, and actual zvals still reside in the same place.
Is there a single CV for each $a in a scope, or is there one per bytecode operand? In other words, in a function which uses $a a lot, does it look it up for each bytecode which uses $a, or only once for that function?
Each name has own CV, so that every time you say $a in same op-array it would be same CV. CVs are local per op-array - $a in two different op-arrays are different CVs, and local per function run - i.e. if the same function is run twice, $a has the same CV but values in this CV would be different, so you need one lookup each run. So if the function uses $a a lot, CVs would save all lookups except the very first one in each function run. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#32460) next »