[php-src] PR #18392: JIT: Don't reuse IP register for EX(call)
| From: | arnaud-lb | Date: | Tue, 22 Apr 2025 11:43:08 +0000 |
| Subject: | [php-src] PR #18392: JIT: Don't reuse IP register for EX(call) | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-31489@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18392
Author: arnaud-lb
JIT reuses the IP (opline) fixed register to store an
EX(call) cache during function
calls. I presume it was convenient to reuse this register in the old JIT, as registers were assigned
manually. However, the technique has a few drawbacks:
* It may be confusing. For example, zend_jit_trace_exit_stub saves IP to
EX(opline), when it may be being reused for EX(call) (e.g.
[here](https://github.com/php/php-src/blob/f396db94602e452b4cd1794dc933f2de79033290/ext/opcache/jit/zend_jit_trace.c#L8662-L8665))
* This would be a blocker if we hypothetically wanted to stop using a fixed register for IP
* The EX(call) cache is lost every time we need to save IP
Here I use a normal IR ref to store EX(call), instead of storing it in the IP register.
bench.php shows no regression in executed instructions under valgrind, and a 1%
improvement in wall time.