Extend map_ptr before copying class table#9188
Merged
arnaud-lb merged 1 commit intophp:masterfrom Aug 1, 2022
Merged
Conversation
arnaud-lb
commented
Jul 28, 2022
Comment on lines
350
to
+353
| if (EXPECTED(from_shared_memory)) { | ||
| if (ZCSG(map_ptr_last) > CG(map_ptr_last)) { | ||
| zend_map_ptr_extend(ZCSG(map_ptr_last)); | ||
| } |
Member
Author
There was a problem hiding this comment.
This is just moving the if (EXPECTED(from_shared_memory)) { block to the beginning of the function, and the if (ZCSG(map_ptr_last) > CG(map_ptr_last)) { block at the beginning of the block.
dstogov
reviewed
Aug 1, 2022
|
|
||
| #define ZSTR_SET_CE_CACHE_EX(s, ce, validate) do { \ | ||
| if (!(validate) || ZSTR_VALID_CE_CACHE(s)) { \ | ||
| ZEND_ASSERT((validate) || ZSTR_VALID_CE_CACHE(s)); \ |
Member
There was a problem hiding this comment.
I didn't understand what do you do with this assertion
Member
There was a problem hiding this comment.
It's asserting that the ce cache is valid, even if validation is skipped.
arnaud-lb
added a commit
that referenced
this pull request
Aug 1, 2022
arnaud-lb
added a commit
that referenced
this pull request
Aug 1, 2022
* PHP-8.1: [ci skip] NEWS Extended map_ptr before copying class table (#9188)
HypeMC
added a commit
to HypeMC/php-src
that referenced
this pull request
Dec 8, 2022
This reverts commit a697083.
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.
A script loaded from shared memory may reference
map_ptrentries higher thanCG(map_ptr_last), so we may need to extend themap_ptrbefore loading the script.zend_accel_load_script()does azend_map_ptr_extend(ZCSG(map_ptr_last)), but I believe that it does it too late. In this change I move thezend_map_ptr_extend(ZCSG(map_ptr_last))before anything else inzend_accel_load_script(). I moved the wholeif (EXPECTED(from_shared_memory)) {block up to avoid duplicating the condition.Fixes #9164
I understand that
map_ptris what allows opcache structures to be immutable, and to be used directly from SHM without copy. Each php process has a local mutablemap_ptrvector, in which opcache structures can reference elements by index. The opcache can allocate newmap_ptrindices in one process, but other processes need to extend the vector themselves.