Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40133 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12616 invoked from network); 29 Aug 2008 13:37:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2008 13:37:31 -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.148 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.235.152.148 mail958c35.nsolutionszone.com Linux 2.5 (sometimes 2.4) (4) Received: from [209.235.152.148] ([209.235.152.148:49329] helo=mail958c35.nsolutionszone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/2F-44384-A9BF7B84 for ; Fri, 29 Aug 2008 09:37:31 -0400 X-POP-User: wilmascam.centurytel.net Received: from pc1 (72-161-146-209.dyn.centurytel.net [72.161.146.209] (may be forged)) by mail958c35.nsolutionszone.com (8.13.6.20060614/8.13.1) with SMTP id m7TDaLDb030768; Fri, 29 Aug 2008 13:36:31 GMT Message-ID: <026201c909dc$46875860$0201a8c0@pc1> To: , "Dmitry Stogov" References: <013e01c8f257$1e1bbcf0$0201a8c0@pc1> <4890B18E.7000500@zend.com> <00e001c8f302$e8100fb0$0201a8c0@pc1> <4891A769.6090306@zend.com> Date: Fri, 29 Aug 2008 08:35:49 -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] Re: [PATCH] Constant expr folding (again), and other things From: php_lists@realplain.com ("Matt Wilmas") Hi again Dmitry, ----- Original Message ----- From: "Dmitry Stogov" Sent: Thursday, July 31, 2008 > Hi Matt, > > For now I would like to disable "-CONST" constant expression which > started to work after your patch. > > Later we are able to implement the complete constant expressions support. One more updated thing to ask about. :-) From the last reply, I wasn't sure if constant folding in zend_do_[binary|unary]_op() could be added (for negative numbers, ORing function flags that were substituted, ~0, 1024 * 1024, etc.) or it was desired to wait for "complete constant expressions support" (in static_scalar context), though I don't see any relation between that, which is an actual language change, and this easy optimization that's only internal (and more useful now with constant substitution). So I updated the patch, which is the same code as before, but without trying to add partial expression support to static_scalar. Seems pretty simple/safe, with basically just the if () { } block added in zend_do_[binary|unary]_op(). :-) The rest updates the unary_op_type typedef (was missing TSRMLS_DC), adds binary_op_type, and updates get_binary_op (half the patch!). The couple changes in the parser, which CAN be ignored if desired, are mostly a cleanup, but '+' static_scalar now actually "does something" like the unary + operator in regular contexts. As I showed before, it makes the following consistent: function foo() { static $a = -'abc'; // 0 static $b = +'abc'; // abc $c = +'abc'; // 0 } http://realplain.com/php/const_folding.diff http://realplain.com/php/const_folding_5_3.diff Well, I don't know if it can be tossed in quickly at this time, but there ya go since I think it's pretty basic! ;^) > Thanks. Dmitry. Thanks, Matt