Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32399 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11115 invoked by uid 1010); 20 Sep 2007 13:30:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11100 invoked from network); 20 Sep 2007 13:30:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Sep 2007 13:30:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.94.239.5 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.6 Received: from [82.94.239.5] ([82.94.239.5:35613] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/C5-09216-1E572F64 for ; Thu, 20 Sep 2007 09:30:10 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.13.7/8.12.11) with ESMTP id l8KDU55p030211; Thu, 20 Sep 2007 15:30:06 +0200 Date: Thu, 20 Sep 2007 15:30:07 +0200 (CEST) X-X-Sender: derick@kossu.ez.no To: Stefan Esser cc: Stefan Esser , PHP internals In-Reply-To: <46F2627F.6060807@hardened-php.net> Message-ID: References: <46F24A61.8050509@sektioneins.de> <46F2627F.6060807@hardened-php.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Subject: Re: [PHP-DEV] RFC: Storing additional information for op_arrays From: derick@php.net (Derick Rethans) On Thu, 20 Sep 2007, Stefan Esser wrote: > 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). Yes, it does: void apc_zend_init(TSRMLS_D) { zend_extension dummy_ext; #ifdef ZEND_ENGINE_2 APCG(reserved_offset) = zend_get_resource_handle(&dummy_ext); assert(APCG(reserved_offset) == dummy_ext.resource_number); assert(APCG(reserved_offset) != -1); assert(sizeof(apc_opflags_t) <= sizeof(void*)); #endif For Xdebug I don't need to use the dummy ext though as it's a real zend extension. regards, Derick -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org