Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93450 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89045 invoked from network); 23 May 2016 16:25:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2016 16:25:02 -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 209.85.161.174 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.174 mail-yw0-f174.google.com Received: from [209.85.161.174] ([209.85.161.174:34136] helo=mail-yw0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/E9-14293-DDE23475 for ; Mon, 23 May 2016 12:25:01 -0400 Received: by mail-yw0-f174.google.com with SMTP id c127so58798218ywb.1 for ; Mon, 23 May 2016 09:25:01 -0700 (PDT) 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; bh=8BmIuqXN5kB1gLwoG2SFjGbZ5FcHPg+SmjzJcM8AG3s=; b=VKq7UiyGChfijEWKnXK7n2ByefRRNNApPPNQpXEmNKI7ExwdT1XRAAhF6GlAdBpCTh x6B5Bz88Rh7CVCPN2ifTUEY0wlVUBM0wB6kybs5CVBPPSuCCaq5zblZIaK7hVEIX6w9i rOU6dfhvAd9cTM58vMl+/dTco4R/Tr6sNXwyBHP077TAKwj8rkSTdwYBvDqNnOXG6tTy fyvnnomd5xq9G2qAB+9xJ5fnouO/U/jZhvW3gBR7WK/vyAlCEn2ayr2FVhk++vUdbE/h 7sNDPRynJmZ1OROVjas/Fr4fPVVxIYtGnwO8GLdUyd4J0sGox3zbUKo5m/SnSNBXh1yv Q6wA== 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; bh=8BmIuqXN5kB1gLwoG2SFjGbZ5FcHPg+SmjzJcM8AG3s=; b=Q3DeTzQjY2i4KHmSPGHvrpfRO2qAEr9Or7OFAbxgwVsjzibNq08CQ+R4kaTx5mcV2W AP/Si5Bt7qa3Lln/OJfKuKvACN+mqc5/HE0Pk8ScoJTlslWDVlV22zjOHT95QQBURi4l 0fsS17BsIL6EmUZndvICfEfhNQ0ZrdBsGxoXQbPUQxLenW0mfpmJ+kp2PHaCbj6/F1Po wUfKSKXWb4X0cDt+j/uPwOFNeB/sgg1mhUplsAyXTEZbeSbTa4GnEpbgetgbtaRtIgkP 8Oe1pqGoI4xqCciFg6TJ4TggUCY99Do3CT1HAVbRuvMOmKH3v7yp6rAzsiqmGjW6/eio leaQ== X-Gm-Message-State: AOPr4FU2AAVOE9eZdY+nXvZU6ProBGoRKL80mc6ydqZWQxVYxMMSYETM1gG8AXLume+FPZPHF8LsiUHzjO283w== MIME-Version: 1.0 X-Received: by 10.13.255.194 with SMTP id p185mr10130410ywf.10.1464020699242; Mon, 23 May 2016 09:24:59 -0700 (PDT) Received: by 10.13.239.3 with HTTP; Mon, 23 May 2016 09:24:59 -0700 (PDT) In-Reply-To: References: Date: Mon, 23 May 2016 18:24:59 +0200 Message-ID: To: Dmitry Stogov Cc: Xinchen Hui , internals Content-Type: multipart/alternative; boundary=94eb2c088930b90b5b053384e178 Subject: Re: "finally" handling refactoring (Bug #72213) From: nikita.ppv@gmail.com (Nikita Popov) --94eb2c088930b90b5b053384e178 Content-Type: text/plain; charset=UTF-8 On Mon, May 23, 2016 at 1:25 PM, Dmitry Stogov wrote: > Thanks for review. > > Both problems should be fixed now > https://gist.github.com/dstogov/0a809891c6a3ac3fac4bd0d9711dd330 > > Do you see any other problems or a better way to fix this? > Your fix for DISCARD_EXCEPTION does not look right to me. It will discard all exceptions too early. For example: function test() { try { throw new Exception(1); } finally { try { try { } finally { return 42; } } finally { throw new Exception(2); } } } test(); This will now not chain exception 1 and 2, because exception 1 is discarded at the return statement. I think this should be handled the same way we do the fast_call dispatch on return, i.e. when we pop the FAST_CALL from the loop var stack we should replace it with a DISCARD_EXCEPTION and then pop it after the finally. This should generate all the necessary DISCARD_EXCEPTION opcodes, and in the right order. Nikita --94eb2c088930b90b5b053384e178--