Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85456 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69125 invoked from network); 24 Mar 2015 21:22:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2015 21:22:18 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.160.179 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.160.179 mail-yk0-f179.google.com Received: from [209.85.160.179] ([209.85.160.179:34452] helo=mail-yk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/E1-57065-A85D1155 for ; Tue, 24 Mar 2015 16:22:18 -0500 Received: by ykfc206 with SMTP id c206so3433419ykf.1 for ; Tue, 24 Mar 2015 14:22:15 -0700 (PDT) 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=tlCjRqePTWOLJBMuGFbnTR1QSDz+ppkpk3EWl6TB9j0=; b=DbvgMQrrVVaSIiH5fAhBcfgdK6bY0g5yeFil0cuXzp7TDV0iAV40TMKkiaBM0ayyNp Pw0cvzpGPuZoOOM95lqu6QCPMUos46Tz92fBa74F8xqrhjb0n+uhPOfzGl73h8nDNzto qSitPdq+fZE1ZjvTiLdoySsBKDyuy0q7TCQ6Rc5w0RORTWRP3vIWIEiKpRzONbOGPMee sDTwHSZ7UpxlKzWWpZprt0qPTo+t0BIq9mnC3uCtgDTMbIHc8hPMqKkffqXInOU6h6Qs +wMH/HK37kix/SA5LD2umRRaStjBkpMvMed+wt9MU4t/JM9t7Kn6QVMO5jnSAme/cDbP e3Ag== X-Gm-Message-State: ALoCoQnmY/zMPLONJmM/S2mNaBHMisOf6of2TGnf7fO0dw5/Ek2PMDSWgrMU5ai4mVRSVrv8ZVn4N5SVjDYSZyw/oLGLhv/DV8IJql9GObEwxOYgwKBe5YHJytnEvakk5CrIEtLarlc9iGlIc7h2w3+VF7C5n7PXSw== MIME-Version: 1.0 X-Received: by 10.52.165.65 with SMTP id yw1mr4660992vdb.51.1427232135521; Tue, 24 Mar 2015 14:22:15 -0700 (PDT) Received: by 10.52.248.36 with HTTP; Tue, 24 Mar 2015 14:22:15 -0700 (PDT) In-Reply-To: References: Date: Wed, 25 Mar 2015 00:22:15 +0300 Message-ID: To: Nikita Popov Cc: Xinchen Hui , Joe Watkins , PHP Internals Content-Type: multipart/alternative; boundary=001a11c29cc0733d3e05120f601b Subject: Re: Use "ropes" for string concatenation From: dmitry@zend.com (Dmitry Stogov) --001a11c29cc0733d3e05120f601b Content-Type: text/plain; charset=UTF-8 These opcodes hardly ever would throw exceptions their selves. This real problem should be fixed in HANDLE_EXCEPTION handler. There we will need to get the list of "active" temporary variables. I don't have a good solution for this yet. Thanks. Dmitry. On Tue, Mar 24, 2015 at 10:45 PM, Nikita Popov wrote: > On Tue, Mar 24, 2015 at 1:08 PM, Dmitry Stogov wrote: > >> >> >> On Tue, Mar 24, 2015 at 2:51 PM, Nikita Popov >> wrote: >> >>> On Tue, Mar 24, 2015 at 10:28 AM, Dmitry Stogov wrote: >>> >>>> I thought about something like this :) >>>> In my opinion UString is really not a proper way to implement Unicoide, >>>> but I agree not break anything in current stage. >>>> Anyway, please review the first PR (in my opinion it is safe to >>>> commit), but you may find some other issues. >>>> >>>> Thanks. Dmitry. >>>> >>> >>> First PR looks okay to me. One question: Why the separate INIT and ADD >>> opcodes? They seem pretty much the same, just one using a hardcoded 0 >>> instead of ex_val. >>> >> >> Oh. It's historical, at first we allocated rope on heap. I'll check if >> INIT_ROPE is still necessary. >> Most probably we still need it, to know the size of rope vector. >> >> >>> Regarding exception-safety - is the problem that doing an EG(exception) >>> check and releasing the rope is too expensive? >>> >> >> No. It's a common problem. Because exception may be thrown in some other >> opcode and we don't clean IS_VAR/IS_TMP_VAR zvals. >> For example the following script leaks independently from the patch >> >> > function foo() { >> throw new Exception(); >> } >> try { >> $a = "a"; >> $a = $a . $a . $a . foo() . $a . "\n"; >> } catch (Exception $e) { >> } >> ?> >> > > Ah yes, I forgot about this issue. However, shouldn't we at least properly > release memory if the exception occurs in the opcode? > > Nikita > --001a11c29cc0733d3e05120f601b--