php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65913 opcodes generated by dynamic inheritance not cached
Submitted: 2013-10-16 12:48 UTC Modified: 2016-11-18 21:07 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: seng dot gavin at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: seng dot gavin at gmail dot com
New email:
PHP Version: OS:

 

 [2013-10-16 12:48 UTC] seng dot gavin at gmail dot com
Description:
------------
According to Gopal in this insightful blog post 6 years ago:
http://notmysock.org/blog/php/demystifying-autofilter.html

I will borrow the terms used in the above post:
- static - opcodes have been replaced with NOOPs
- dymamic - no opcodes have been replaced

When dynamic inheritance is detected, the following should happen:
- Any cached opcodes for that file become invalid
- We will always recompile the file thereafter

The current behaviour seems to be:
- Any cached opcodes will still be valid (and used as long as on that page request, dynamic inheritance is not detected i.e. the parent class is already known by zend and thus the NOOP makes sense)
- Only if dynamic inheritance is detected, will a recompile happen.

Other than the discrepancy in behaviour between the blog and code, it seems strange that we opt to cache the static version which is not always usable and recompile the dynamic version which is always usable. Furthermore, I'm not sure why we should not cache the dynamic version and use it thereafter.

This patch changes the behaviour to:
- Static opcodes will be cached and used until dynamic inheritance is detected
- When dynamic inheritance is detected, the dynamic opcodes are cached instead
- Thereafter, every request for the file (regardless of whether we can use a static or dynamic version) will always get the cached dynamic version.


Patches

apc_cache_dynamic_inheritance (last revision 2013-10-16 12:48 UTC by seng dot gavin at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-18 21:07 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:07 UTC] kalle@php.net
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Nov 05 00:01:27 2024 UTC