Add function exposing HAVE_GCC_GLOBAL_REGS #8359
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.