-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Add function exposing HAVE_GCC_GLOBAL_REGS #8359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Is this PR waiting for something, or can it be merged? |
Can you please export that as part of zend_execute.c instead of the VM? We try to leave everything out of the VM which doesn't strictly need to be there. |
Is there a reason this targets the PHP-8.0 branch? |
Only because I read this:
And since my primary use case is for JIT code I figured I'd put it against the first version that had a JIT (e.g PHP8). |
If this isn't fixing a bug in PHP-8.0, please change the base to master. Thanks! |
Is there something I need to do for this? I.e is there part of the PR process for this feature that I've missed? I had assumed I didn't need to do an RFC for it. |
What's the problem?
Understanding what's happening during the PHP JIT compilation process is a bit tricky. Some of this complexity is inherent, but the Zend Engine (at present) doesn't make it that easy to gauge what's going on via a debugger like GDB.
For example, consider the following snippet from the JIT compiler:
php-src/ext/opcache/jit/zend_jit_x86.dasc
Lines 1742 to 1766 in c345b6e
To understand how this impacts the generated code you need to know at minimum:
You can deduce the first of these at runtime using
zend_vm_kind
:php-src/Zend/zend_vm.h
Line 31 in 5b01c48
But there's no way to know the second of these programatically at present. You can deduce this by looking at the object code in GDB, but that's tedious and not suited to any sort of automated checking.
This PR
This PR just adds a public function called
zend_gcc_global_regs
that returns 1 if HAVE_GCC_GLOBAL_REGS is set and 0 otherwise. This makes it far simpler to detect what calling convention to expect.