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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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)

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 Apr 19 22:01:28 2024 UTC