Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89176 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60793 invoked from network); 11 Nov 2015 13:19:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2015 13:19:36 -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.223.174 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.223.174 mail-io0-f174.google.com Received: from [209.85.223.174] ([209.85.223.174:34664] helo=mail-io0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/91-48205-26043465 for ; Wed, 11 Nov 2015 08:19:35 -0500 Received: by iody8 with SMTP id y8so33558508iod.1 for ; Wed, 11 Nov 2015 05:19:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zend_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=mWlZGK1vuunGPei5ZFOVq02c9rRLECA+V/BIFIGESuY=; b=f+M16lAqfWBakH4LhrTz8G76efoGVH8Sg450PUaYCqj14omsCWRFMpG/xmESojRvJX FhezpSekuJpMWkYIPQT16YDHEDm9dyFfBeEO9aYxhWZ7/AY4QfX4ZISG1s83wtfseu+Y vfW6sd4Rn4UxjYfZjs6FqMpcfOZ41HJX0Dq5O6+Q0E3wmylVUlbY7fC2JuC5ACPD4vxh 0C3wvBqUZlabNy43qV6C1J1+rnl76r4dFWQjdPSr3PTpjGTWe1T670ORq7JBvgf1ZRGN aO+/DCCQatQbfm+VZ93AmtBm6s03rmoeTAvcpb3SzkbneSi42O4JnTRrkrqOPKxqL+gi hAzA== 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=mWlZGK1vuunGPei5ZFOVq02c9rRLECA+V/BIFIGESuY=; b=ctIoFKNbwAm1aPBGYR61GcO9KCpfBtY8JTk9/EFOx347G2U+J909Gr2toVbc+CT8FT ZQeLsFnfA1wemmX/QzlmnG9ykkXBznUsjMZFAwT/qjsnkBhfn7HnULNyyb+7DkVAiUga WC15v+T/yKriOwXNi8YBDEXSmrareC6iSOb3rTRO1VjLXnt6VxT11BJJk7fF9WPbGxVG PjfIcWVHQY+LgKzPCBSgxqsx4Blf2LkSDRtHvFwfkx9OOp0zncMbhDCzkLBDFOyymbVY syH8EEqRNJsPPJf5y13oXiUjRdgovbtmNt/Fov1uPkvA8X+zyzmmPfFt6QkdZ157yGPn PvTg== X-Gm-Message-State: ALoCoQkCOC5mlBe3YPIg6c3qNDhckkR7r5gMvnUS1xbBnq1IasMO6plA3nqYjgufVVG38tjNYH420/aFkPj5Epgu8SHI7lp8pJdr9aiZFmYHV6gw07ZUQmlDlBD0j5ZEvnTnvPtaYEVl1gXEjEibMVS6Kp1VBy6UcQWAs8IesiiM0h+TPgBM9K8= MIME-Version: 1.0 X-Received: by 10.107.25.77 with SMTP id 74mr1194333ioz.196.1447247965380; Wed, 11 Nov 2015 05:19:25 -0800 (PST) Received: by 10.50.73.166 with HTTP; Wed, 11 Nov 2015 05:19:25 -0800 (PST) In-Reply-To: References: Date: Wed, 11 Nov 2015 16:19:25 +0300 Message-ID: To: Nikita Popov Cc: Xinchen Hui , Bob Weinand , PHP Internals Content-Type: multipart/alternative; boundary=001a113fd4c0e1011f052443aca4 Subject: Re: Safe Temporary Cleanup on Exception (Variable Liveness) From: dmitry@zend.com (Dmitry Stogov) --001a113fd4c0e1011f052443aca4 Content-Type: text/plain; charset=UTF-8 It looks like the last version of the patch https://github.com/php/php-src/pull/1634 solves all the problems (except for reported by Nikita "unknown liveness in finally" - Zend/tests/temporary_cleaning_010.phpt). Please, analyse the patch and try to craft a script not covered by the patch. If nobody object and no problems found, I'll commit this on Friday. Thanks. Dmitry. On Tue, Nov 10, 2015 at 10:28 PM, Dmitry Stogov wrote: > I've committed unrelated and obvious parts (without semantic changes). > The updated and extended patch now is much more clean > https://gist.github.com/dstogov/43eaa3f3b68583877322 > Anyway, it's still incomplete. > > Thanks. Dmitry. > > On Tue, Nov 10, 2015 at 2:29 PM, Dmitry Stogov wrote: > >> >> >> On Tue, Nov 10, 2015 at 1:42 PM, Nikita Popov >> wrote: >> >>> On Tue, Nov 10, 2015 at 10:53 AM, Dmitry Stogov wrote: >>> >>>> Hi, >>>> >>>> Please take a look into >>>> https://gist.github.com/dstogov/43eaa3f3b68583877322 >>>> >>>> This is variation on Bob's idea about variable liveness. >>>> The patch is incomplete. Liveness construction is still naive. However, >>>> all tests are passed. >>>> >>>> Ranges are represented by start/end/variable cartages. (I suppose this >>>> representation is more compact, than in the original proposal). >>>> In general, it's possible to use few ranges for the same variable, if >>>> its whole live range is not linear. (this is not implemented yet). >>>> >>>> Related ideas and tests are welcome. >>>> >>>> Thanks. Dmitry. >>>> >>> >>> One leak this does not cover yet is a discarded delayed return value: >>> >>> function test() { >>> try { >>> $a = [1, 2, 3]; >>> return $a + []; >>> } finally { >>> throw new Exception; >>> } >>> } >>> >>> try { >>> test(); >>> } catch (Exception $e) {} >>> >>> This case is a bit tricky because it violates the usual invariant that >>> all temporaries have well-defined liveness ranges (either alive or not, no >>> maybe). We'd have to change that first. >>> >> >> I see the problem. We can't statically define live-ranges for finally >> code, because we don't know where it's going to be called from. >> May be we may reconstruct this at run-time. >> >> Thanks. Dmitry, >> >> >> >>> >>> Nikita >>> >>> >> > --001a113fd4c0e1011f052443aca4--