VM kinds

php.internals

Tim Starling

4 years ago
What are VM kinds for? Are they just a prototyping tool to allow different implementation strategies to be benchmarked? Or are they permanent? Does anyone use them? I ask because I'm working on a VM bug, and non-default VM kinds make already complex code even more complex and harder to edit. -- Tim Starling

Nikita Popov

4 years ago
On Wed, Nov 10, 2021 at 8:13 AM Tim Starling <tstarling@wikimedia.org> wrote:
> What are VM kinds for? Are they just a prototyping tool to allow > different implementation strategies to be benchmarked? Or are they > permanent? Does anyone use them? > > I ask because I'm working on a VM bug, and non-default VM kinds make > already complex code even more complex and harder to edit. > > -- Tim Starling >
I don't think anyone uses them, and the GOTO/SWITCH VMs receive little testing in practice (we don't use them in CI), and I believe they're not supported by the JIT either. Personally, I would be fine with simply dropping them, as they do add additional maintenance burden without any apparent benefit. Maybe Dmitry has some thoughts on this. Regards, Nikita

Dmitry Stogov

4 years ago
I prefer to keep GOTO and SWITCH VMs. It's easy to drop something, but it's going to be much more complex to reimplement it again. Note that HYBRID VM (based on CALL and GOTO VMs) was introduced only in PHP-7.2, because GOTO was already implemented a long time ago. In the future, it's possible to extend HYBRID VM, to make it work with GCC-incompatible compilers through SWITCH. We might also like to move from direct-threaded to indirect-threaded dispatch. Thanks. Dmitry. On Wed, Nov 10, 2021 at 11:35 AM Nikita Popov <nikita.ppv@gmail.com> wrote:

Tim Starling

4 years ago
OK, thanks for the answer. My PR is up now, with a fixme comment for the GOTO and SWITCH VMs. I'm still not sure how to make them work. https://github.com/php/php-src/pull/7642 -- Tim Starling On 10/11/21 8:10 pm, Dmitry Stogov wrote: