Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83576 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73172 invoked from network); 23 Feb 2015 15:00:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2015 15:00:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=jgmdev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jgmdev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.169 as permitted sender) X-PHP-List-Original-Sender: jgmdev@gmail.com X-Host-Fingerprint: 209.85.216.169 mail-qc0-f169.google.com Received: from [209.85.216.169] ([209.85.216.169:46531] helo=mail-qc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/92-01128-8904BE45 for ; Mon, 23 Feb 2015 10:00:40 -0500 Received: by qcxr5 with SMTP id r5so11351253qcx.13 for ; Mon, 23 Feb 2015 07:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=bZZ8S66G9Ba2ZinhphGRkltxNrZEy3tjZdiQsUpisVE=; b=o7yfuah4BCX1Z6b8osj+cY9wOGR6PQj6IqzA0tNDrstKOaRHphkWmh5ETZ8jp/no79 9vItuEDunUGGGVP3Iepl83RfwbRPZ7C32sUEU0mbOYOxR+wCaAxnRrPWHJHjsn+PUHSq FDukBmcImL0YC+gp7Of51RMIRJoDP0IzniC488fg3G/EC37+CggZo0CdlhEl5DEROhiB GUR56r5yYwsFcaWiGlu1JbyLh/2jllrcIFCxRiLTygMRtqExkv519ryoMK3HSzXhaYDS xIkKWQaPIjr4K7NNiAHlZIwh7h2WJNIuAyEHnMesIAVN7Zsl9AVdfMSSDw/HCdUbzWuU YukQ== X-Received: by 10.140.100.169 with SMTP id s38mr23023179qge.96.1424703637517; Mon, 23 Feb 2015 07:00:37 -0800 (PST) Received: from [192.168.1.109] ([24.138.231.2]) by mx.google.com with ESMTPSA id k17sm21882449qab.1.2015.02.23.07.00.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Feb 2015 07:00:36 -0800 (PST) Message-ID: <54EB4091.40806@gmail.com> Date: Mon, 23 Feb 2015 11:00:33 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Zeev Suraski , Joe Watkins CC: PHP internals References: <2e4694f9805ee81ea0b2c79eab06c2d6@mail.gmail.com> <54EA5EDA.8010605@gmail.com> <54EA6A99.5010609@gmail.com> <54EA7F15.9030606@gmail.com> <54EA891B.6030405@gmail.com> <09b9ee836c04b1750614a91bd39a5bed@mail.gmail.com> <54EA97A2.4010701@gmail.com> <661590f4daa710176268b43c1b950583@mail.gmail.com> In-Reply-To: <661590f4daa710176268b43c1b950583@mail.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) From: jgmdev@gmail.com (Jefferson Gonzalez) On 02/23/2015 05:05 AM, Zeev Suraski wrote: >> -----Original Message----- >> From: Joe Watkins [mailto:pthreads@pthreads.org] >> Sent: Monday, February 23, 2015 10:03 AM >> To: Jefferson Gonzalez >> Cc: Zeev Suraski; PHP internals >> Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints >> RFC) >> >> Zeev, >> >> I missed the initial replies to this, just had a quick read through >> (of the kind >> you have first thing on a Monday morning). >> >> Essentially the problem is this: >> >> > My point is that we can do the very same optimizations with coercive >> types as well - basically, that there is no delta. >> >> The problem is that an implementation that has to care about coercion, >> one that has to care about nonsense input, has to generate considerably >> more complex code, to manage that input or perform those coercions. > > Not necessarily. If you can infer the type with confidence, you can do away > with coercion code altogether. If you can't, then you're not obligated to > generate optimized paths for every possible input - you can just defer to > the relevant coerce() function. It's very similar to what you'd be able to > do with strict, except instead of calling coerce(), it would run a runtime > type check that errors out on failure. The difference is that of > functionality, not performance. > In that case since coercive is less strict it would be needed to duplicate the code in order to optimize, example: function calc (int $val1, int $val2){ ... } //This call does not requires coercive type checks calc(1,6) -> direct call to optimized C function //This call may require coercive checks calc($val1, $val2) -> call to coercive implementation of the function So in order to optimize I guess it would be needed to generate 2 versions of a function: optimized and coercive, which will increase the required ram at runtime and even the CPU in order to gain the performance benefits presented on strict mode.