Re: Giving Globals the CV treatment [WAS: Runtime JIT Proposals]
| From: | Sara Golemon | Date: | Tue, 23 Jan 2007 09:33:31 +0000 |
| Subject: | Re: Giving Globals the CV treatment [WAS: Runtime JIT Proposals] | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-27597@lists.php.net to get a copy of this message | ||
> At first I don't understand why you are trying to deallocate variable.
>
> + if (CG(active_op_array)->T == (parent->u.var - 1)) {
> + CG(active_op_array)->T--;
> + }
>
> Isn't the same variable reused as result of ZEND_FETCH_DIM?
>
Yeah, I hastily recanted that about three minutes after my post... It
was accidentally left in from a prior attempt. You're absolutely right
that it doesn't belong there. Just my sloppiness in preparing the patch
for posting.
> The rest of patch seems proper, but I am not sure about place.
> Why we optimize @$a['b'] but not @$a->b and @$a->b()?
>
> I would prefer to find more general solution.
>
Well, we could do it in the end_variable_parse, but at that point we
actually *do* have to erase an op and a temp var. Doing it at this
stage prevents the extra op/tempvar from being allocated at all.
Looking at do_fetch_property, I notice that we're already doing this
(after a fashion) for turning $this->prop into an immediate FETCH_OBJ
(setting op1 to UNUSED to indicate $this). This approach really just
builds on that existing solution.
I've updated the patch (adding FETCH_OBJ support and applying some
concepts from do_fetch_property's implementation for $this optimization
to the FETCH_DIM/OBJ CV implementations).
I suppose the one alternate approach we could take would be to make a
macro/inline func out of this rewriting step so that the DIM/OBJ parsers
can use the same code-base. I might even suggest we look at supporting
op1->IS_UNUSED for $this when used with array access on objects (but
that would require an update so that the opcode handler supports it as
well).
-Sara