Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ZEND_BW_NOTis currently the only bitwise opcode without a JIT handler:BW_OR,BW_AND,BW_XOR,SLandSRare all compiled. As a result, an expression such as~$a & $bbreaks the compiled code with a call into the VM handler, and values kept in registers have to be spilled around it. This and-not combination shows up in bit-manipulation code such as hash functions, checksums and other algorithms.This PR adds a handler for the case where the operand is known to be
int. Any other operand type (string, float, bool, null, array, object, undefined, constant) is not handled and keeps going through the VM handler, so behaviour,warnings and
TypeErrormessages are unchanged.Release build (
-O2), x86-64, best of several runs, 20M iterations of$s ^= (~$a & $b) ^ ($i << 3):This is a micro-benchmark that isolates the affected pattern.