Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83009 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67151 invoked from network); 17 Feb 2015 21:50:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 21:50:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.179 mail-vc0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:44226] helo=mail-vc0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/B3-34644-397B3E45 for ; Tue, 17 Feb 2015 16:50:12 -0500 Received: by mail-vc0-f179.google.com with SMTP id hy4so13576541vcb.10 for ; Tue, 17 Feb 2015 13:50:09 -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=XlpNc3pLEdOUF2k8VAGrhwKCmYJJHMn+Mzlfu/PmZg8=; b=HhgvXMUrPXNzvqzPUqXfDq7wRx2WXXPZQXcJhgBADQ2MgLWAKLtWU3/Z/nj501lZ42 kc2R+1hlcMQ79fmFYCH+dDZ/mdUVMi8EZmpftqodEeFHflknwox97xm7cSTOJzlmNSR+ gc2YbSAXAw6ZKldMAQchaRgf1MuRycQrlkPB2c/b5IJA0HHM5nkTUjLlfrLfVrojG8St ThVboR9VY1UwwLe4Yvz/ZobqnMsAuoOmtNDmw9+uv+uQctQGIAr3g1G5n29SHD2kkk+P u2X//EJqStMJrdPIMgSWlaEi2W4j80+3TxGhTQmr3lnZFQqv87Gs8v9++YMwDBUjLjvi wR7Q== X-Gm-Message-State: ALoCoQl9EjelGbPdfQJTP2LUdKydwWVKd9gIRVNbNaAjeMYzERfaEUKdbF0NV/6OuyFIEb3spoXrHf+Cx6pjeEA7SxRhPJmYrAS1NaEOYANmhV/RyfuNuDzEnmoupu/TccsGLwXM9jbFipbsSQbRSfVSh1MJzMiZng== MIME-Version: 1.0 X-Received: by 10.52.52.136 with SMTP id t8mr17093007vdo.49.1424209809266; Tue, 17 Feb 2015 13:50:09 -0800 (PST) Received: by 10.52.74.73 with HTTP; Tue, 17 Feb 2015 13:50:09 -0800 (PST) In-Reply-To: References: <54E1C24B.6010806@googlemail.com> Date: Wed, 18 Feb 2015 01:50:09 +0400 Message-ID: To: Joe Watkins , Nikita Popov Cc: Crypto Compress , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=089e0115f048c471dd050f4fafed Subject: Re: [PHP-DEV] RFC: Expectations From: dmitry@zend.com (Dmitry Stogov) --089e0115f048c471dd050f4fafed Content-Type: text/plain; charset=UTF-8 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 >> > > --089e0115f048c471dd050f4fafed--