Re: Mind if I hook the compiler?
| From: | Nikita Popov | Date: | Sun, 18 Jan 2015 16:50:33 +0000 |
| Subject: | Re: Mind if I hook the compiler? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80747@lists.php.net to get a copy of this message | ||
On Sun, Jan 18, 2015 at 3:58 AM, Sara Golemon <pollita@php.net> wrote:
> https://github.com/php/php-src/pull/1004
>
> Wondering if anyone has an objection to me merging this. It just
> offers extensions a chance to alter the AST prior to bytecode
> emission. Mostly for evil things, but potentially for 3rd-party
> optimizers or whatevs. Does it need an RFC? The very minor
> indirection cost hides itself behind OpCache, so it should harm
> anything...
>
Totally okay with making that hookable, but not sure if compile_top_stmt is
the best place to do that, at least in the form implemented in the PR.
Assuming that you want to implement a preprocessing pass on the AST the
fast that zend_compile_top_stmt is called recursively might be somewhat
inconvenient. Maybe compile_top_stmt should at least also call
compile_top_stmt instead of zend_compile_top_stmt?
Nikita