Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85453 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58452 invoked from network); 24 Mar 2015 19:45:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2015 19:45:18 -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.212.178 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:34657] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/10-57065-DCEB1155 for ; Tue, 24 Mar 2015 14:45:17 -0500 Received: by wibg7 with SMTP id g7so58781892wib.1 for ; Tue, 24 Mar 2015 12:45:14 -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:content-type; bh=isidOzakOtJkoLbQ0H75o+oj7Q1llzI4a+BbsdvtEEU=; b=pQ+aLsZ2qLRPaPj9tbnbjU1H9Beys80NlMEQEmireKjcE4wz2pXPkJN5z6+A764CUW g6/hbHMdWIxTnNNTA6YqnjGKccd90yqluzDmQRLGp/wLHOzwBSHros9ab4AMvUqzFMlN fnTlHjR94AtTUv8EIdPloZGsZC1Q4/oEpr8QGBs7ijWFXam0FmSQjAXEYzV8Uuham6kx MxACfCnoiYW2vIRiM8iWvgVKZ7JzkDagbAmolbxQfVzzhxvGIal2ITJAdcSIpy1qOQ2a 4xhHRfL6xo6SXEikAOhOoC485GaDv1pIwrJNofIlWh7ZvZG2zvsCemIfOXuU1rPXYSMm d6kA== MIME-Version: 1.0 X-Received: by 10.194.76.69 with SMTP id i5mr11261487wjw.3.1427226314166; Tue, 24 Mar 2015 12:45:14 -0700 (PDT) Received: by 10.27.10.193 with HTTP; Tue, 24 Mar 2015 12:45:14 -0700 (PDT) In-Reply-To: References: Date: Tue, 24 Mar 2015 20:45:14 +0100 Message-ID: To: Dmitry Stogov Cc: Xinchen Hui , Joe Watkins , PHP Internals Content-Type: multipart/alternative; boundary=047d7bb042be7857af05120e0548 Subject: Re: Use "ropes" for string concatenation From: nikita.ppv@gmail.com (Nikita Popov) --047d7bb042be7857af05120e0548 Content-Type: text/plain; charset=UTF-8 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 --047d7bb042be7857af05120e0548--