Conditions with that always returns true is 'if' necessary?
Paul Sandoz
paul.sandoz at oracle.com
Tue Apr 22 08:07:06 UTC 2014
Hi Otávio,
On Apr 21, 2014, at 3:06 PM, Otávio Gonçalves de Santana <otaviojava at java.net> wrote:
> Hello everyone, one question.
> Conditions that always returns true, is 'if' necessary?
I can imagine it is a left over from hacking in the fast path. IMHO better to remove the if and comment the line below to retain the general pattern.
Could easily be tacked on to an existing change e.g. if Vladimir is not fed up updating his basic types patch :-)
http://cr.openjdk.java.net/~vlivanov/8037210
Paul.
> I found one.
>
> diff -r 57c1da89ae1a
> src/share/classes/java/lang/invoke/BoundMethodHandle.java
> --- a/src/share/classes/java/lang/invoke/BoundMethodHandle.java Wed Apr 16
> 12:32:36 2014 -0700
> +++ b/src/share/classes/java/lang/invoke/BoundMethodHandle.java Mon Apr 21
> 09:50:29 2014 -0300
> @@ -66,8 +66,7 @@
> try {
> switch (xtype) {
> case 'L':
> - if (true) return bindSingle(type, form, x); // Use known
> fast path.
> - return (BoundMethodHandle)
> SpeciesData.EMPTY.extendWithType('L').constructor[0].invokeBasic(type,
> form, x);
> + return bindSingle(type, form, x); // Use known fast path.
> case 'I':
> return (BoundMethodHandle)
> SpeciesData.EMPTY.extendWithType('I').constructor[0].invokeBasic(type,
> form, ValueConversions.widenSubword(x));
> case 'J':
>
>
> --
> Atenciosamente.
>
> Otávio Gonçalves de Santana
>
> blog: http://otaviosantana.blogspot.com.br/
> twitter: http://twitter.com/otaviojava
> site: http://www.otaviojava.com.br
> (11) 98255-3513
More information about the core-libs-dev
mailing list