Re: Compiled variables and backpatching
| From: | Paul Biggar | Date: | Sun, 23 Sep 2007 19:28:14 +0000 |
| Subject: | Re: Compiled variables and backpatching | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32428@lists.php.net to get a copy of this message | ||
On 9/23/07, Stanislav Malyshev <stas@zend.com> wrote:
> > What is a compiled variable?
> > How does it differ from a non-compiled-variable?
>
> When engine encounters variable like $a what it usually does is it looks
> up current symbol table for an entry named 'a', and then takes zval*
> sitting there. However, since during the same scope the entry for $a
> will be the same (though not a value sitting there!), once found in can
> be stored so future calls to $a will not require looking up in the hash
> table. That's what CVs do. The reason, of course, is performance :)
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?
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?
Thanks for the quick response,
Paul
--
Paul Biggar
paul.biggar@gmail.com