Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82961 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16982 invoked from network); 17 Feb 2015 14:11:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 14:11:19 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wg0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:54159] helo=mail-wg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/A5-19463-60C43E45 for ; Tue, 17 Feb 2015 09:11:19 -0500 Received: by mail-wg0-f41.google.com with SMTP id b13so35871483wgh.0 for ; Tue, 17 Feb 2015 06:11:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fc+b+l+heaHRgpfO6uinduam/+buV3fxR4TyyLpZQAc=; b=ye7x698Swux4EH0QW49KoT72pyqlAYDrWA08bSh7GZoOpsa2Rjs/YvtMJWD40XrTk0 HrbZGyOWSAAPY/wQTkJ6ycB09pxfPa2xxgMuBZ9WjwDYh+qMROfAfyrPlJWsiJOWjMWK WPoIfY6N11lUclOPBDBQ/o2w8VhQxV6ImGW99wgTLaz2fo6blqRYEdiynLh3F+5K28R1 G/xZMKgYCELnActghrr5HwaUMK6OLBr1kDlN6V9rTTJ72cKN9wQCj6bIqmnbMY6cOl/Z /f7CZht3G7WE8Keg6v8BvFjLfa3KzkerP3/pxqhuM6rVB5OgcC9PPxrK96B0Cq6HYtbk HBtQ== MIME-Version: 1.0 X-Received: by 10.180.74.206 with SMTP id w14mr48404810wiv.71.1424182274508; Tue, 17 Feb 2015 06:11:14 -0800 (PST) Received: by 10.27.10.168 with HTTP; Tue, 17 Feb 2015 06:11:14 -0800 (PST) In-Reply-To: References: <54E1C24B.6010806@googlemail.com> Date: Tue, 17 Feb 2015 15:11:14 +0100 Message-ID: To: Dmitry Stogov Cc: Joe Watkins , Crypto Compress , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=f46d041824dc915018050f494667 Subject: Re: [PHP-DEV] RFC: Expectations From: nikita.ppv@gmail.com (Nikita Popov) --f46d041824dc915018050f494667 Content-Type: text/plain; charset=UTF-8 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. > > 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? Nikita --f46d041824dc915018050f494667--