Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40119 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9355 invoked from network); 28 Aug 2008 14:19:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Aug 2008 14:19:09 -0000 Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 209.235.152.149 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.235.152.149 mail959c35.nsolutionszone.com Linux 2.5 (sometimes 2.4) (4) Received: from [209.235.152.149] ([209.235.152.149:57402] helo=mail959c35.nsolutionszone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/E2-28891-CD3B6B84 for ; Thu, 28 Aug 2008 10:19:08 -0400 X-POP-User: wilmascam.centurytel.net Received: from pc1 (d36-195.rt-bras.wnvl.centurytel.net [69.179.163.195]) by mail959c35.nsolutionszone.com (8.13.6.20060614/8.13.1) with SMTP id m7SEImwk027115; Thu, 28 Aug 2008 14:19:02 GMT Message-ID: <00be01c90919$0592d0f0$0201a8c0@pc1> To: , "Dmitry Stogov" References: <00ea01c8a160$2edd8160$0201a8c0@pc1> <016c01c8eccd$e28cfac0$0201a8c0@pc1> <488835D0.1040005@zend.com> <00e501c8ed77$3498cf20$0201a8c0@pc1> <48889901.8000008@zend.com> <015101c8f306$34c358f0$0201a8c0@pc1> <4891CC46.2020208@zend.com> <020e01c8f32e$a82a9fb0$0201a8c0@pc1> <4891F189.7030202@zend.com> Date: Thu, 28 Aug 2008 09:18:45 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1933 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933 Subject: Re: [PHP-DEV] [PATCH] No runtime fetching of built-in global constants From: php_lists@realplain.com ("Matt Wilmas") Hi Dmitry, Well, it's been awhile since Alpha 1 :-), so I wanted to finally resend this before Alpha 2! I agree that the additional optimization probably wouldn't happen often, as there won't be that much namespace usage right away, I assume. But I think it makes sense to handle :: prefix constants, since they're known to have global scope, and I can see the future [online] optimization tip: "When using namespaces, use :: for global constants to get compile-time substitution." ;-) The code is the same as before, just updated the patch. It doesn't really seem less clear, to me, than the current code. In zend_do_fetch_constant(), the "check_namespace" variable may be better named something like "from_namespace" according to my changes, to be more clear, but I left that out to make the patch as simple as possible. http://realplain.com/php/ct_const_fixes.diff http://realplain.com/php/ct_const_fixes_5_3.diff Thanks, Matt ----- Original Message ----- From: "Dmitry Stogov" Sent: Thursday, July 31, 2008 > Hi Matt, > > Now I know. :) > Anyway, I don't think this optimization will work often. > > Send me the patch after Alpha1 release. > > Thanks. Dmitry. > > > Matt Wilmas wrote: > > Hi Dmitry, > > > > Do you know that with your changes, no substitution will happen in a > > namespace even when using :: prefix? :-/ (That's what I would do when I > > know it's global, for optimization.) Or is that what you meant by "not so > > optimal?" > > > > > > - Matt > > > > > > ----- Original Message ----- > > From: "Dmitry Stogov" > > Sent: Thursday, July 31, 2008 > > > >> Thanks Matt. I committed near the same patch. > >> It's not so optimal, but little bit more clear. > >> > >> Thanks. Dmitry. > >> > >> Matt Wilmas wrote: > >>> Hi Dmitry, > >>> > >>> For the behavior change that I mentioned in the other thread, with this > >>> code: > >>> > >>> function foo() { > >>> static $a = -PHP_INT_MAX; > >>> } > >>> > >>> Which could work sometimes, and sometimes not (if in a namespace or > >>> ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION is set). I changed things so that > >>> there is no substitution of constants (except with CT_SUBST flag, like > >>> always) for compile time constants (ZEND_CT mode). They don't create a > >>> FETCH_CONSTANT opcode anyway. :-) > >>> > >>> Another thing I realized wasn't getting optimized (runtime constants), > > which > >>> can be, is with: > >>> > >>> namespace foo; > >>> $a = ::PHP_INT_MAX; // :: for global scope > >>> > >>> So the patch allows substitution there as well. > >>> > >>> http://realplain.com/php/ct_const_fixes.diff > >>> http://realplain.com/php/ct_const_fixes_5_3.diff > >