Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87718 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 546 invoked from network); 11 Aug 2015 20:15:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2015 20:15:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.180 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.212.180 mail-wi0-f180.google.com Received: from [209.85.212.180] ([209.85.212.180:36226] helo=mail-wi0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/D5-00789-7C75AC55 for ; Tue, 11 Aug 2015 16:15:06 -0400 Received: by wicja10 with SMTP id ja10so88692046wic.1 for ; Tue, 11 Aug 2015 13:15: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:content-type; bh=1BUX3yu6TggDJWF3B7q3pF3mnSjl9fXIal8Z8vYSoT0=; b=0j2Mjd/uBlsDl2waNb6CM9ove3Wkp+O5x2as8bgFEPI5iVJbTE4m+v42pT76OuAHVw ojXC4viBnJkACLbn+5EXz7Fk9UK5zZrM8wiNADe5LzP0D5d7YADe34Iz7YGZIofgva45 8Ra2favL2so8uIt7FkpRsvTDmqVx0W2pL8+jw3ly48EBRNSU07abroriwQhVBIOSIRm2 VcTjIr5LG/O6Dc86aRuJlkTCCY2D+8Mgo7V+64jWDDuvaSREUOkY57KErbpRFiNEcnI/ JZSziDGp1h2HHltXpR2iYzNnmFfYQDgDWZ2RQRsvg3cd+gt1FFMqHaFHdIX72VQVgFY/ Takg== MIME-Version: 1.0 X-Received: by 10.194.89.72 with SMTP id bm8mr60145552wjb.116.1439324101335; Tue, 11 Aug 2015 13:15:01 -0700 (PDT) Received: by 10.27.140.215 with HTTP; Tue, 11 Aug 2015 13:15:01 -0700 (PDT) In-Reply-To: <04E6618E3189404FB15D042E588A90FC@pc1> References: <8BE12FDCDC5C457282790368866BD61E@pc1> <04E6618E3189404FB15D042E588A90FC@pc1> Date: Tue, 11 Aug 2015 22:15:01 +0200 Message-ID: To: Matt Wilmas Cc: PHP Internals , Dmitry Stogov Content-Type: multipart/alternative; boundary=089e010d868cc6e17e051d0ec15b Subject: Re: [PHP-DEV] Parameter parsing for zval type? From: nikita.ppv@gmail.com (Nikita Popov) --089e010d868cc6e17e051d0ec15b Content-Type: text/plain; charset=UTF-8 On Tue, Aug 11, 2015 at 10:10 PM, Matt Wilmas wrote: > Hi Dmitry, > > > ----- Original Message ----- > From: "Dmitry Stogov" > Sent: Tuesday, August 11, 2015 > > Hi Matt, >> >> >> On Tue, Aug 11, 2015 at 9:00 PM, Matt Wilmas >> wrote: >> >> Hi again, >>> >>> ----- Original Message ----- >>> From: "Matt Wilmas" >>> Sent: Tuesday, August 11, 2015 >>> >>> Hi Dmitry, all, >>> >>>> >>>> Help me understand this. :-) It's been more puzzling to me recently >>>> since just coming to the part of optimizing traditional ZPP (sharing >>>> part >>>> with FAST_ZPP...). >>>> >>>> With the FAST_ZPP inline macros, why is there a Z_PARAM_ZVAL and >>>> Z_PARAM_ZVAL_DEREF? It seems the zpp 'z' specifier is always like >>>> ZVAL_DEREF, right? So Z_PARAM_ZVAL has no equivalent in traditional >>>> zpp. >>>> At the very least, this would seem to suggest a difference in >>>> behavior/functionality. But I haven't found any (or bug reports, if >>>> tests >>>> didn't cover something). >>>> >>>> >>> Oops! No, plain zpp 'z' does not have ZVAL_DEREF() applied, of course. >>> But it's also using zend_parse_arg_zval_DEREF(), which is wrong... (in >>> the >>> case of "z!" with reference to IS_NULL?). >>> >> >> >> Sorry. I don't understand you without context. If you think something is >> wrong in current implementation - please, demonstrate it with test cases, >> examples or code references. If you talk about your code, then show it. >> > > Sorry, thought I gave enough context and code references! I can't > demonstrate with a test case, which is why I'm asking about it. :-) > > No, not my code changes (you'll have plenty of code to see soon). I'm > fine replicating the current logic exactly, as I have, but the logic of > these couple parts doesn't make sense, to me. Let me try to simplify with > couple examples... > > Look at e.g. is_numeric() or strpos() (needle). Plain zval param parsing, > so NO ZVAL_DEREF() occurs (FAST_ZPP or traditional). These 2 example > functions don't handle IS_REFERENCE type, so they would break. > > Or is there no way for them (or any function?) to get a IS_REFERENCE? > Then *why* is there ZVAL_DEREF() in param parsing functions? We could > remove it! > > Which is it...? > Functions accepting references are specially marked in arginfo. Normal function argument can never be IS_REFERENCE. Reference arguments are always IS_REFERENCE. There is also a rarely used mixed mode where both are possible. For DEREF-or-not distinction is irrelevant for normal arguments, it's only important if an argument is already marked to accept a ref. Nikita --089e010d868cc6e17e051d0ec15b--