Earlier quoted context omitted.
Not sure if this qualifies as intermediate representation in the LLVM sense, but PHP has opcodes already, it is not fully interpreted anymore (like it was in PHP 3). These opcodes are used for optimizations and cached for the lifetime of the PHP process (across multiple requests).
That's probably too low-level. Usually an AST is needed that is void of all syntactic sugar, yet can express the required data flows and dependencies so the trivial substitutions/replacements/caching and refactorings can be done at this level. Lower level bytecode lacks these higher level references (it usually has a lot of indices that index into raw lookup tables, but no real symbols that refer to results of comput…
PHP 8 to Add a JIT
51–60 of 190 posts
Re: PHP 8 to Add a JIT
#52Re: PHP 8 to Add a JIT
#53There is something to be said about PHP's staying power. The early versions of the language weren't considered "right". Except maybe they were right for the problem at hand. The way I see it was PHP captured the vector of change , and left ample room for future developments. Both internal changes (hello, bytecode; hello, JIT), language level features (hi there, namespaces), and runtime level features (oh hai, countle…
PHP also didn't make the mistake Perl did. A shame because Perl tried very hard to make the right thing easy with security.
When PHP gained full OOP support with PHP5 the Perl community was still tearing itself apart over introducing a MOP and which of the dozen Moose clones should reign supreme. That was the final nail in Perl's coffin, at least in it's bid to compete with PHP.
Re: PHP 8 to Add a JIT
#54Earlier quoted context omitted.
> making a dynamic language perform well Perhaps the advantage here is that PHP really all that dynamic. PHP is much closer in design to taking Java and compiling it on every request than it is like Python or Ruby.
Well, you can do $moo = "hello"; $zork = "moo"; echo $$zork; // hello It doesn't get much more dynamic than that.
Re: PHP 8 to Add a JIT
#55There is something to be said about PHP's staying power. The early versions of the language weren't considered "right". Except maybe they were right for the problem at hand. The way I see it was PHP captured the vector of change , and left ample room for future developments. Both internal changes (hello, bytecode; hello, JIT), language level features (hi there, namespaces), and runtime level features (oh hai, countle…
I think PHP had a couple of obvious advantages - it almost had a "first mover" advantage in that it happened to be installed alongside CGI-BIN on shared webhosts way back in the way - plus Drupal and WordPress being PHP projects. But to me, one of the most significant advantages PHP has is that its documentation is terrific . PHP.net is simple, clear about parameters and return values (as clear as PHP lets it be anyw…
I was talking to some kid who wanted to be a developer, and I echoed this sentiment. A complex tool with good documentation is easier to use than a simple tool with bad documentation.
Re: PHP 8 to Add a JIT
#56Re: PHP 8 to Add a JIT
#57There is something to be said about PHP's staying power. The early versions of the language weren't considered "right". Except maybe they were right for the problem at hand. The way I see it was PHP captured the vector of change , and left ample room for future developments. Both internal changes (hello, bytecode; hello, JIT), language level features (hi there, namespaces), and runtime level features (oh hai, countle…
The only reason I use php for my own sites is because I don't want to administer any server and I don't want to be tied to a provider.
PHP is a good fit for this, because it's available at practically all cheap hosting providers (I don't need to administer the server with shared hosting) and I'm not tied to a single provider, because I can switch to an other hosting provider without too much effort.
With other langauges I either have to manage my own VPS (I don't want to pay for managed VPS), or I'm tied to a provider (Appengine, etc.).
Re: PHP 8 to Add a JIT
#58This is the RFC with more technical details https://wiki.php.net/rfc/jit . I believe their plan is to emit low-level code directly via DynAsm, without their own intermediate representation. This kind of approach has been tried again and again and again and every project doing this either not got the results they wanted and given up or has had to go back and add a proper intermediate representation. Examples include R…
> making a dynamic language perform well Perhaps the advantage here is that PHP really all that dynamic. PHP is much closer in design to taking Java and compiling it on every request than it is like Python or Ruby.
The _get and _set magic methods (called when getting/setting missing properties) are quite common especially for frameworks.
Re: PHP 8 to Add a JIT
#59Earlier quoted context omitted.
Well, you can do $moo = "hello"; $zork = "moo"; echo $$zork; // hello It doesn't get much more dynamic than that.
That looks it merely needs some reflection support (variable name lookup).
With a proper intermediate representation you'd connect that $$ variable lookup directly to the original variable's edge.