Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74469 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21916 invoked from network); 23 May 2014 18:48:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2014 18:48:21 -0000 Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.176 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.216.176 mail-qc0-f176.google.com Received: from [209.85.216.176] ([209.85.216.176:52440] helo=mail-qc0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/E9-01753-2F79F735 for ; Fri, 23 May 2014 14:48:18 -0400 Received: by mail-qc0-f176.google.com with SMTP id r5so8625070qcx.21 for ; Fri, 23 May 2014 11:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=fLcsyZdgl/ogMrgm/l3mp1TPzBN7lXVIpLltxO5biog=; b=nEKAqrL2ljdGzIcpkaXb3S+ANPel5olmYNbNCrtO6mw6/nLzXDpnz6jTcZzhFf01i5 986yE+z1z29WFG298BP+JerJ5tO1reCw52C31vvvyXsBC2v64uRSDLlGdWpijJQ5NR5o bFWCR/bScdOYUVFA/hRODDruTiIvK+lP7rl1xoYbZhnpX4buVeAasLaIX7IPUltCjBOK UvVrXmALbTOkdn3XzpvCFoTxq2Bjx5564M1f/60se1ydtSMSDIosqV6fFT3ivZCynE/f Dwwx+IpPShwy+0KltWMutJ6Qre4w917YgB3FIzeD97CkgyRC4Xa1h5vW/WjV7i8C0On1 U/vQ== MIME-Version: 1.0 X-Received: by 10.140.98.234 with SMTP id o97mr9155142qge.35.1400870895069; Fri, 23 May 2014 11:48:15 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.224.194.73 with HTTP; Fri, 23 May 2014 11:48:14 -0700 (PDT) In-Reply-To: <537EE0A5.9030109@sugarcrm.com> References: <2DC459EE-AE98-4CAE-977A-6FB918FDEF54@bafford.com> <537EA42B.4000000@lerdorf.com> <537EE0A5.9030109@sugarcrm.com> Date: Fri, 23 May 2014 19:48:14 +0100 X-Google-Sender-Auth: s1RleRq2_EXbNmK5LEvPPQcKEpg Message-ID: To: Stas Malyshev Cc: John Bafford , Rasmus Lerdorf , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11393a8c13af7804fa15ac87 Subject: Re: [PHP-DEV] Bison 3 support for PHP 5.5 From: bukka@php.net (Jakub Zelenka) --001a11393a8c13af7804fa15ac87 Content-Type: text/plain; charset=UTF-8 On Fri, May 23, 2014 at 6:46 AM, Stas Malyshev wrote: > Hi! > > > So instead, I created the TSRMLS_DN and TSRMLS_CN macros which, in > > the ZTS case, work like TSRMLS_D/TSRMLS_C, but when ZTS is off, still > > resolve to a parameter (that must always be present), which is passed > > NULL. > > I don't think it is a very good idea to add extra parameter that does > nothing to every function. There should be a better solution to this. > > I agree with Stas that the way how it's done at the moment is pretty ugly. I was dealing with similar problem in jsond parser ( https://github.com/bukka/php-jsond/blob/master/jsond_parser.y ) where I decided to use a structure (php_json_parser) for general parser info as well as scanner data and TSRMLS if ZTS defined. It means that data from the scanner are passed to the parser through that structure instead of using global variable (that's the way how it's done in PHP). tsrm_ls can be set using TSRMLS_SET_CTX fetched from that structure TSRMLS_FETCH_FROM_CTX. So to sum it up... I think that a better solution would be using a structure that would contain scanner data (_zend_php_scanner_globals ) and TSRMLS if ZTS defined. It would be a cleaner solution IMHO. It could also allow some optimization for the compiler as local variables might be saved in registers (not sure about this one... :) ). However this is probaly more something for phpng as it requires a bit more changes... :) Jakub --001a11393a8c13af7804fa15ac87--