Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32398 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64119 invoked by uid 1010); 20 Sep 2007 12:07:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 64086 invoked from network); 20 Sep 2007 12:07:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2007 12:07:40 -0000 Authentication-Results: pb1.pair.com header.from=sesser@hardened-php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sesser@hardened-php.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hardened-php.net from 81.169.159.221 cause and error) X-PHP-List-Original-Sender: sesser@hardened-php.net X-Host-Fingerprint: 81.169.159.221 hardened-php.net Linux 2.4/2.6 Received: from [81.169.159.221] ([81.169.159.221:44185] helo=mail.hardened-php.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/05-35158-78262F64 for ; Thu, 20 Sep 2007 08:07:37 -0400 Received: from [127.0.0.1] (p50876F0C.dip.t-dialin.net [80.135.111.12]) by mail.hardened-php.net (Postfix) with ESMTP id 6D0291200B1; Thu, 20 Sep 2007 12:28:48 +0200 (CEST) Message-ID: <46F2627F.6060807@hardened-php.net> Date: Thu, 20 Sep 2007 14:07:27 +0200 User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Derick Rethans Cc: Stefan Esser , PHP internals References: <46F24A61.8050509@sektioneins.de> In-Reply-To: X-Enigmail-Version: 0.95.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: Storing additional information for op_arrays From: sesser@hardened-php.net (Stefan Esser) Derick Rethans schrieb: > On Thu, 20 Sep 2007, Stefan Esser wrote: > > >> 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. >> > > Have a pointer on how this is done? I sortof need/want to do this in > Xdebug as well, however I don't want opcode caches to remember this > value. > Well the "official" way to use the reserved area of an opcode array is to get an handle from the zend engine for reserved space. This is done by ZEND_API int zend_get_resource_handle(zend_extension *extension) it returns an index you can simply use. (I think meanwhile APC will honor this and will not overwrite the first bytes). > Sounds like a good idea to me - but the op code caches do need to some > special trickery for this I guess. However, in my case I do *not* want > an opcode cache to remember the stored data, so that perhaps needs to be > taken into account as well The basic idea would be to add API functions like zend_op_array_add_data(key, data, size, flags) zend_op_array_remove_data()... zend_op_array_get_data, zend_op_array_get_all_data In the flags one could choose: Needs to be cached etc... Well and this will be stored in a datastructure that will just be pointed at by the op_array struct. So op_arrays will not really grow (just a single pointer added) and the whole overhead is only in the extensions that actually require such extra data and in the opcode caches that need to cache this. And I think the opcode cachers would just need to traverse the list of all data and store it with the op_array. I doubt that would take much changed in the cacher software. And well if the cache authors speak up, PHP can pretty much implement all the API functions required for such a step... Stefan Esser