Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83029 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42465 invoked from network); 18 Feb 2015 07:22:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 07:22:05 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.160.173 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.160.173 mail-yk0-f173.google.com Received: from [209.85.160.173] ([209.85.160.173:60721] helo=mail-yk0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/93-18888-B9D34E45 for ; Wed, 18 Feb 2015 02:22:04 -0500 Received: by mail-yk0-f173.google.com with SMTP id 19so19158580ykq.4 for ; Tue, 17 Feb 2015 23:22:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=3JrJ+gC4yhsVqv6KiBARHddqF23ON0reFZAl7JB1lnE=; b=ei8d2ktmwilgSLxUDJvyNBxEoMiuDakl8+/Lo+7uN5orMccl/wjzlDb10ofGAx3I5q PEFobo4Gq5rVfIfygoolWJgomQCUubCNcROK8koU0UAq4OwdkKQ/i6OHdgSkxu6TLVeq QZHGFJOWqGskCYIV22riQIRvChsCcGwLEHOTivnuldT36BNygZ3RTHLJpmbILxDcsoTO hGOm8A9voqTX0Ik7foS3bhTdBVxwFCQvXZ2cCY2NhT1s8dja7VHQD8hzdMc4+VksoQ7J KwRDBUJp4Hd5vYfKzJgryLlzPbbgQwd1S3zrd+MYl36CB6WWc9/s8MffR7ra9JBnj1Ll 2UGA== X-Gm-Message-State: ALoCoQlxiKWy8Vrd54AGZgiN5FQSVT5OlkklKmHTNHvn/F44M9RP2TsOLgDmfpGVc7idpy4bm2JIyBxYtgGBTd6K26x4RbZ51NXvhB8IQ9mDZJ7AvlXyRJzv1C95mWxgqpOBQVkcp6ELkuedgtc5Ufeq06U7C2VQFg== MIME-Version: 1.0 X-Received: by 10.52.27.178 with SMTP id u18mr7788274vdg.38.1424244120529; Tue, 17 Feb 2015 23:22:00 -0800 (PST) Received: by 10.52.74.73 with HTTP; Tue, 17 Feb 2015 23:22:00 -0800 (PST) In-Reply-To: References: <54E1C24B.6010806@googlemail.com> Date: Wed, 18 Feb 2015 11:22:00 +0400 Message-ID: To: Joe Watkins Cc: Nikita Popov , Crypto Compress , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=20cf307c9d02e0faad050f57acf7 Subject: Re: [PHP-DEV] RFC: Expectations From: dmitry@zend.com (Dmitry Stogov) --20cf307c9d02e0faad050f57acf7 Content-Type: text/plain; charset=UTF-8 OK thanks. I'm switching to another task :) Thanks. Dmitry. On Wed, Feb 18, 2015 at 10:16 AM, Joe Watkins wrote: > Updated RFC as requested. > > I'm just going to wait to hear what Nikita says, especially about > optimizing away unqualified calls to assert. > I guess this could be viewed as a BC break, it seems like quite a nice > break but not sure. > > Will open voting when we hear from Nikita. > > Cheers > Joe > > On Wed, Feb 18, 2015 at 6:23 AM, Joe Watkins > wrote: > >> Will update RFC today, thanks for working on it Dmitry :) >> >> Cheers >> Joe >> >> On Tue, Feb 17, 2015 at 9:50 PM, Dmitry Stogov wrote: >> >>> Hi Joe >>> >>> The patch is ready https://github.com/php/php-src/pull/1088/files >>> >>> 1) I implemented AST pretty-printer to reconstruct the source. It may be >>> reused in Reflection and other places through >>> >>> ZEND_API zend_string *zend_ast_export(const char *prefix, zend_ast *ast, >>> const char *suffix); >>> >>> 2) zend.assertions=-1 - makes zero-cost asserts >>> >>> 3) assert() in a namespace leads to call a function defined in this >>> namespace (if it's defined), but zend.assertions is still may disable this >>> call or even prevent code generation for it. it's possible to use \assert() >>> to call the system function. >>> >>> Please, make update RFC, add notes about (2) and (3). >>> Then, it should be ready for voting. >>> >>> Nikita, please take a quick look over the patch. I hope, you don't have >>> objections. >>> >>> Thanks. Dmitry. >>> >>> >>> >>> >>> On Tue, Feb 17, 2015 at 6:51 PM, Dmitry Stogov wrote: >>> >>>> >>>> >>>> On Tue, Feb 17, 2015 at 5:11 PM, Nikita Popov >>>> wrote: >>>> >>>>> On Mon, Feb 16, 2015 at 4:47 PM, Dmitry Stogov >>>>> wrote: >>>>> >>>>>> Hi Nikita, >>>>>> >>>>>> it looks like a part of old implementation is not trivial with new >>>>>> AST compiler. >>>>>> >>>>>> previously we translated assert(condition) into assert(condition, >>>>>> "assert(condition)"). >>>>>> actually we just captured a part of input buffer and added missing >>>>>> string argument. >>>>>> >>>>>> Is there a simple way to do the same now? >>>>>> >>>>> >>>>> Not very simple, but we could store pointers/offsets to the start and >>>>> end of the fcall in the ast node, similar to what is done with lex_pos for >>>>> declarations: http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_ast.h#177 >>>>> >>>>> It would be nice if we could have precise offset information for all >>>>> nodes (this is particularly valuable if the ast is exposed to userland), >>>>> but that would increase memory usage during compilation, not sure if it's >>>>> worthwhile. >>>>> >>>>> >>>>>> It's possible to convert AST into string using recursive >>>>>> pretty-printer. >>>>>> It's not a simple task itself, but it may be reused for other things. >>>>>> >>>>> >>>> I went by this way... :) >>>> It must be ready soo. >>>> >>>> >>>>> >>>>>> Joe, the rest (including zero-cost assert) is implemented at >>>>>> https://github.com/php/php-src/pull/1088/files >>>>>> 9 related tests are failed for now. >>>>>> >>>>> >>>>> As this is implemented right now, it would require writing \assert() >>>>> in order to be zero-cost. Maybe we should disallow redefinition of assert >>>>> as a namespaced function, so we can always optimize this? >>>>> >>>> >>>> good catch. >>>> >>>> Thanks. >>>> >>>> >>>>> >>>>> Nikita >>>>> >>>> >>>> >>> >> > --20cf307c9d02e0faad050f57acf7--