Q: How to handle zend_op_array.scope and zend_op_array.prototype in opcode cache?
| From: | Eric Stenson | Date: | Tue, 24 Jun 2014 19:08:48 +0000 |
| Subject: | Q: How to handle zend_op_array.scope and zend_op_array.prototype in opcode cache? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-75063@lists.php.net to get a copy of this message | ||
PHP Internals folks--
I'm working on the opcode cache part of Wincache, and I believe that Wincache isn't
properly handling the scope and prototype fields of the zend_op_array struct when copying it into
shared memory.
I tried looking at the Zend Opcache code to figure out what The Right Way(TM) to handle these
fields, and I'm curious about how these fields are used by the Zend engine.
From what I can tell, Zend Opcache has a per-process HashTable where it keeps track of which items
is has copied into shared memory (xlat_table).
It looks like the xlat_table is cleared out before each compilation. When persisting, Zend persists
things in the following order:
1. function_table
2. class_table
3. zend_op_array (for the main zend_op_array produced by compile)
My questions:
* Is there some guarantee that the scope and prototype on the main zend_op_array exist in the
function_table and class_table for the compilation?
* Does the scope and prototype fields really matter for the main zend_op_array? Wincache has been
setting them to NULL since day 1, and everything seems to work just fine...
* The xlat_table key is a ulong. Zend Opcache uses the pointer of an object as the key. On
Windows, a ulong is 32 bits. How does this even work on an x64 Windows box?
Thx!
--E.