Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77634 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 266 invoked from network); 25 Sep 2014 21:45:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2014 21:45:59 -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.220.174 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.174 mail-vc0-f174.google.com Received: from [209.85.220.174] ([209.85.220.174:35939] helo=mail-vc0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/31-27297-41D84245 for ; Thu, 25 Sep 2014 17:45:58 -0400 Received: by mail-vc0-f174.google.com with SMTP id hy10so8645488vcb.33 for ; Thu, 25 Sep 2014 14:45:53 -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=hyjWGUHG/Z2jowxVfEJ7qmlVd3cTMkETDIJxIUAI1gs=; b=IXK35ftJ/xuhJp+AD+MlqJnlPrY08Hr+Br6+2tm5rGoOmOtOEqpFS8roXtHaiNjMti ZROCWuZ2a++TuM29hf+SYh3T8zSzVv0yjCJMtYnRTWfaqVk/1CYaW99ME5BnNdmmeBYh 60dBrJjM87xJeyhneBG2vR7Fv9TH0GasNS2Fgd3rTuaWFrejYNtmqciyOC0fl9heCtYc 6eLu59MItitJmQCGoK+tMeeLLuFrt3e3nFdXV4xUm9F6gPU8CLdk+d+l7lRBxeBYjS7R 5r99sGVl/er8OTWicsQBWYPSq37GvTr/yuGln7HHBh7WWK6UCU2FtUCgIy1gky8SGKz/ knRA== X-Gm-Message-State: ALoCoQmfVOLrS4eziDDCYaw64GDY6aubtELEFfLdppHd6yyKg0jW/i1kRnbdXWzzi+gS5LyGml3ZKCNgrfHM0Oj40qtJx9OBBFe1gVjYwfzA6vF9BGZ5rPovhfGNKj51JGuimJ5VL3m/hZZ6tlTfL5KEyvwN3bDqkQ== MIME-Version: 1.0 X-Received: by 10.220.168.74 with SMTP id t10mr2229768vcy.35.1411681552895; Thu, 25 Sep 2014 14:45:52 -0700 (PDT) Received: by 10.52.158.197 with HTTP; Thu, 25 Sep 2014 14:45:52 -0700 (PDT) In-Reply-To: References: Date: Fri, 26 Sep 2014 01:45:52 +0400 Message-ID: To: Nikita Popov Cc: Leigh , PHP Internals Content-Type: multipart/alternative; boundary=001a11c2bb1e7f29270503eab966 Subject: Re: [PHP-DEV] [VOTE] Fix list() behavior inconsistency From: dmitry@zend.com (Dmitry Stogov) --001a11c2bb1e7f29270503eab966 Content-Type: text/plain; charset=UTF-8 FETCH_DIM_TMP_VAR is used especiualy for list(). It expects array, don't check for objects and strings. It doesn't remove the operand and allow it's reuse in next opcode. FETCH_DIM_R is used for list() only in some cases (when operand IS_VAR). To work in list() context it has to keep operand not destroyed, and to do it FETCH_DIM_R has to check for (opline->extended_value & ZEND_FETCH_ADD_LOCK). Note that this check has to be executed for each array access operation unrelated to list() handling. Thanks. Dmitry. On Fri, Sep 26, 2014 at 12:32 AM, Nikita Popov wrote: > On Thu, Sep 25, 2014 at 1:15 PM, Dmitry Stogov wrote: > >> disabling string handling would allow make operation simpler and would >> improve regular access to array elements. >> We won't need to check for (opline->extended_value & ZEND_FETCH_ADD_LOCK) >> in FETCH_DIM_R handler. >> However, it's going to be very small improvement, and I don't care a lot. >> :) >> >> enabling string handling would require complication of >> ZEND_FETCH_DIM_TMP_VAR handler (for strings support). >> It's going to make list() handling a bit slower, but not significantly. >> >> my choice +1 for disabling. >> > > Could you please clarify why removing string support would make the > operation simpler? I voted for always supporting strings because I thought > that is the option that simplifies things - in particular it would allow > use to drop the FETCH_DIM_TMP_VAR opcode and always go through FETCH_DIM_R > instead. Sample patch here: > https://github.com/nikic/php-src/compare/stringOffsetsInList Or did I > miss something and we can't do that? > > Nikita > --001a11c2bb1e7f29270503eab966--