One problem I and others have run into is that from time to time we need
to store extra information for specific opcode arrays. For simple values
it is possible to use one of the reserved slots in the op_array
structure, but in the past that has been unrelieable because APC for
example simply overwrote the first slots without asking the Zend Engine
to reserve some space.

I think it's a bug in APC. Each extension has its own slot, by allocated slot number, and should never touch other slots (unless it has some protocol to talk to the extension which owns other slot). So touching slot that is not owned by the code is a bug like touching unallocated memory.

The next problem is that the amount of data you can store is not that big.
Leaving a pointer in the reserved field is also not a good idea, because
this will break as soon the opcode array is shared among processes or
was stored on the disk.

Well, we can't have pointers to disk in memory :), so disk is another problem. As for shared memory, I don't see how one can support arbitrary length and structure data without using pointers in one way or another, so once you share that you'd have to use shared memory pointers anyway. Maybe I misunderstand something in what do you mean - could you tell some more on what would be the improvement you are thinking of?

Therefore it would be great if we can come up with a modification of the
op_array structure that allows extensions to append arbitrary sized data
to an op_array, that gets also cached by all the opcode cachers...

Note that reserved space in op_array is meant for general extension usage, not just for bytecode caches. So at least some of that data doesn't have to be cached. Now, we could add some other data that would be cached, but here we need to understand how we can do arbitrary length and arbitrary structure data that can be stored in shared memory and concurrently used. It looks to me rather complex task, not sure it belongs to the engine even - unless I'm missing some obvious easy solution.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to