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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
14 - 13 = ?
Subscribe to this entry?

 
 [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)

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Mar 29 10:01:28 2024 UTC