forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
hacks #27
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
Closed
hacks #27
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6817df8
hax
ndossche d3dcdd5
Fix mistake
ndossche 14eefe0
undo oopsie
ndossche 69cd3b9
more fixing
ndossche 0c675bf
fix
ndossche ade9b5c
Start trying to move everything to a _twice variant instead of _ex
ndossche a00f5ae
Move more to _twice, maybe a bit extreme but let's see what the perfo…
ndossche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,6 +124,7 @@ ZEND_API void ZEND_FASTCALL zend_ref_del_type_source(zend_property_info_source_l | |
|
|
||
| ZEND_API zval* zend_assign_to_typed_ref(zval *variable_ptr, zval *value, uint8_t value_type, bool strict); | ||
| ZEND_API zval* zend_assign_to_typed_ref_ex(zval *variable_ptr, zval *value, uint8_t value_type, bool strict, zend_refcounted **garbage_ptr); | ||
| ZEND_API zval* zend_assign_to_typed_ref_twice(zval *variable_ptr, zval *value, uint8_t value_type, bool strict, zval *extra_copy); | ||
|
|
||
| static zend_always_inline void zend_copy_to_variable(zval *variable_ptr, zval *value, uint8_t value_type) | ||
| { | ||
|
|
@@ -179,6 +180,33 @@ static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval | |
| return variable_ptr; | ||
| } | ||
|
|
||
| static zend_always_inline zval* zend_assign_to_variable_twice(zval *variable_ptr, zval *second_variable_ptr, zval *value, uint8_t value_type, bool strict) | ||
| { | ||
| do { | ||
| if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) { | ||
| if (Z_ISREF_P(variable_ptr)) { | ||
| if (UNEXPECTED(ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(variable_ptr)))) { | ||
| return zend_assign_to_typed_ref_twice(variable_ptr, value, value_type, strict, second_variable_ptr); | ||
| } | ||
|
|
||
| variable_ptr = Z_REFVAL_P(variable_ptr); | ||
| if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) { | ||
| break; | ||
| } | ||
| } | ||
| zend_refcounted *garbage = Z_COUNTED_P(variable_ptr); | ||
| zend_copy_to_variable(variable_ptr, value, value_type); | ||
| ZVAL_COPY(second_variable_ptr, variable_ptr); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, now I'm wondering. Could we have just used |
||
| GC_DTOR_NO_REF(garbage); | ||
| return variable_ptr; | ||
| } | ||
| } while (0); | ||
|
|
||
| zend_copy_to_variable(variable_ptr, value, value_type); | ||
| ZVAL_COPY(second_variable_ptr, variable_ptr); | ||
| return variable_ptr; | ||
| } | ||
|
|
||
| static zend_always_inline zval* zend_assign_to_variable_ex(zval *variable_ptr, zval *value, zend_uchar value_type, bool strict, zend_refcounted **garbage_ptr) | ||
| { | ||
| do { | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the whole point of this to assign to
second_variable_ptrbefore callingGC_DTOR_NO_REF(garbage), as that may reassign the variable, freeingvariable_ptrbefore being assigned again? I think that's the difference in the tests you're seeing, this should assignvaluedirectly, preferably, and beforeGC_DTOR_NO_REF(variable_ptrandvalueshould be the same at that point).