Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83023 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30729 invoked from network); 18 Feb 2015 06:23:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 06:23:49 -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.175 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.192.175 mail-pd0-f175.google.com Received: from [209.85.192.175] ([209.85.192.175:33226] helo=mail-pd0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1F/51-18888-4FF24E45 for ; Wed, 18 Feb 2015 01:23:49 -0500 Received: by pdjz10 with SMTP id z10so49340246pdj.0 for ; Tue, 17 Feb 2015 22:23:45 -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=oWYvCt8d5gtmc8yYXMOYynen/UVxPFokfSLgNnYVluM=; b=HLT+VM0WG+sb79aIEbd/1wWG9HjLEqg6wSHUqdqOgLahRmyiBuB89kr1W9MxtKdr+7 DMyWbHkgq91P5tuuOguqvqZ598t4lStpLutL5oyV3YB+7Mt6AAEEtVq+CzuU7i1AE7fj B/C+c2ILftT7vbC5TnbqrLpptLqCzuCedS+/Dwzz5amFyqYGJCqDYsVJpAT0MWLcq50Y BfUTe+5p1DNqKi8/qujcxTjppiL9ySU4zZRwL6t62o6cxOiJTzKG88bIUJhigKHNukVf bv46R1NMMo/nogW0ajNJzZws586jfPaYkittwGvDLO5AMIT9+yNI3gS310zQ1AsHGofr JnEQ== X-Gm-Message-State: ALoCoQkqQMCvb336xJszFCVMJnIPt/OebTG9+4aE4IfPmI1VUoue81fm0k3d1OZo5aouo5N2X5EC MIME-Version: 1.0 X-Received: by 10.66.66.133 with SMTP id f5mr35592502pat.20.1424240625318; Tue, 17 Feb 2015 22:23:45 -0800 (PST) Received: by 10.70.49.100 with HTTP; Tue, 17 Feb 2015 22:23:45 -0800 (PST) X-Originating-IP: [86.190.233.59] In-Reply-To: References: <54E1C24B.6010806@googlemail.com> Date: Wed, 18 Feb 2015 06:23:45 +0000 Message-ID: To: Dmitry Stogov Cc: Nikita Popov , Crypto Compress , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=001a1134b5168c1547050f56dc7a Subject: Re: [PHP-DEV] RFC: Expectations From: pthreads@pthreads.org (Joe Watkins) --001a1134b5168c1547050f56dc7a Content-Type: text/plain; charset=UTF-8 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 >>> >> >> > --001a1134b5168c1547050f56dc7a--