Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83028 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40770 invoked from network); 18 Feb 2015 07:16:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 07:16:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.192.180 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.192.180 mail-pd0-f180.google.com Received: from [209.85.192.180] ([209.85.192.180:34359] helo=mail-pd0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/43-18888-A5C34E45 for ; Wed, 18 Feb 2015 02:16:43 -0500 Received: by pdjg10 with SMTP id g10so49734773pdj.1 for ; Tue, 17 Feb 2015 23:16:40 -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=afxZ7OfZTOeCnqz7J3MVIjtPgl85M0GA8yybXwJvDw0=; b=F9/6Mj72WUEwp0cMR7i9V2KgqSsnBy0hDtS8sWe870wz2VMcefkJ6TfjWNusMDaNLs oFwPNoLUNkJ9BFBh6ZBtdtq4B0+Vl1jccHscv8gtoi4ry7muDu6P9ZNfdXzWsAcVmr0a a4xAXjsmKOxVUfiWHetpln/BalpP4TwebWgUQZBXKIZRewWisv/3NGgi56rwxhQ+OOVL PJXQPHoPYQ4DkFCTW+FLxxTUvyJgZ3T78AqttYEKit+cmbfZv6dp/8ogvHCwOoHtUvUf raPYegL1CKj6/JHSfGUnV86ZHaVBe0acob1fo2YUv+o2KXF69jJj2ZvmRKoAETahcAUD EsRQ== X-Gm-Message-State: ALoCoQnd/2oYhljy2TAVbqgkKGuiqzGD7uLXue0BooKFeRHnUi0lq1smqiE6oq9LaHBIMlM5u2GB MIME-Version: 1.0 X-Received: by 10.70.0.176 with SMTP id 16mr12106453pdf.78.1424243800219; Tue, 17 Feb 2015 23:16:40 -0800 (PST) Received: by 10.70.49.100 with HTTP; Tue, 17 Feb 2015 23:16:40 -0800 (PST) X-Originating-IP: [86.190.233.59] In-Reply-To: References: <54E1C24B.6010806@googlemail.com> Date: Wed, 18 Feb 2015 07:16:40 +0000 Message-ID: To: Dmitry Stogov Cc: Nikita Popov , Crypto Compress , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=047d7b678710c93a8f050f5799c0 Subject: Re: [PHP-DEV] RFC: Expectations From: pthreads@pthreads.org (Joe Watkins) --047d7b678710c93a8f050f5799c0 Content-Type: text/plain; charset=UTF-8 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 >>>> >>> >>> >> > --047d7b678710c93a8f050f5799c0--